Mercurial > dive4elements > river
view flys-client/src/main/java/de/intevation/flys/client/shared/Transform2D.java @ 1384:e89303730d00
Bugfix: added missing i18n strings and synced english translation with default translation.
flys-client/trunk@3164 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 04 Nov 2011 11:40:24 +0000 |
parents | ea2191b1299d |
children | ef745bc6bed9 |
line wrap: on
line source
package de.intevation.flys.client.shared; import java.io.Serializable; import com.google.gwt.core.client.GWT; /** * This object supports a linear transformation to transform xy coordinates into * an other coordinate system based on scale and translation values. * * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class Transform2D implements Serializable { protected double sx; protected double sy; protected double tx; protected double ty; public Transform2D() { } /** * Creates a new transformation with scale and translation factors. * * @param sx The scale factor for the x axis. * @param sy The scale factor for the y axis. * @param tx The translation factor for the x axis. * @param ty The translation factor for the y axis. */ public Transform2D(double sx, double sy, double tx, double ty) { this.sx = sx; this.sy = sy; this.tx = tx; this.ty = ty; } /** * Transforms the pixel x and y into a new coordinate system based on the * scale and translation values specified in the constructor. */ public double[] transform(double x, double y) { double resX = sx * x + tx; double resY = sy * y + ty; return new double[] { resX, resY }; } public void dumpGWT() { GWT.log("SX = " + sx); GWT.log("SY = " + sy); GWT.log("TX = " + tx); GWT.log("TY = " + ty); } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :