public class TLcyShapeVisibilityAddOn extends ALcyFormatAddOn
createBaseFormat()
.
To visualize the results, you need to plug in the TLcyLspShapeVisibilityFormatAddOn
as well.
For visibility calculations on a GXY map, refer to TLcyVisibilityAddOn
.
TLcyShapeVisibilityManager
which
is plugged in as service on the Lucy back-end by this add-on.
Consult the class javadoc of the manager for more information on how to use it.
ILcyVisibilityCalculationPropertiesProvider
.
The default instance is based on the settings defined in the configuration file of this add-on.
You can replace the default instance by overriding the createVisibilityCalculationPropertiesProvider()
method.
TLcyLspShapeVisibilityFormatAddOn
.
Modifier and Type | Field and Description |
---|---|
static String |
OBSERVATION_RESULTS_MODEL_TYPE_NAME
The type name used by the model containing the observation results.
|
static String |
OBSERVER_MODEL_TYPE_NAME
|
static String |
SHAPE_VISIBILITY_MODEL_NODE_TYPE_NAME
The type name used by the model node which groups the observers and observation results.
|
Constructor and Description |
---|
TLcyShapeVisibilityAddOn()
Default constructor
|
Modifier and Type | Method and Description |
---|---|
protected ALcyFormat |
createBaseFormat()
Returns a new data format for this add-on.
|
protected ALcyFormat |
createFormatWrapper(ALcyFormat aBaseFormat)
Returns a new data format wrapper for this add-on.
|
protected Function<TLcdDomainObjectContext,TLcdShapeAltitudeContext<ILcdShape>> |
createObserveeShapeProvider()
Returns a function used to calculate the shape under observation in the visibility calculations.
|
protected Function<TLcdDomainObjectContext,TLcdShapeAltitudeContext<ILcdPoint>> |
createPointObserverShapeProvider()
Returns a function used to calculate the
ILcdPoint shape for an observer in the visibility calculations. |
protected ILcdAltitudeProvider |
createTerrainAltitudeProvider(ILcdView aView,
double aCalculationStepSize,
ILcdGeoReference aPreferredReference,
ILcyLucyEnv aLucyEnv)
Creates an
ILcdAltitudeProvider that is used by the visibility calculations to retrieve the altitude of the terrain. |
protected ILcyVisibilityCalculationPropertiesProvider |
createVisibilityCalculationPropertiesProvider()
Returns a provider for the properties used during the visibility calculations.
|
void |
plugInto(ILcyLucyEnv aLucyEnv)
Creates and plugs in the add-on's format.
|
void |
unplugFrom(ILcyLucyEnv aLucyEnv)
Unplugs the add-on's format.
|
createFormatTool, getFormat
createPreferencesTool, getLongPrefix, getLucyEnv, getPreferences, getPreferencesTool, getShortPrefix
getConfigSourceName, getDisplayName, setConfigSourceName, setDisplayName
public static final String OBSERVER_MODEL_TYPE_NAME
public static final String OBSERVATION_RESULTS_MODEL_TYPE_NAME
public static final String SHAPE_VISIBILITY_MODEL_NODE_TYPE_NAME
public void plugInto(ILcyLucyEnv aLucyEnv)
ALcyFormatAddOn
Creates and plugs in the add-on's format.
plugInto
in class ALcyFormatAddOn
aLucyEnv
- the Lucy environment to plug intoALcyAddOn.unplugFrom(com.luciad.lucy.ILcyLucyEnv)
public void unplugFrom(ILcyLucyEnv aLucyEnv)
ALcyFormatAddOn
unplugFrom
in class ALcyFormatAddOn
aLucyEnv
- the Lucy environmentALcyAddOn.plugInto(com.luciad.lucy.ILcyLucyEnv)
protected ALcyFormat createBaseFormat()
ALcyFormatAddOn
Returns a new data format for this add-on. Override this method to extend the default format with new functionality.
For example, to alter the icon of the layers of this format, you can decorate the layer factory created in the format:
@Override
protected ALcyFormat createBaseFormat() {
return new ALcyFormatWrapper(super.createBaseFormat()){
@Override
protected ILcdGXYLayerFactory createGXYLayerFactory(){
final ILcdGXYLayerFactory delegate = super.createGXYLayerFactory();
return new ILcdGXYLayerFactory(){
@Override
public ILcdGXYLayer createGXYLayer(ILcdModel aModel){
ILcdGXYLayer layer = delegate.createGXYLayer(aModel);
if (layer != null){
ILcdIcon icon = ...;
layer.setIcon(icon);
}
return layer;
}
}
}
}
}
createBaseFormat
in class ALcyFormatAddOn
protected final ALcyFormat createFormatWrapper(ALcyFormat aBaseFormat)
ALcyFormatAddOn
Returns a new data format wrapper for this add-on. A format wrapper extends the base format with aspects such as asynchronous painting, mutable file behavior, safe guarding, etc.
Overriding this method of an existing add-on should be done with extreme care as add-ons typically rely on the wrappers that should be present (e.g. a safe guard).
createFormatWrapper
in class ALcyFormatAddOn
aBaseFormat
- the base format to wrapALcyFormatWrapper
protected ILcyVisibilityCalculationPropertiesProvider createVisibilityCalculationPropertiesProvider()
Returns a provider for the properties used during the visibility calculations. This method is called once when the add-on is plugged in.
You can override this method to return a custom instance, allowing you to return custom properties to influence how the visibility calculations are performed.
The default implementation of this method creates an instance based on the settings specified in the configuration file of this add-on.
protected Function<TLcdDomainObjectContext,TLcdShapeAltitudeContext<ILcdPoint>> createPointObserverShapeProvider()
Returns a function used to calculate the ILcdPoint
shape for an observer in the visibility calculations.
The function receives the TLcdDomainObjectContext
for the (candidate) observer domain object,
and should return an ILcdPoint
when the domain object is a valid observer, together with the altitude mode to interpret the Z-value of the point.
If not, the function should return null
.
The point returned by the function:
TLcdCoverageAltitudeMode.ABOVE_GEOID
, the geoid height information will be retrieved from the model reference.
In that case, the model reference must contain this information (see ILcdGeoReference.getGeodeticDatum()
and ILcdGeodeticDatum.hasNonZeroHeights()
).
The returned function will be called multiple times for the same domain object context. For example when the domain object changes, the function will be re-triggered to obtain the new shape.
When the function has returned a non-null
point for a certain domain object context,
it should return a non-null
value on subsequent calls for the same domain object context.
The default implementation of this method is based on the ALcdShape.fromDomainObject(Object)
for deriving the shape and uses a heuristic for the coverage altitude mode.
This method can also be called from a background thread.
ILcdPoint
shape for an observer.protected Function<TLcdDomainObjectContext,TLcdShapeAltitudeContext<ILcdShape>> createObserveeShapeProvider()
Returns a function used to calculate the shape under observation in the visibility calculations.
The function receives the TLcdDomainObjectContext
for the (candidate) observee domain object,
and should return an ILcdShape
when the domain object is a valid observee, together with the altitude mode to interpret the Z-values of the shape.
If not, the function should return null
.
The shape returned by the function:
TLcdCoverageAltitudeMode.ABOVE_GEOID
, the geoid height information will be retrieved from the model reference.
In that case, the model reference must contain this information (see ILcdGeoReference.getGeodeticDatum()
and ILcdGeodeticDatum.hasNonZeroHeights()
).
The returned function will be called multiple times for the same domain object context. For example when the domain object changes, the function will be re-triggered to obtain a new shape.
When the function has returned a non-null
value for a certain domain object context,
it should return a non-null
value on subsequent calls for the same domain object context.
The default implementation of this method is based on the ALcdShape.fromDomainObject(Object)
for deriving the shape and uses a heuristic for the coverage altitude mode.
This method can also be called from a background thread.
protected ILcdAltitudeProvider createTerrainAltitudeProvider(ILcdView aView, double aCalculationStepSize, ILcdGeoReference aPreferredReference, ILcyLucyEnv aLucyEnv)
Creates an ILcdAltitudeProvider
that is used by the visibility calculations to retrieve the altitude of the terrain.
The default implementation of this method returns an altitude provider using either the elevation of the painted terrain or the height
data available in the models loaded on the map, depending on the value of the useModelElevationData
property
in the configuration file of this add-on.
This method can also be called from a background thread.
aView
- The view containing the line-of-sight.
This can be used to access all the data that is loaded on the map.aCalculationStepSize
- The step size that will be used for the calculation.
It matches the ILcyVisibilityCalculationPropertiesProvider.VisibilityCalculationProperties.getCalculationStepSize()
.aPreferredReference
- The reference that will be used the most to retrieve elevation values.
Performance will improve if the returned altitude provider can provide elevation values for points expressed in this reference without additional transformations.aLucyEnv
- The Lucy back-end