com.esri.arcgis.enginecore
Class GraphicTracker

java.lang.Object
  extended by com.esri.arcgis.enginecore.GraphicTracker
All Implemented Interfaces:
IGraphicTracker, com.esri.arcgis.interop.RemoteObjRef, Serializable

public class GraphicTracker
extends Object
implements com.esri.arcgis.interop.RemoteObjRef, IGraphicTracker

A collection of Graphics that will be displayed on a Map or Globe

See Also:
Serialized Form

Constructor Summary
GraphicTracker()
          Constructs a GraphicTracker using ArcGIS Engine.
GraphicTracker(Object obj)
          Deprecated. As of ArcGIS 9.2, replaced by normal Java casts.
GraphicTracker theGraphicTracker = (GraphicTracker) obj;
 
Method Summary
 int add(IGeometry pGeometry, IGraphicTrackerSymbol pGraphicTrackerSymbol)
          Adds a new graphic from the given geometry and symbol.
 void addIActiveViewEventsListener(IActiveViewEvents theListener)
          addIActiveViewEventsListener.
 IGraphicTrackerSymbol createSymbol(ISymbol pSymbol2D, ISymbol pSymbol3D)
          Creates a Graphic Tracker symbol given a 2D and a 3D symbol.
 IGraphicTrackerSymbol createSymbolFromPath(String pathTo2D, String pathTo3D)
          Creates a Graphic Tracker symbol given a path to a 2D symbol and a path to a 3D symbol.
 boolean equals(Object o)
          Compare this object with another
static String getClsid()
          getClsid.
 int getCount()
          Indicates the number of graphics in the collection.
 int hashCode()
          the hashcode for this object
 void highlight(int id, boolean bHighlight)
          Emphasizes the graphic.
 int hitTest(int x, int y)
          Returns the ID of the first graphic touched by the input window coordinates.
 void initialize(Object pMapOrGlobe)
          Sets the Map or Globe that will be used to render the Graphic Tracker.
 boolean isSuspendUpdate()
          Disables automatic refreshing of the display until unsuspended or until the display is explicitly refreshed.
 void moveTo(int id, double x, double y, double z)
          Moves the given graphic to the location specified by the input map coordinates.
 void remove(int id)
          Removes the graphic specified by the supplied ID.
 void removeAll()
          Removes all graphics from the collection.
 void removeIActiveViewEventsListener(IActiveViewEvents theListener)
          removeIActiveViewEventsListener.
 void replace(int id, IGeometry pGeometry, IGraphicTrackerSymbol pGraphicTrackerSymbol)
          Creates a new graphic which will replace the element specified by the given ID.
 void setElevationMode(int id, int eElevation)
          Sets the elevation mode for the given graphic.
 void setGeometry(int id, IGeometry pGeometry)
          Sets a new geometry for the given graphic.
 void setLabel(int id, String newLabel)
          Sets a label for the given graphic.
 void setOrientationMode(int id, int eOrientation)
          Sets the orientation mode for the given graphic.
 void setPointOrientation(int id, double dPitch, double dRoll, double dYaw)
          Sets the orientation for the given point graphic.
 void setPointSymbolSize(int id, double size)
          Sets the symbol size for the given point graphic.
 void setScaleMode(int id, int eScale)
          Sets the scaling mode for the given graphic.
 void setSuspendUpdate(boolean suspendUpdate)
          Disables automatic refreshing of the display until unsuspended or until the display is explicitly refreshed.
 void setSymbol(int id, IGraphicTrackerSymbol pGraphicTrackerSymbol)
          Sets a new symbol for the given graphic.
 void setTextSymbol(int id, ISimpleTextSymbol pSymbol)
          Sets the text symbol for the given graphic.
 void setTransparency(int id, int lTransparency)
          Sets the transparency for the given graphic.
 void setVisible(int id, boolean bVisible)
          Sets the visibility for the given graphic.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.esri.arcgis.interop.RemoteObjRef
getJintegraDispatch, release
 

Constructor Detail

GraphicTracker

public GraphicTracker()
               throws IOException,
                      UnknownHostException
