skip to main content
Defense > Programmer's documentation > Programming with JViews Maps for Defense > Map Defense GUI interactors > Area of Sight interactor
 
Area of Sight interactor
Describes the Area of Sight interactor.
*Overview
*Explains the use of the IlvMakeAreaOfSightInteractor class to display the area visible from a point on the map.
*Creating and Installing the Area of Sight interactor
*Provides code for creating the Area of Sight interactor.
*Using the Area of Sight interactor
*Describes the functioning of the Area of Sight interactor and the style parameters that can be used.
Overview
The IlvMakeAreaOfSightInteractor allows the user to display in a manager view the area visible from a point on the map indicated by the mouse pointer. When the user moves the mouse, the interactor computes and displays an approximation of the Area of Sight in accordance with the mouse movements. When the user presses the mouse button, a more detailed area of sight is displayed centered on the point at which the mouse was clicked.
The following figure shows an example of the approximation and detailed views of the Area of Sight.
Area of Sight approximate and detailed views
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 Area of Sight interactor
To create this interactor, use the following line of code:
 
IlvMakeAreaOfSightInteractor interactor=new IlvMakeAreaOfSightInteractor();
You can then install this interactor as described in the Using the GUI beans section in Programming with JViews Maps.
Using the Area of Sight interactor
When the interactor is used, it creates an IlvTiledRasterDataSource. This data source is based on an IlvComputedRasterReader that uses a single image computed from altitude information and held in memory.
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 IlvLineOfSightRasterStyle, to customize the appearance of that particular area of sight in the map layer tree. This is done by changing the following parameters:
*The Bounds attribute. The area of interest for which the line of sight computations are made.
*The Point of View Latitude attribute. The latitude of the virtual observer.
*The Point of View Longitude attribute. The longitude of the virtual observer.
*The Point of View Height attribute. The height, in meters, of the virtual observer above ground.
*The Color Modelattribute. Describes the color of the visible and hidden areas within the area of sight bounds, and also a specific color identifying the position of the observer.
*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).

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