Package hec.gfx2d
Class G2dLine
java.lang.Object
java.util.Observable
hec.lang.NamedType
hec.gfx2d.G2dLine
- All Implemented Interfaces:
AsciiSerializable,FieldAccessor,ActionListener,Serializable,Cloneable,Comparable,EventListener,Observer,Modifiable
- Direct Known Subclasses:
G2dLogarithmicLine,G2dTimeSeriesLine,G2dVerifyLine
Description of the Class
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected RmaJMenuLabelprotected JPopupMenuprotected G2dLinePropertiesFields inherited from class hec.lang.NamedType
_description, _ignoreModifiedEvents, _index, _isValid, _modified, _name, defaultDescription, defaultName, DESCRIPTION_CHANGED, NAME_CHANGED, RENAME_EVENT -
Constructor Summary
ConstructorsConstructorDescriptionG2dLine()Constructor for the G2dLine objectG2dLine(G2dLineProperties prop) Constructor for the G2dLine objectG2dLine(G2dLineProperties prop, double[] xarray, double[] yarray, int size) The constructor creates a new G2dLine for the given properties and data -
Method Summary
Modifier and TypeMethodDescriptionvoidThis method listens for action events.voidAdds a feature to the Callout attribute of the G2dLine objectvoidaddLineData(double[] xarray, double[] yarray, int numPts) Adds a adds line data to the last line segment in the listvoidaddLineSegment(double[] xarray, double[] yarray, int numPts) booleanget whether the line auto skips drawing it's symbolsbooleanDeprecated.booleanreturn whether the Symbols are visibleprotected DefaultJPanel[]voidClears the table of callouts, effectivly erasing them.voidDescription of the Methodclone()Description of the MethodbooleanDescription of the Methodvoidprotected voidCreates the default popup menu for this linevoiddrawCallouts(Graphics g, Rectangle clipRect) Draws the callouts on the particular line if the _drawCallouts variable is truevoidThis method draws a line to the specified graphics context.Method that allows the editing of line properties.An overloaded editLineProperties that allows the passing in of the Window.voidfinalize()Description of the MethodbooleanDeprecated.getFieldObject(Field fld) Gets the FieldObject attribute of the G2dLine objectget the fill Color for this lineget the fill color for this line as a Stringintget the fill pattern for this G2dLineget the fill pattern for this G2dLine as a Stringintget the Fill type for this lineget the Fill type for this line as a Stringintget the offset for the first symbol of this linegetLabel()intintget the line Color for this lineget the line color for this line as a Stringdouble[][]getLineSegmentAt(int index) intreturn the line step stylereturn the line step style as a Stringfloat[]get the line style for this lineget the line style for this line as a StringfloatGets the LineWidth attribute of the G2dLine objectGets the NearestDataPt attribute of the G2dLine objectgetNearestDataPt(LocalPt pt, boolean interpolate) Returns the point in local coordinates of the closest data point to the given pt if interpolate is true then the point is returned that is on a line segment that joins two data points on the G2dLine.doublegetNearestDataPt(LocalPt lpt, WorldPt ptnbest) Returns the nearest data point in world coordinates to a given local point.getNearestDataPt(WorldPt pt, boolean interpolate) Gets the NearestDataPt attribute of the G2dLine objectdoublegetNearestLocation(LocalPt lpt, WorldPt ptnbest) Computes the nearest point on the line to the given point, the nearest point is returned in "ptnbest".intReturns the number of line segments added to this line since the last time the clearLineData() method has been called.intGets the NumPoints attribute of the G2dLine objectprotected ListGets the line propertiesgetScale()doubleget the Symbol Fill Colorget the Symbol Fill Color as a Stringintget the symbol skip count for this G2dLineget the Symbol Line Colorget the Symbol Line Color as a StringintDeprecated.floatget the symbol size for this G2dLineintget the symbol skip count for this G2dLineintDeprecated.intget the symbol type for this G2dLineget the symbol type string for this G2dLinebooleanbooleanbooleanDeprecated.booleanbooleanreturn whether this line draws or notbooleanprotected voidscale(double[] worldXData, double[] worldYData, double[] scaledXData, double[] scaledYData, int startPt, int numPoints) protected voidscale(double[] worldXData, double[] worldYData, int[] scaledXData, int[] scaledYData, int startPt, int numPoints) Description of the MethodvoidDeprecated.voidDeprecated.voidsetCalloutsVisible(boolean b) Sets the callouts visible or not visible depending on the value of bvoidsetClipLineToBounds(boolean b) voidDeprecated.voidDeprecated.voidDeprecated.voidDeprecated.booleansetFieldObject(Field fld, Object fobj) Sets the FieldObject attribute of the G2dLine objectvoidvoidsetFillColor(String fillColor) set the fill color for this line.voidsetFillPattern(String fillPattern) set the fill pattern for this linevoidsetFillType(String fillStyle) set the Fill type for this line.voidsetFirstSymbolOffset(int offset) set the offset for the first symbol for this G2dLinevoidSets the Glyph attribute of the G2dLine objectvoidvoidsetLabelAlignment(int align) voidsetLabelAlignment(String align) voidvoidvoidsetLabelFont(Font f) voidsetLabelFont(String fontString) voidsetLabelPosition(int position) voidsetLabelPosition(String pos) voidsetLabelVisible(boolean b) voidvoidsetLineColor(String lineColor) set the line color for this G2dLinevoidsetLineData(double[] xarray, double[] yarray, int numPts) This sets the data that the line uses to draw to the screen.voidsetLineLabel(String label) voidsetLineLabelVisible(boolean b) voidsetLineStepStyle(String stepStyle) set the line step style for this line.voidsetLineStyle(String lineStyle) set the line style for this G2dLinevoidsetLineVisible(boolean state) set the visibility of this linevoidsetLineWidth(float width) set the width for this G2dLinevoidsetPeriodStepStyle(String stepStyle) voidSets the properties that this line uses to drawvoidSets the Scale attribute of the G2dLine objectvoidsetSelectedPoints(double[] xarray, double[] yarray, int numPts) This sets the points that will be selected and drawn with the "selected" properties in the G2dLineProperties.voidsetStepInterval(double interval) voidsetSymbolFillColor(String symbolFillColor) set the symbol fill color for this line's symbolsvoidsetSymbolInterval(int interval) set the symbol interval for this G2dLinevoidsetSymbolLineColor(String symbolLineColor) set the symbol line color for this line's symbolsvoidsetSymbolOffset(int offset) Deprecated.voidsetSymbolsAutoInterval(boolean state) set the line symbols auto skip statevoidsetSymbolSize(float size) set the symbol size for this G2dLinevoidsetSymbolSkipCount(int skipCount) set the symbol skip count for this G2dLinevoidsetSymbolsSkipInterval(int skipInterval) Deprecated.voidsetSymbolsVisible(boolean state) set whether symbols are visiblevoidsetSymbolType(int type) set the symbol type for this G2dLinevoidsetSymbolType(String name) set the symbol type for this G2dLinevoidsetVisible(boolean visible) voidDescription of the Methodprotected com.vividsolutions.jts.geom.GeometryReturns a geometry in local coordinates that represents this list.toString()Description of the Methodprotected com.vividsolutions.jts.geom.GeometryMethods inherited from class hec.lang.NamedType
addModifiableListener, compareTo, fireModifiedStateChanged, getDescription, getDisplayName, getIgnoreModifiedEvents, getIndex, getName, isModified, isValid, readResolve, removeModifiableListener, rename, set, setDescription, setIgnoreModifiedEvents, setIndex, setModified, setName, setValid, update, useRecursiveModifiedTestMethods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
-
Field Details
-
_properties
-
_popupMenu
-
_nameMenuItem
-
_clipToBounds
protected boolean _clipToBounds
-
-
Constructor Details
-
G2dLine
public G2dLine()Constructor for the G2dLine object -
G2dLine
Constructor for the G2dLine object- Parameters:
prop- Description of Parameter
-
G2dLine
The constructor creates a new G2dLine for the given properties and data- Parameters:
prop- - the specific line propertiesxarray- - the set of x data points in World Coordinatesyarray- - the set of y data points in World Coordinatessize- - the number of points on the line
-
-
Method Details
-
setStepInterval
public void setStepInterval(double interval) -
getStepInterval
public double getStepInterval() -
setLineData
public void setLineData(double[] xarray, double[] yarray, int numPts) This sets the data that the line uses to draw to the screen. This deletes any previous line data- Parameters:
xarray- - the set of x data points in World Coordinatesyarray- - the set of y data points in World CoordinatesnumPts- The new LineData value
-
setSelectedPoints
public void setSelectedPoints(double[] xarray, double[] yarray, int numPts) This sets the points that will be selected and drawn with the "selected" properties in the G2dLineProperties.- Parameters:
xarray- - the set of x data points in World Coordinatesyarray- - the set of y data points in World CoordinatesnumPts- - the number of value from the arrays to copy, we copy starting at index 0
-
copyCurveProperties
-
setProperties
Sets the properties that this line uses to draw- Parameters:
prop- The new Properties value
-
setScale
Sets the Scale attribute of the G2dLine object- Parameters:
s- The new Scale value
-
getScale
-
setGlyph
Sets the Glyph attribute of the G2dLine object- Parameters:
g- The new Glyph value
-
setFieldObject
Sets the FieldObject attribute of the G2dLine object- Specified by:
setFieldObjectin interfaceFieldAccessor- Overrides:
setFieldObjectin classNamedType- Parameters:
fld- The new FieldObject valuefobj- The new FieldObject value- Returns:
- Description of the Returned Value
-
getProperties
Gets the line properties- Returns:
- The Properties value
-
getNumPoints
public int getNumPoints()Gets the NumPoints attribute of the G2dLine object- Returns:
- The NumPoints value
-
getLineWidth
public float getLineWidth()Gets the LineWidth attribute of the G2dLine object- Returns:
- The LineWidth value
-
getNearestDataPt
Gets the NearestDataPt attribute of the G2dLine object- Parameters:
pt- Description of Parameterinterpolate- Description of Parameter- Returns:
- The NearestDataPt value
-
getNearestDataPt
Gets the NearestDataPt attribute of the G2dLine object- Parameters:
pt- Description of Parameter- Returns:
- The NearestDataPt value
-
toLocalGeometry
protected com.vividsolutions.jts.geom.Geometry toLocalGeometry()Returns a geometry in local coordinates that represents this list.- Returns:
-
toWorldGeometry
protected com.vividsolutions.jts.geom.Geometry toWorldGeometry() -
getNearestDataPt
Returns the point in local coordinates of the closest data point to the given pt if interpolate is true then the point is returned that is on a line segment that joins two data points on the G2dLine.- Parameters:
pt- Description of Parameterinterpolate- Description of Parameter- Returns:
- The NearestDataPt value
-
getNearestDataPt
Returns the nearest data point in world coordinates to a given local point. All test are done in local coordinates because local coordinates are in pixels and scaling does not matter. Returns RMAConst.UNDEF_DOUBLE if nothing was found.- Parameters:
lpt- The local point to test on.ptnbest- This value is filled with the best world point- Returns:
- The distance between the input local pt in world coordinates and the best world coordinate.
-
getNearestLocation
Computes the nearest point on the line to the given point, the nearest point is returned in "ptnbest".- Parameters:
lpt-ptnbest-- Returns:
- the distance from lpt to ptnbest
-
getFieldObject
Gets the FieldObject attribute of the G2dLine object- Specified by:
getFieldObjectin interfaceFieldAccessor- Overrides:
getFieldObjectin classNamedType- Parameters:
fld- Description of Parameter- Returns:
- The FieldObject value
-
clearLineData
public void clearLineData()Description of the Method -
addCallout
Adds a feature to the Callout attribute of the G2dLine object- Parameters:
p- The feature to be added to the Callout attribute
-
setClipLineToBounds
public void setClipLineToBounds(boolean b) -
setVisible
public void setVisible(boolean visible) -
isVisible
public boolean isVisible() -
drawLine
This method draws a line to the specified graphics context. The line is clipped so it fits within the clipping rectangle- Parameters:
g- - the graphics context to clip toclipRect- - the rectangle that bounds the viewable region. This describes how the line is clipped. The clipping units are in world coordinates
-
isCalloutsVisible
public boolean isCalloutsVisible() -
setCalloutsVisible
public void setCalloutsVisible(boolean b) Sets the callouts visible or not visible depending on the value of b- Parameters:
b- true for visible, false otherwise
-
clearCallouts
public void clearCallouts()Clears the table of callouts, effectivly erasing them. -
getLabelColor
-
getLabelColorString
-
setLabelColor
-
setLabelColor
-
drawCallouts
Draws the callouts on the particular line if the _drawCallouts variable is true- Parameters:
g- the graphics context to draw to.clipRect- a rectangle that defines the viewable regions. Callouts will not be drawn outside the clipping rectangle.
-
addLineData
public void addLineData(double[] xarray, double[] yarray, int numPts) Adds a adds line data to the last line segment in the list- Parameters:
xarray- The feature to be added to the LineData attributeyarray- The feature to be added to the LineData attributenumPts- The feature to be added to the LineData attribute
-
addLineSegment
public void addLineSegment(double[] xarray, double[] yarray, int numPts) -
getNumLineSegments
public int getNumLineSegments()Returns the number of line segments added to this line since the last time the clearLineData() method has been called.- Returns:
- int
-
getLineSegmentAt
public double[][] getLineSegmentAt(int index) -
clone
Description of the Method- Overrides:
clonein classNamedType- Returns:
- Description of the Returned Value
- Throws:
CloneNotSupportedException- Description of Exception
-
finalize
Description of the Method -
actionPerformed
This method listens for action events. If an action event is generated by a component of this line it is routed to the appropriate handler- Specified by:
actionPerformedin interfaceActionListener- Parameters:
e- Description of Parameter
-
buildPropertiesPanel
-
editLineProperties
Method that allows the editing of line properties. This method displays a visible dialog for line editing. -
editLineProperties
An overloaded editLineProperties that allows the passing in of the Window.- Parameters:
w-- See Also:
-
getOKListeners
-
showPopup
Description of the Method- Parameters:
c- Description of Parameterx- Description of Parametery- Description of Parameter
-
contains
Description of the Method- Parameters:
pt- Description of Parameter- Returns:
- Description of the Returned Value
-
toString
Description of the Method -
createPopupMenu
protected void createPopupMenu()Creates the default popup menu for this line -
scale
protected void scale(double[] worldXData, double[] worldYData, int[] scaledXData, int[] scaledYData, int startPt, int numPoints) Description of the Method- Parameters:
worldXData- Description of ParameterworldYData- Description of ParameterscaledXData- Description of ParameterscaledYData- Description of ParameterstartPt-numPoints- Description of Parameter
-
scale
protected void scale(double[] worldXData, double[] worldYData, double[] scaledXData, double[] scaledYData, int startPt, int numPoints) -
getLabelAlignment
public int getLabelAlignment() -
getLabelAlignmentString
-
setLabelAlignment
public void setLabelAlignment(int align) -
setLabelAlignment
-
getLabelPosition
public int getLabelPosition() -
getLabelPositionString
-
setLabelPosition
public void setLabelPosition(int position) -
setLabelPosition
-
getLabelFont
-
getLabelFontString
-
setLabelFont
-
setLabelFont
-
setLabelVisible
public void setLabelVisible(boolean b) -
setLineLabelVisible
public void setLineLabelVisible(boolean b) -
isLabelVisible
public boolean isLabelVisible() -
isLineLabelVisible
public boolean isLineLabelVisible() -
getLabel
-
setLabel
-
getLineLabel
-
setLineLabel
-
setFillType
set the Fill type for this line.- Parameters:
fillStyle- one of the following Strings "None", "Above", "Below" or null for "None"- See Also:
-
getFillTypeString
get the Fill type for this line as a String- Returns:
- the fill type String
-
getFillType
public int getFillType()get the Fill type for this line- Returns:
- the fill type
-
setFillPattern
set the fill pattern for this line- Parameters:
fillPattern- the fill pattern- See Also:
-
getFillPatternString
get the fill pattern for this G2dLine as a String- Returns:
- the fill pattern String
-
getFillPattern
public int getFillPattern()get the fill pattern for this G2dLine- Returns:
- the fill pattern
-
setFillColor
set the fill color for this line.- Parameters:
fillColor- the fill color- See Also:
-
setFillColor
-
getFillColorString
get the fill color for this line as a String- Returns:
- the fill color String
-
getFillColor
get the fill Color for this line- Returns:
- the fill Color
-
setLineColor
set the line color for this G2dLine- Parameters:
lineColor- the line color- See Also:
-
setLineColor
-
getLineColorString
get the line color for this line as a String- Returns:
- the line color String
-
getLineColor
get the line Color for this line- Returns:
- the line Color
-
setLineStyle
set the line style for this G2dLine- Parameters:
lineStyle- the line style- See Also:
-
getLineStyleString
get the line style for this line as a String- Returns:
- the line style String
-
getLineStyle
public float[] getLineStyle()get the line style for this line- Returns:
- the line style
-
setLineVisible
public void setLineVisible(boolean state) set the visibility of this line- See Also:
-
setDrawLineOn
Deprecated.set this line to draw -
setDrawLineOff
Deprecated.set this line not to draw -
isLineVisible
public boolean isLineVisible()return whether this line draws or not- Returns:
- whether this line draws
-
isLineDrawn
Deprecated.return whether this line draws or not -
setSymbolFillColor
set the symbol fill color for this line's symbols- Parameters:
symbolFillColor- the symbol fill color- See Also:
-
getSymbolFillColorString
get the Symbol Fill Color as a String- Returns:
- the Symbol fill color String
-
getSymbolFillColor
get the Symbol Fill Color- Returns:
- the Symbol fill Color
-
setSymbolLineColor
set the symbol line color for this line's symbols- Parameters:
symbolLineColor- the symbol line color- See Also:
-
getSymbolLineColorString
get the Symbol Line Color as a String- Returns:
- the Symbol Line Color String
-
getSymbolLineColor
get the Symbol Line Color- Returns:
- the Symbol Line Color
-
setSymbolsVisible
public void setSymbolsVisible(boolean state) set whether symbols are visible- See Also:
-
setDrawSymbolsOn
Deprecated.set this line to draw it's symbols -
setDrawSymbolsOff
Deprecated.set this line not to draw it's symbols -
areSymbolsVisible
public boolean areSymbolsVisible()return whether the Symbols are visible- Returns:
- whether the symbols are visible
-
areSymbolsDrawn
Deprecated.return whether the Symbols are drawn for this line -
setLineStepStyle
set the line step style for this line.- Parameters:
stepStyle- the step style - "normal", "step" or "cubic"- See Also:
-
setPeriodStepStyle
-
getLineStepStyle
public int getLineStepStyle()return the line step style- Returns:
- the line step style
-
getLineStepStyleString
return the line step style as a String- Returns:
- the line step style as a String
-
setLineWidth
public void setLineWidth(float width) set the width for this G2dLine- Parameters:
width- the new line width- See Also:
-
setFirstSymbolOffset
public void setFirstSymbolOffset(int offset) set the offset for the first symbol for this G2dLine- Parameters:
offset- the symbol offset- See Also:
-
setSymbolOffset
Deprecated.set the symbol offset for this G2dLine -
getFirstSymbolOffset
public int getFirstSymbolOffset()get the offset for the first symbol of this line- Returns:
- the symbol offset
-
getSymbolOffset
Deprecated.get the symbol offset of this line -
setSymbolSkipCount
public void setSymbolSkipCount(int skipCount) set the symbol skip count for this G2dLine- Parameters:
skipCount-- See Also:
-
setSymbolInterval
public void setSymbolInterval(int interval) set the symbol interval for this G2dLine- Parameters:
interval-- See Also:
-
setSymbolsSkipInterval
Deprecated.set the symbol skip interval for this G2dLine -
getSymbolSkipCount
public int getSymbolSkipCount()get the symbol skip count for this G2dLine- Returns:
- the symbol skip interval
-
getSymbolInterval
public int getSymbolInterval()get the symbol skip count for this G2dLine- Returns:
- the symbol skip interval
-
getSymbolSkipInterval
Deprecated.get the symbol skip interval for this G2dLine -
setSymbolSize
public void setSymbolSize(float size) set the symbol size for this G2dLine- Parameters:
size- the symbol size- See Also:
-
getSymbolSize
public float getSymbolSize()get the symbol size for this G2dLine- Returns:
- the symbol size
-
setSymbolType
public void setSymbolType(int type) set the symbol type for this G2dLine- Parameters:
type- the symbol type
-
setSymbolType
set the symbol type for this G2dLine- Parameters:
name- the symbol type
-
getSymbolType
public int getSymbolType()get the symbol type for this G2dLine- Returns:
- the symbol type
-
getSymbolTypeString
get the symbol type string for this G2dLine- Returns:
- the symbol type
-
setSymbolsAutoInterval
public void setSymbolsAutoInterval(boolean state) set the line symbols auto skip state -
setAutoSkipSymbolsOn
Deprecated.set the line to auto skip it's symbols -
setAutoSkipSymbolsOff
Deprecated.set the line to not auto skip it's symbols -
areSymbolsAutoInterval
public boolean areSymbolsAutoInterval()get whether the line auto skips drawing it's symbols- Returns:
- whether the line auto skips drawing it's symbols
-
getAutoSkipSymbols
Deprecated.get whether the line auto skips drawing it's symbols
-