Sometimes, shape objects disappear from certain camera positions in the view, although they should be at least partially visible
Objects can vanish in 2D as well as in 3D, and it typically happens at the edge of the screen. For instance:
A radar domain object is represented by a point, and visualized as an arc band emanating from the center point . The arc band disappears when a user moves around the map until the center point is out of the view, even if the arc band itself is still in the view.
A trajectory is visualized as a buffer shape with the trajectory line as its axis. The buffer disappears when the trajectory line is not in the view.
The ground position of an airborne aircraft is visualized with an icon on the terrain. When you pitch a 3D view so that the aircraft itself ends up above the view, the ground icon disappears as well.
A domain object represented by a point with a size of 0 is visualized with an icon that has its size is specified in meters (world-sized). The icon shows the physical size of the object, but it disappears when the center point of the object is outside of the view.
A domain object represented by a point with a size of 0 is visualized with a large icon with a size specified in pixels (view-sized). The icon disappears when its center point is outside the view.
A domain object is visualized with a label or icon, and for which an offset from the object has been defined in pixels. The label or icon disappears when the object is outside of the view.
The common pattern in these glitches is that an object is visualized with a different spatial location or size than the location or size tied to the object. There are two common ways in which this discrepancy manifests:
The bounds of the domain object’s shape do not represent the physical size or location of the object. This is the case in the first four examples.
The domain object is visualized with a larger view-sized icon or label. This is the case in the last two examples.
To determine the set of visible elements in a view, LuciadLightspeed performs a spatial query on the model, typically in the
ILcd2DBoundsIndexedModel.applyOnInteract2D(). It uses the view bounds to perform the query. Such a spatial query is the root cause of the disappearance of your shapes:
because the spatial query is based on the view’s extent, an object is not considered visible if the domain object’s bounds
are outside the view extent.
In most cases, LuciadLightspeed automatically compensates for these discrepancies, and keeps shapes from vanishing. Sometimes though, you need to take action yourself to make sure your shapes don’t disappear.
If your shapes still disappear, the fundamental solution is ensuring that your domain object bounds represent the object’s real world size. Unfortunately, this is often not feasible. LuciadLightspeed already applies measures to retrieve partially visible elements.
LuciadLightspeed also offers a few configurable options that allow spatial queries to pick up elements outside of the view. Pick the options that are the best fit for your situation.
TLspShapeLayerBuilder.objectWorldMargin() to adapt the layer world padding.
You expand the view region with a margin defined in meters. The layer uses the expanded view extent when it retrieves domain objects and therefore retrieves more objects.
You can set the margin to the largest discrepancy between an object’s model bounds and the visualized geometry size in your data set.
TLspShapeLayerBuilder.objectViewMargin() to adapt the layer view padding.
You expand the view region with a margin defined in pixels. The layer converts the pixel margin to a world margin, and therefore retrieves more objects.
You can set the margin to half the size of the largest icon you are using.
TLspShapeLayerBuilder.culling(false) to disable object culling entirely.
If you use this setting, all objects are displayed. There is no spatial filtering of the domain objects.
This is useful when your data set is relatively small. There can be a performance impact for large data sets, so check the impact on the performance of your application.