X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.scenegraph%2Fsrc%2Forg%2Fsimantics%2Fscenegraph%2Fg2d%2FIdentityAffineTransform.java;fp=bundles%2Forg.simantics.scenegraph%2Fsrc%2Forg%2Fsimantics%2Fscenegraph%2Fg2d%2FIdentityAffineTransform.java;h=2eb989b902212865db2643b7596808f3c96f3533;hb=969bd23cab98a79ca9101af33334000879fb60c5;hp=0000000000000000000000000000000000000000;hpb=866dba5cd5a3929bbeae85991796acb212338a08;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/IdentityAffineTransform.java b/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/IdentityAffineTransform.java new file mode 100644 index 000000000..2eb989b90 --- /dev/null +++ b/bundles/org.simantics.scenegraph/src/org/simantics/scenegraph/g2d/IdentityAffineTransform.java @@ -0,0 +1,164 @@ +/******************************************************************************* + * Copyright (c) 2012 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.scenegraph.g2d; + +import java.awt.geom.AffineTransform; +import java.awt.geom.NoninvertibleTransformException; + +/** + * An optimization for memory consumption to keep down the allocation of + * unnecessary identity-type affine transforms. This will be used as the default + * affine transform in {@link G2DNode} and {@link G2DParentNode}. + * + * @author Tuukka Lehtonen + */ +public class IdentityAffineTransform extends AffineTransform { + + public static final IdentityAffineTransform INSTANCE = new IdentityAffineTransform(); + + private static final long serialVersionUID = 7843049586639496587L; + + private IdentityAffineTransform() { + // No self-construction. + } + + @Override + public boolean isIdentity() { + return true; + } + + @Override + public void translate(double tx, double ty) { + throw new UnsupportedOperationException(); + } + + @Override + public void rotate(double theta) { + throw new UnsupportedOperationException(); + } + + @Override + public void rotate(double theta, double anchorx, double anchory) { + throw new UnsupportedOperationException(); + } + + @Override + public void rotate(double vecx, double vecy) { + throw new UnsupportedOperationException(); + } + + @Override + public void rotate(double vecx, double vecy, double anchorx, double anchory) { + throw new UnsupportedOperationException(); + } + + @Override + public void quadrantRotate(int numquadrants) { + throw new UnsupportedOperationException(); + } + + @Override + public void quadrantRotate(int numquadrants, double anchorx, double anchory) { + throw new UnsupportedOperationException(); + } + + @Override + public void scale(double sx, double sy) { + throw new UnsupportedOperationException(); + } + + @Override + public void shear(double shx, double shy) { + throw new UnsupportedOperationException(); + } + + @Override + public void setToIdentity() { + // NOP + } + + @Override + public void setToTranslation(double tx, double ty) { + throw new UnsupportedOperationException(); + } + + @Override + public void setToRotation(double theta) { + throw new UnsupportedOperationException(); + } + + @Override + public void setToRotation(double theta, double anchorx, double anchory) { + throw new UnsupportedOperationException(); + } + + @Override + public void setToRotation(double vecx, double vecy) { + throw new UnsupportedOperationException(); + } + + @Override + public void setToRotation(double vecx, double vecy, double anchorx, double anchory) { + throw new UnsupportedOperationException(); + } + + @Override + public void setToQuadrantRotation(int numquadrants) { + throw new UnsupportedOperationException(); + } + + @Override + public void setToQuadrantRotation(int numquadrants, double anchorx, double anchory) { + throw new UnsupportedOperationException(); + } + + @Override + public void setToScale(double sx, double sy) { + throw new UnsupportedOperationException(); + } + + @Override + public void setToShear(double shx, double shy) { + throw new UnsupportedOperationException(); + } + + @Override + public void setTransform(AffineTransform Tx) { + throw new UnsupportedOperationException(); + } + + @Override + public void setTransform(double m00, double m10, double m01, double m11, double m02, double m12) { + throw new UnsupportedOperationException(); + } + + @Override + public void concatenate(AffineTransform Tx) { + throw new UnsupportedOperationException(); + } + + @Override + public void preConcatenate(AffineTransform Tx) { + throw new UnsupportedOperationException(); + } + + @Override + public void invert() throws NoninvertibleTransformException { + throw new UnsupportedOperationException(); + } + + @Override + public Object clone() { + return new AffineTransform(); + } + +} \ No newline at end of file