-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- * VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.g2d.element.handler.impl;\r
-\r
-import java.awt.geom.Rectangle2D;\r
-\r
-import org.simantics.g2d.element.IElement;\r
-import org.simantics.g2d.element.handler.InternalSize;\r
-\r
-/**\r
- * Handler for elements with fixed internal size (eg vector symbols). \r
- * \r
- * @author Toni Kalajainen\r
- */\r
-public class FixedSize implements InternalSize {\r
-\r
- private static final long serialVersionUID = -3597595326131594492L;\r
-\r
- public static InternalSize of(double width, double height)\r
- {\r
- return new FixedSize(0, 0, width, height);\r
- }\r
-\r
- public static InternalSize of(double minX, double minY, double width, double height)\r
- {\r
- return new FixedSize(minX, minY, width, height);\r
- }\r
-\r
- public static InternalSize of(Rectangle2D bounds)\r
- {\r
- return new FixedSize(bounds.getMinX(), bounds.getMinY(), bounds.getWidth(), bounds.getHeight());\r
- }\r
-\r
- final Double aspectRatio;\r
- Rectangle2D bounds;\r
-\r
- FixedSize(double minX, double minY, double width, double height)\r
- {\r
- this.aspectRatio = width / height;\r
- bounds = new Rectangle2D.Double(minX, minY, width, height);\r
- }\r
-\r
- @Override\r
- public Rectangle2D getBounds(IElement e, Rectangle2D s) {\r
- if (s==null) s = new Rectangle2D.Double();\r
- s.setFrame(bounds); \r
- return s;\r
- }\r
-\r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.g2d.element.handler.impl;
+
+import java.awt.geom.Rectangle2D;
+
+import org.simantics.g2d.element.IElement;
+import org.simantics.g2d.element.handler.InternalSize;
+
+/**
+ * Handler for elements with fixed internal size (eg vector symbols).
+ *
+ * @author Toni Kalajainen
+ */
+public class FixedSize implements InternalSize {
+
+ private static final long serialVersionUID = -3597595326131594492L;
+
+ public static InternalSize of(double width, double height)
+ {
+ return new FixedSize(0, 0, width, height);
+ }
+
+ public static InternalSize of(double minX, double minY, double width, double height)
+ {
+ return new FixedSize(minX, minY, width, height);
+ }
+
+ public static InternalSize of(Rectangle2D bounds)
+ {
+ return new FixedSize(bounds.getMinX(), bounds.getMinY(), bounds.getWidth(), bounds.getHeight());
+ }
+
+ final Double aspectRatio;
+ Rectangle2D bounds;
+
+ FixedSize(double minX, double minY, double width, double height)
+ {
+ this.aspectRatio = width / height;
+ bounds = new Rectangle2D.Double(minX, minY, width, height);
+ }
+
+ @Override
+ public Rectangle2D getBounds(IElement e, Rectangle2D s) {
+ if (s==null) s = new Rectangle2D.Double();
+ s.setFrame(bounds);
+ return s;
+ }
+
+
+}