From b4d20201fa41205ca8d19f80487471c795ae4c52 Mon Sep 17 00:00:00 2001 From: lempinen Date: Thu, 5 Aug 2010 12:44:01 +0000 Subject: [PATCH] Added transformation setters for elements git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@16963 ac1ea38d-2e2b-0410-8846-a27921b304fc --- .../src/org/simantics/sysdyn/ui/elements2/CloudFactory.java | 5 +++++ .../sysdyn/ui/elements2/HoverTextElementNoBounds.java | 4 ++++ .../src/org/simantics/sysdyn/ui/elements2/ValveFactory.java | 5 +++++ 3 files changed, 14 insertions(+) diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/CloudFactory.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/CloudFactory.java index 504b790d..fd7277e8 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/CloudFactory.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/CloudFactory.java @@ -14,6 +14,7 @@ package org.simantics.sysdyn.ui.elements2; import java.awt.BasicStroke; import java.awt.Color; import java.awt.Shape; +import java.awt.geom.AffineTransform; import java.awt.geom.Path2D; import java.awt.geom.Rectangle2D; import java.util.Collection; @@ -111,6 +112,7 @@ public class CloudFactory extends SysdynElementFactory { @Override public void init(IElement e, G2DParentNode parent) { + AffineTransform at = ElementUtils.getTransform(e); HoverShapeNode node = ElementUtils.getOrCreateNode(e, parent, NODE, "valve", HoverShapeNode.class); node.setStroke(STROKE); @@ -118,6 +120,9 @@ public class CloudFactory extends SysdynElementFactory { node.setColor(Color.BLACK); node.setShape(getCloudShape()); + if(at != null) + node.setTransform(at); + hoverHintListener = new IHintListener() { @Override diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/HoverTextElementNoBounds.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/HoverTextElementNoBounds.java index 0275e952..b8e9ff6c 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/HoverTextElementNoBounds.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/HoverTextElementNoBounds.java @@ -13,6 +13,7 @@ package org.simantics.sysdyn.ui.elements2; import java.awt.Color; import java.awt.Font; +import java.awt.geom.AffineTransform; import org.simantics.diagram.elements.ITextListener; import org.simantics.diagram.elements.TextElementNoBounds; @@ -99,6 +100,7 @@ public class HoverTextElementNoBounds extends TextElementNoBounds { Color fillColor = ElementUtils.getFillColor(e); Color borderColor = ElementUtils.getBorderColor(e, Color.BLACK); String text = ElementUtils.getText(e); + AffineTransform at = ElementUtils.getTransform(e); node.init(text, font, color, originX, originY, 0.235); node.setBackgroundColor(fillColor); node.setBorderColor(borderColor); @@ -106,6 +108,8 @@ public class HoverTextElementNoBounds extends TextElementNoBounds { node.setPadding(paddingX, paddingY); node.setBorderWidth((float) borderWidth); node.setEditable(editable); + if(at != null) + node.setTransform(at); this.hoverHintListener = new IHintListener() { @Override diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/ValveFactory.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/ValveFactory.java index a9774e5c..6c9123a8 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/ValveFactory.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/ValveFactory.java @@ -13,6 +13,7 @@ package org.simantics.sysdyn.ui.elements2; import java.awt.BasicStroke; import java.awt.Color; +import java.awt.geom.AffineTransform; import java.awt.geom.Path2D; import java.awt.geom.Rectangle2D; import java.util.Collection; @@ -115,6 +116,7 @@ public class ValveFactory extends SysdynElementFactory { @Override public void init(IElement e, G2DParentNode parent) { super.init(e, parent); + AffineTransform at = ElementUtils.getTransform(e); final HoverShapeNode node = ElementUtils.getOrCreateNode(e, parent, NODE, "valve", HoverShapeNode.class); // Calculate borders from text node bounds. @@ -124,6 +126,9 @@ public class ValveFactory extends SysdynElementFactory { node.setShape(createShape(VALVE_SIZE, Boolean.TRUE.equals(e.getHint(KEY_ROTATED)))); node.setHover(ElementUtils.isHovering(e)); + if(at != null) + node.setTransform(at); + hoverHintListener = new IHintListener() { @Override -- 2.47.1