|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.geom.Point2D
java.awt.geom.Point2D.Double
info.monitorenter.gui.chart.TracePoint2D
public class TracePoint2D
A specialized version of java.awt.Point2D.Double
who carries two further values:
double scaledX
and double scaledY
which allow the
Chart2D
to cache the scaled values (between 0.0 and 1.0) without having to keep a
copy of the aggregators (ITrace2D
) complete tracepoints.
This avoids the necessity to care for the correct order of a set of scaled tracepoints copied for
caching purposes. Especially in the case of new TracePoint2D
instances added to a
ITrace2D
instance managed by a Chart2D
there remains no
responsibility for sorting the cached copy. This allows that the managing Chart2D
may just rescale the newly added tracepoint instead of searching for the correct order of the new
tracepoint by value - comparisons of x and y: The TracePoint2D
passed to the
method traceChanged(Chart2DDataChangeEvent e)
coded in the argument is the
original.
Why caching of scaled values for the coordinates?
This takes more RAM but else for every repaint()
invocation of the
Chart2D
would force all tracepoints of all traces to be rescaled again.
A TracePoint2D will inform it's listener of type ITrace
on changes of the internal
values.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.awt.geom.Point2D |
---|
Point2D.Double, Point2D.Float |
Field Summary | |
---|---|
protected boolean |
m_scaledOnce
Flag for the Chart2D painter that allows it to render only instances he has processed before. |
double |
m_scaledX
Public level for the access of AAxis . |
double |
m_scaledY
Public level for the access of AAxis . |
static int |
STATE_ADDED
The state flag used to inform the listener via
in case a point was added. |
static int |
STATE_CHANGED
The state flag used to inform the listener via
in case a point was
changed. |
static int |
STATE_REMOVED
The state flag used to inform the listener via
in case a point was
removed. |
Fields inherited from class java.awt.geom.Point2D.Double |
---|
x, y |
Constructor Summary | |
---|---|
TracePoint2D(double xValue,
double yValue)
Construct a TracePoint2D whose coords are initalized to (x,y). |
Method Summary | |
---|---|
Object |
clone()
|
int |
compareTo(Object obj)
Compares to TracePoint2D instances by their x value in ascending order. |
boolean |
equals(Object o)
|
int |
hashCode()
|
void |
setListener(ITrace2D listener)
Allows ITrace2D instances to register (or deregister) themselves with this point
to receive (or stop receiving) change information via
ITrace2D.firePointChanged(TracePoint2D, int) events. |
void |
setLocation(double xValue,
double yValue)
This method overloads the method of java.awt.geom.Point2D.Double to fire a
property change event to listeners of the corresponding
instances via their method
(with int argument set to ). |
Methods inherited from class java.awt.geom.Point2D.Double |
---|
getX, getY, toString |
Methods inherited from class java.awt.geom.Point2D |
---|
distance, distance, distance, distanceSq, distanceSq, distanceSq, setLocation |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final transient int STATE_ADDED
ITrace2D
listener via
ITrace2D.firePointChanged(TracePoint2D, int)
in case a point was added.
public static final transient int STATE_REMOVED
ITrace2D
listener via
ITrace2D.firePointChanged(TracePoint2D, int)
in case a point was
removed.
public static final transient int STATE_CHANGED
ITrace2D
listener via
ITrace2D.firePointChanged(TracePoint2D, int)
in case a point was
changed.
Will be used by
and
setLocation(double, double)
.
Point2D.setLocation(Point2D)
protected boolean m_scaledOnce
public double m_scaledX
AAxis
.
public double m_scaledY
AAxis
.
Constructor Detail |
---|
public TracePoint2D(double xValue, double yValue)
xValue
- the x value to use.yValue
- the y value to use.Method Detail |
---|
public Object clone()
clone
in class Point2D
Object.clone()
public int compareTo(Object obj) throws ClassCastException
TracePoint2D
instances by their x value in ascending order.
compareTo
in interface Comparable
obj
- the point to compare to this instance.
ClassCastException
- if the given instance is not of this type.Comparable.compareTo(java.lang.Object)
public boolean equals(Object o)
equals
in class Point2D
Object.equals(java.lang.Object)
public int hashCode()
hashCode
in class Point2D
Object.hashCode()
public void setListener(ITrace2D listener)
ITrace2D
instances to register (or deregister) themselves with this point
to receive (or stop receiving) change information via
ITrace2D.firePointChanged(TracePoint2D, int)
events.
listener
- The instance that will be informed about changes or null to deregister.public void setLocation(double xValue, double yValue)
java.awt.geom.Point2D.Double
to fire a
property change event to listeners of the corresponding ITrace2D
instances via their method ITrace2D.firePointChanged(TracePoint2D, int)
(with int argument set to STATE_CHANGED
).
setLocation
in class Point2D.Double
xValue
- the new x-coordinate for this point.yValue
- the new y-coordinate for this point.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |