From b60c7874d84c7463f771332054c98643a0f99404 Mon Sep 17 00:00:00 2001 From: lempinen Date: Thu, 5 Aug 2010 12:56:18 +0000 Subject: [PATCH] Rest of the transforms git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@16967 ac1ea38d-2e2b-0410-8846-a27921b304fc --- .../simantics/sysdyn/ui/elements2/HoverTextNode.java | 8 +++++++- .../simantics/sysdyn/ui/elements2/InputFactory.java | 5 +++++ .../src/org/simantics/sysdyn/SysdynResource.java | 12 ++++++------ 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/HoverTextNode.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/HoverTextNode.java index d6f1e37d..a55f7544 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/HoverTextNode.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/HoverTextNode.java @@ -4,6 +4,7 @@ import java.awt.BasicStroke; import java.awt.Color; import java.awt.Graphics2D; import java.awt.font.FontRenderContext; +import java.awt.geom.NoninvertibleTransformException; import java.awt.geom.Rectangle2D; import org.simantics.diagram.elements.TextNode; @@ -18,6 +19,7 @@ public class HoverTextNode extends TextNode { @Override public void render(Graphics2D g) { + g.transform(transform); if(horizontalAlignment == Alignment.CENTER.ordinal()) { FontRenderContext frc = g.getFontRenderContext(); Rectangle2D stringBounds = font.getStringBounds(getText(), frc); @@ -38,7 +40,11 @@ public class HoverTextNode extends TextNode { g.setColor(oldColor); g.setStroke(oldStroke); } - + try { + g.transform(transform.createInverse()); + } catch (NoninvertibleTransformException e) { + e.printStackTrace(); + } super.render(g); diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/InputFactory.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/InputFactory.java index 1977dfb0..43936fd3 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/InputFactory.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/elements2/InputFactory.java @@ -4,6 +4,7 @@ import java.awt.BasicStroke; import java.awt.Color; import java.awt.Font; import java.awt.Shape; +import java.awt.geom.AffineTransform; import java.awt.geom.Path2D; import java.awt.geom.Rectangle2D; import java.util.Collection; @@ -175,6 +176,7 @@ public class InputFactory extends SysdynElementFactory { Color borderColor = ElementUtils.getBorderColor(e, Color.BLACK); String text = SysdynElementUtils.getInputReference(e); double scale = 0.235; + AffineTransform at = ElementUtils.getTransform(e); node.init(text, font, color, originX, font.getSize2D() * scale, scale); node.setBackgroundColor(fillColor); node.setBorderColor(borderColor); @@ -182,6 +184,9 @@ public class InputFactory extends SysdynElementFactory { node.setBorderWidth((float) 0); node.setEditable(false); node.setShowSelection(false); + + if(at != null) + node.setTransform(at); } @Override diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/SysdynResource.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/SysdynResource.java index e95f4987..f2c110f9 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/SysdynResource.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/SysdynResource.java @@ -21,9 +21,9 @@ import org.simantics.db.exception.DatabaseException; public class SysdynResource { public final Resource Admin1; - public final Resource Admin1; - public final Resource Admin2; + public final Resource Admin1CM; public final Resource Admin2; + public final Resource Admin2CM; public final Resource Auxiliary; public final Resource AuxiliarySymbol; public final Resource BasicExperiment; @@ -109,9 +109,9 @@ public class SysdynResource { public static class URIs { public static final String Admin1 = "http://www.simantics.org/Sysdyn-1.0/Admin1"; - public static final String Admin1 = "http://www.simantics.org/Sysdyn-1.0/Admin1"; - public static final String Admin2 = "http://www.simantics.org/Sysdyn-1.0/Admin2"; + public static final String Admin1CM = "http://www.simantics.org/Sysdyn-1.0/Admin1CM"; public static final String Admin2 = "http://www.simantics.org/Sysdyn-1.0/Admin2"; + public static final String Admin2CM = "http://www.simantics.org/Sysdyn-1.0/Admin2CM"; public static final String Auxiliary = "http://www.simantics.org/Sysdyn-1.0/Auxiliary"; public static final String AuxiliarySymbol = "http://www.simantics.org/Sysdyn-1.0/AuxiliarySymbol"; public static final String BasicExperiment = "http://www.simantics.org/Sysdyn-1.0/BasicExperiment"; @@ -207,9 +207,9 @@ public class SysdynResource { public SysdynResource(ReadGraph graph) { Admin1 = getResourceOrNull(graph, URIs.Admin1); - Admin1 = getResourceOrNull(graph, URIs.Admin1); - Admin2 = getResourceOrNull(graph, URIs.Admin2); + Admin1CM = getResourceOrNull(graph, URIs.Admin1CM); Admin2 = getResourceOrNull(graph, URIs.Admin2); + Admin2CM = getResourceOrNull(graph, URIs.Admin2CM); Auxiliary = getResourceOrNull(graph, URIs.Auxiliary); AuxiliarySymbol = getResourceOrNull(graph, URIs.AuxiliarySymbol); BasicExperiment = getResourceOrNull(graph, URIs.BasicExperiment); -- 2.47.1