ilog.views.maps.grids
Class IlvMGRSGrid

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.IlvMGRSGrid
All Implemented Interfaces:
IlvManagerViewDecoration, IlvPersistentObject, IlvManagerLightViewDecoration, Serializable

public class IlvMGRSGrid
extends IlvAbstractBaseGrid

The MGRS grid displays a set of autoadaptive MGRS standard grids and labels on top of a geographic view. This grid displays a list of Grid zones (either UPS or UTM zones), and their sub grids (100000m,10000m,1000m). Each grid or subgrid is labeled, using the standardized name for the current area.

 IlvMGRSGrid grid = new IlvMGRSGrid();
 IlvMGRSGridZone.addAllZones(grid);
 view.addViewDecoration(grid);
 

Since:
JViews 7.5
See Also:
Serialized Form

Nested Class Summary
protected static class IlvMGRSGrid.GridInfo
          Data class used to store both a coordinate and the direction (N or E) for later formatting.
 
Field Summary
 
Fields inherited from class ilog.views.maps.grids.IlvAbstractBaseGrid
bottomLine, FRC, leftLine, rightLine, tmp1, tmp2, topLine, visibleRect
 
Constructor Summary
IlvMGRSGrid()
          Default constructor.
IlvMGRSGrid(IlvInputStream stream)
          Creates a grid by reading parameters from the stream.
 
Method Summary
 boolean addGridZone(IlvGridZone zone)
          Adds the specified zone to this grid if it is not already present.
protected  void drawText(Graphics2D g, Point2D point, Object text, boolean horizontal, int alignment)
          Overloading the drawtext method to transform GridInfo into formatted AttributedCharacterIterator.
 Color getSubGridColor(int gridSize)
          Returns the color to use to paint subgrids.
 double getSubGridMaxScale(int gridSize)
          Returns the max scale (that is, minimal zoom factor) for each grid to appear.
 boolean isShowThousands()
          Indicates whether the subgrid labels show "000m".
 void paintGrid(Graphics2D g, IlvTransformer t)
          Paints the grid.
 boolean removeGridZone(IlvGridZone zone)
          Removes the specified zone from this grid if it is present.
 void setShowThousands(boolean showThousands)
          Inform the subgrid labels to show as, for example, "559000mE" instead of "559E" Default value is false.
 void setTextFont(Font textFont)
          Overridden version of setTextFont to compute internal parameters (in grid label formatting) when the font changes.
 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, 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, setTextOutlineColor, setTextVisible, setTransformer, setVisibleOnlyOnView, setVisibleRect, updateTransforms, updateViewParameters
 
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

IlvMGRSGrid

public IlvMGRSGrid()
Default constructor. This grid has no zone, you need to call either addGridZone(IlvGridZone)or IlvMGRSGridZone.addAllZones(IlvMGRSGrid)to select which zones will be displayed.


IlvMGRSGrid

public IlvMGRSGrid(IlvInputStream stream)
            throws IlvReadFileException
Creates a grid by reading parameters from the stream.

Parameters:
stream - Stream to read from.
Throws:
IlvReadFileException
Method Detail

addGridZone

public boolean addGridZone(IlvGridZone zone)
Adds the specified zone to this grid if it is not already present.

Parameters:
zone - Zone to add.
Returns:
true if this grid does not already contain the specified zone.

getSubGridColor

public Color getSubGridColor(int gridSize)
Returns the color to use to paint subgrids. By default, it is a brighter color than the higher grid level.

Parameters:
gridSize - 100000, 100000 or 1000 m.
Returns:
The color to use to paint subgrids.
See Also:
IlvAbstractBaseGrid.getGridColor()

getSubGridMaxScale

public double getSubGridMaxScale(int gridSize)
Returns the max scale (that is, minimal zoom factor) for each grid to appear. By default, the scale is 200 times the gridSize (the 1000m grid will appear for maps at scale 1/200 000 ). When the LightPainting flag is on, the max scale is divided by 10.

Parameters:
gridSize - 100000, 100000 or 1000 m.
Returns:
The scale at which the subgrid appears.

isShowThousands

public boolean isShowThousands()
Indicates whether the subgrid labels show "000m".

Returns:
true if the thousand label decoration is enabled.

paintGrid

public void paintGrid(Graphics2D g,
                      IlvTransformer t)
Paints the grid.

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

removeGridZone

public boolean removeGridZone(IlvGridZone zone)
Removes the specified zone from this grid if it is present.

Parameters:
zone - Zone to be removed from this grid, if present.
Returns:
true if the grid contains the specified zone.

setShowThousands

public void setShowThousands(boolean showThousands)
Inform the subgrid labels to show as, for example, "559000mE" instead of "559E" Default value is false.

Parameters:
showThousands - true if the thousand label decoration should be enabled.

setTextFont

public void setTextFont(Font textFont)
Overridden version of setTextFont to compute internal parameters (in grid label formatting) when the font changes.

Overrides:
setTextFont in class IlvAbstractBaseGrid
Parameters:
textFont - New base font to use.

drawText

protected void drawText(Graphics2D g,
                        Point2D point,
                        Object text,
                        boolean horizontal,
                        int alignment)
Overloading the drawtext method to transform GridInfo into formatted AttributedCharacterIterator. This method will use the current showThousands flag to display either xxXX000mE or xxXXE coordinates.

Overrides:
drawText in class IlvAbstractBaseGrid
Parameters:
g - The Graphics to paint to.
point - Swing view coordinates of the text reference point.
text - Can be either a GridInfo or a string.
horizontal - true if the string must be horizontal.
alignment - Indicates if the text is centered, after or before the reference point. Alignment can be either:

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)


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