|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gishur.x.XObject
A generic planar object. A concrete planar object should represent some sort of a planar primitive like point, line, polygon.
All planar objects should implement transform
enabling affine transformations. XObject provides some shortcut methods like
#scale
, #rotate
and translate
for special affine transformations
This class is just a 'light' version of XObject
to extend
the 'old' planar geometric classes. Some of this classes methods are useless
(e.g. mutability methods) but used by DisplayObjects in order
visualize gishur.x classes in a similar way to the newer gishur.x2.core classes.
Constructor Summary | |
XObject()
|
Method Summary | |
java.lang.Object |
clone()
Creates a new object of the same class as this object. |
XObject |
copy()
This method creates a clone of this object instance like clone with a little difference: if this is immutable, the clone won't be
till the first modification. |
XObject |
getMutable()
This method returns either this XObject or a temporary mutable
clone of this XObject, depending on its mutability.
|
XObject |
inverseTransform_XObject(double m00,
double m01,
double m02,
double m10,
double m11,
double m12)
Inverse transforms this XObject by the given affine
transformation matrix. |
boolean |
mutable()
Checks, if this XObject is mutable. |
void |
restoreMutability()
Restores the mutability information to the information of the original of this clone. |
XObject |
rotate_XObject(XPoint center,
double angle)
Rotates this XObject around the rotation center
center by angle . |
XObject |
scale_XObject(XPoint center,
double xscale,
double yscale)
Scales this XObject with xscale and
yscale scale factors and with center point
center . |
java.lang.String |
toString()
Returns a string representation of the object. |
XObject |
transform_XObject(AffineTransformation t)
Transforms this XObject by the given affine
transformation matrix. |
abstract XObject |
transform_XObject(double m00,
double m01,
double m02,
double m10,
double m11,
double m12)
Transforms this XObject by the given affine
transformation matrix. |
XObject |
translate_XObject(double dx,
double dy)
Translates this XObject by the given Vector
(dx,dy) . |
XObject |
translate_XObject(XPoint v)
Translates this XObject by the given Vector
v . |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public XObject()
Method Detail |
public boolean mutable()
#STATE_MUTABLE
is set)public XObject getMutable()
this
XObject or a temporary mutable
clone of this
XObject, depending on its mutability.
If this
XObject is immutable, a clone will be created and returned
that is mutable until a call to restoreMutability()
. This gives
one the possibility to write code like this without knowing something
about the mutability of the used XObject:
XObject a=...; a=getMutable(); // get a mutable version of a a.transform(...); // change a ... (can be more transformations) a.restoreMutability(); // restore the old mutability information of the original
this
or a mutable clone.copy()
,
#restorMutability
public void restoreMutability()
this
is a normal mutable
(or immutable) XObject, nothing happens.public XObject copy()
this
is immutable, the clone won't be
till the first modification. This is usefull if you like to create a modified
version of an object instance and you don't know, if this object is mutable.
With copy
you can assure, there will be created a new instance;
you can write code as this:
XObject a=...; XObject b=a.copy().translate(x,y);If
a
is mutable, copy
assures that a new instance
is created and #translate
works on that copy. If a
is
immutable, copy
creates a new instance of a
and
lets modify #translate
this instance exactly one time.this
object, that is modifyable at least one
time (depending on the immutable-flag of this
).public abstract XObject transform_XObject(double m00, double m01, double m02, double m10, double m11, double m12)
this
XObject by the given affine
transformation matrix.m00,m01,m02
- first row of the transformation matrixm10,m11,m12
- second row of the transformation matrixthis
, only if it is
mutable, otherwise a new XObject represeting the transformed object).public XObject inverseTransform_XObject(double m00, double m01, double m02, double m10, double m11, double m12)
this
XObject by the given affine
transformation matrix.m00,m01,m02
- first row of the transformation matrixm10,m11,m12
- second row of the transformation matrixthis
, only if it is
mutable, otherwise a new XObject represeting the transformed object).public XObject transform_XObject(AffineTransformation t)
this
XObject by the given affine
transformation matrix.t
- the transformation matrixthis
, only if it is
mutable)public XObject scale_XObject(XPoint center, double xscale, double yscale)
this
XObject with xscale
and
yscale
scale factors and with center point
center
.center
- immutable scaling center pointxscale
- scale factor for x-axisyscale
- scale factor for y-axisthis
, only if it is
mutable)public XObject rotate_XObject(XPoint center, double angle)
this
XObject around the rotation center
center
by angle
.center
- rotation centerangle
- rotation anglethis
, only if it is
mutable)public XObject translate_XObject(double dx, double dy)
this
XObject by the given Vector
(dx,dy)
.(dx,dy)
- translation vectorthis
, only if it is
mutable)public XObject translate_XObject(XPoint v)
this
XObject by the given Vector
v
.(dx,dy)
- translation vectorthis
, only if it is
mutable)public java.lang.Object clone()
clone
in interface Cloneable
clone
in class java.lang.Object
OutOfMemoryError
- if there is not enough memory.Cloneable
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |