com.partnersoft.maps.ephemera
Class SnapWithDistance

java.lang.Object
  extended by com.partnersoft.maps.ephemera.SnapWithDistance
All Implemented Interfaces:
Ephemeron

public class SnapWithDistance
extends java.lang.Object
implements Ephemeron

Rubber-banding ephemeron, draws a line stretching between some anchor point and the current mouse position, or snaps to a nearby object matching passed parameters.

Copyright 2007 Paul Reavis

Version:
$Id$
Author:
Rich Stepanski

Field Summary
protected  XyPoint anchor
           
protected  MapApp app
           
protected  StretchFromPointWithDistance nonSnapEphemeron
           
protected  NameSet targetDataTypes
           
protected  java.lang.String targetMapset
           
 
Constructor Summary
SnapWithDistance(MapApp app, XyPoint anchor, NameSet targetDataTypes, java.lang.String targetMapset, java.lang.String lineStyle, java.lang.String textStyle)
          Creates a new SnapWithDistance object.
 
Method Summary
 void draw(DrawingSurface surface, MapViewFrame frame, XyPoint mousePosition)
          Draw appropriate graphics on the given surface with the given frame, mouse position, and any implementation-specific internal state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

anchor

protected XyPoint anchor

nonSnapEphemeron

protected StretchFromPointWithDistance nonSnapEphemeron

targetMapset

protected java.lang.String targetMapset

targetDataTypes

protected NameSet targetDataTypes

app

protected MapApp app
Constructor Detail

SnapWithDistance

public SnapWithDistance(MapApp app,
                        XyPoint anchor,
                        NameSet targetDataTypes,
                        java.lang.String targetMapset,
                        java.lang.String lineStyle,
                        java.lang.String textStyle)
Creates a new SnapWithDistance object.

Parameters:
app - - Valid app.
anchor - - Point to draw from.
targetDataTypes - - data types to attempt to snap to.
targetMapset - - name of mapset containing target data types.
lineStyle - - line style to draw. Passed to StretchFromPointsWithDistance.
textStyle - - text style to draw. Passed to StretchFromPointsWithDistance.
Method Detail

draw

public void draw(DrawingSurface surface,
                 MapViewFrame frame,
                 XyPoint mousePosition)
Description copied from interface: Ephemeron
Draw appropriate graphics on the given surface with the given frame, mouse position, and any implementation-specific internal state. The drawing surface is set up with the given frame, and is in map coordinates (not pixels).

Specified by:
draw in interface Ephemeron