ilog.views.maps.grids
Class IlvLatLonGrid

java.lang.Object
  extended by ilog.views.IlvIndexedSet
      extended by ilog.views.IlvManagerLayer
          extended by ilog.views.maps.grids.IlvAbstractBaseGrid
              extended by ilog.views.maps.grids.IlvLatLonGrid
All Implemented Interfaces:
IlvManagerViewDecoration, IlvPersistentObject, IlvManagerLightViewDecoration, Serializable

public class IlvLatLonGrid
extends IlvAbstractBaseGrid

The Lat/Lon grid displays a set of autoadaptive grids and labels along latitude or longitude lines on top of a geographic view. If the grid is autoadaptive (autoScaled), the step between each successive lat/lon line will be dependant on the current view scale. For example, the following code can be used to display an automatically scaled longitude/latitude grid.

   IlvManagerView view=new IlvManagerView();
   ...
   view.getManager().addLayer(new IlvLatLonGrid());
 

Since:
JViews 7.5
See Also:
Serialized Form

Field Summary
 
Fields inherited from class ilog.views.maps.grids.IlvAbstractBaseGrid
bottomLine, FRC, leftLine, rightLine, tmp1, tmp2, topLine, visibleRect
 
Constructor Summary
IlvLatLonGrid()
          Default constructor.
IlvLatLonGrid(IlvInputStream stream)
          Creates a grid by reading parameters from the stream.
 
Method Summary
protected  void automaticScaling()
          Automatically computes the step according to the screen scale of the view.
 void drawLatPolyline(Graphics2D dst, IlvTransformer t, double lat)
          Draws a single polyline (in fact a general path) for the current view parameters and specified latitude.
 void drawLonPolyline(Graphics2D dst, IlvTransformer t, double lon)
          Draws a single polyline (in fact a general path) for the current view parameters and specified latitude.
 double getLatMax()
          Returns the maximum latitude for which grid lines can appear.
 double getLatMin()
          Returns the minimum latitude for which grid lines can appear.
 double getLonMax()
          Returns the maximum longitude for which grid lines can appear.
 double getLonMin()
          Returns the minimum longitude for which grid lines can appear.
 void paintGrid(Graphics2D dst, IlvTransformer t)
          Implementation of the paint mechanism.
 void setLatMax(double latMax)
          Sets the maximum latitude for which grid lines can appear.
 void setLatMin(double latMin)
          Sets the minimum latitude for which grid lines can appear.
 void setLonMax(double longMax)
          Sets the maximum longitude for which grid lines can appear.
 void setLonMin(double longMin)
          Sets the minimum longitude for which grid lines can appear.
 void updateViewParameters(IlvManagerView v)
          Sets grid parameters for next draw.
 void write(IlvOutputStream stream)
          Writes the layer to an output stream. You should not call this method directly, but you may need to override it in a subclass of IlvManagerLayer to store your own information. If you override the method, you may call super.write(stream) after your own saving instructions. Calling the superclass method will dump the graphic objects stored in the layer.
 
Methods inherited from class ilog.views.maps.grids.IlvAbstractBaseGrid
addObject, checkPointInsideView, draw, drawImpl, drawLine, drawString, drawText, getAwtCoordinatesFromLatLon, getCoordinateTransformation, getGraphicFromLatLonCoordinate, getGridColor, getInverseCoordinateTransformation, getLatLonFromAwtCoordinates, getLatLonFromGraphicCoordinate, getSmoothness, getStep, getTextColor, getTextFont, getTextOutlineColor, getViewScale, getViewTransformer, isAutoScaled, isLightPainting, isTextVisible, isVisible, paint, paintLight, print, setAutoScaled, setGridColor, setScale, setSmoothness, setStep, setTextColor, setTextFont, setTextOutlineColor, setTextVisible, setTransformer, setVisibleOnlyOnView, setVisibleRect, updateTransforms
 
Methods inherited from class ilog.views.IlvManagerLayer
addVisibilityFilter, computeBBox, getAlpha, getIndex, getManager, getName, getNamedProperty, getProperty, getVisibilityFilters, isSelectable, isTemporarilyHidden, isVisible, removeNamedProperty, removeVisibilityFilter, setAlpha, setManager, setName, setNamedProperty, setProperty, writeIt
 
