单个模型元素在 UI 中多次表示...如何在 GEF 中实现?

发布于 2024-10-04 11:03:18 字数 553 浏览 5 评论 0原文

我有一个模型,其中一个模型对象在显示的图表中多次表示。考虑以下模型:

  1. 有许多分区
  2. 每个分区都有 x SourcePorts 和 y DestinationPorts
  3. 每个 SourcePort 都可以连接到 DestinationPort
  4. 选择一个分区

我想将其可视化,以便所选分区位于中心:

  1. 左侧有所有绘制了所有源端口的分区可见
  2. 中间是选定的分区,绘制了所有端口
  3. 右侧显示了绘制了所有目标端口的所有分区 绘制了
  4. 端口之间的所有连接
  5. 用户可以操纵端口和连接(添加/删除)端口和连接)

所以我的分区模型映射到多个图形。普通分区绘制两次(左侧一次,右侧一次),所选分区绘制三次。

如何在 GEF 中实施这一点?我应该为每个分区创建一个 EditPart 并让它为所有图形表示返回一个 IFigure 吗?或者绘制到屏幕上的每个实例都应该有它自己的 EditPart 吗?或者创建一个额外的模型(其中一个分区通过多个模型实例表示)是否有益?

I have a model where one model object is represented multiple times in the displayed graph. Consider the following model:

  1. There are many Partitions
  2. Every partition has x SourcePorts and y DestinationPorts
  3. Every SourcePort may be connected to a DestinationPort
  4. One Partition is selected

I want to visualize this such that the selected Partition is in the center:

  1. On the left there are all Partitions visible with all the SourcePorts painted
  2. In the center there is the selected Partition with all Ports painted
  3. On the right there are all Partitions visible with all the DestinationPorts painted
  4. All connections between Ports are painted
  5. The user could manipulation the Ports and Connections (Add/Remove Ports and Connections)

So my model of a Partition maps to multiple figures. An ordinary Partition is painted twice (one time on the left and one time on the right) and the selected Partition three times.

How to implement this in GEF? Should I create one EditPart per Partition and let it return a IFigure for all graphical representations? Or should every instance that is drawn to the screen have it's own EditPart? Or is it benificial to create an extra model where one Partition is represented through multiple model instances?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

纵性 2024-10-11 11:03:18

我建议创建一个包含所有可视化数据的不同模型:
通过这种方式,您可以将数据模型的元素链接到可视化模型的多个元素实例,并以简单而优雅的方式解决您的问题。此外,您不会用可视化所需的所有数据(即图中元素的坐标)“污染”数据模型。

萨鲁蒂

I suggest to create a different model which contains all the visualizazion data:
in this way you could link an element of the data model to multiple instance of eleemnts of the visualization model and solve your problem in a simple and elegant way. Moreover you don't "pollute" the data model with all the data needed for the visualization, i.e. the coordinate of the elements in the diagram.

Saluti

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文