1 package org.simantics.sysdyn.ui.elements;
\r
3 import java.awt.geom.AffineTransform;
\r
4 import java.awt.geom.Point2D;
\r
6 public abstract class PositionableDrawable extends Drawable implements ITransformable, Cloneable {
\r
7 protected double posX;
\r
8 protected double posY;
\r
11 public Point2D getPosition() {
\r
12 return new Point2D.Double(posX, posY);
\r
15 public AffineTransform getTransform() {
\r
16 return new AffineTransform(1.0, 0.0, 0.0, 1.0, posX, posY);
\r
19 public ITransformable moveTo(double x, double y) {
\r
21 PositionableDrawable d = (PositionableDrawable)clone();
\r
25 } catch(CloneNotSupportedException e) {
\r
30 public ITransformable setTransform(AffineTransform at) {
\r
32 PositionableDrawable d = (PositionableDrawable)clone();
\r
33 d.posX = at.getTranslateX();
\r
34 d.posY = at.getTranslateY();
\r
36 } catch(CloneNotSupportedException e) {
\r