Class TLcdGXYRoutePainter

All Implemented Interfaces:
ILcdCloneable, ILcdDeepCloneable, ILcdPropertyChangeSource, ILcdGXYEditor, ILcdGXYEditorProvider, ILcdGXYPainter, ILcdGXYPainterProvider, ILcdGXYPathPainter, Serializable, Cloneable

public class TLcdGXYRoutePainter extends TLcdGXYShapeListPainter
This extension of TLcdGXYShapeListPainter paints ILcdShapeList objects whose shapes are themselves ILcdPointList implementations. Optionally, an icon can be painted on each point in the point lists. Painting of the icons is delegated to another painter, which can be set using the setPointPainter() method.
See Also:
  • Constructor Details

    • TLcdGXYRoutePainter

      public TLcdGXYRoutePainter()
      Constructs a new TLcdGXYRoutePainter object. A TLcdGXYPointListPainter is initialized to paint the routes as polylines and set to be the editor provider and the painter provider of this TLcdGXYShapeListPainter.
  • Method Details

    • clone

      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 ILcdGXYEditorProvider
      Specified by:
      clone in interface ILcdGXYPainterProvider
      Overrides:
      clone in class TLcdGXYShapeListPainter
      Returns:
      a clone of this painter provider.
      See Also:
    • getLineStyle

      public ILcdGXYPainterStyle getLineStyle()
      Returns the line style of this painter.
      Returns:
      the line style of this painter.
    • setLineStyle

      public void setLineStyle(ILcdGXYPainterStyle aStyle)
      Sets the line style of this painter.
      Parameters:
      aStyle - the line style of this painter.
    • paint

      public void paint(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext)
      Description copied from class: TLcdGXYShapeListPainter
      Displays the representation of the object in the given mode on the Graphics passed, taking into account the context passed.

      This implementation will retrieve a painter for all ILcdShape objects inside the ILcdShapeList object using the retrieveShapePainter method and will use that painter to paint the corresponding shape.

      Specified by:
      paint in interface ILcdGXYPainter
      Overrides:
      paint in class TLcdGXYShapeListPainter
      Parameters:
      aGraphics - The graphics to paint the object on.
      aMode - The mode to render the object in.
      aGXYContext - The context to render the object in.
    • getGXYPainter

      public ILcdGXYPainter getGXYPainter(Object aObject)
      Description copied from interface: ILcdGXYPainterProvider
      Finds an ILcdGXYPainter that can be used to paint or locate the object passed.

      The painter provider is responsible for setting the object to the painter before returning the painter. An implementation should therefore have the following structure:

      
       public ILcdGXYPainter getGXYPainter(Object aObject) {
         ILcdGXYPainter painter = ... // find the painter for the object
         if (painter != null) {
          painter.setObject(aObject);
         }
         return painter;
       }
       

      Specified by:
      getGXYPainter in interface ILcdGXYPainterProvider
      Overrides:
      getGXYPainter in class ALcdGXYPainter
      Parameters:
      aObject - the object to find a painter for
      Returns:
      a painter that can be used to paint or locate the object; or null if no painter could be found for the given object, or the object could not be set on the retrieved painter.
    • setPointPainter

      public void setPointPainter(ILcdGXYPainter aPainter)
      Sets the painter used to paint icons on the points of a route. Set this to null to disable icon painting.
      Parameters:
      aPainter - an ILcdGXYPainter that must be able to paint ILcdPoint objects.
    • getPointPainter

      public ILcdGXYPainter getPointPainter()
      Returns the painter used to paint icons on the points of a route.
      Returns:
      the ILcdGXYPainter used to paint the points of a route.