jwo.landserf.gui3d
Class View3d

java.lang.Object
  extended byjwo.landserf.gui3d.View3d

public class View3d
extends Object

Class for storing 3d views and routes over a surface. Can store, load, and save the state of the 3d view as well as flythrough routes.

Version:
2.2, 11th February, 2004.
Author:
Jo Wood

Constructor Summary
View3d()
          Creates an empty route.
 
Method Summary
 void addWaypoint(float x, float y, float z, float heading, float pitch, float fov)
          Adds a waypoint to the route.
 Color getFogColour()
          Reports the colour of fog to be displayed.
 float getFogDensity()
          Reports the fog density used in the 3d view.
 int getResolution()
          Reports the currently stored DEM display resolution.
 Vector getRoute()
          Reports the currently stored route as a series of waypoints.
 Color getSeaColour()
          Reports the colour of sea to be displayed.
 Color getSkyColour()
          Reports the colour of sky to be displayed.
 float getVScale()
          Reports the vertical scaling of the DEM display in the view.
 Color getWallColour()
          Reports the colour of walls to be displayed.
 boolean isSky()
          Reports whether the sea and sky are displayed behind the surface.
 boolean isSmooth()
          Reports whether the DEM view smooths the drape or not.
 void openRoute(String fileName)
          Loads a route with the given file name.
 void resetRoute()
          Resets the currently stored route.
 void saveRoute(String fileName)
          Saves a route with the given file name.
 void setFogColour(Color fogColour)
          Stores the colour of fog to be displayed.
 void setFogDensity(float fogDensity)
          Stores the fog density used in the 3d view.
 void setGrid(boolean useGrid)
          Stores whether the DEM view displays as a grid or not.
 void setResolution(int resolution)
          Stores the resolution of the DEM display in the view.
 void setSeaColour(Color seaColour)
          Stores the colour of sea to be displayed.
 void setSkyColour(Color skyColour)
          Stores the colour of sky to be displayed.
 void setSmooth(boolean isSmooth)
          Stores whether the DEM view smooths the drape or not.
 void setVScale(float vScale)
          Stores the vertical scaling of the DEM display in the view.
 void setWallColour(Color wallColour)
          Stores the colour of walls to be displayed.
 void showSky(boolean showSky)
          Stores whether the sea and sky are displayed behind the surface.
 VectorMap toVectorMap()
          Creates a VectorMap version of this route.
 boolean useGrid()
          Reports whether the DEM view displays as a grid or not.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

View3d

public View3d()
Creates an empty route.

Method Detail

resetRoute

public void resetRoute()
Resets the currently stored route.


setResolution

public void setResolution(int resolution)
Stores the resolution of the DEM display in the view.

Parameters:
resolution - Resolution of DEM display expressed as sample interval of highest DEM resolution.

getResolution

public int getResolution()
Reports the currently stored DEM display resolution.

Returns:
Resolution of DEM display expressed as sample interval of highest DEM resolution, or -1 if not defined.

setVScale

public void setVScale(float vScale)
Stores the vertical scaling of the DEM display in the view.

Parameters:
vScale - Vertical scaling of DEM display.

getVScale

public float getVScale()
Reports the vertical scaling of the DEM display in the view.

Returns:
Vertical scaling of DEM display or -1 if not defined.

setFogDensity

public void setFogDensity(float fogDensity)
Stores the fog density used in the 3d view.

Parameters:
fogDensity - Fog density (between 0 and 1).

getFogDensity

public float getFogDensity()
Reports the fog density used in the 3d view.

Returns:
Fog density (between 0 and 1) or -1 if not defined.

setSmooth

public void setSmooth(boolean isSmooth)
Stores whether the DEM view smooths the drape or not.

Parameters:
isSmooth - True if drape is to be smoothed.

showSky

public void showSky(boolean showSky)
Stores whether the sea and sky are displayed behind the surface.

Parameters:
showSky - True if sea and sky are displayed.

isSky

public boolean isSky()
Reports whether the sea and sky are displayed behind the surface.

Returns:
True if sea and sky are displayed.

isSmooth

public boolean isSmooth()
Reports whether the DEM view smooths the drape or not.

Returns:
True if drape is to be smoothed.

setGrid

public void setGrid(boolean useGrid)
Stores whether the DEM view displays as a grid or not.

Parameters:
useGrid - True if drape is displayed as a grid.

useGrid

public boolean useGrid()
Reports whether the DEM view displays as a grid or not.

Returns:
True if drape is displayed as a grid.

setSkyColour

public void setSkyColour(Color skyColour)
Stores the colour of sky to be displayed.

Parameters:
skyColour - Colour of sky.

getSkyColour

public Color getSkyColour()
Reports the colour of sky to be displayed.

Returns:
Sky colour or null if not defined.

setSeaColour

public void setSeaColour(Color seaColour)
Stores the colour of sea to be displayed.

Parameters:
seaColour - Colour of sea.

getSeaColour

public Color getSeaColour()
Reports the colour of sea to be displayed.

Returns:
Sea colour or null if not defined.

setFogColour

public void setFogColour(Color fogColour)
Stores the colour of fog to be displayed.

Parameters:
fogColour - Colour of fog.

getFogColour

public Color getFogColour()
Reports the colour of fog to be displayed.

Returns:
Fog colour or null if not defined.

setWallColour

public void setWallColour(Color wallColour)
Stores the colour of walls to be displayed.

Parameters:
wallColour - Colour of walls.

getWallColour

public Color getWallColour()
Reports the colour of walls to be displayed.

Returns:
Wall colour or null if not defined.

getRoute

public Vector getRoute()
Reports the currently stored route as a series of waypoints. Each waypoint is represented as an array with 6 elements: x,y,z, heading, pitch and field of view. For backwards compatibility, fov might not be defined, in which case it will have a value of -1. The collection will be empty if no route is yet defined.

Returns:
Collection of route waypoints.

openRoute

public void openRoute(String fileName)
Loads a route with the given file name.

Parameters:
fileName - Name of file containing route information.

saveRoute

public void saveRoute(String fileName)
Saves a route with the given file name.

Parameters:
fileName - Name of file to contain route information.

addWaypoint

public void addWaypoint(float x,
                        float y,
                        float z,
                        float heading,
                        float pitch,
                        float fov)
Adds a waypoint to the route. All coordinates are in geographic units.

Parameters:
x - Easting of waypoint.
y - Northing of waypoint.
z - Elevation of waypoint.
heading - Azimuthal heading (in degrees clockwise from North).
pitch - Pitch of viewing direction (in degrees, -ve points down).
fov - Field of view.

toVectorMap

public VectorMap toVectorMap()
Creates a VectorMap version of this route.

Returns:
VectorMap storing this route information.


Copyright Jo Wood, 1996-2005, last modified, 11th March, 2005