Skip to main content


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: 35
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 messageGo to next message
Ken Keefe is currently offline Ken KeefeFriend
Messages: 35
Registered: September 2009
Member
Any thoughts on this?
Re: Trying to understand DynamicAnchorShapeSnippet and MindMap Example [message #1785387 is a reply to message #1774708] Fri, 13 April 2018 11:24 Go to previous message
Matthias Wienand is currently offline Matthias WienandFriend
Messages: 163
Registered: March 2015
Senior Member
Hi Ken,

this should be related to the anchor provider, i.e. there is DefaultAnchorProvider that specifies a computeAnchorageReferenceGeometry() method that returns the NodeUtils.getShapeOutline() for the adaptable visual by default. You should register a custom anchor provider via your module and exchange the computation, for example, by delegating to a geometry provider for the anchorage reference geometry. However, I did not take a close look at the MindMap tutorial right now, but I think I remember that a custom anchor provider is used there, too.

h2h
Matthias
Previous Topic:[GEF 3] Connection Mouse Cursor Linux
Next Topic:GEF5 versus Sirius/GMF
Goto Forum:
  


Current Time: Wed Sep 26 08:24:17 GMT 2018

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

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

Back to the top