ArcStrabo10.ArcStraboObject.AddShapeFileLayer C# (CSharp) Метод

AddShapeFileLayer() приватный Метод

Add Shapefile layer
private AddShapeFileLayer ( string path, string fileName ) : void
path string
fileName string
Результат void
        private void AddShapeFileLayer(string path, string fileName)
        {
            try
            {
                // Create a new ShapefileWorkspaceFactory object and
                // open a shapefile folder - the path works with standard 9.3 installation
                IWorkspaceFactory workspaceFactory = new ShapefileWorkspaceFactory();
                IFeatureWorkspace featureWorkspace = (IFeatureWorkspace)
                  workspaceFactory.OpenFromFile(path, 0);
                // Create a new FeatureLayer and assign a shapefile to it
                IFeatureLayer featureLayer = new ESRI.ArcGIS.Carto.FeatureLayer();
                featureLayer.FeatureClass = featureWorkspace.OpenFeatureClass(fileName);
                ILayer layer = (ILayer)featureLayer;
                layer.Name = featureLayer.FeatureClass.AliasName;
                // Add the Layer to the focus map
                IMap map = ArcMap.Document.FocusMap;

                map.AddLayer(layer);
            }
            catch (Exception e)
            {
                Log.WriteLine("AddShapeFileLayer: " + e.Message);
            }
        }