public class K2DStyledElement extends K2DElement
| Modifier and Type | Field and Description |
|---|---|
protected K2DElement |
element |
protected Style |
selectionStyle |
protected Style |
style |
attributes, DEFAULT_DC_BUFFER, id, selected| Constructor and Description |
|---|
K2DStyledElement()
Constructor for bean compliance only.
|
K2DStyledElement(K2DElement element,
Style style)
Creates an object containing a K2DElement and a Style.
|
K2DStyledElement(K2DElement element,
Style style,
Style selectionStyle)
Creates an object containing a K2DElement and a Style.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
clone()
Clones the current K2DStyledElement.
|
void |
draw(GraphicsRef gr,
K2DTransform t,
Style s)
Deprecated.
use draw(GraphicsRef, ViewState, Style) instead
|
void |
draw(GraphicsRef gr,
ViewState vs,
Style s)
Draws the element on the specified graphics object using the specified
ViewState.
|
void |
drawHandles(GraphicsRef gr,
K2DTransform t,
Style s)
This method draws handles around the element.
|
java.lang.Object[] |
getAttributes()
Gets the attributes of the element.
|
Rectangle |
getDisplayBounds(K2DTransform t,
Style s)
Determines the bounding box of the displayed element in DC.
|
Rectangle |
getDisplayBoundsWc(ViewState vs,
Style s)
Determines the bounding box including the style of element in WC (World Coordinates).
|
K2DElement |
getElement()
Gets the K2DElement
|
Geometry |
getGeometry()
Returns the geometry object associated with the element.
|
long |
getId()
Gets the id of the element.
|
Style |
getStyle()
Gets the Style associated with the K2DElement
|
int |
getType()
Return the current element type.
|
int |
hashCode() |
boolean |
isSelected()
Determines if the element is selected.
|
void |
setAttributes(java.lang.Object[] attributes)
Sets the attributes of the element.
|
void |
setElement(K2DElement element)
Sets the K2DElement
|
void |
setElementAndStyle(K2DElement element,
Style style)
Sets the Style and The K2DElement
|
void |
setGeometry(Geometry geometry)
Sets the geometry object associated with the element.
|
void |
setId(long id)
Sets the id of the element.
|
void |
setSelected(boolean selected)
Sets the selection state of the element.
|
void |
setStyle(Style style)
Sets the Style associated with the K2DElement
|
Shareable |
share()
Creates a clone of the current element excluding the geometry which remains
the same instance in both elements.
Use clone() to create a real copy of the current element. |
int |
sizeOf()
Returns the estimated memory used by this object in bytes.
|
boolean |
touches(Point dcCoord,
K2DTransform t,
Style s)
Determines if the specified device coordinate touches the displayed
element.
|
copyAttributes, drawHandles, equals, fromByteArray, generateUniqueId, getDisplayBounds, sizeOfAttributes, toByteArray, toByteArray, touchesprotected Style style
protected Style selectionStyle
protected K2DElement element
public K2DStyledElement()
public K2DStyledElement(K2DElement element, Style style)
element - The K2DElementstyle - The Style associated with the K2DElementpublic K2DStyledElement(K2DElement element, Style style, Style selectionStyle)
element - The K2DElementstyle - The Style associated with the K2DElementselectionStyle - The selection Style associated with the K2DElement. If null,
the default style will be used.public java.lang.Object clone()
clone in class K2DElementpublic K2DElement getElement()
public Style getStyle()
public void setElement(K2DElement element)
element - the associated element.public void setStyle(Style style)
style - the corresponding stylepublic void setElementAndStyle(K2DElement element, Style style)
element - the K2Delement that will associated with this K2DStyledElement
instancestyle - the style that will associated with this K2DElement instancepublic long getId()
getId in class K2DElementpublic void setId(long id)
setId in class K2DElementid - the new id of the elementpublic java.lang.Object[] getAttributes()
K2DElementgetAttributes in class K2DElementpublic boolean isSelected()
K2DElementisSelected in class K2DElementK2DElement.setSelected(boolean)public void setAttributes(java.lang.Object[] attributes)
K2DElementsetAttributes in class K2DElementattributes - public void setSelected(boolean selected)
K2DElementsetSelected in class K2DElementselected - @Deprecated public void draw(GraphicsRef gr, K2DTransform t, Style s)
draw in class K2DElementgr - a wrapper to the Graphics object to draw on.t - the transformation to apply to the elements - the style that defines the appearance of the element, only used
if the style of this K2DStyledElement is nullpublic void draw(GraphicsRef gr, ViewState vs, Style s)
draw in class K2DElementgr - a wrapper to the Graphics object to draw onvs - the view state that provides context information to draw the element.s - the style that defines the appearance of the element, only used
if the style of this K2DStyledElement is nullpublic int sizeOf()
sizeOf in class K2DElementpublic Shareable share()
K2DElementclone() to create a real copy of the current element.share in interface Shareableshare in class K2DElementK2DElement.clone()public void drawHandles(GraphicsRef gr, K2DTransform t, Style s)
K2DElementdrawHandles in class K2DElementgr - the Graphics object to draw on.t - the transformation to apply to the element.s - the style of the element.public Rectangle getDisplayBounds(K2DTransform t, Style s)
K2DElementgetDisplayBounds in class K2DElementt - the transformation used to calculate the display bounds of the element.s - the style used used to calculate the display bounds of the element.public Geometry getGeometry()
K2DElementgetGeometry in class K2DElementpublic void setGeometry(Geometry geometry)
K2DElementsetGeometry in class K2DElementgeometry - the geometrypublic boolean touches(Point dcCoord, K2DTransform t, Style s)
touches in class K2DElementdcCoord - the device coordinatet - the transformation used to display the elements - the style used to display the element - not used by the
K2DStyledElement.K2DTransform,
Stylepublic int getType()
K2DElementgetType in class K2DElementElementTypespublic int hashCode()
hashCode in class K2DElementpublic Rectangle getDisplayBoundsWc(ViewState vs, Style s)
getDisplayBoundsWc in class K2DElementvs - the view state that provides context information to calculate the display bounds of the element.s - the style used used to calculate the display bounds of the element.