com.esri.arcgis.editor
Class IEditSketchProxy

java.lang.Object
  extended by com.esri.arcgis.interop.Dispatch
      extended by com.esri.arcgis.editor.IEditSketchProxy
All Implemented Interfaces:
IEditSketch, Externalizable, Serializable
Direct Known Subclasses:
IEditSketch2Proxy

public class IEditSketchProxy
extends com.esri.arcgis.interop.Dispatch
implements IEditSketch, Serializable

Provides access to members that access and manipulate the edit sketch.

Superseded By

IEditSketch3

Remarks

The IEditSketch interface is on the Editor CoClass.

Edit tasks set the geometry type of the edit sketch, and the sketch tools add points to that geometry. For example, the Create New Feature task sets the edit sketch geometry type to be the same as the geometry type of the target layer. In contrast, the Select Features Using a Line task always sets the edit sketch geometry type to esriGeometryPolyline, with no regard to the current layer geometry type.

Edit tasks often set the edit sketch geometry to esriGeometryNull, causing the sketch tools to become inactive. For example, the Reshape task will set the edit sketch geometry to esriGeometryNull if there are no polygon or polyline features selected. This prevents users from creating an edit sketch that would otherwise do nothing. Edit tasks respond to editor events such as OnSelectionChanged and OnCurrentLayerChanged to accomplish this.

When To Use

The purpose of the IEditSketch interface is to manage a geometry that will be used extensively by the editor. Ultimately, the editor's current task takes the geometry to perform some action; for example, the CreateNewFeature task takes the geometry and stores it in the database as a new feature.

The editor automatically creates a new empty geometry. The type of geometry created is the same as the editor's current layer (IEditor::CurrentLayer ). Use the AddPoint method to build (add data to) the edit sketch geometry and FinishSketch to signal the current task that the geometry is ready for use. To bring an existing feature into the edit sketch, set the Geometry property to the desired feature and call RefreshSketch .

Product Availability

Available with ArcGIS Desktop.

See Also:
ISnapEnvironment, IEditProperties, IFeatureClass.getShapeType(), IEditTask.activate(com.esri.arcgis.editor.IEditor, com.esri.arcgis.editor.IEditTask), IEditor, IGeometry, IEditLayers, IEditTask.deactivate(), IEditAttributeProperties, IEditEvents2, IEditTask.onFinishSketch(), IDatasetEdit, IDatasetEditInfo, IEditTask.onDeleteSketch(), IEditTask.getName(), IEditEvents, Editor, esriGeometryType, IEditSketch, Serialized Form

Field Summary
 boolean noncastable
           
 
Fields inherited from class com.esri.arcgis.interop.Dispatch
DISPATCH_METHOD, DISPATCH_PROPERTYGET, DISPATCH_PROPERTYPUT, DISPATCH_PROPERTYPUTREF, objRef
 
Constructor Summary
  IEditSketchProxy()
           
  IEditSketchProxy(Object obj)
           
protected IEditSketchProxy(Object obj, String iid)
           
 
Method Summary
 void addListener(String iidStr, Object theListener, Object theSource)
           
 void addPoint(IPoint point, boolean allowUndo)
          Adds a point to the edit sketch.
 void finishSketch()
          Completes the current edit sketch.
 void finishSketchPart()
          Completes a part for the current edit sketch.
 IGeometry getGeometry()
          Geometry stored in the edit sketch.
 int getGeometryType()
          Type of the geometry stored in the edit sketch.
 IPoint getLastPoint()
          The last point in the edit sketch.
 int getPart()
          The index of the current part of the sketch.
 int getSegment()
          The index of the current segment of the sketch.
 int getVertex()
          The index of the current vertex of the sketch.
 void modifySketch()
          Call to notify listeners that the sketch has been changed.
 void refreshSketch()
          Invalidates the portion of the display that is occupied by the sketch.
 void removeListener(String iidStr, Object theListener)
           
 void setGeometryByRef(IGeometry geometry)
          Geometry stored in the edit sketch.
 void setGeometryType(int geomType)
          Type of the geometry stored in the edit sketch.
 
