Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bbn.openmap.layer.terrain
Class LOSGenerator

    java.lang.Object
      com.bbn.openmap.layer.terrain.LOSGenerator

All Implemented Interfaces:
  TerrainTool

public class LOSGenerator
extends java.lang.Object
implements TerrainTool

The LOSGenerator uses gestures to create a mask over the map. The circular mask of green pixels shows what places are within the sight of the center of the circle. Additional height can be added to the center of the circle via the TerrainLayer palette, to represent a tower, building, or aircraft.

Field Summary
`protected boolean` | `cancelled` Set when the projection has changed while a swing worker is gathering graphics, and we want him to stop early.
`protected OMGraphicList` | `graphics`
`protected ProgressSupport` | `progressSupport`
`protected com.bbn.openmap.layer.terrain.LOSStateMachine` | `stateMachine`

Fields inherited from interface com.bbn.openmap.layer.terrain.TerrainTool
`MAX_SPACE_BETWEEN_PIXELS`

Constructor Summary
`LOSGenerator(TerrainLayer tLayer)` The creation of the tool starts here.

Method Summary
`void` | `addLOSEvent(java.awt.event.MouseEvent event)` Used to modify the circle parameters with another mouse event.
`void` | `addProgressListener(ProgressListener list)` Add a ProgressListener that will display build progress.
`protected double` | `calculateLOSslope(LatLonPoint cord, float arc_dist)` CalculateLOSslope figures out the slope from the pixel to the center, in radians.
`void` | `clearProgressListeners()` Clear all progress listeners.
`void` | `createLOSImage()` Takes the member settings and manages the creation of the image.
`void` | `doImage()`
`protected void` | `fireProgressUpdate(int type, java.lang.String task, int frameNumber, int totalFrames)` Fire an build update to progress listeners.
`OMGraphicList` | `getGraphics()` Get the current list of graphics from the tool.
`State` | `getState()` Get the current state from the state machine of the tool.
`void` | `init()` Tell the tool to initialize.
`boolean` | `isCancelled()` Check to see if the cancelled flag has been set.
`void` | `removeProgressListener(ProgressListener list)` Remove a ProgressListener that displayed build progress.
`void` | `reset()` Without arguments, the reset() call makes both graphics go offscreen in their smallest size.
`void` | `reset(boolean circ, boolean image)` Circ is for the circle to be reset, and image is for the image to be reset.
`protected void` | `resolveImagePoint(int x, int y, int[] newPixels, float[] azimuthVals, int range, float pix_arc_interval, boolean mark, int colorForMark)` Calculates the color for each pixel.
`void` | `setCancelled(boolean set)` Used to set the cancelled flag in the layer.
`void` | `setCenter(java.awt.event.MouseEvent event)` Called when the circle is started.
`void` | `setLOSobjectHeight(int value)` Sets the new object height to use at the center of the circle.
`void` | `setScreenParameters(Projection p)` Called on every getRectangle, in order to let the cache get sized right, and to reset the graphics if the scale changed (since they won't make sense.
`protected void` | `workerComplete()` The TerrainWorker calls this method on the layer when it is done working.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### stateMachine

    protected com.bbn.openmap.layer.terrain.LOSStateMachine stateMachine

### graphics

    protected OMGraphicList graphics

### cancelled

    protected boolean cancelled

  Set when the projection has changed while a swing worker is gathering graphics, and we want him to stop early.

### progressSupport

    protected ProgressSupport progressSupport

Constructor Detail

### LOSGenerator

    public LOSGenerator(TerrainLayer tLayer)

  The creation of the tool starts here. The DTED data cache is passed in, along with a path to the dted directory to get more data if needed.

Method Detail

### getGraphics

    public OMGraphicList getGraphics()

  Description copied from interface: `TerrainTool`
  Get the current list of graphics from the tool.

  Specified by:
    `getGraphics` in interface `TerrainTool`

### getState

    public State getState()

  Description copied from interface: `TerrainTool`
  Get the current state from the state machine of the tool.

  Specified by:
    `getState` in interface `TerrainTool`

### init

    public void init()

  Description copied from interface: `TerrainTool`
  Tell the tool to initialize.

  Specified by:
    `init` in interface `TerrainTool`

### doImage

    public void doImage()

### workerComplete

    protected void workerComplete()

  The TerrainWorker calls this method on the layer when it is done working. If the calling worker is not the same as the "current" worker, then a new worker is created.

### setCancelled

    public void setCancelled(boolean set)

  Used to set the cancelled flag in the layer. The swing worker checks this once in a while to see if the projection has changed since it started working. If this is set to true, the swing worker quits when it is safe.

### isCancelled

    public boolean isCancelled()

  Check to see if the cancelled flag has been set.

### reset

    public void reset()

  Without arguments, the reset() call makes both graphics go offscreen in their smallest size.

  Specified by:
    `reset` in interface `TerrainTool`

### reset

    public void reset(boolean circ,
                      boolean image)

  Circ is for the circle to be reset, and image is for the image to be reset. Sometimes you only want one to be moved.

### setScreenParameters

    public void setScreenParameters(Projection p)

  Called on every getRectangle, in order to let the cache get sized right, and to reset the graphics if the scale changed (since they won't make sense.

  Specified by:
    `setScreenParameters` in interface `TerrainTool`

### createLOSImage

    public void createLOSImage()

  Takes the member settings and manages the creation of the image. A large vector of slope values are created, depending on the size of the circle, and how many pixels are around it. Each entry in the vector is the value of the largest slope value in that direction. The image is created from the inside out, pixel by pixel. The slope from the pixel to the center is calculated, and then compared with the value for that direction (in the vector). If the pixel's slope is larger, the point is visible, and is colored that way. The vector is updated, and the cycle continues.

### resolveImagePoint

    protected void resolveImagePoint(int x,
                                     int y,
                                     int[] newPixels,
                                     float[] azimuthVals,
                                     int range,
                                     float pix_arc_interval,
                                     boolean mark,
                                     int colorForMark)

  Calculates the color for each pixel. After is gets the slope value for that pixel, it manages the comparison to get the pixel colored correctly.

### calculateLOSslope

    protected double calculateLOSslope(LatLonPoint cord,
                                       float arc_dist)

  CalculateLOSslope figures out the slope from the pixel to the center, in radians. The arc_dist is in radians, and is the radian arc distance of the point from the center point of the image, on the earth. This slope calculation does take the earth's curvature into account, based on the spherical model.

### setCenter

    public void setCenter(java.awt.event.MouseEvent event)

  Called when the circle is started. It starts the circle to be drawn, and sets the parameters that will be needed to figure out the image.

  Parameters:
    `event` - mouse event where the circle should be started.

### addLOSEvent

    public void addLOSEvent(java.awt.event.MouseEvent event)

  Used to modify the circle parameters with another mouse event. Takes care of resetting hte circle parameters and regenerating the circle.

### setLOSobjectHeight

    public void setLOSobjectHeight(int value)

  Sets the new object height to use at the center of the circle. The old object is subtracted out first to get the center height of the ground before the new value is added.

  Parameters:
    `value` - height of the object in meters.

### addProgressListener

    public void addProgressListener(ProgressListener list)

  Add a ProgressListener that will display build progress.

### removeProgressListener

    public void removeProgressListener(ProgressListener list)

  Remove a ProgressListener that displayed build progress.

### clearProgressListeners

    public void clearProgressListeners()

  Clear all progress listeners.

### fireProgressUpdate

    protected void fireProgressUpdate(int type,
                                      java.lang.String task,
                                      int frameNumber,
                                      int totalFrames)

  Fire an build update to progress listeners.

  Parameters:
    `frameNumber` - the current frame count
    `totalFrames` - the total number of frames.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details