Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » SlidableAnchor and custom polygon as NodeFigure
SlidableAnchor and custom polygon as NodeFigure [message #210001] Thu, 30 October 2008 14:15 Go to next message
Stephan Kleber is currently offline Stephan KleberFriend
Messages: 6
Registered: July 2009
Junior Member
This is a multi-part message in MIME format.
--------------030004000506040206010307
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Hi,

I need a NodeFigure to have an slidable anchor, following the outline of
my figure. At the moment on top and bottom of the figure the connection
line is set apart from the figure due to the use of an rectangular
bounding box.

I tried to acomplish my goal by overriding getPolygonPoints() from
NodeFigure which for my understanding should have done the trick. But it
didn't. The method below shows my attempt. primaryShape is an IFigure.

@Override
public PointList getPolygonPoints() {
PointList pl = primaryShape.getPolygonPoints();
return pl;
}

The result is an anchor in the middle of the shape almost all the time
except two angle-ranges which result in strangeLine.gif
The visible angled line should have gone to the shape below.

I don't have a clue where to look for the error, since I found almost no
information on this and the few I found spoke of attempts linke mine.

Help is very much appreciated.

Stephan

PS: I'm new to this newsgroup, so if I've done anything wrong in writing
this request, please criticise me constructively.

--------------030004000506040206010307
Content-Type: image/gif;
name="polyNode.gif"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="polyNode.gif"

R0lGODlhhwB8APcAAAAAAAAALgAAQQAAXAAAZgAAggAAiQAAkQAuLgAueQAu kQAumABBQQBB
mABPqwBcqwBmsQBwtwBwvS4AAC4Agi4uAC4uLi4ukS5Pmi5cmi6RzTOZmUEA AEEALkEukUFc
T08AAE8ALk8ugk8uiU9BAE9BXE9BiU9BkU9PLlwAQVxPLlxPT1xcXFyYwmYA AGaCn2aYyGax
5XAAAHBBT3BBXHBcXHBmQXCr13nC7oCAgImCq4mnsIm33JFPAJFcQZG33JG9 4JHN7phcLpjN
8pvS8pycnJ9BAJ9mAJ9wLqVwQaXN6qXX8qewsKt5T7CwsLFmALfg97u7u71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bw/OECAB9gAAchSAjQwRCqs+76QFv0O2og IDAwAQx9wC77
EIAAUEXxxwOwA6F9pFozRHTAO9AdDuFFvUCJ6aEoIB7Acf30p/450KNjUyWI DtLPKX6hlJna
tZ7Ma+Z+lH3Ob1798V9mf0H755d/+/+LTP8GMkABBdAxBfQToA6omARSCUol gSD/GHiQHxnp
ghjMIGpKRcGC3Ogo9qGIAynyIqHISIQdFMiJTBgF4fBpfQ0JkVJG9EKvPYSG S5Fho2B4EApd
xUI1jE71bFrIlRW+DzsNIRBYDMSeESKEP4TZ4BHRg5D/pAWK9OMhE9+ixAnC 0IhqSREBCQXE
vPhwjOLToV1o6MQ+4LAvIRqhGA/jIAee8DIvcmAINUMbByLJMa3pkyAHSchC GvKQiEykIhfJ
yEY6UjMBAQA7
--------------030004000506040206010307
Content-Type: image/gif;
name="strangeLine.gif"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="strangeLine.gif"

R0lGODlhvwDZAPcAAAAAAAAALgAAQQAAXAAAZgAAggAAiQAAkQAuLgAueQAu kQAumABBQQBB
mABPqwBcqwBmsQBwtwBwvS4AAC4Agi4uAC4uLi4ukS5Pmi5cmi6RzTOZmUEA AEEALkEukUFc
T08AAE8ALk8ugk8uiU9BAE9BXE9BiU9BkU9PLlwAQVxPLlxPT1xcXFyYwmYA AGZmZmaCn2aY
yGax5XAAAHBBT3BBXHBcXHBmQXCr13nC7oCAgImCq4mnsIm33JFPAJFcQZG3 3JG94JHN7phc
LpjN8pvS8pycnJ9BAJ9mAJ9wLqVwQaXN6qXX8qewsKt5T7CwsLFmALfg97i4 uL1wAL2JT8DA
wMTy/8jIyMjy/8yJLs2RQc2YT9HR0dKRT9SYQdT0/9a3cNfl19fu+9vX29vb 29ylXODS0uXN
q+Xl5enp6eq9cOq9eerIkezr8u7IgvLNkfPSkfPz8/TUnfT3+/fXpffgt/fy 7vvgq/vgsfv3
8v7+/v/uvf/uzf/yxP/zyf/11AAAAAAAAAAAAAAAAAAAAAAAAAA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/6Bu5qddj/lPLqfzzHGu6y3pPNA38znPdg7o n9/pZy/3Wc57
NjSgb9jlTt6T0XeGM6ER7UxH1xnSgla0klUJ1EJbGirBDLWoR73LYXKX0tu0 okcYuMyWzNIj
a35aPs3JkQq22iWr5EisW6bQivDxLKLUyK6tNmsIY8SSaMHkRYYts15LRNlo QbZFmA2WNldk
kHkxZC1RXU9VVy6Pgvn1tD2NzYpAkTJxhBO1t+fsLZYxgFvG9Jw1/RAzqsbd E1k3VqwdtFiq
5txJJLc+ISLuJ4I7Ivoemzu17SEfJjx805Q2cTD58Nq8EtrFsWTF0dZobAab O7/e+PkOmOv6
2FrkcFI7IBkbxECUJ+2Apm4OAQVuP/21xH/sw3n6dG4+no/P5+ADeveErj2i W8/o0UP68pRe
PKYDz+m7g7rtpB47qq/O6qXD+ue0rjmuU87rjQP74QICADs=
--------------030004000506040206010307--
Re: SlidableAnchor and custom polygon as NodeFigure [message #210151 is a reply to message #210001] Fri, 31 October 2008 11:30 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Stephan,

Looks like you have to either override NodeFigure.createDefaultAnchor() method
or put proper connection anchor into HashMap returned by NodeFigure.getConnectionAnchors()
method.
Then you have to modify returned connection anchor appropriately to calculate
proper intersection point as a result of getLocation(Point reference) method
execution.

I think you can use one of theexisting ConnectionAnchor implementations.
For example - BaseSlidableAnchor with overriden getPolygonPoints() method
(not a method of NodeFigure!);

-----------------
Alex Shatalin
Re: SlidableAnchor and custom polygon as NodeFigure [message #210281 is a reply to message #210151] Mon, 03 November 2008 14:48 Go to previous messageGo to next message
Stephan Kleber is currently offline Stephan KleberFriend
Messages: 6
Registered: July 2009
Junior Member
Thank you Alex,

but BaseSlidableAnchor should already by able to do what I want. Look at
the predefined BaseSlidableAnchor.getPolygonPoints():

....
if (getOwner() instanceof IPolygonAnchorableFigure) {
PrecisionPointList polyList = new
PrecisionPointList(((IPolygonAnchorableFigure)
getOwner()).getPolygonPoints());
getOwner().translateToAbsolute(polyList);
return polyList;
}
....

So it should suffice if owner (returned by
BaseSlidableAnchor.getOwner()) is an implementation of
IPolygonAnchorableFigure. This is the case for a NodeFigure. So I
overrode NodeFigure.getPolygonPoints() to return the polygon points of
my figure. This works so far and produces relative coordinates for the
polygon of my NodeFigure.

I tried to override NodeFigure.createDefaultAnchor() to implement my own
calculation of the intersection points. But then I ran into a problem
translating coordinates from relative to absolute coordinates. The
methods translateToAbsolute() and translateToRelative() simply didn't do
anything on my reference points or my point list of my polygon.

Either I missed something in the API-Doc or the description of this
methods is simply wrong. Since these Methods are heavily used I assume
there is no bug. Do I have to calculate this myself, too?

Any further ideas?

Stephan


Alex Shatalin schrieb:
> Hello Stephan,
>
> Looks like you have to either override NodeFigure.createDefaultAnchor()
> method or put proper connection anchor into HashMap returned by
> NodeFigure.getConnectionAnchors() method. Then you have to modify
> returned connection anchor appropriately to calculate proper
> intersection point as a result of getLocation(Point reference) method
> execution.
>
> I think you can use one of theexisting ConnectionAnchor implementations.
> For example - BaseSlidableAnchor with overriden getPolygonPoints()
> method (not a method of NodeFigure!);
>
> -----------------
> Alex Shatalin
>
>
Re: SlidableAnchor and custom polygon as NodeFigure [message #216369 is a reply to message #210151] Mon, 26 January 2009 11:10 Go to previous messageGo to next message
Cristian is currently offline CristianFriend
Messages: 5
Registered: July 2009
Junior Member
I have same problem, i would like to define an anchor that follows the
outline of my figure.
It's a composite figure (a polygon followed by a circle)

> Looks like you have to either override NodeFigure.createDefaultAnchor()
> method or put proper connection anchor into HashMap returned by
> NodeFigure.getConnectionAnchors() method.

I tried to override NodeFigure.getConnectionAnchors() method following
the example of the logic diagram (LEDEditPart.createBoundsMap()), but in
HashTable adds Point instead of connection anchors.
Probably I'm not able to add the correct parameters to HashTable,
someone could give me an example?
Re: SlidableAnchor and custom polygon as NodeFigure [message #216425 is a reply to message #216369] Tue, 27 January 2009 02:08 Go to previous messageGo to next message
Alex Boyko is currently offline Alex BoykoFriend
Messages: 200
Registered: July 2009
Senior Member
Hi,

You need to override more than just getConnectionAnchor() method on the
NodeFigure. #getConnectionAnchorTerminal(ConnectionAnchor) should be
overriden too, so you have keys for the hashtable. Perhaps, other anchro
related methods should be overriden too, but that depends on what you're
doing.

Cheers,
Alex
Re: SlidableAnchor and custom polygon as NodeFigure [message #216517 is a reply to message #216425] Tue, 27 January 2009 16:13 Go to previous messageGo to next message
Alex Boyko is currently offline Alex BoykoFriend
Messages: 200
Registered: July 2009
Senior Member
Another option is approximate the figure with a polyline and let the
regular Slidableanchor do all the work for you.
This is the best option in my opinion!

Cheers,
Alex
Re: SlidableAnchor and custom polygon as NodeFigure [message #216578 is a reply to message #216517] Wed, 28 January 2009 14:16 Go to previous messageGo to next message
FrankTZimmermann is currently offline FrankTZimmermannFriend
Messages: 2
Registered: July 2009
Junior Member
Alex Boyko schrieb:
> Another option is approximate the figure with a polyline and let the
> regular Slidableanchor do all the work for you.
> This is the best option in my opinion!
>
> Cheers,
> Alex
>


I've just overridden this one method NodeFigure.getPolygonPoints() in
the corresponding EditPart and it works fine.


/**
* @generated NOT
*/
protected NodeFigure createNodePlate() {
final DefaultSizeNodeFigure result = new
DefaultSizeNodeFigure(getMapMode().DPtoLP(40),getMapMode().D PtoLP(40)){

@Override
public PointList getPolygonPoints(){

//just some way to get the polygon points
Rectangle bounds = new Rectangle(getBounds());
PointList ptList = new PointList();
int[] scalePoints = ((EventFigure)getPrimaryShape()).scalePointList();
for (int i=0;i<scalePoints.length;i+=2){
ptList.addPoint(scalePoints[i]+bounds.x, scalePoints[i+1]+bounds.y);
}
ptList.addPoint(scalePoints[0]+bounds.x, scalePoints[1]+bounds.y);
return ptList;
}

};
return result;
}

hope it helps
Frank
Re: SlidableAnchor and custom polygon as NodeFigure [message #219804 is a reply to message #216578] Tue, 24 February 2009 08:34 Go to previous message
Cristian is currently offline CristianFriend
Messages: 5
Registered: July 2009
Junior Member
Thanks for your help,
but what is the EventFigure class?

> protected NodeFigure createNodePlate() {
> final DefaultSizeNodeFigure result = new
> DefaultSizeNodeFigure(getMapMode().DPtoLP(40),getMapMode().D PtoLP(40)){
>
> @Override
> public PointList getPolygonPoints(){
>
> //just some way to get the polygon points
> Rectangle bounds = new Rectangle(getBounds());
> PointList ptList = new PointList();
> int[] scalePoints = ((EventFigure)getPrimaryShape()).scalePointList();
> for (int i=0;i<scalePoints.length;i+=2){
> ptList.addPoint(scalePoints[i]+bounds.x, scalePoints[i+1]+bounds.y);
> }
> ptList.addPoint(scalePoints[0]+bounds.x, scalePoints[1]+bounds.y);
> return ptList;
> }
>
> };
> return result;
> }
>
> hope it helps
> Frank
>

regards,
Cristian
Previous Topic:nodes disapear after connecting them
Next Topic:integer arrays
Goto Forum:
  


Current Time: Fri Mar 29 02:27:51 GMT 2024

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

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

Back to the top