Class TLcdMapRulerController

All Implemented Interfaces:
ILcdUndoableSource, ILcdStatusSource, ILcdGXYController, KeyListener, MouseListener, MouseMotionListener, Serializable, EventListener

public class TLcdMapRulerController extends ALcdGXYSmartController implements MouseListener, MouseMotionListener
This ILcdGXYController interprets mouse events for displaying a distance between points on the screen and the circle spanning the given distance.

Another, more advanced, ruler controller is available as well. Please refer to TLcdAdvancedMapRulerController.

Using this ILcdGXYController method makes sense only when the ILcdGXYView it interacts with has a ILcdXYWorldReference that is an instance of ILcdGridReference.

If the property popupDialog is true, it pops up a Dialog in which the distance and azimuth of the last geodesic segment drawn, as well as the total distance of all segments are displayed.

Redefines formatDistance and formatAzimuth if you need to display these values with a specific unit of measure.

Redefine displayLastSegmentDistance, displayLastSegmentAzimuth and displayTotalDistance if you need to display all or some of these values differently.

See Also:
  • Constructor Details

    • TLcdMapRulerController

      public TLcdMapRulerController()
      Deprecated.
      Default constructor for a TLcdMapRulerController .
    • TLcdMapRulerController

      public TLcdMapRulerController(boolean aRegisterFlag)
      Deprecated.
      use the constructor without parameters.
      Parameters:
      aRegisterFlag - whether to register this class as a bean or not.
  • Method Details

    • setTraceOn

      public void setTraceOn(boolean aTraceOn)
      Deprecated.
      This method has been deprecated. It is recommended to use the standard Java logging framework directly.
      Enables tracing for this class instance. Calling this method with either true or false as argument automatically turns off tracing for all other class instances for which setTraceOn has not been called. If the argument is false then only the informative, warning and error log messages are recorded.
      Overrides:
      setTraceOn in class ALcdGXYSmartController
      Parameters:
      aTraceOn - if true then all log messages are recorded for this instance. If false, then only the informative, warning and error log messages are recorded.
    • isTraceOn

      public boolean isTraceOn()
      Deprecated.
      This method has been deprecated. It is recommended to use the standard Java logging framework directly.
      Returns true if tracing is enabled for this class.
      Overrides:
      isTraceOn in class ALcdGXYSmartController
      Returns:
      true if tracing is enabled for this class, false otherwise.
    • startInteraction

      public void startInteraction(ILcdGXYView aGXYView)
      Deprecated.
      This method calls super.startInteraction( aGXYView ). Then, if the property popupDialog is true, it pops up a Dialog in which the distance and azimuth of the last geodesic segment drawn, as well as the total distance of all segments are displayed.

      Redefines formatDistance and formatAzimuth if you need to display these values with a specific unit of measure.

      Redefine displayLastSegmentDistance, displayLastSegmentAzimuth and displayTotalDistance if you need to display all or some of these values differently.

      Specified by:
      startInteraction in interface ILcdGXYController
      Overrides:
      startInteraction in class ALcdGXYSmartController
      Parameters:
      aGXYView - the ILcdGXYView this ILcdGXYController will interact with.
      See Also:
    • terminateInteraction

      public void terminateInteraction(ILcdGXYView aGXYView)
      Deprecated.
      Description copied from class: ALcdGXYController
      Releases a few items. Can be redefined but this 'super' method should be called too.
      Specified by:
      terminateInteraction in interface ILcdGXYController
      Overrides:
      terminateInteraction in class ALcdGXYSmartController
      Parameters:
      aGXYView - the ILcdGXYView this ILcdGXYController interacted with.
      See Also:
    • mousePressed

      public void mousePressed(MouseEvent me)
      Deprecated.
      Specified by:
      mousePressed in interface MouseListener
      Overrides:
      mousePressed in class ALcdGXYSmartController
    • mouseMoved

      public void mouseMoved(MouseEvent me)
      Deprecated.
      The mouse movement calculates and displays the new distances and calls a repaint on the view, forcing a paint of this controller.
      Specified by:
      mouseMoved in interface MouseMotionListener
      Overrides:
      mouseMoved in class ALcdGXYSmartController
    • paint

      public void paint(Graphics aGraphics)
      Deprecated.
      Draws of a line between the mouse click points on the screen and the drawing of the circle spanning the distance between the last mouse clicking point and the current position ( if isDrawEqualDistanceCurve() is true ).
      Specified by:
      paint in interface ILcdGXYController
      Overrides:
      paint in class ALcdGXYController
      Parameters:
      aGraphics - the Graphics on which the view was rendered.
    • displayLastSegmentDistance

      protected void displayLastSegmentDistance(double aDistance, MouseEvent me)
      Deprecated.
      See Also:
    • displayLastSegmentAzimuth

      protected void displayLastSegmentAzimuth(double aAzimuth, MouseEvent me)
      Deprecated.
      See Also:
    • displayTotalDistance

      protected void displayTotalDistance(double aDistance, MouseEvent me)
      Deprecated.
      See Also:
    • mouseReleased

      public void mouseReleased(MouseEvent me)
      Deprecated.
      A mouse release causes the last location to be added to the list of points that are going to be linked. A repetitive mouse release resets the list of points.
      Specified by:
      mouseReleased in interface MouseListener
      Overrides:
      mouseReleased in class ALcdGXYSmartController
    • calculateDistance

      protected double calculateDistance(int aFromX, int aFromY, int aToX, int aToY)
      Deprecated.
      Calculates the model distance in meters between the model locations that are on screen at[aFromX,aFromY] and [aTox,aToY].

      Using this method only makes sense when the ILcdGXYView this ILcdGXYController interacts with has a ILcdGridReference as a ILcdXYWorldReference.

      Parameters:
      aFromX - the first coordinate of the first point
      aFromY - the second coordinate of the first point
      aToX - the first coordinate of the second point
      aToY - the second coordinate of the second point
      Returns:
      a distance in meters or -1.
    • calculateAzimuth

      protected double calculateAzimuth(int aFromX, int aFromY, int aToX, int aToY)
      Deprecated.
      Calculates the azimuth between the model locations that are on screen at[aFromX,aFromY] and [aTox,aToY].

      Using this method makes sense only when the ILcdGXYView this ILcdGXYController interacts with has a ILcdGridReference as a ILcdXYWorldReference.

      Parameters:
      aFromX - the first coordinate of the first point
      aFromY - the second coordinate of the first point
      aToX - the first coordinate of the second point
      aToY - the second coordinate of the second point
    • formatDistance

      protected String formatDistance(double aDistance, MouseEvent me)
      Deprecated.
      Format the model distance aDistance in meters as a String. Redefine this method to have the distances displayed with another unit of measure.
      Parameters:
      aDistance - the distance to format, expressed in meters.
      me - the mouse event that could have caused the distance to change. Note that this may be null. This argument is not used in this implementation.
      Returns:
      the distance in meters if distance < 100000, in Km otherwise
    • formatAzimuth

      protected String formatAzimuth(double aAzimuth, MouseEvent me)
      Deprecated.
      Format the model azimuth aAzimuth in radians as a String. Redefine this method to have the distances displayed with another unit of measure.
      Parameters:
      aAzimuth - the azimuth between two points, expressed in radians !
      me - the mouse event that could have caused the distance to change. Note that this may be null. This argument is not used in this implementation.
      Returns:
      the azimuth expressed in degrees, between 0 and 360 degrees.
    • doPanGXYView

      protected void doPanGXYView(int aDeltaX, int aDeltaY)
      Deprecated.
      Description copied from class: ALcdGXYSmartController
      Performs the pan of this ILcdGXYController ILcdGXYView
      Overrides:
      doPanGXYView in class ALcdGXYSmartController
      Parameters:
      aDeltaX - delta along the X axis, in AWT pixels
      aDeltaY - delta along the Y axis, in AWT pixels
    • doZoomGXYView

      protected void doZoomGXYView(double aDoubleFactor)
      Deprecated.
      Description copied from class: ALcdGXYSmartController
      Performs the zoom of this ILcdGXYController ILcdGXYView
      Overrides:
      doZoomGXYView in class ALcdGXYSmartController
      Parameters:
      aDoubleFactor - zoom factor with which to multiply the view's scale
    • getLastSegmentDistance

      public double getLastSegmentDistance()
      Deprecated.
      Returns:
      the distance of the last geodesic lines drawn. Calling that method can be useful when redefining the mouseMoved method for instance.
    • getLastSegmentAzimuth

      public double getLastSegmentAzimuth()
      Deprecated.
      Returns:
      the azimuth of the last geodesic lines drawn. Calling that method can be useful when redefining the mouseMoved method for instance.
    • getTotalDistance

      public double getTotalDistance()
      Deprecated.
      Returns:
      the current total distance of all geodesic lines drawn. Calling that method can be useful when redefining the mouseMoved method for instance.
    • undo

      public void undo()
      Deprecated.
      Performs no action.
    • setGhostColor

      public void setGhostColor(Color aGhostColor)
      Deprecated.
      Sets the color of the lines and circles that will be rendered to graphically display the distances on the map.
      Parameters:
      aGhostColor - the color of the lines and circles that will be rendered
      See Also:
    • getGhostColor

      public Color getGhostColor()
      Deprecated.
      Returns the color of the lines and circles that will be rendered to graphically display the distances on the map.
      Returns:
      the color of the lines and circles that will be rendered
      See Also:
    • setGhostLineWidth

      public void setGhostLineWidth(int aGhostLineWidth)
      Deprecated.
      GhostLineWidth is the property that holds the width of the lines and circle that are drawn. This property has an effect only for JVM versions upper that 1.2. For lower versions, the line width will be always 1.
      Parameters:
      aGhostLineWidth - the line width to set.
    • getGhostLineWidth

      public int getGhostLineWidth()
      Deprecated.
      GhostLineWidth is the property that holds the width of the lines and circle that are drawn. This property has an effect only for JVM versions upper that 1.2 For lower versions, the line width will be always 1.
      Returns:
      the current line width.
    • isDrawEqualDistanceCurve

      public boolean isDrawEqualDistanceCurve()
      Deprecated.
      The property drawEqualDistanceCurve determines whether to draw the circle.
      Returns:
      true if drawEqualDistanceCurve is true, else false is returned.
    • setDrawEqualDistanceCurve

      public void setDrawEqualDistanceCurve(boolean aDrawEqualDistanceCurve)
      Deprecated.
      Sets whether to render a curve representing points at an equal distance of the last point.
      Parameters:
      aDrawEqualDistanceCurve - true to have a curve rendered that shows points at equal distance of the last point.
    • isPopupDialog

      public boolean isPopupDialog()
      Deprecated.
      Returns whether a dialog should be shown displaying the values available in this controller.
      Returns:
      whether a dialog should be shown displaying the values available in this controller.
      See Also:
    • setPopupDialog

      public void setPopupDialog(boolean aPopupDialog)
      Deprecated.
      Sets whether a dialog should be shown displaying the values available in this controller. Default value is true.
      Parameters:
      aPopupDialog - true to have a dialog displaying the values available in this controller.
      See Also:
    • setDrawGeodesicLine

      public void setDrawGeodesicLine(boolean aDrawGeodesicLine)
      Deprecated.
      Sets whether to render lines of shortest distance between the points.
      Parameters:
      aDrawGeodesicLine - true to render lines of shortest distance between the points.
    • isDrawGeodesicLine

      public boolean isDrawGeodesicLine()
      Deprecated.
      The property drawGeodesicLine determines whether to draw the lines.
      Returns:
      true if drawGeodesicLine is true, else false is returned.
    • setActionListenerOnDoubleClick

      public void setActionListenerOnDoubleClick(ActionListener aActionListener)
      Deprecated.
    • getActionListenerOnDoubleClick

      public ActionListener getActionListenerOnDoubleClick()
      Deprecated.