Need help creating an IName object describing a Workspace, Dataset and FeatureClass

586
1
03-23-2011 03:06 PM
BruceJones
New Contributor
As part of a custom plug-in data source, I am required to implement the IParseNameString CanParse() and Parse() methods.

The Parse() method will receive a string such as the following:
F:\arctest\plugindata\points\Polygon
Where :
  F:\arctest\plugindata is the path to the workspace containing my feature data set.
  points is the feature data set. On disk it is points.csp
  Polygon is the name of a feature class within points.csp that I am interested in. This particular sample dataset contains 12 feature classes.

It is the job of the Parse() method to return an IName objects describing the workspace, dataset and presumably the featureclass represented by the incoming string.

FYI, his data set can be found in the ArcObjects SDK in C:\Program Files (x86)\ArcGIS\DeveloperKit10.0\Samples\data\SimplePointData.

The code below will allow my plug-in data source to successfully open the points.csp data set but will always result in the opening of the first feature class within points.csp rather than the one named Polygon. I assume that this is due to the fact that nowhere in the code below have I specified Polygon as the feature class name to use. Simply put, I don't know how.

To keep things simple, no actual parsing yet. Just hard coded paths.

Any tips on what I need to do would be appreciated.

    public IName Parse(string ParseName)
    {

        // Incoming ParseName string is:
        //  F:\arctest\plugindata\points\Polygon
        // Where :
        //  "F:\arctest\plugindata" is the workspace directory
        //  "points" is the feature dataset. On disk it is points.csp
        //  "Polygon" is the name of the feature class withing points.csp

        IWorkspaceName workspaceName = new WorkspaceNameClass();
        workspaceName.WorkspaceFactoryProgID = "esriGeoDatabase.SimplePointPluginWorkspaceFactory";  // My plugin factory
        workspaceName.PathName = "F:\\arctest\\plugindata"; // Path of the directory containing my dataset

        IFeatureClassName fcName = new FeatureClassNameClass();
        fcName.FeatureType = esriFeatureType.esriFTSimple;
        fcName.ShapeType = ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolygon;
        fcName.ShapeFieldName = "SHAPE";

        IDatasetName dsName = (IDatasetName)fcName;
        dsName.Name = "points"; // The dataset to open (points.csp on disk)
        dsName.WorkspaceName = workspaceName;
      
        // What about Polygon? which is one of 12 feature classes in the points.csp dataset and the one I want to open

        return (IName)fcName;

    }
0 Kudos
1 Reply
BruceJones
New Contributor
NEW INFO:
The sample plug-in data source provided by ESRI (as well as my own) is implemented such that a workspace is a directory and an individual file is a FeatureDataset containing several FeatureClasses.

Do I need to somehow incorporate IFeatureDatasetName into the creation of the IName that I am attempting. I apologize of this is all rather unclear, this is somewhat new to me.

Any assistance would be greatly appreciated.
0 Kudos