Methods inherited from class com.esri.arcgis.interop.Dispatch
bindUsingMoniker, constructVtblPosTable, convertToNative, cookieForListener, createDispatch, createObjrefMonikerDisplayName, equals, getActiveObject, getActiveObject, getDefaultProperty, getDispatchIdOfName, getLastErrorCode, getMtsObjectContext, getObjRef, getPropertyByName, getPropertyByName, getVtblPos, hashCode, initDispatch, invoke, invokeMethodByName, invokeMethodByName, invokeMethodByName, invokePropertyGetByName, invokePropertyPutByName, invokePropertyPutByRefByName, isNativeMode, isObjRef, optimizedVtblInvoke, queryInterface, readExternal, release, setNativeMode, setPropertyByName, toString, vtblInvoke, writeExternal
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

noncastable

public boolean noncastable
Constructor Detail

IEditSketchProxy

public IEditSketchProxy()

IEditSketchProxy

public IEditSketchProxy(Object obj)
                 throws IOException
Throws:
IOException

IEditSketchProxy

protected IEditSketchProxy(Object obj,
                           String iid)
                    throws IOException
Throws:
IOException
Method Detail

addListener

public void addListener(String iidStr,
                        Object theListener,
                        Object theSource)
                 throws IOException
Overrides:
addListener in class com.esri.arcgis.interop.Dispatch
Throws:
IOException

removeListener

public void removeListener(String iidStr,
                           Object theListener)
                    throws IOException
Overrides:
removeListener in class com.esri.arcgis.interop.Dispatch
Throws:
IOException

getPart

public int getPart()
            throws IOException,
                   AutomationException
The index of the current part of the sketch.

Remarks

You must right-click on the desired part of the edit sketch to set this property correctly. The wrong part index will be returned if you do not right-click on the desired part beforehand. For example, if an edit sketch has two parts, Part will always return a 0 (all sketches have at least one part) until you right click on the second part.

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

Specified by:
getPart in interface IEditSketch
Returns:
The part
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.
See Also:
IEditSketch.getSegment(), IEditSketch.getVertex()

getSegment

public int getSegment()
               throws IOException,
                      AutomationException
The index of the current segment of the sketch.

Remarks

You must right-click on the desired segment in the edit sketch to set this property correctly. The wrong segment index will be returned if you do not right-click on the desired segment beforehand. A value of -1 indicates no segment has been selected. For example, if your last right-click was on an edit sketch vertex, the Segment property will return a value of -1.

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

Specified by:
getSegment in interface IEditSketch
Returns:
The segment
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.
See Also:
IEditSketch.getVertex(), IEditSketch.getPart()

getVertex

public int getVertex()
              throws IOException,
                     AutomationException
The index of the current vertex of the sketch.

Remarks

You must right-click on the desired vertex in the edit sketch to set this property correctly. The wrong vertex index will be returned if you do not right-click on the desired vertex beforehand. A value of -1 means no vertex has been selected. For example, if your last right-click was on a segment in the edit sketch, the Vertex property will be set to -1.

Use Part, Segment and Vertex when creating custom commands for the sketch context menu. For example, to delete a vertex in the edit sketch, right-click on the vertex to retrieve its index and call IPointCollection::RemovePoints .

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

Specified by:
getVertex in interface IEditSketch
Returns:
The vertex
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.
See Also:
IEditSketch.getSegment(), IEditSketch.getPart()

getGeometryType

public int getGeometryType()
                    throws IOException,
                           AutomationException
Type of the geometry stored in the edit sketch.

Remarks

Use this property in conjunction with the Geometry property to manage the geometry inside the edit sketch. Valid geometry types are: esriGeometryPoint , esriGeometryPolygon , esriGeometryPolyline and esriGeometryNull . Setting GeometryType automatically initializes the Geometry property and vice versa. For example, if you set the GeometryType to esriGeometryPolygon, a new empty Polygon object will b e created.

When To Use

Use this property to control actions on the edit sketch based on geometry type. For example, you may have code that draws a rubberband between the current mouse location and the edit sketch's last point if the geometry type is not point.

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

Specified by:
getGeometryType in interface IEditSketch
Returns:
A com.esri.arcgis.geometry.esriGeometryType constant
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setGeometryType

public void setGeometryType(int geomType)
                     throws IOException,
                            AutomationException
Type of the geometry stored in the edit sketch.

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