Constructs a GraphicTracker using ArcGIS Engine.

Throws:
IOException - if there are interop problems
UnknownHostException - if there are interop problems

GraphicTracker

public GraphicTracker(Object obj)
               throws IOException
Deprecated. As of ArcGIS 9.2, replaced by normal Java casts.
GraphicTracker theGraphicTracker = (GraphicTracker) obj;

Construct a GraphicTracker using a reference to such an object returned from ArcGIS Engine or Server. This is semantically equivalent to casting obj to GraphicTracker.

Parameters:
obj - an object returned from ArcGIS Engine or Server
Throws:
IOException - if there are interop problems
Method Detail

getClsid

public static String getClsid()
getClsid.


equals

public boolean equals(Object o)
Compare this object with another

Overrides:
equals in class Object

hashCode

public int hashCode()
the hashcode for this object

Overrides:
hashCode in class Object

addIActiveViewEventsListener

public void addIActiveViewEventsListener(IActiveViewEvents theListener)
                                  throws IOException
addIActiveViewEventsListener. Listen to events generated by this class.

Parameters:
theListener - An object that implements the com.esri.arcgis.carto.IActiveViewEvents interface.
Throws:
IOException - If there are communications problems.

removeIActiveViewEventsListener

public void removeIActiveViewEventsListener(IActiveViewEvents theListener)
                                     throws IOException
removeIActiveViewEventsListener. Stop listening to events generated by this class.

Parameters:
theListener - An object that implements the com.esri.arcgis.carto.IActiveViewEvents interface.
Throws:
IOException - If there are communications problems.

getCount

public int getCount()
             throws IOException,
                    AutomationException
Indicates the number of graphics in the collection.

Description

The number of graphics tracked.

Specified by:
getCount in interface IGraphicTracker
Returns:
The count
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

createSymbol

public IGraphicTrackerSymbol createSymbol(ISymbol pSymbol2D,
                                          ISymbol pSymbol3D)
                                   throws IOException,
                                          AutomationException
Creates a Graphic Tracker symbol given a 2D and a 3D symbol.

Specified by:
createSymbol in interface IGraphicTracker
Parameters:
pSymbol2D - A reference to a com.esri.arcgis.display.ISymbol (in)
pSymbol3D - A reference to a com.esri.arcgis.display.ISymbol (in)
Returns:
A reference to a com.esri.arcgis.enginecore.IGraphicTrackerSymbol
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

createSymbolFromPath

public IGraphicTrackerSymbol createSymbolFromPath(String pathTo2D,
                                                  String pathTo3D)
                                           throws IOException,
                                                  AutomationException
Creates a Graphic Tracker symbol given a path to a 2D symbol and a path to a 3D symbol.

Specified by:
createSymbolFromPath in interface IGraphicTracker
Parameters:
pathTo2D - The pathTo2D (in)
pathTo3D - The pathTo3D (in)
Returns:
A reference to a com.esri.arcgis.enginecore.IGraphicTrackerSymbol
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

add

public int add(IGeometry pGeometry,
               IGraphicTrackerSymbol pGraphicTrackerSymbol)
        throws IOException,
               AutomationException
Adds a new graphic from the given geometry and symbol. The returned Id should be used to manage the graphic.

Description

Adds the symbol and geomety to be tracked and returns an integer used to identify the graphic. Only geometries which support IPoint, IPolyline and IPolygon can be added. The Graphic Tracker holds an internal copy of each geometry and symbol supplied to it. The symbol must be appropriate for the geometry type; i.e. use fill symbols, not point symbols, to represent polygon geometries.The first graphic added will appear underneath subsequent graphics if they have overlapping display areas.

Specified by:
add in interface IGraphicTracker
Parameters:
pGeometry - A reference to a com.esri.arcgis.geometry.IGeometry (in)
pGraphicTrackerSymbol - A reference to a com.esri.arcgis.enginecore.IGraphicTrackerSymbol (in)
Returns:
The id
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

remove

public void remove(int id)
            throws IOException,
                   AutomationException
Removes the graphic specified by the supplied ID.

Description

Removes the graphic; so it is no longer tracked.

