|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsimtools.shapes.AbstractShape
simtools.shapes.PlotShape
jsynoptic.builtin.Plot
public class Plot
A Plot shape to display curves using up to 2 pairs of axes X and Y primary and secondary axes are independent
Nested Class Summary | |
---|---|
protected class |
Plot.AxeRange
Class AxeRange. |
class |
Plot.PlotCompoundEdit
|
static class |
Plot.PlotPropertiesNames
|
Nested classes/interfaces inherited from class simtools.shapes.PlotShape |
---|
PlotShape.Curve, PlotShape.Limit |
Nested classes/interfaces inherited from class simtools.shapes.AbstractShape |
---|
AbstractShape.AbstractShapePropertiesNames |
Field Summary | |
---|---|
protected boolean |
autopx
Deprecated. Do not use this attribute anymore, use axesRangeArray[PX].auto instead |
protected boolean |
autopy
Deprecated. Do not use this attribute anymore, use axesRangeArray[PY].auto instead |
protected boolean |
autosx
Deprecated. Do not use this attribute anymore, use axesRangeArray[SX].auto instead |
protected boolean |
autosy
Deprecated. Do not use this attribute anymore, use axesRangeArray[PX].auto instead |
protected static int |
AXE_NUMBER
A constant to know the number of axes. |
protected Plot.AxeRange[] |
axesLimitsArray
The array of AxeRange. |
protected static java.lang.String[] |
AXIS_ID
axes names for property managment |
static boolean |
DEFAULT_DISPLAY_DATA_SOURCE_ID
|
protected static java.awt.Color[] |
defaultPalette
|
protected boolean |
isNotifying
|
protected boolean |
isPrimaryBounded
|
protected boolean |
isSecondaryBounded
|
protected java.lang.String |
link
|
protected int |
nbXGraduation
|
protected int |
nbYGraduation
|
protected int |
paletteIndex
|
static int |
preferredXGraduation
Prefered number of rows if the value is < 2 then the user don't want to fix a prefered number of rows |
static int |
preferredYGraduation
Prefered number of columns if the value is < 0 then the user don't want to fix a prefered number of colmuns |
protected java.util.Vector |
primaryCurves
|
protected long |
primaryEndIndex
|
protected long |
primaryStartIndex
|
protected DataSource |
primaryX
|
protected static int |
PX
Constant indexes to find PX, PY, SX and SY limits values and validity. |
protected java.lang.String |
pxlabel
Deprecated. Do not use this attribute anymore, use axesRangeArray[PX].label instead |
protected double |
pxmax
Deprecated. Do not use these attributes anymore, use axesRangeArray[PX].min, axesRangeArray[PX].max, axesRangeArray[PX].step instead. |
protected double |
pxmin
Deprecated. Do not use these attributes anymore, use axesRangeArray[PX].min, axesRangeArray[PX].max, axesRangeArray[PX].step instead. |
protected double |
pxstep
Deprecated. Do not use these attributes anymore, use axesRangeArray[PX].min, axesRangeArray[PX].max, axesRangeArray[PX].step instead. |
protected boolean |
pxvaluesOK
Deprecated. Do not use these attributes anymore, use axesRangeArray[PX].validity, axesRangeArray[PY].validity, axesRangeArray[SX].validity, axesRangeArray[SY].validity instead. |
protected static int |
PY
Constant indexes to find PX, PY, SX and SY limits values and validity. |
protected java.lang.String |
pylabel
Deprecated. Do not use this attribute anymore, use axesRangeArray[PY].label instead |
protected double |
pymax
Deprecated. Do not use these attributes anymore, use axesRangeArray[PY].min, axesRangeArray[PY].max, axesRangeArray[PY].step instead. |
protected double |
pymin
Deprecated. Do not use these attributes anymore, use axesRangeArray[PY].min, axesRangeArray[PY].max, axesRangeArray[PY].step instead. |
protected double |
pystep
Deprecated. Do not use these attributes anymore, use axesRangeArray[PY].min, axesRangeArray[PY].max, axesRangeArray[PY].step instead. |
protected boolean |
pyvaluesOK
Deprecated. Do not use these attributes anymore, use axesRangeArray[PX].validity, axesRangeArray[PY].validity, axesRangeArray[SX].validity, axesRangeArray[SY].validity instead. |
static MenuResourceBundle |
resources
Resources |
protected java.util.Vector |
secondaryCurves
|
protected long |
secondaryEndIndex
|
protected long |
secondaryStartIndex
|
protected DataSource |
secondaryX
|
protected static int |
SX
Constant indexes to find PX, PY, SX and SY limits values and validity. |
protected java.lang.String |
sxlabel
Deprecated. Do not use this attribute anymore, use axesRangeArray[SX].label instead |
protected double |
sxmax
Deprecated. Do not use these attributes anymore, use axesRangeArray[SX].min, axesRangeArray[SX].max, axesRangeArray[SX].step instead. |
protected double |
sxmin
Deprecated. Do not use these attributes anymore, use axesRangeArray[SX].min, axesRangeArray[SX].max, axesRangeArray[SX].step instead. |
protected double |
sxstep
Deprecated. Do not use these attributes anymore, use axesRangeArray[SX].min, axesRangeArray[SX].max, axesRangeArray[SX].step instead. |
protected boolean |
sxvaluesOK
Deprecated. Do not use these attributes anymore, use axesRangeArray[PX].validity, axesRangeArray[PY].validity, axesRangeArray[SX].validity, axesRangeArray[SY].validity instead. |
protected static int |
SY
Constant indexes to find PX, PY, SX and SY limits values and validity. |
protected java.lang.String |
sylabel
Deprecated. Do not use this attribute anymore, use axesRangeArray[SY].label instead |
protected double |
symax
Deprecated. Do not use these attributes anymore, use axesRangeArray[SY].min, axesRangeArray[SY].max, axesRangeArray[SY].step instead. |
protected double |
symin
Deprecated. Do not use these attributes anymore, use axesRangeArray[SY].min, axesRangeArray[SY].max, axesRangeArray[SY].step instead. |
protected double |
systep
Deprecated. Do not use these attributes anymore, use axesRangeArray[SY].min, axesRangeArray[SY].max, axesRangeArray[SY].step instead. |
protected boolean |
syvaluesOK
Deprecated. Do not use these attributes anymore, use axesRangeArray[PX].validity, axesRangeArray[PY].validity, axesRangeArray[SX].validity, axesRangeArray[SY].validity instead. |
protected DiagramComponent.ContextualDrawing |
translateDrawing
|
protected DiagramComponent.ContextualDrawing |
zoomDrawing
|
Fields inherited from class simtools.shapes.PlotShape |
---|
_asx1, _asx2, _asy1, _asy2, _color, _curves, _font, _limits, _magnetizedCurve, curveInformationFont, curveInformationLabel, dirty, displayCurveInformation, hasLegend, image, imageGraphics, legendBounds, logpx, logpy, logsx, logsy, optimize, optimizeMode, pyformat, syformat, title, titleFont |
Fields inherited from class simtools.shapes.AbstractShape |
---|
_h, _ox, _oy, _propertyNames, _w, _x, _y, ANTI_ALIASING, currentDialogBox, FONT_NAMES, listeners, REFRESH_PERIOD |
Fields inherited from interface jsynoptic.base.ContextualActionProvider |
---|
EDITOR_CONTEXT, MOUSE_OUT_CONTEXT, MOUSE_OVER_CONTEXT, MOUSE_PRESSED_CONTEXT, SHAPELIST_CONTEXT, SOURCELIST_CONTEXT |
Constructor Summary | |
---|---|
Plot(int ox,
int oy,
int width,
int height)
|
Method Summary | |
---|---|
boolean |
addDataSource(DataSource d)
|
boolean |
addPrimaryY(DataSource ds,
boolean background)
|
boolean |
addPrimaryYForSecondaryX(DataSource ds,
boolean background)
|
boolean |
addSecondaryY(DataSource ds,
boolean background)
|
boolean |
addSecondaryYForSecondaryX(DataSource ds,
boolean background)
|
protected boolean |
addY(DataSource ds,
boolean primary,
boolean usePrimaryX,
boolean background)
|
boolean |
canAddDataSource(DataSource d)
|
boolean |
canDoAction(double x,
double y,
java.lang.Object o,
java.lang.String action,
int context)
Returns true if, and only if, it is possible to do the action right now |
protected AbstractShape |
cloneShape()
Performs a copy of the shape This method has to be overriden to deal with concrete shapes |
protected void |
computeHorizontalAxeRange(Plot.AxeRange axeRange,
AxisShape axe,
boolean log,
double x1,
double x2)
Computes a zoom for an horizontal axis (PX or SX). |
static double |
computeStep(double min,
double max,
int averageNbGrad)
Computes the "best" step to go from min to max Average number of graduations is set to 10 Algo from simgo/util/geom/WaveAxis.java |
protected void |
computeTranslationAxeRange(Plot.AxeRange axeRange,
AxisShape axe,
boolean log,
double x)
Computes a translation for an axis (PX or SX). |
protected void |
computeVerticalAxeRange(Plot.AxeRange axeRange,
AxisShape axe,
boolean log,
double y1,
double y2)
Computes a zoom for an vertical axis (PY or SY). |
protected void |
computeVerticalBoundAndStep(Plot.AxeRange yAxeRange,
java.util.Vector curves)
Auto-scale a vertical axe regarding values on |
protected void |
computeZoomWheelHorizontalAxeRange(Plot.AxeRange axeRange,
AxisShape axe,
boolean log,
double x,
boolean zoomIn,
double zoomWheelFactor)
|
protected void |
computeZoomWheelVerticalAxeRange(Plot.AxeRange axeRange,
AxisShape axe,
boolean log,
double y,
boolean zoomIn,
double zoomWheelFactor)
|
JPropertiesPanel |
createPanel()
|
void |
displayCursorLocation(double x,
double y)
|
boolean |
doAction(double x,
double y,
java.lang.Object o,
java.lang.String action,
javax.swing.undo.CompoundEdit undoableEdit)
Do one of the actions previously declared by getAction. |
protected LimitShape |
doAddLimitAction(boolean isVertical,
boolean useSecondary,
double position,
java.lang.String name)
|
protected CurveShape |
doAddYAction(java.lang.Object[] obar)
|
boolean |
doCollectiveAction(DiagramSelection sel,
double x,
double y,
java.lang.Object o,
java.lang.String action,
javax.swing.undo.CompoundEdit undoableEdit)
Do one of the collective actions previously declared by getCollectiveActions. |
java.lang.String[] |
getActions(double x,
double y,
java.lang.Object o,
int context)
Return list of possible actions the contect information may be used, or not. |
java.util.HashMap |
getAxesProperties(java.util.HashMap map,
int axeNumber)
|
java.lang.Double |
getAxeValue(int axeIndex,
int x)
Computes an axis coordinate from a mouse position in plot shape |
java.util.LinkedHashMap |
getCollectiveActions(DiagramSelection sel,
double x,
double y,
java.lang.Object o,
int context)
Return list of possible collective actions |
DiagramComponent.ContextualDrawing |
getContextualDrawing(DiagramSelection s)
|
protected java.util.Vector |
getCurveParameters(java.util.Vector curves)
|
java.util.HashMap |
getCurvesProperties(java.util.HashMap map)
|
protected java.util.Vector |
getLimitParameters(java.util.ArrayList al)
|
java.lang.String |
getLink()
|
DataSource |
getPrimaryX()
|
java.lang.String[] |
getPropertyNames()
Get the list of property names |
java.lang.Object |
getPropertyValue(java.lang.String name)
Get the value of the property named name |
DataSource |
getSecondaryX()
|
void |
notificationEnd(java.lang.Object referer)
This callback is called after all notifications were processed. |
protected void |
notifyChange()
Notify listeners that this shape has changed. |
void |
refresh()
Reload all shape properties. |
void |
removeCurve(CurveShape curveShape)
|
void |
repaintDiagram(java.awt.Rectangle oldBounds)
|
void |
setCurveParameters(java.util.Vector l)
|
void |
setLimitParamters(java.util.Vector l)
|
void |
setLink(java.lang.String link)
|
boolean |
setPrimaryX(DataSource ds,
boolean background)
|
void |
setPropertyValue(java.lang.String name,
java.lang.Object value)
Assigns value to the property named name |
boolean |
setSecondaryX(DataSource ds,
boolean background)
|
void |
setX(DataSource ds,
boolean primary)
|
protected boolean |
setX(DataSource ds,
boolean primary,
boolean background)
|
void |
shapeDataChanged(CurveShape csc,
DataSource oldData,
DataSource newData,
boolean onX)
This function is called when one of the data displayed by the curve is replaced |
void |
translate(double x1,
double x2,
double y1,
double y2)
Changes the axes defintion according to a translation defined with 2 points |
void |
zoom(double x1,
double x2,
double y1,
double y2,
boolean xOnly)
Changes the axes defintion according to a zoom defined with 2 coordinates |
void |
zoomWheel(double x,
double y,
double zoomWheelFactor,
boolean zoomIn)
Make a zoom box around (x,y) position. |
Methods inherited from class simtools.shapes.AbstractShape |
---|
addListener, contains, contains, contains, contains, getAnchor, getBounds, getBounds2D, getInnerProperties, getMax, getMaxTranslated, getMin, getPathIterator, getPathIterator, intersects, intersects, notifyChange, removeListener, setProperties, wipeOff |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static int preferredXGraduation
public static int preferredYGraduation
public static boolean DEFAULT_DISPLAY_DATA_SOURCE_ID
protected java.lang.String link
protected transient DiagramComponent.ContextualDrawing zoomDrawing
protected transient DiagramComponent.ContextualDrawing translateDrawing
public static MenuResourceBundle resources
protected static java.awt.Color[] defaultPalette
protected int paletteIndex
protected transient DataSource primaryX
protected transient DataSource secondaryX
protected java.util.Vector primaryCurves
protected java.util.Vector secondaryCurves
protected boolean isPrimaryBounded
protected long primaryStartIndex
protected long primaryEndIndex
protected boolean isSecondaryBounded
protected long secondaryStartIndex
protected long secondaryEndIndex
protected transient int nbXGraduation
protected transient int nbYGraduation
protected double pxmin
protected double pxmax
protected double pxstep
protected java.lang.String pxlabel
protected boolean autopx
protected double pymin
protected double pymax
protected double pystep
protected java.lang.String pylabel
protected boolean autopy
protected double sxmin
protected double sxmax
protected double sxstep
protected java.lang.String sxlabel
protected boolean autosx
protected double symin
protected double symax
protected double systep
protected java.lang.String sylabel
protected boolean autosy
protected boolean pxvaluesOK
protected boolean pyvaluesOK
protected boolean sxvaluesOK
protected boolean syvaluesOK
protected static final int PX
protected static final int PY
protected static final int SX
protected static final int SY
protected static final int AXE_NUMBER
protected static final java.lang.String[] AXIS_ID
protected Plot.AxeRange[] axesLimitsArray
protected transient boolean isNotifying
Constructor Detail |
---|
public Plot(int ox, int oy, int width, int height)
Method Detail |
---|
public java.lang.String getLink()
getLink
in interface Linkable
public void setLink(java.lang.String link)
setLink
in interface Linkable
protected AbstractShape cloneShape()
AbstractShape
cloneShape
in class PlotShape
public boolean setPrimaryX(DataSource ds, boolean background)
public DataSource getPrimaryX()
public boolean addPrimaryY(DataSource ds, boolean background)
public boolean setSecondaryX(DataSource ds, boolean background)
public DataSource getSecondaryX()
public boolean addSecondaryY(DataSource ds, boolean background)
public boolean addSecondaryYForSecondaryX(DataSource ds, boolean background)
public boolean addPrimaryYForSecondaryX(DataSource ds, boolean background)
public void setX(DataSource ds, boolean primary)
protected boolean setX(DataSource ds, boolean primary, boolean background)
protected LimitShape doAddLimitAction(boolean isVertical, boolean useSecondary, double position, java.lang.String name)
protected CurveShape doAddYAction(java.lang.Object[] obar)
protected boolean addY(DataSource ds, boolean primary, boolean usePrimaryX, boolean background)
public static double computeStep(double min, double max, int averageNbGrad)
public void repaintDiagram(java.awt.Rectangle oldBounds)
public void removeCurve(CurveShape curveShape)
removeCurve
in class PlotShape
protected void computeVerticalBoundAndStep(Plot.AxeRange yAxeRange, java.util.Vector curves)
axeRange
- - The range related to the axe to be scaled.curves
- - Curves that belong to that axepublic java.util.LinkedHashMap getCollectiveActions(DiagramSelection sel, double x, double y, java.lang.Object o, int context)
SelectionContextualActionProvider
getCollectiveActions
in interface SelectionContextualActionProvider
sel
- the current selectionx
- Coordinate, mouse position in the same unit as contains(x,y)y
- Coordinate, mouse position in the same unit as contains(x,y)o
- Object the collective actions should work on. Possibly null => default or all actionscontext
- one of the context defined in the ContextualActionProvider class
public java.lang.String[] getActions(double x, double y, java.lang.Object o, int context)
ContextualActionProvider
getActions
in interface ContextualActionProvider
x
- Coordinate, mouse position in the same unit as contains(x,y)y
- Coordinate, mouse position in the same unit as contains(x,y)o
- Object the actions should work on. Possibly null => default or all actionscontext
- one of the context defined in the ContextualActionProvider class
public boolean canDoAction(double x, double y, java.lang.Object o, java.lang.String action, int context)
ContextualActionProvider
canDoAction
in interface ContextualActionProvider
x
- Coordinate, for example mouse positiony
- Coordinate, for example mouse positiono
- Object the action should work on.action
- An action returned by a previous getActions call with the same x, y, o parameters
It may be null, in which case the default action is requested for this x,y,o.context
- one of the context defined in the ContextualActionProvider class
public void displayCursorLocation(double x, double y)
public boolean doCollectiveAction(DiagramSelection sel, double x, double y, java.lang.Object o, java.lang.String action, javax.swing.undo.CompoundEdit undoableEdit)
SelectionContextualActionProvider
doCollectiveAction
in interface SelectionContextualActionProvider
sel
- sel the current selectionx
- Coordinate, for example mouse positiony
- Coordinate, for example mouse positiono
- Object the action should work on.action
- action An action returned by a previous getCollectiveActions call with the same x, y, o parametersundoableEdit
- undoableEdit The current compound edit for undo/redo operation.
If the action is undoable, the required edits shall be added to this current compound edit.
public boolean doAction(double x, double y, java.lang.Object o, java.lang.String action, javax.swing.undo.CompoundEdit undoableEdit)
ContextualActionProvider
doAction
in interface ContextualActionProvider
x
- Coordinate, for example mouse positiony
- Coordinate, for example mouse positiono
- Object the action should work on.action
- An action returned by a previous getActions call with the same x, y, o parameters
It may be null, in which case the default action is requested for this x,y,o.undoableEdit
- current edit for undo/redo operation
If not null, this action is undoable.
public void zoom(double x1, double x2, double y1, double y2, boolean xOnly)
x1
- The first zoom area x coordinate.x2
- The second zoom area x coordinate.y1
- The first zoom area y coordinate.y2
- The second zoom area y coordinate.xOnly
- True zoom only the X axispublic void zoomWheel(double x, double y, double zoomWheelFactor, boolean zoomIn)
x
- y
- zoomWheelFactor
- zoomIn,
- if true zoom in , otherwise zoom outpublic void translate(double x1, double x2, double y1, double y2)
x1
- The first translation point x coordinate.x2
- The second translation point x coordinate.y1
- The first translation point y coordinate.y2
- The second translation point y coordinate.protected void computeVerticalAxeRange(Plot.AxeRange axeRange, AxisShape axe, boolean log, double y1, double y2)
axeRange
- The AxeRange axeRange to compute.axe
- The AxisShape that use this AxeRange.log
- True if the axe is under log format, false otherwise.y1
- The first zoom area y coordinate.y2
- The second zoom area y coordinate.protected void computeHorizontalAxeRange(Plot.AxeRange axeRange, AxisShape axe, boolean log, double x1, double x2)
axeRange
- The AxeRange axeRange to compute.axe
- The AxisShape that use this AxeRange.log
- True if the axe is under log format, false otherwise.x1
- The first zoom area x coordinate.x2
- The second zoom area x coordinate.public java.lang.Double getAxeValue(int axeIndex, int x)
axe
- The AxisShapex1
- A mouse position in plot hsape.
protected void computeTranslationAxeRange(Plot.AxeRange axeRange, AxisShape axe, boolean log, double x)
axeRange
- The AxeRange axeRange to compute.axe
- The AxisShape that use this AxeRange.log
- True if the axe is under log format, false otherwise.x1
- The translation valueprotected void computeZoomWheelHorizontalAxeRange(Plot.AxeRange axeRange, AxisShape axe, boolean log, double x, boolean zoomIn, double zoomWheelFactor)
protected void computeZoomWheelVerticalAxeRange(Plot.AxeRange axeRange, AxisShape axe, boolean log, double y, boolean zoomIn, double zoomWheelFactor)
public boolean addDataSource(DataSource d)
addDataSource
in interface DataSourceConsumer
d
- the data source to be added
public boolean canAddDataSource(DataSource d)
canAddDataSource
in interface DataSourceConsumer
d
- the data source to be added
public void notificationEnd(java.lang.Object referer)
EndNotificationListener
notificationEnd
in interface EndNotificationListener
notificationEnd
in class PlotShape
protected void notifyChange()
AbstractShape
notifyChange
in class AbstractShape
public void shapeDataChanged(CurveShape csc, DataSource oldData, DataSource newData, boolean onX)
CurveShapeListener
shapeDataChanged
in interface CurveShapeListener
shapeDataChanged
in class PlotShape
csc
- the curveoldData
- the old datanewData
- the new datapublic JPropertiesPanel createPanel()
public java.lang.String[] getPropertyNames()
NamedProperties
getPropertyNames
in interface NamedProperties
getPropertyNames
in class AbstractShape
public java.util.HashMap getAxesProperties(java.util.HashMap map, int axeNumber)
public java.util.HashMap getCurvesProperties(java.util.HashMap map)
public void setPropertyValue(java.lang.String name, java.lang.Object value)
AbstractShape
value
to the property named name
setPropertyValue
in interface NamedProperties
setPropertyValue
in class AbstractShape
name
- the name of the property to getvalue
- its new valueAbstractShape.setPropertyValue(String, Object)
public java.lang.Object getPropertyValue(java.lang.String name)
AbstractShape
name
getPropertyValue
in interface NamedProperties
getPropertyValue
in class AbstractShape
name
- the name of the property to get
AbstractShape.getPropertyValue(String)
protected java.util.Vector getCurveParameters(java.util.Vector curves)
protected java.util.Vector getLimitParameters(java.util.ArrayList al)
public void setCurveParameters(java.util.Vector l)
public void setLimitParamters(java.util.Vector l)
public DiagramComponent.ContextualDrawing getContextualDrawing(DiagramSelection s)
getContextualDrawing
in interface DiagramComponent.ContextualDrawingProvider
public void refresh()
AbstractShape
refresh
in class AbstractShape
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |