-/*******************************************************************************\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
-/*\r
- * 10.10.2006\r
- */\r
-package org.simantics.utils.ui.gfx;\r
-\r
-import java.awt.Dimension;\r
-\r
-\r
-/**\r
- * PixelDimension\r
- * \r
- * @author Toni Kalajainen\r
- */\r
-public class PixelDimension {\r
-\r
- public final int width;\r
-\r
- public final int height;\r
-\r
- public PixelDimension(int width, int height) {\r
- this.width = width;\r
- this.height = height;\r
- }\r
-\r
- public PixelDimension(PixelDimension d) {\r
- this(d.width, d.height);\r
- }\r
- \r
- public PixelDimension(Dimension d) {\r
- this(d.width, d.height);\r
- }\r
-\r
- public int getHeight() {\r
- return height;\r
- }\r
-\r
- public int getWidth() {\r
- return width;\r
- }\r
-\r
- public boolean equals(Object obj) {\r
- if (!(obj instanceof PixelDimension))\r
- return false;\r
- PixelDimension d = (PixelDimension) obj;\r
- return (width == d.width) && (height == d.height);\r
- }\r
-\r
- public int hashCode() {\r
- int sum = width+height;\r
- return sum*(sum+1)/2 + width;\r
- }\r
- \r
- @Override\r
- public String toString() {\r
- return "PixelDimension [w=" + width + ", h=" + height + "]";\r
- } \r
- \r
- /**\r
- * returns aspect ratio (width / height)\r
- * @return returns aspect ratio (width / height)\r
- */\r
- public double getAspectRatio()\r
- {\r
- return (double)width / (double)height;\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
+ *******************************************************************************/
+/*
+ * 10.10.2006
+ */
+package org.simantics.utils.ui.gfx;
+
+import java.awt.Dimension;
+
+
+/**
+ * PixelDimension
+ *
+ * @author Toni Kalajainen
+ */
+public class PixelDimension {
+
+ public final int width;
+
+ public final int height;
+
+ public PixelDimension(int width, int height) {
+ this.width = width;
+ this.height = height;
+ }
+
+ public PixelDimension(PixelDimension d) {
+ this(d.width, d.height);
+ }
+
+ public PixelDimension(Dimension d) {
+ this(d.width, d.height);
+ }
+
+ public int getHeight() {
+ return height;
+ }
+
+ public int getWidth() {
+ return width;
+ }
+
+ public boolean equals(Object obj) {
+ if (!(obj instanceof PixelDimension))
+ return false;
+ PixelDimension d = (PixelDimension) obj;
+ return (width == d.width) && (height == d.height);
+ }
+
+ public int hashCode() {
+ int sum = width+height;
+ return sum*(sum+1)/2 + width;
+ }
+
+ @Override
+ public String toString() {
+ return "PixelDimension [w=" + width + ", h=" + height + "]";
+ }
+
+ /**
+ * returns aspect ratio (width / height)
+ * @return returns aspect ratio (width / height)
+ */
+ public double getAspectRatio()
+ {
+ return (double)width / (double)height;
+ }
+
+}