Specified by:
setGeometryType in interface IEditSketch
Parameters:
geomType - A com.esri.arcgis.geometry.esriGeometryType constant (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getGeometry

public IGeometry getGeometry()
                      throws IOException,
                             AutomationException
Geometry stored in the edit sketch.

Remarks

This property sets the geometry the editor works with, ultimately passing it to the current task. By default, the editor creates a new empty geometry for you, and it does this any time you change the editor's current layer (IEditLayers::SetCurrentLayer ), reset the GeometryType property, or complete a task with a previous geometry. Because of this behavior, there is generally no need to set the Geometry property when you are building new geometries from scratch. Do set the Geometry property when you want to bring an existing feature into the edit sketch.

Valid geometry types are: esriGeometryPoint , esriGeometryMultipoint, esriGeometryPolyline and esriGeometryPolygon .

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

Specified by:
getGeometry in interface IEditSketch
Returns:
A reference to a com.esri.arcgis.geometry.IGeometry
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

setGeometryByRef

public void setGeometryByRef(IGeometry geometry)
                      throws IOException,
                             AutomationException
Geometry stored in the edit sketch.

Description

This property sets the geometry an EditSketch holds and works with. When working with the Editor object created and managed by MapStudio, the EditSketch by default hold s a new empty geometry (Mulitpoint , Polyline or Polygon) determined by CurrentLayer. Use the empty geometry when building new geometries; for example, when adding a new parcel to a parcels layer. To modify an existing feature, do not use the default geometry; instead, set Geometry to the desired feature and this will bring it into the EditSketch. Note: manually setting Geometry also sets GeometryType accordingly and vice versa. Each Task performs a different action involving the geometry when FinishSketch is called.

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

Specified by:
setGeometryByRef in interface IEditSketch
Parameters:
geometry - 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.

addPoint

public void addPoint(IPoint point,
                     boolean allowUndo)
              throws IOException,
                     AutomationException
Adds a point to the edit sketch. If allowUndo is true, a new operation will be created.

Remarks

Use the AddPoint method to build the geometry held in the edit sketch. The required point parameter specifies the location of the next point in the sketch. In all cases, new segments are added linking the edit sketch to the provided point, except where the geometry type is set to Point or the point represents the very first point in the edit sketch.


In the above illustration, a new segment is added to a Polyline using the AddPoint method.

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

Specified by:
addPoint in interface IEditSketch
Parameters:
point - A reference to a com.esri.arcgis.geometry.IPoint (in)
allowUndo - The allowUndo (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

refreshSketch

public void refreshSketch()
                   throws IOException,
                          AutomationException
Invalidates the portion of the display that is occupied by the sketch.

Description

Refreshes only the portion of the screen falling within the edit sketch's slightly expanded envelope (IGeometry::Envelope).

Remarks

Sometimes it may be necessary to invalidate a larger portion of the display in order to get rid of unwanted artifacts. This situation can arise when you shorten the length of a segment for example. Since the new geometry is shorter and calling RefreshSketch only refreshes the area within the envelope of the geometry, old data may still be erroneously displayed outside of this boundary. See the documentation for the InvalidArea object for more details.

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

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

finishSketch

public void finishSketch()
                  throws IOException,
                         AutomationException
Completes the current edit sketch.

Remarks

This function completes the edit sketch by notifying the editor's current task of this event. FinishSketch also calls RefreshSketch and IEditEvents::OnSketchFinished .

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

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

finishSketchPart

public void finishSketchPart()
                      throws IOException,
                             AutomationException
Completes a part for the current edit sketch.

Remarks

Call this function to create multi-part geometries.

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

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

getLastPoint

public IPoint getLastPoint()
                    throws IOException,
                           AutomationException
The last point in the edit sketch.

Remarks

Use this property to retrieve the last point in the edit sketch.

When To Use

The last point is often used as an anchor when drawing a rubber-band (line) between the EditSketch and the current mouse location.

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

Specified by:
getLastPoint in interface IEditSketch
Returns:
A reference to a com.esri.arcgis.geometry.IPoint
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

modifySketch

public void modifySketch()
                  throws IOException,
                         AutomationException
Call to notify listeners that the sketch has been changed.

Remarks

Generates an event signaling that the EditSketch has been modified. Listen for this event using IEditEvents::OnSketchModified .

Product Availability

Available with ArcGIS Desktop.

Supported Platforms

Windows

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