skip to main content
Defense > Programmer's documentation > Programming with JViews Maps for Defense > Map Defense GUI interactors > Line of Sight interactor
 
Line of Sight interactor
Describes the Line of Sight interactor.
*Overview
*Explains the use of the IlvMakeLineOfVisibilityInteractor class to display a color-coded line of sight on a map.
*Creating and installing the Line of Sight interactor
*Provides code for creating the Line of Sight interactor and Altitude Visibility Chart.
*Using the Line of Sight interactor
*Describes the functioning of the Line of Sight interactor and the style parameters that can be used.
*Altitude Visibility Chart bean
*Describes the Altitude Visibility Chart produced with the Line of Sight.
Overview
The IlvMakeLineOfVisibilityInteractor allows the user to display a color coded line of sight on a map. The color coding indicates the visible and hidden parts of the terrain from the observation point, that is, one end of the line. If specified, the interactor can also create an Altitude Visibility Chart, which displays a tabbed pane containing a terrain cut along the Line of Sight, see Altitude Visibility Chart bean.
The following figure shows an example of a Line of Sight.
Line of Sight
The source code for the Map Builder demonstration, which contains all of the code described in this section, can be found at <installdir> /jviews-maps/samples/mapbuilder/index.html
Creating and installing the Line of Sight interactor
To create the Line of Sight interactor and Altitude Visibility Chart use the following line of code:
 
IlvMakeLineOfVisibilityInteractor interactor=new
  IlvMakeLineOfVisibilityInteractor(tabbedpane);
The tabbedPane parameter can be null if you do not want the interactor to create a vertical view of the terrain, see Altitude Visibility Chart bean.
You can then install this interactor as described in the Using the GUI beans section in Programming with JViews Maps.
Using the Line of Sight interactor
When the interactor is used, it creates an IlvGraphicLayerDataSource and inserts it into the data source model of the manager. This data source manages a single graphic object, an IlvLineOfVisibility.
At the same time, the interactor creates an IlvMapLayer to display this new graphic object and adds it to the map layer tree under a Terrain Analysis group. The user can use the style of that layer, an IlvLineOfVisibilityStyle, to customize the appearance of that particular Line of Sight in the map layer tree. This is done by changing the following Line of Sight parameters:
*The Point of View Height attribute. The height, in meters, of the virtual observer above ground.
*The Hidden Zone Colorattribute. The color of those parts of the terrain not visible to the virtual observer on the Line of Sight and Altitude Visibility Chart.
*The Visible Zone Color attribute. The color of parts of the terrain visible on the Line of Sight and Altitude Visibility Chart.
*The Precision attribute. The visibility algorithm samples the map altitude data according to the value of the precision attribute, for example, every 100 meters. It then constructs the visible and invisible parts from this table of altitudes, taking into account the curvature of the earth (by default).
Altitude Visibility Chart bean
If specified, the interactor also creates an IlvAltitudeVisibilityChart in a tabbed pane as soon as the line of visibility is added on the map, see Creating and installing the Line of Sight interactor. This chart displays a terrain cut along the line, identifying the observation point and showing the parts of the terrain visible or hidden to the virtual observer.
If the user changes the Line of Sight, either by using the select tool and moving the line extremities, or by modifying the style parameters, JViews Maps for Defense updates the Altitude Visibility Chart.
For further information about this bean, see The Altitude Visibility Chart bean.

Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.