Class K2DComplexElement
java.lang.Object
com.kheops.jmap.client.graphics2D.K2DElement
com.kheops.jmap.client.graphics2D.K2DComplexElement
- All Implemented Interfaces:
- Shareable,- Serializable,- Cloneable
A class containing many K2DElement (K2DPolygon, K2DPolyline, K2DPoint, etc).
- See Also:
- 
Field SummaryFields inherited from class com.kheops.jmap.client.graphics2D.K2DElementattributes, DEFAULT_DC_BUFFER, id, selected
- 
Constructor SummaryConstructorsConstructorDescriptionConstructs an empty instance of K2DComplexElement.K2DComplexElement(K2DElement element, long id) Constructs a K2DComplexElement with a Vector that contains a group of K2DElement.
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddElement(K2DElement element) Adds a K2DElement to the complex element.voidaddElements(K2DElement[] elements) clone()Clones this complex element.voiddraw(GraphicsRef gr, K2DTransform t, Style s) Draws all the elements of this complex element to the specified Graphics, using the specified transform matrix and the specified style.voiddrawHandles(GraphicsRef gr, K2DTransform t, Style s) This method draws handles around the element.Determines the bounding box of the displayed element in DC.getDisplayBoundsWc(ViewState vs, Style s) Determines the bounding box including the style of element in WC (World Coordinates).Returns the geometry object associated with the element.intgetType()Return the current element type.voidremoveElement(K2DElement element) Removes an element from this complex element.voidsetElements(K2DElement[] elements) voidsetGeometry(Geometry geometry) Sets the geometry object associated with the element.voidsetSelected(boolean selected) Sets the selection state of the element.share()Creates a clone of the current element excluding the geometry which remains the same instance in both elements.
 Useclone()to create a real copy of the current element.intsizeOf()Returns the estimated memory used by this object in bytes.booleantouches(Point dcCoord, K2DTransform t, Style s) Determines if the specified device coordinate touches the displayed element.Methods inherited from class com.kheops.jmap.client.graphics2D.K2DElementcopyAttributes, draw, drawHandles, equals, fromByteArray, generateUniqueId, getAttributes, getDisplayBounds, getId, hashCode, isSelected, setAttributes, setId, sizeOfAttributes, toByteArray, toByteArray, touches
- 
Constructor Details- 
K2DComplexElementpublic K2DComplexElement()Constructs an empty instance of K2DComplexElement.
- 
K2DComplexElementConstructs a K2DComplexElement with a Vector that contains a group of K2DElement.- Parameters:
- element- an element to add to the complex element
- id- the id of the element
 
 
- 
- 
Method Details- 
addElementAdds a K2DElement to the complex element.- Parameters:
- element- the element to be added
 
- 
addElements
- 
removeElementRemoves an element from this complex element.- Parameters:
- element- the element to be removed
 
- 
drawDraws all the elements of this complex element to the specified Graphics, using the specified transform matrix and the specified style.- Specified by:
- drawin class- K2DElement
- Parameters:
- gr- the GraphicsRef object to draw on
- t- the transformation to apply to the element
- s- the style that defines the appearance of the element
- See Also:
 
- 
cloneClones this complex element.- Specified by:
- clonein class- K2DElement
- Returns:
- a new instance of the drawing vector
 
- 
sizeOfpublic int sizeOf()Returns the estimated memory used by this object in bytes.- Overrides:
- sizeOfin class- K2DElement
- Returns:
- the estimated memory used by this object in bytes.
 
- 
drawHandlesDescription copied from class:K2DElementThis method draws handles around the element. The position of the handles is implementation dependent. These handles are typically used to modify the geometry of the element.- Specified by:
- drawHandlesin class- K2DElement
- Parameters:
- gr- the Graphics object to draw on.
- t- the transformation to apply to the element.
- s- the style of the element.
 
- 
getDisplayBoundsDescription copied from class:K2DElementDetermines the bounding box of the displayed element in DC. The bounding box is the smallest possible rectangle in which the displayed element fits entirely.- Specified by:
- getDisplayBoundsin class- K2DElement
- Parameters:
- t- the transformation used to calculate the display bounds of the element.
- s- the style used to calculate the display bounds of the element.
- Returns:
- the bounding box of the displayed element
 
- 
getGeometryDescription copied from class:K2DElementReturns the geometry object associated with the element.- Specified by:
- getGeometryin class- K2DElement
- Returns:
- The geometry object associated with the element.
 
- 
setGeometryDescription copied from class:K2DElementSets the geometry object associated with the element.- Specified by:
- setGeometryin class- K2DElement
- Parameters:
- geometry- the geometry
 
- 
touchesDescription copied from class:K2DElementDetermines if the specified device coordinate touches the displayed element. A point touches the element if it overlaps the graphical representation of the element. The style of the element influences the result.- Specified by:
- touchesin class- K2DElement
- Parameters:
- dcCoord- the device coordinate
- t- the transformation used to display the element
- s- the style used to display the element
- Returns:
- true if the element contains the point, false otherwise
- See Also:
 
- 
getElements
- 
setElements
- 
getTypepublic int getType()Description copied from class:K2DElementReturn the current element type.- Specified by:
- getTypein class- K2DElement
- Returns:
- the element type.
- See Also:
 
- 
setSelectedpublic void setSelected(boolean selected) Description copied from class:K2DElementSets the selection state of the element.- Overrides:
- setSelectedin class- K2DElement
- Parameters:
- selected- if true, the element will be selected else it will be unselected
 
- 
getDisplayBoundsWcDetermines the bounding box including the style of element in WC (World Coordinates). The bounding box is the smallest possible rectangle in which the displayed element fits entirely. This method offers a basic implementation by transforming the DC getDisplayBounds method result in WC. To optimize performance, each K2DElement should override this method with its own implementation. See existing implementations (K2DPolygon, K2DPoint, K2DPolyline, etc.) for examples.- Overrides:
- getDisplayBoundsWcin class- K2DElement
- Parameters:
- vs- 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.
- Returns:
- the bounding box of the displayed element in WC
 
 
-