Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2012-03-12 05:31:12 -0400
committerHenrik Rentz-Reichert2012-03-12 05:31:12 -0400
commit59f7b04b5a1db0119c1d896c1661c4cfa4228547 (patch)
tree86ef84204aa112fa73a210f653ceedfddcb17f0a /plugins/org.eclipse.etrice.ui.structure
parent73342e0b8b533fdd8007e0ee2900c4f93fc58467 (diff)
downloadorg.eclipse.etrice-59f7b04b5a1db0119c1d896c1661c4cfa4228547.tar.gz
org.eclipse.etrice-59f7b04b5a1db0119c1d896c1661c4cfa4228547.tar.xz
org.eclipse.etrice-59f7b04b5a1db0119c1d896c1661c4cfa4228547.zip
[ui.structure] fixed positions of interface items on actor refs
Diffstat (limited to 'plugins/org.eclipse.etrice.ui.structure')
-rw-r--r--plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/InterfaceItemSupport.java22
1 files changed, 17 insertions, 5 deletions
diff --git a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/InterfaceItemSupport.java b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/InterfaceItemSupport.java
index 9fdedce8d..fa11ab4ee 100644
--- a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/InterfaceItemSupport.java
+++ b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/InterfaceItemSupport.java
@@ -708,7 +708,7 @@ public class InterfaceItemSupport {
public static void createRefItems(ActorContainerRef acr, ContainerShape refShape, IFeatureProvider featureProvider) {
ActorContainerClass refClass = (acr instanceof ActorRef)?((ActorRef)acr).getType():((SubSystemRef)acr).getType();
- List<? extends InterfaceItem> refItems = RoomHelpers.getInterfaceItems(refClass, true);
+ List<InterfaceItem> refItems = RoomHelpers.getInterfaceItems(refClass, true);
if (refShape!=null && refClass!=null &&!refItems.isEmpty()) {
@@ -728,8 +728,12 @@ public class InterfaceItemSupport {
List<InterfaceItem> extRefItems = RoomHelpers.getInterfaceItems(extRefClass, true);
List<InterfaceItem> intRefItems = SupportUtil.getInterfaceItems(refShape, featureProvider);
- int scaleX = refAcShape.getGraphicsAlgorithm().getWidth()/ActorContainerRefSupport.DEFAULT_SIZE_X;
- int scaleY = refAcShape.getGraphicsAlgorithm().getHeight()/ActorContainerRefSupport.DEFAULT_SIZE_Y;
+ // relate visible rectangle sizes to each other and compute scale factors
+ double scaleX = (refAcShape.getGraphicsAlgorithm().getWidth()-2*StructureClassSupport.MARGIN)
+ /(double)(refShape.getGraphicsAlgorithm().getWidth()-2*ActorContainerRefSupport.MARGIN);
+ double scaleY = (refAcShape.getGraphicsAlgorithm().getHeight()-2*StructureClassSupport.MARGIN)
+ /(double)(refShape.getGraphicsAlgorithm().getHeight()-2*ActorContainerRefSupport.MARGIN);
+
for (Shape childShape : refAcShape.getChildren()) {
bo = featureProvider.getBusinessObjectForPictogramElement(childShape);
if (bo instanceof InterfaceItem) {
@@ -738,8 +742,16 @@ public class InterfaceItemSupport {
EObject ownObject = SupportUtil.getOwnObject((InterfaceItem)bo, rs);
if (!intRefItems.contains(ownObject)) {
- int x = ITEM_SIZE_SMALL/2 + childShape.getGraphicsAlgorithm().getX()/scaleX;
- int y = ITEM_SIZE_SMALL/2 + childShape.getGraphicsAlgorithm().getY()/scaleY;
+ // original mid points relative to visible rectangle
+ int origMidX = childShape.getGraphicsAlgorithm().getX();
+ int origMidY = childShape.getGraphicsAlgorithm().getY();
+ int x = (int) (origMidX/scaleX);
+ int y = (int) (origMidY/scaleY);
+
+ // translate to get mid points relative to invisible rectangle
+ x += ActorContainerRefSupport.MARGIN;
+ y += ActorContainerRefSupport.MARGIN;
+
SupportUtil.addItem(ownObject, x, y, refShape, featureProvider);
}
}

Back to the top