Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Trying to understand DynamicAnchorShapeSnippet and MindMap Example
Trying to understand DynamicAnchorShapeSnippet and MindMap Example [message #1773874] Thu, 05 October 2017 21:53 Go to next message
Ken Keefe is currently offline Ken KeefeFriend
Messages: 33
Registered: September 2009
Member
The DynamicAnchorShapeSnippet seems to be written to help developers understand how to make connection anchors follow the contours of a Shape. That is what I would like to do in my application. I've used the MindMap tutorial as an example for my code. I have an AnchorProvider that does pretty much the same thing as the MindMap code in com.itemis.gef.tutorial.mindmap.parts.SimpleMindMapAnchorProvider.

If you check out the latest version of the MindMap tutorial from github (https://github.com/itemis/gef-mindmap-tutorial), the arcs do not attach to the mind map nodes, but to the bounding box instead. It is a little hard to see with the rounded rectangles they use, but if you apply the small patch below, it changes the node shape to ellipses and the problem becomes very apparent.

Anyway, could someone either:

1. Explain how to change the MindMap tutorial to get the anchors to follow the shape contours.

2. Explain a little more about how the DynamicAnchorShapeSnippet works. I've been struggling to understand what is going on in that code.




diff --git a/com.itemis.gef.tutorial.mindmap.visuals/src/com/itemis/gef/tutorial/mindmap/visuals/MindMapNodeVisual.java b/com.itemis.gef.tutorial.mindmap.visuals/src/com/itemis/gef/tutorial/mindmap/visuals/MindMapNodeVisual.java
index da664bc..c1c08a1 100644
--- a/com.itemis.gef.tutorial.mindmap.visuals/src/com/itemis/gef/tutorial/mindmap/visuals/MindMapNodeVisual.java
+++ b/com.itemis.gef.tutorial.mindmap.visuals/src/com/itemis/gef/tutorial/mindmap/visuals/MindMapNodeVisual.java
@@ -1,7 +1,7 @@
 package com.itemis.gef.tutorial.mindmap.visuals;
 
 import org.eclipse.gef.fx.nodes.GeometryNode;
-import org.eclipse.gef.geometry.planar.RoundedRectangle;
+import org.eclipse.gef.geometry.planar.Ellipse;
 
 import javafx.geometry.Insets;
 import javafx.geometry.Orientation;
@@ -22,12 +22,12 @@
 	private Text titleText;
 	private TextFlow descriptionFlow;
 	private Text descriptionText;
-	private GeometryNode<RoundedRectangle> shape;
+	private GeometryNode<Ellipse> shape;
 	private VBox labelVBox;
 
 	public MindMapNodeVisual() {
 		// create background shape
-		shape = new GeometryNode<>(new RoundedRectangle(0, 0, 70, 30, 8, 8));
+		shape = new GeometryNode<>(new Ellipse(0, 0, 70, 30));
 		shape.setFill(Color.LIGHTGREEN);
 		shape.setStroke(Color.BLACK);
 

Re: Trying to understand DynamicAnchorShapeSnippet and MindMap Example [message #1774708 is a reply to message #1773874] Wed, 18 October 2017 22:18 Go to previous message
Ken Keefe is currently offline Ken KeefeFriend
Messages: 33
Registered: September 2009
Member
Any thoughts on this?
Previous Topic:GEF 5 (MVC) + e4 RCP Application Tutorial
Next Topic:GEF5 Export Diagram as SVG
Goto Forum:
  


Current Time: Thu Jan 18 22:04:53 GMT 2018

Powered by FUDForum. Page generated in 0.01929 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software