Methods inherited from class ilog.views.IlvIndexedSet
afterUpdate, beforeUpdate, collectObjects, deleteAll, getCardinal, getElements, getIndex, getManagers, getManagersCount, getObject, getObject, getSubsequentRemoveThreshold, isQuadtreeEnabled, map, mapInside, mapInside, mapIntersects, mapIntersects, removeObject, setIndex, setQuadtreeEnabled, setSubsequentRemoveThreshold
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlvLatLonGrid

public IlvLatLonGrid()
Default constructor.


IlvLatLonGrid

public IlvLatLonGrid(IlvInputStream stream)
Creates a grid by reading parameters from the stream.

Parameters:
stream - Stream to read from.
Method Detail

write

public void write(IlvOutputStream stream)
           throws IOException
Writes the layer to an output stream. You should not call this method directly, but you may need to override it in a subclass of IlvManagerLayer to store your own information. If you override the method, you may call super.write(stream) after your own saving instructions. Calling the superclass method will dump the graphic objects stored in the layer.

Specified by:
write in interface IlvPersistentObject
Overrides:
write in class IlvAbstractBaseGrid
Parameters:
stream - the output stream
Throws:
IOException - thrown when an exception occurs during the write operation for this object.
See Also:
IlvAbstractBaseGrid.write(ilog.views.io.IlvOutputStream)

updateViewParameters

public void updateViewParameters(IlvManagerView v)
Sets grid parameters for next draw. This method computes current drawing parameters for optimization issues. A grid will be able to draw only once at a time - even if using multiple threads.

Overrides:
updateViewParameters in class IlvAbstractBaseGrid
Parameters:
v - View for which to retrieve parameters.
See Also:
This method also computes the automatic best step., automaticScaling()

paintGrid

public void paintGrid(Graphics2D dst,
                      IlvTransformer t)
Implementation of the paint mechanism.

Specified by:
paintGrid in class IlvAbstractBaseGrid
Parameters:
dst - The Graphics onto which to paint the grid.
t - The view transformer to use.

drawLonPolyline

public void drawLonPolyline(Graphics2D dst,
                            IlvTransformer t,
                            double lon)
Draws a single polyline (in fact a general path) for the current view parameters and specified latitude.

Parameters:
dst - Graphic to draw with.
t - View transformer.
lon - Longitude in radians.

drawLatPolyline

public void drawLatPolyline(Graphics2D dst,
                            IlvTransformer t,
                            double lat)
Draws a single polyline (in fact a general path) for the current view parameters and specified latitude.

Parameters:
dst - Graphic to draw with.
t - View transformer.
lat - Latitude.

setLatMax

public void setLatMax(double latMax)
Sets the maximum latitude for which grid lines can appear.

Parameters:
latMax - The latitude in radians.

setLatMin

public void setLatMin(double latMin)
Sets the minimum latitude for which grid lines can appear.

Parameters:
latMin - The latitude in radians.

setLonMax

public void setLonMax(double longMax)
Sets the maximum longitude for which grid lines can appear.

Parameters:
longMax - The longitude in radians.

setLonMin

public void setLonMin(double longMin)
Sets the minimum longitude for which grid lines can appear.

Parameters:
longMin - The longitude in radians.

automaticScaling

protected void automaticScaling()
Automatically computes the step according to the screen scale of the view.

See Also:
IlvAbstractBaseGrid.setStep(double)

getLatMax

public double getLatMax()
Returns the maximum latitude for which grid lines can appear.

Returns:
The latitude in radians.

getLatMin

public double getLatMin()
Returns the minimum latitude for which grid lines can appear.

Returns:
The latitude in radians.

getLonMax

public double getLonMax()
Returns the maximum longitude for which grid lines can appear.

Returns:
The longitude in radians.

getLonMin

public double getLonMin()
Returns the minimum longitude for which grid lines can appear.

Returns:
The longitude in radians.


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.