单个模型元素在 UI 中多次表示...如何在 GEF 中实现?
我有一个模型,其中一个模型对象在显示的图表中多次表示。考虑以下模型:
- 有许多分区
- 每个分区都有 x SourcePorts 和 y DestinationPorts
- 每个 SourcePort 都可以连接到 DestinationPort
- 选择一个分区
我想将其可视化,以便所选分区位于中心:
- 左侧有所有绘制了所有源端口的分区可见
- 中间是选定的分区,绘制了所有端口
- 右侧显示了绘制了所有目标端口的所有分区 绘制了
- 端口之间的所有连接
- 用户可以操纵端口和连接(添加/删除)端口和连接)
所以我的分区模型映射到多个图形。普通分区绘制两次(左侧一次,右侧一次),所选分区绘制三次。
如何在 GEF 中实施这一点?我应该为每个分区创建一个 EditPart 并让它为所有图形表示返回一个 IFigure 吗?或者绘制到屏幕上的每个实例都应该有它自己的 EditPart 吗?或者创建一个额外的模型(其中一个分区通过多个模型实例表示)是否有益?
I have a model where one model object is represented multiple times in the displayed graph. Consider the following model:
- There are many Partitions
- Every partition has x SourcePorts and y DestinationPorts
- Every SourcePort may be connected to a DestinationPort
- One Partition is selected
I want to visualize this such that the selected Partition is in the center:
- On the left there are all Partitions visible with all the SourcePorts painted
- In the center there is the selected Partition with all Ports painted
- On the right there are all Partitions visible with all the DestinationPorts painted
- All connections between Ports are painted
- 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我建议创建一个包含所有可视化数据的不同模型:
通过这种方式,您可以将数据模型的元素链接到可视化模型的多个元素实例,并以简单而优雅的方式解决您的问题。此外,您不会用可视化所需的所有数据(即图中元素的坐标)“污染”数据模型。
萨鲁蒂
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