X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=bundles%2Forg.simantics.utils.ui%2Fsrc%2Forg%2Fsimantics%2Futils%2Fui%2Fgfx%2FPhysicalDimension.java;fp=bundles%2Forg.simantics.utils.ui%2Fsrc%2Forg%2Fsimantics%2Futils%2Fui%2Fgfx%2FPhysicalDimension.java;h=19544867cbb07d3fe2fee455bb8c66f47046b714;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=32fb83bf45227274406ce60c668c2022f6228735;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.utils.ui/src/org/simantics/utils/ui/gfx/PhysicalDimension.java b/bundles/org.simantics.utils.ui/src/org/simantics/utils/ui/gfx/PhysicalDimension.java index 32fb83bf4..19544867c 100644 --- a/bundles/org.simantics.utils.ui/src/org/simantics/utils/ui/gfx/PhysicalDimension.java +++ b/bundles/org.simantics.utils.ui/src/org/simantics/utils/ui/gfx/PhysicalDimension.java @@ -1,79 +1,79 @@ -/******************************************************************************* - * 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; - - -/** - * PhysicalDimension - * @author Toni Kalajainen - */ -public class PhysicalDimension { - - /** Width in meters */ - public final double width; - - /** height in meters */ - public final double height; - - private final int hash; - - public PhysicalDimension(double width, double height) { - this.width = width; - this.height = height; - this.hash = makeHash(width, height); - } - - public PhysicalDimension(PixelDimension d) { - this(d.width, d.height); - } - - public double getHeight() { - return height; - } - - public double 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() { - return hash; - } - - private static int makeHash(Double w, Double h) { - return w.hashCode() ^ (h.hashCode()*7); - } - - @Override - public String toString() { - return "PhysicalDimension [w=" + width + ", h=" + height + "]"; - } - - /** - * returns aspect ratio (width / height) - * @return returns aspect ratio (width / height) - */ - public double getAspectRatio() - { - return width / height; - } - -} +/******************************************************************************* + * 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; + + +/** + * PhysicalDimension + * @author Toni Kalajainen + */ +public class PhysicalDimension { + + /** Width in meters */ + public final double width; + + /** height in meters */ + public final double height; + + private final int hash; + + public PhysicalDimension(double width, double height) { + this.width = width; + this.height = height; + this.hash = makeHash(width, height); + } + + public PhysicalDimension(PixelDimension d) { + this(d.width, d.height); + } + + public double getHeight() { + return height; + } + + public double 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() { + return hash; + } + + private static int makeHash(Double w, Double h) { + return w.hashCode() ^ (h.hashCode()*7); + } + + @Override + public String toString() { + return "PhysicalDimension [w=" + width + ", h=" + height + "]"; + } + + /** + * returns aspect ratio (width / height) + * @return returns aspect ratio (width / height) + */ + public double getAspectRatio() + { + return width / height; + } + +}