Specified by:
remove in interface IGraphicTracker
Parameters:
id - The id (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

removeAll

public void removeAll()
               throws IOException,
                      AutomationException
Removes all graphics from the collection.

Description

Removes all graphics; so they are no longer tracked.

Specified by:
removeAll in interface IGraphicTracker
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

replace

public void replace(int id,
                    IGeometry pGeometry,
                    IGraphicTrackerSymbol pGraphicTrackerSymbol)
             throws IOException,
                    AutomationException
Creates a new graphic which will replace the element specified by the given ID.

Description

Replaces both the symbol and geometry associated with a graphic.

Specified by:
replace in interface IGraphicTracker
Parameters:
id - The id (in)
pGeometry - A reference to a com.esri.arcgis.geometry.IGeometry (in)
pGraphicTrackerSymbol - A reference to a com.esri.arcgis.enginecore.IGraphicTrackerSymbol (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

initialize

public void initialize(Object pMapOrGlobe)
                throws IOException,
                       AutomationException
Sets the Map or Globe that will be used to render the Graphic Tracker.

Description

Initializes the Graphic Tracker to use either a map or globe. In 2D, setting a reference scale to the map will set it to the GT as well.

Specified by:
initialize in interface IGraphicTracker
Parameters:
pMapOrGlobe - A reference to another Object (IUnknown) (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setLabel

public void setLabel(int id,
                     String newLabel)
              throws IOException,
                     AutomationException
Sets a label for the given graphic.

Description

Sets a text label for the graphic. If you don't use the SetTextSymbol() method first then a default text symbol will be used. Call SetLabel with an empty string to remove the label.

Specified by:
setLabel in interface IGraphicTracker
Parameters:
id - The id (in)
newLabel - The newLabel (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setGeometry

public void setGeometry(int id,
                        IGeometry pGeometry)
                 throws IOException,
                        AutomationException
Sets a new geometry for the given graphic.

Specified by:
setGeometry in interface IGraphicTracker
Parameters:
id - The id (in)
pGeometry - A reference to a com.esri.arcgis.geometry.IGeometry (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setSymbol

public void setSymbol(int id,
                      IGraphicTrackerSymbol pGraphicTrackerSymbol)
               throws IOException,
                      AutomationException
Sets a new symbol for the given graphic.

Specified by:
setSymbol in interface IGraphicTracker
Parameters:
id - The id (in)
pGraphicTrackerSymbol - A reference to a com.esri.arcgis.enginecore.IGraphicTrackerSymbol (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setScaleMode

public void setScaleMode(int id,
                         int eScale)
                  throws IOException,
                         AutomationException
Sets the scaling mode for the given graphic.

Specified by:
setScaleMode in interface IGraphicTracker
Parameters:
id - The id (in)
eScale - A com.esri.arcgis.enginecore.esriGTScale constant (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setOrientationMode

public void setOrientationMode(int id,
                               int eOrientation)
                        throws IOException,
                               AutomationException
Sets the orientation mode for the given graphic.

Specified by:
setOrientationMode in interface IGraphicTracker
Parameters:
id - The id (in)
eOrientation - A com.esri.arcgis.enginecore.esriGTOrientation constant (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setElevationMode

public void setElevationMode(int id,
                             int eElevation)
                      throws IOException,
                             AutomationException
Sets the elevation mode for the given graphic.

Specified by:
setElevationMode in interface IGraphicTracker
Parameters:
id - The id (in)
eElevation - A com.esri.arcgis.enginecore.esriGTElevation constant (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setVisible

public void setVisible(int id,
                       boolean bVisible)
                throws IOException,
                       AutomationException
Sets the visibility for the given graphic.

Description

Sets the graphic to be visible or invisible.

Specified by:
setVisible in interface IGraphicTracker
Parameters:
id - The id (in)
bVisible - The bVisible (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setTransparency

public void setTransparency(int id,
                            int lTransparency)
                     throws IOException,
                            AutomationException
Sets the transparency for the given graphic.

Description

Sets the graphic to be transparent or not. This is used only in 2D mode and only if the graphic's symbol supports ISymbolEffects.

Specified by:
setTransparency in interface IGraphicTracker
Parameters:
id - The id (in)
lTransparency - The lTransparency (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setTextSymbol

public void setTextSymbol(int id,
                          ISimpleTextSymbol pSymbol)
                   throws IOException,
                          AutomationException
Sets the text symbol for the given graphic.

Description

Sets the text symbol which will be used for the graphic's label.

Specified by:
setTextSymbol in interface IGraphicTracker
Parameters:
id - The id (in)
pSymbol - A reference to a com.esri.arcgis.display.ISimpleTextSymbol (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setPointOrientation

public void setPointOrientation(int id,
                                double dPitch,
                                double dRoll,
                                double dYaw)
                         throws IOException,
                                AutomationException
Sets the orientation for the given point graphic. Note that the orientation will only be applied if the graphic has its orientation mode set to esriGTOrientationFixed.

Description

Sets the point symbol's orientation to the supplied pitch, roll and yaw values. This applies only if the graphic's orientation is fixed using the SetOrientation() method. In 2D, only the yaw value is used.

Specified by:
setPointOrientation in interface IGraphicTracker
Parameters:
id - The id (in)
dPitch - The dPitch (in)
dRoll - The dRoll (in)
dYaw - The dYaw (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setPointSymbolSize

public void setPointSymbolSize(int id,
                               double size)
                        throws IOException,
                               AutomationException
Sets the symbol size for the given point graphic.

Description

Sets the point symbol's size without the need to create an additional graphic tracker symbol.

Specified by:
setPointSymbolSize in interface IGraphicTracker
Parameters:
id - The id (in)
size - The size (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

highlight

public void highlight(int id,
                      boolean bHighlight)
               throws IOException,
                      AutomationException
Emphasizes the graphic.

Description

Highlights or unhighlights the graphic. More than one graphic can be highlighted at a time.

Specified by:
highlight in interface IGraphicTracker
Parameters:
id - The id (in)
bHighlight - The bHighlight (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

hitTest

public int hitTest(int x,
                   int y)
            throws IOException,
                   AutomationException
Returns the ID of the first graphic touched by the input window coordinates.

Description

Returns the id of the graphic that was hit or -1 if no graphic was hit.

Specified by:
hitTest in interface IGraphicTracker
Parameters:
x - The x (in)
y - The y (in)
Returns:
The id
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

moveTo

public void moveTo(int id,
                   double x,
                   double y,
                   double z)
            throws IOException,
                   AutomationException
Moves the given graphic to the location specified by the input map coordinates.

Description

Moves the point, polyline or polygon geometry associated with a graphic according to its centroid's location. In 2D, the z-value is not used.

Specified by:
moveTo in interface IGraphicTracker
Parameters:
id - The id (in)
x - The x (in)
y - The y (in)
z - The z (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isSuspendUpdate

public boolean isSuspendUpdate()
                        throws IOException,
                               AutomationException
Disables automatic refreshing of the display until unsuspended or until the display is explicitly refreshed. Suspending automatic refresh is ideal before bulk updates.

Description

Suspends update (i.e refresh) of the display. This property is false by default. This means the GraphicTracker will automatically refresh the display after each graphic is changed.
Setting this property to true, moving the graphics and then setting this property to false will result in one refresh call and will draw all graphics at once. In an dynamic map, this property is not relevant.

Specified by:
isSuspendUpdate in interface IGraphicTracker
Returns:
The suspendUpdate
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setSuspendUpdate

public void setSuspendUpdate(boolean suspendUpdate)
                      throws IOException,
                             AutomationException
Disables automatic refreshing of the display until unsuspended or until the display is explicitly refreshed. Suspending automatic refresh is ideal before bulk updates.

Description

Suspends update (i.e refresh) of the display. This property is false by default. This means the GraphicTracker will automatically refresh the display after each graphic is changed.
Setting this property to true, moving the graphics and then setting this property to false will result in one refresh call and will draw all graphics at once. In an dynamic map, this property is not relevant.

Specified by:
setSuspendUpdate in interface IGraphicTracker
Parameters:
suspendUpdate - The suspendUpdate (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.