Class TLcdUTMZonePainter

java.lang.Object
com.luciad.view.gxy.ALcdGXYPainter
com.luciad.view.map.painter.TLcdUTMZonePainter
All Implemented Interfaces:
ILcdCloneable, ILcdPropertyChangeSource, ILcdGXYLabelPainter, ILcdGXYPainter, ILcdGXYPainterProvider, Serializable, Cloneable

public class TLcdUTMZonePainter extends ALcdGXYPainter implements ILcdGXYPainter, ILcdGXYLabelPainter
The TLcdUTMZonePainter extends ALcdGXYPainter and implements ILcdGXYPainter to paint an UTM-MGRS zone (TLcdUTMZone) on a hemisphere. Note that, to paint the complete zone, this painter should be called twice, to paint the northern and to paint the southern hemisphere. This painter paints the following:
  • the UTM grid zone contours and matching UTM zone and grid band label (e.g. 1 and F)
  • when zooming in, the 100.000m grid squares (starting from setMaximalZoomForGridDetail(double)) and matching label (e.g. FJ). Also, the grid zone designation appears in the view corners (e.g. 4Q)
  • when zooming in even further, sub-grid-square lines (see setScaled(boolean)) and labels
See Also:
  • Constructor Details Link icon

    • TLcdUTMZonePainter Link icon

      public TLcdUTMZonePainter()
  • Method Details Link icon

    • setObject Link icon

      public void setObject(Object aObject)
      Sets the Object to be represented by this ILcdGXYPainter. The Object is casted to an TLcdUTMZone.
      Specified by:
      setObject in interface ILcdGXYLabelPainter
      Specified by:
      setObject in interface ILcdGXYPainter
      Parameters:
      aObject - the object for which the representation shall be handled by this painter.
      See Also:
    • setHemiSphere Link icon

      public void setHemiSphere(int aHemiSphere)
      Sets the hemisphere to paint for this zone.
      Parameters:
      aHemiSphere - one of TLcdUTMZone.NORTHERN_HEMISPHERE or TLcdUTMZone.SOUTHERN_HEMISPHERE.
    • getHemiSphere Link icon

      public int getHemiSphere()
      Returns the hemisphere that will be painted for this zone.
      Returns:
      either TLcdUTMZone.NORTHERN_HEMISPHERE or TLcdUTMZone.SOUTHERN_HEMISPHERE.
    • getObject Link icon

      public Object getObject()
      Gets the Object this ILcdGXYPainter represents.
      Specified by:
      getObject in interface ILcdGXYLabelPainter
      Specified by:
      getObject in interface ILcdGXYPainter
      Returns:
      the Object for which the representation is currently being handled by this painter.
      See Also:
    • getZoneObject Link icon

      public TLcdUTMZone getZoneObject()
      Gets the Object this ILcdGXYPainter represents as a TLcdUTMZone.
    • isPaintGridWhenLabeling Link icon

      public boolean isPaintGridWhenLabeling()
      Returns if painting of the grid is done when drawing the labels (true) or when painting the bodies (false). Labels are typically painted on top of the bodies of all other layers, so this allows painting the grid on top of all other layers, regardless of the grid's layer position.
      Returns:
      if painting of the grid is done when drawing the labels (true) or when painting the bodies (false).
      See Also:
    • setPaintGridWhenLabeling Link icon

      public void setPaintGridWhenLabeling(boolean aPaintGridWhenLabeling)
      Sets if painting of the grid should be done when drawing the labels (true) or when painting the bodies (false).
      Parameters:
      aPaintGridWhenLabeling - if painting of the grid should be done when drawing the labels (true) or when painting the bodies (false).
      See Also:
    • setUTMCoordinateSeparator Link icon

      public void setUTMCoordinateSeparator(char aUTMCoordinateSeparator)
      Set the character to separate the zone and the coordinates and between the coordinates. Set the value 0 (not the character '0') to have no spaces between the zone and the coordinates.
      Parameters:
      aUTMCoordinateSeparator - the character to separate the zone and the coordinates and between the coordinates.
      See Also:
    • getUTMCoordinateSeparator Link icon

      public char getUTMCoordinateSeparator()
      Returns the character to separate the zone and the coordinates.
      Returns:
      the character to separate the zone and the coordinates.
      See Also:
    • setZoneSeparator Link icon

      public void setZoneSeparator(char aZoneSeparator)

      Sets the character to use as separator between the UTM grid zone and the 100km squares. Set the value to 0 (not the character '0') to have no separator between the UTM grid zone and the 100km squares.

      The default is 0.

      Parameters:
      aZoneSeparator - the character to separate the UTM grid zone and the 100km squares.
      See Also:
    • getZoneSeparator Link icon

      public char getZoneSeparator()
      Returns the character to separate the UTM grid zone and the 100km squares.
      Returns:
      the character to separate the UTM grid zone and the 100km squares.
      See Also:
    • paint Link icon

      public void paint(Graphics aGraphics, int aState, ILcdGXYContext aGXYContext)
      Implements ILcdGXYPainter.paint for TLcdUTMZone Objects.
      Specified by:
      paint in interface ILcdGXYPainter
      Parameters:
      aGraphics - the Graphics on which the representation of the object is painted
      aState - the mode the object is represented in (see class documentation).
      aGXYContext - the ILcdGXYContext the drawing depends on.
    • paintLabel Link icon

      public void paintLabel(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext)
      Description copied from interface: ILcdGXYLabelPainter

      Paints the label of the set Object on aGraphics. aGXYContext should contain the ILcdGXYView for which the label is painted and ILcdGXYLayer to which the object belongs

      The implementation of this method shall define how to paint the label of the set Object in the given mode, considering aGXYContext and the possible locations aLocationIndex (of multiple alternatives).

      The domain Object of the label to be painted and the location index should be set before calling this method using the setObject and setLocationIndex methods respectively.

      Specified by:
      paintLabel in interface ILcdGXYLabelPainter
      Parameters:
      aGraphics - the Graphics instance on which to paint.
      aMode - a combination of ILcdGXYLabelPainter.DEFAULT and ILcdGXYLabelPainter.SELECTED.
      aGXYContext - the ILcdGXYContext in which the label painting has to be performed.
      See Also:
    • setCornerLabelInsets Link icon

      public void setCornerLabelInsets(Insets aCornerLabelInsets)
      Retrieves the insets for the corner labels. Corner labels will not be painted in the border defined by the insets.
      Parameters:
      aCornerLabelInsets - the insets for the corner labels
    • getCornerLabelInsets Link icon

      public Insets getCornerLabelInsets()
      Sets the insets for the corner labels. Corner labels will not be painted in the border defined by the insets.
      Returns:
      the borders to avoid placing the corner labels at.
    • boundsSFCT Link icon

      public void boundsSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, ILcd2DEditableBounds aBoundsSFCT)
      Sets the bounds equal to the views width and height. The location is 0.0,0.0.
      Specified by:
      boundsSFCT in interface ILcdGXYPainter
      Parameters:
      aGraphics - the Graphics on which the representation of the object is painted
      aMode - the mode the object is represented in (see class documentation). For example, an object may be represented differently in SELECTED mode compared to DEFAULT mode. The returned bounds of the representation must take this different representation into account.
      aGXYContext - the context for which the representation of the object is painted. It contains amongst others the transformations from model to world and world to view.
      aBoundsSFCT - the bounds that must be adapted to encompass the representation of the object in the given mode and context. These bounds must not be taken into account when the method has thrown an exception.
      See Also:
    • getGridZoneColor Link icon

      public Color getGridZoneColor()
      Returns the outline color of the grid zones
      Returns:
      the outline color of the grid zones
    • setGridZoneColor Link icon

      public void setGridZoneColor(Color aColor)
      Sets the outline color of the grid zones
      Parameters:
      aColor - the outline color of the grid zones
    • getColor Link icon

      public Color getColor()
      Returns the outline color of the 100.000m squares
      Returns:
      the outline color of the 100.000m squares
    • setColor Link icon

      public void setColor(Color aColor)
      Sets the outline color of the 100.000m squares.
      Parameters:
      aColor - the outline color of the 100.000m squares
    • getColorScales Link icon

      public Color getColorScales()
      Gets the Color used by this painter to paint the scales within the 100.000m squares.
    • setColorScales Link icon

      public void setColorScales(Color aColorScales)
      Sets the Color to be used by this painter to paint the scales within the 100.000m squares.
    • getScaled Link icon

      public boolean getScaled()
      Returns whether the scale grid is to be painted.
    • setScaled Link icon

      public void setScaled(boolean aScaled)
      Specifies whether the scale grid should be painted.
      See Also:
    • getLabeled Link icon

      public boolean getLabeled()
      Returns whether the grid labels are to be painted.
    • setLabeled Link icon

      public void setLabeled(boolean aLabeled)
      Specifies whether the grid labels should be painted.
    • getLabelColor Link icon

      public Color getLabelColor()
      Gets the Color for the labels.
    • setLabelColor Link icon

      public void setLabelColor(Color aLabelColor)
      Sets the Color for the labels.
    • getMaximalZoomForGridDetail Link icon

      public double getMaximalZoomForGridDetail()
      The property maximalZoomForGridDetail determines at which zoom level the painter starts to draw the the 100km grid lines, and not only the contour of the TLcdUTMZone.
      Returns:
      the value of the property maximalZoomForGridDetail.
    • setMaximalZoomForGridDetail Link icon

      public void setMaximalZoomForGridDetail(double aMaximalZoomForGridDetail)
      The property maximalZoomForGridDetail determines at which zoom level the painter starts to draw the 100km grid lines, and not only the contour of the TLcdUTMZone. Sets the value of the property maximalZoomForGridDetail to aMaximalZoomForGridDetail.
      Parameters:
      aMaximalZoomForGridDetail - a double greater than zero indicating at which zoom level the painter starts to draw the 100km grid lines
    • getMinimalZoomForLabels Link icon

      public double getMinimalZoomForLabels()
      The property minimalZoomForLabels determines at which zoom level the painter starts to draw the labels.
      Returns:
      the value of the property minimalZoomForLabels.
    • setMinimalZoomForLabels Link icon

      public void setMinimalZoomForLabels(int aMinimalZoomForLabels)
      The property minimalZoomForLabels determines at which zoom level the painter starts to draw the labels. Sets the value of the property minimalZoomForLabels to aMinimalZoomForLabels.
      Parameters:
      aMinimalZoomForLabels - the level at which the painter starts to draw the labels
    • getScaleDistance Link icon

      public int getScaleDistance()
      The property scaleDistance determines the coarseness of the scale grid.
      Returns:
      the distance (in meters) between the grid lines of the scale grid.
    • getAutomaticRescaling Link icon

      public boolean getAutomaticRescaling()
      Returns whether the scale grid is to be painted at distances that are automatically calculated on the basis of the level of zoom (with a minimal distance of 1km).
    • setAutomaticRescaling Link icon

      public void setAutomaticRescaling(boolean aAutomaticRescaling)
      Specifies whether the scale grid is to be painted at distances that are automatically calculated on the basis of the level of zoom (with a minimal distance of 1km).
    • getQuickDraw Link icon

      public boolean getQuickDraw()
      Returns whether the scale grid is to be painted more quickly but less accurately.
    • setQuickDraw Link icon

      public void setQuickDraw(boolean aQuickDraw)
      Specifies whether the scale grid is to be painted more quickly but less accurately.
    • setScaleDistance Link icon

      public void setScaleDistance(int aScaleDistance)
      The property scaleDistance determines the coarseness of the scale grid.
      Parameters:
      aScaleDistance - the distance (in meters) between the grid lines of the scale grid. this should be either 10000, 1000, 100, 10 or 1.
    • setMinimalZoomForScales Link icon

      public void setMinimalZoomForScales(int aLimit)
      The property minimalZoomForScales determines at which zoom level the painter starts to draw the scale grid. Sets the value of the property minimalZoomForScales to aLimit.
    • getCornerLabelColor Link icon

      public Color getCornerLabelColor()
      Gets the Color for the labels which are situated at the corners of the view.
    • setCornerLabelColor Link icon

      public void setCornerLabelColor(Color aCornerLabelColor)
      Sets the Color for the labels which are situated at the corners of the view.
    • getCornerLabelFont Link icon

      public Font getCornerLabelFont()
      Returns the Font for the labels which are situated at the corners of the view.
      Returns:
      the Font for the labels which are situated at the corners of the view.
      See Also:
    • setCornerLabelFont Link icon

      public void setCornerLabelFont(Font aCornerLabelFont)
      Sets the Font for the labels which are situated at the corners of the view.
      Parameters:
      aCornerLabelFont - the new font value.
      See Also:
    • getMinimalZoomForScales Link icon

      public int getMinimalZoomForScales()
      The property minimalZoomForScales determines at which zoom level the painter starts to draw the the scale grid.
      Returns:
      the value of the property minimalZoomForScales.
    • getLabelFont Link icon

      public Font getLabelFont()
      Gets the Font for the labels.
    • setLabelFont Link icon

      public void setLabelFont(Font aLabelFont)
      Sets the Font for the labels.
    • isLabelHaloEnabled Link icon

      public boolean isLabelHaloEnabled()
      Returns whether the painter will add a halo effect around the grid labels.
      Returns:
      whether the painter will add a halo effect around the grid labels.
      See Also:
    • setLabelHaloEnabled Link icon

      public void setLabelHaloEnabled(boolean aHaloEnabled)
      Determines whether the painter will add a halo effect around the grid labels. By default, this property is set to false.
      Parameters:
      aHaloEnabled - a flag indicating whether to add a halo effect around the grid labels.
      See Also:
    • getLabelHaloThickness Link icon

      public int getLabelHaloThickness()
      Returns the thickness of the halo effect for the grid labels.
      Returns:
      the thickness of the halo effect for the grid labels.
      See Also:
    • setLabelHaloThickness Link icon

      public void setLabelHaloThickness(int aHaloThickness)
      Sets the thickness defined in pixels of the halo effect for the grid labels. By default, this property is set to 1.
      Parameters:
      aHaloThickness - the thickness defined in pixels of the halo effect for the grid labels.
      See Also:
    • getLabelHaloColor Link icon

      public Color getLabelHaloColor()
      Returns the color of the halo effect.
      Returns:
      the color of the halo effect.
      See Also:
    • setLabelHaloColor Link icon

      public void setLabelHaloColor(Color aHaloColor)
      Sets the color of the halo effect for the grid labels. By default, this property is set to Color.white.
      Parameters:
      aHaloColor - the color of the halo effect for the grid labels.
      See Also:
    • isTouched Link icon

      public boolean isTouched(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext)
      Always returns false.
      Specified by:
      isTouched in interface ILcdGXYPainter
      Parameters:
      aGraphics - the Graphics on which the representation of the object is painted
      aMode - the mode the object is represented in
      aGXYContext - contains the location of the interaction and the transformations to convert this location into model coordinates
      Returns:
      False.
      See Also:
    • setLocationIndex Link icon

      public void setLocationIndex(int aLocationIndex)
      Does nothing. There is only one possible location.
      Specified by:
      setLocationIndex in interface ILcdGXYLabelPainter
      Parameters:
      aLocationIndex - the index of the location. Must be between 0 and getPossibleLocationCount() - 1.
      See Also:
    • getLocationIndex Link icon

      public int getLocationIndex()
      Returns 0, the only possible location index.
      Specified by:
      getLocationIndex in interface ILcdGXYLabelPainter
      Returns:
      0, the only possible location index.
      See Also:
    • getPossibleLocationCount Link icon

      public int getPossibleLocationCount(Graphics aGraphics)
      Returns 1, there is only one possible location index.
      Specified by:
      getPossibleLocationCount in interface ILcdGXYLabelPainter
      Parameters:
      aGraphics - the Graphics the label will be painted on.
      Returns:
      1, there is only one possible location index.
      See Also:
    • labelBoundsSFCT Link icon

      public double labelBoundsSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, Rectangle aRectangleSFCT) throws TLcdNoBoundsException
      Sets the bounds to the bounds of the visible part of the ILcdGXYView.
      Specified by:
      labelBoundsSFCT in interface ILcdGXYLabelPainter
      Parameters:
      aGraphics - the aGraphics to consider.
      aMode - the representation mode of the label.
      aGXYContext - the ILcdGXYContext the drawing depends on.
      aRectangleSFCT - the Rectangle containing the bounds of the label in view / graphics coordinates as side effect.
      Returns:
      the angle orientation of the rectangle around the labels in RADIANs, clockwise, 0 at 3 o'clock.
      Throws:
      TLcdNoBoundsException - if the Object doesn't have any valid bounds, e.g. if it is always invisible in the current projection.
      See Also:
    • toString Link icon

      public String toString()
      Always returns "UTM grid painter".
      Overrides:
      toString in class Object
      Returns:
      "UTM grid painter"
    • clone Link icon

      public Object clone()
      Description copied from interface: ILcdCloneable

      Makes Object.clone() public.

      When for example extending from java.lang.Object, it can be implemented like this:
      
       public Object clone() {
         try {
           return super.clone();
         } catch ( CloneNotSupportedException e ) {
           // Cannot happen: extends from Object and implements Cloneable (see also Object.clone)
           throw new RuntimeException( e );
         }
       }
       
      Specified by:
      clone in interface ILcdCloneable
      Specified by:
      clone in interface ILcdGXYLabelPainter
      Specified by:
      clone in interface ILcdGXYPainterProvider
      Overrides:
      clone in class ALcdGXYPainter
      Returns:
      a clone of this painter provider.
      See Also: