Package com.motivewave.platform.sdk.draw
Class ResizePoint
java.lang.Object
com.motivewave.platform.sdk.draw.Figure
com.motivewave.platform.sdk.draw.ResizePoint
Resize points provide a way for the user to interact with a study using the mouse.
The user can move resize points around the chart by dragging them to the desired location.
-
Constructor Summary
ConstructorDescriptionResizePoint
(Enums.ResizeType type) Constructor.ResizePoint
(Enums.ResizeType type, boolean absolute) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionboolean
contains
(double x, double y, DrawContext ctx) This method is called by the study framework to determine if the figure contains the x and y coordinates.void
draw
(Graphics2D gc, DrawContext ctx) Draws the resize point using the outline and fill colorGets the fill color (for drawing the resize point)Gets the location where this figure will be drawn on the graph.Gets the absolute location (ie time and price).Gets the outline color (for drawing the resize point)long
getTime()
Gets the time location (x coordinate).getType()
Gets the type of resize point.double
getValue()
Gets the real value location (y coordinate).boolean
true if an absolute time/price coordinate is used to determine its locationboolean
Indicates if this resize point should snap to common location such as the bottom or top of a price bar.void
layout
(DrawContext ctx) Calculates x/y coordinates on the graph.void
Sets the fill color (for drawing the resize point)void
setGraphLocation
(Point2D location) Sets the location where this figure will be drawn on the graph.void
setLocation
(long time, double value) Sets the absolute location of this figure.void
setLocation
(Coordinate coord) Sets the absolute location (ie time and price).void
Sets the outline color (for drawing the resize point)void
setSnapToLocation
(boolean b) Sets the snap to location attribute.Methods inherited from class com.motivewave.platform.sdk.draw.Figure
getBounds, getPopupMessage, isUnderlay, isVisible, setBounds, setPopupMessage, setUnderlay
-
Constructor Details
-
ResizePoint
Constructor. Creates a resize point of the given type.- Parameters:
type
- resize type
-
ResizePoint
Constructor. Creates a resize point of the given type and using absolute/relative positioning- Parameters:
type
- resize typeabsolute
- true if the location is based on an absolute position (time, price)
-
-
Method Details
-
layout
Calculates x/y coordinates on the graph. If the position is absolute and the location is set (time/price), this will convert it to the graph coordinates. -
contains
This method is called by the study framework to determine if the figure contains the x and y coordinates. This implementation considers the use of the relative location to determine if the figure contains x and y. -
getType
Gets the type of resize point. The type can be use to constrain the movement of the point.- Returns:
- type or resize point
- See Also:
-
getFillColor
Gets the fill color (for drawing the resize point)- Returns:
- fill color for this resize point
-
setFillColor
Sets the fill color (for drawing the resize point)- Parameters:
c
- fill color
-
getOutlineColor
Gets the outline color (for drawing the resize point)- Returns:
- outline color for this resize point
-
setOutlineColor
Sets the outline color (for drawing the resize point)- Parameters:
c
- outline color
-
setGraphLocation
Sets the location where this figure will be drawn on the graph.- Parameters:
location
- x,y coordinate where this point will be drawn
-
getGraphLocation
Gets the location where this figure will be drawn on the graph.- Returns:
- graph location of this figure
-
isSnapToLocation
public boolean isSnapToLocation()Indicates if this resize point should snap to common location such as the bottom or top of a price bar.- Returns:
- true if the resize point should snap to the top/bottom of price bars
-
setSnapToLocation
public void setSnapToLocation(boolean b) Sets the snap to location attribute. If true, this resize point will snap to the top ane bottom of price bars.- Parameters:
b
- snap to location attribute
-
getLocation
Gets the absolute location (ie time and price).- Returns:
- the absolute location.
-
setLocation
Sets the absolute location (ie time and price).- Parameters:
coord
- coordinate for the absolute location
-
setLocation
public void setLocation(long time, double value) Sets the absolute location of this figure.- Parameters:
time
- time value (in milliseconds)value
- y axis value
-
getTime
public long getTime()Gets the time location (x coordinate).- Returns:
- time x coordinate in milliseconds since 1970
-
getValue
public double getValue()Gets the real value location (y coordinate).- Returns:
- real value (y coordinate)
-
isAbsolute
public boolean isAbsolute()true if an absolute time/price coordinate is used to determine its location- Returns:
- true if an absolute time/price coordinate is used to determine the location
-
draw
Draws the resize point using the outline and fill color
-