This article provides an introduction to the more complex visualization of domain objects. It provides you with some more background information about how LuciadLightspeed uses painters and discretizers to visually represent domain objects in a view.
Domain objects visualization in an ILspPaintableLayer
ILspPaintableLayer uses a set of one or more ILspPainter instances to render visual representations of domain objects into the view. In the remainder of this article, it is assumed
that the default implementation TLspLayer is used.
Painters can be added to a TLspLayer using the setPainter(TLspPaintRepresentation, ILspPainter) method.
TLspPaintRepresentation is an enumeration class that defines various visual representations that a domain object can have. By default, LuciadLightspeed
defines the following representations:
-
BODYidentifies the main geometric representation of the object. Body painters typically render a discretized version of anILcdShape, icons at the location of anILcdPointor images obtained from anILcdRaster. -
LABELdefines a textual representation of the object. Labels are typically drawn on or near the body of the corresponding object. As an example, street data may have bodies consisting of lines, and labels indicating the street names. -
HANDLEidentifies the representation of the edit handles of the object that is being edited.
A TLspPaintRepresentationState is a combination of a TLspPaintRepresentation and an TLspPaintState. The latter has three possible values:
REGULAR, SELECTED, and EDITED which results in the default TLspPaintRepresentationState instances:
-
REGULAR_BODYcorresponds toBODY, but the corresponding painter is only invoked for geometry objects that are not selected, nor being edited. -
REGULAR_LABELcorresponds toLABEL, but the corresponding painter is only invoked for label objects that are not selected, nor being edited. -
REGULAR_HANDLEcorresponds toHANDLE, but the corresponding painter is only invoked for handle objects that are not selected, nor being edited. -
SELECTED_BODYcorresponds toBODY, but the corresponding painter is only invoked for objects which are currently selected. -
SELECTED_LABELcorresponds toLABEL, but the corresponding painter is only invoked for objects which are currently selected. -
EDITED_BODYcorresponds toBODY, but the corresponding painter is only invoked for objects which are currently being edited. -
EDITED_LABELcorresponds toLABEL, but the corresponding painter is only invoked for objects which are currently being edited.
|
A painter for a given |
When an ILspView is repainting itself, it asks its layers to list all their available paint representations (that is the ones for which the
layers have a painter). The view then determines the order in which all these layers and paint representations are to be drawn.
Labels, for instance, are typically drawn on top of bodies.
Next, the view asks the layers to render their paint representations one by one. The layers do this by determining which objects
in the model are visible in the current view, and then invoking the appropriate ILspPainter to paint those objects.
How does LuciadLightspeed display shapes in Lightspeed layers?
Layers created through the TLspShapeLayerBuilder use a TLspShapePainter to display shapes. In the majority of cases, you do not have to interact with this shape painter directly to display the
shape’s geometry. Instead, you can use ALspStyleTargetProvider to style the shape with a geometry. For more information, see Deriving geometry from objects.
TLspShapePainter converts the vector-based objects in your data model into a format that Lightspeed layers can display. The shape painter
uses an ILspShapeDiscretizer for this, which discretizes the geometry of domain objects into a representation consisting of meshes. Meshes describe shapes
with geometric primitives, such as lines and triangles. The result of the LuciadLightspeed discretization is a 3D mesh object.
If the shape painter cannot determine the object’s geometry from an associated ALspStyleTargetProvider, it passes the object to the shape discretizer directly. The discretizer determines the geometry of the shape.
The following shapes are supported by TLspShapeDiscretizer, the default implementation of ILspShapeDiscretizer:
-
ILcdExtrudedShapeif the base shape is one of the previous shapes in the list
If you want to paint a custom shape other than the supported shapes, you must extend TLspShapeDiscretizer. The class TLspShapeDiscretizationParameters allows you to modify the discretization process and results.
|
For |