Maintaing a list of BoxRelativeAnchors in a Shape [message #931788] |
Wed, 03 October 2012 14:26 |
Surya Kathayat Messages: 44 Registered: July 2012 |
Member |
|
|
Hi,
I am trying to have incoming links to end at the middle of top line of a node(e.g. rectangle) and all outgoing links to start at the middle of the buttom line of a graphical node. See in the figure, incoming links should end on A and outgoing links on B.
How this could be done? I though of using BoxRelativeAnchors. I created two box relative anchors and added to the pictorial element of a graphical node, as below.
But I am not sure how can I set proper anchors at the start and end of a connection in the add method of add link feature i.e. in connection.setStart(??); connection.setEnd(??); ??.
@Override
public PictogramElement add(IAddContext context) {
...
...
final BoxRelativeAnchor boxAnchorIn = peCreateService.createBoxRelativeAnchor(containerShape);
boxAnchorIn.setRelativeWidth(0.5);
boxAnchorIn.setRelativeHeight(0.0);
boxAnchorIn.setReferencedGraphicsAlgorithm(roundedRectangle);
final Rectangle rectangle = gaService.createRectangle(boxAnchorIn);
rectangle.setForeground(manageColor(IdmColors.TASK_BORDER_COLOR));
rectangle.setBackground(manageColor(IdmColors.TASK_FILL_COLOR));
rectangle.setLineWidth(2);
gaService.setLocationAndSize(rectangle, 0, 0, 5, 5);
final BoxRelativeAnchor boxAnchorOut = peCreateService.createBoxRelativeAnchor(containerShape);
boxAnchorOut.setRelativeWidth(0.5);
boxAnchorOut.setRelativeHeight(1.0);
boxAnchorOut.setReferencedGraphicsAlgorithm(roundedRectangle);
final Rectangle rectangleOut = gaService.createRectangle(boxAnchorOut);
rectangleOut.setForeground(manageColor(IdmColors.TASK_BORDER_COLOR));
rectangleOut.setBackground(manageColor(IdmColors.TASK_FILL_COLOR));
rectangleOut.setLineWidth(2);
gaService.setLocationAndSize(rectangleOut, -5, -5, 5, 5);
...
...
}
-
Attachment: anchors.gif
(Size: 5.54KB, Downloaded 480 times)
[Updated on: Wed, 03 October 2012 15:29] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03143 seconds