This document is archived and information here might be outdated.  Recommended version.


IESRIShape Interface (ArcObjects .NET 10.6 SDK)
ArcObjects Help for .NET developers > ArcObjects namespaces > Geometry > ESRI.ArcGIS.Geometry > Interfaces > IE > IESRIShape Interface (ArcObjects .NET 10.6 SDK)
ArcObjects Library Reference (Geometry)  

IESRIShape Interface

Provides access to members that Import/Export ArcObjects geometries to Esri shapefile format. Note: the IESRIShape interface has been superseded byIESRIShape2. Please consider using the more recent version.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Members

Name Description
Method AttachToESRIShape Takes ownership of the input Esri shapefile format buffer. The geometry must be deleted, set to empty, edited, or imported from/attached to a different buffer before the buffer can be re-used.
Read-only property ESRIShapeSize The size of the buffer, in bytes, that will be required to hold the Esri shapefile formatted version of the geometry. The value may exceed the minimum required size.
Read-only property ESRIShapeSizeEx The size of the buffer (in bytes) that will be required to hold the Esri shapefile version of the geometry. Only attributes specified by modifiers to allow will be exported. The value may exceed the minimum required size. ModifiersToAllow is a combination of e
Method ExportToESRIShape Writes an Esri shapefile formatted version of this geometry to the specified buffer. Returns the exact number of bytes written to the buffer.
Method ExportToESRIShapeEx Writes an Esri shapefile formatted version of this geometry to the specified buffer. Only exports attributes specified by modifiersToAllow (combination of esriShapeExportFlags values.). Returns the exact number of bytes written to the buffer.
Method GetModifierOffset Finds out the byte offsets within a shape buffer at which an exported attribute can be found. Only works if the shape hasn't changed since the last call to ExportToESRIShape or ExportToESRIShapeEx.
Method ImportFromESRIShape Defines this geometry from the input Esri shapefile formatted buffer. Assumes the buffer describes a topologically correct geometry. Returns the exact number of bytes read from the buffer.
Method NonTrustedImportFromESRIShape Defines this geometry from the contents of the input Esri shapefile formatted buffer. Does not assume that the buffer describes a topological correct geometry. Returns the exact number of bytes read from the buffer.
Method QueryESRIShapeType Returns the basic type and modifiers (combination of esriShapeModifiers) that define the geometry's shape type, as it was last exported.

CoClasses that implement IESRIShape

CoClasses and Classes Description

Remarks

Shape modifiers are used in certain methods of this interface.  For instance they are used to define which geometry attributes to allow when exporting or importing a geometry. 

[C#]

As an example, the C# method below shows how modifiers can be used to strip off the m-values of a geometry by exporting it with a bitwise combination of modifiers and then re-importing the resulting geometry.

void IESRIShape_Methods(ref IGeometry geomToChange)

{

IESRIShape shp=geomToChange as IESRIShape;

IGeometry geom=shp as IGeometry;

long size=shp.ESRIShapeSize;

esriShapeModifiers modifier=esriShapeModifiers.esriShapeHasIDs | esriShapeModifiers.esriShapeHasZs | esriShapeModifiers.esriShapeHasCurves;

size=shp.get_ESRIShapeSizeEx((int)modifier);

byte[] buffer=new byte[size];

int count=0;

shp.ExportToESRIShapeEx((int)modifier, true, ref count, out buffer[0]);

shp.ImportFromESRIShape(ref count, ref buffer[0]);

      geomToChange=geom;

}