Ejemplo n.º 1
0
        private void processLayer(LayerTypes lt)
        {
            UID pID         = new UIDClass();
            int layerTypeID = (int)lt;

            pID.Value = LayerTypeUIDs[(int)lt];
            List <ILayer> FoundLayerList = getLayerList(pID);

            foreach (ILayer lyr in FoundLayerList)
            {
                if (!processedLayers.Contains(lyr))
                {
                    LayerInfo lyrInfo = new LayerInfo(mapDoc);
                    switch (lt)
                    {
                    case LayerTypes.GroupLayer:
                        lyrInfo.processGroupLayer(lyr);
                        break;

                    case LayerTypes.AnnotationLayer:
                        lyrInfo.processAnnotationLayer(lyr);
                        break;

                    case LayerTypes.AnnotationSubLayer:
                        lyrInfo.processAnnotationSubLayer(lyr);
                        break;

                    case LayerTypes.RasterLayer:
                        lyrInfo.processRasterLayer(lyr);
                        break;

                    case LayerTypes.RasterCatalogLayer:
                        lyrInfo.processRasterCatalogLayer(lyr);
                        break;

                    case LayerTypes.FeatureLayer:
                        lyrInfo.processFeatureLayer(lyr);
                        break;

                    case LayerTypes.OtherLayer:
                        lyrInfo.processOtherLayer(lyr);
                        break;
                    }
                    lyrInfos.Add(lyrInfo);
                    processedLayers.Add(lyr);
                }
            }
        }
Ejemplo n.º 2
0
        public MXD(string mxdPath)
        {
            path = mxdPath;
            // GUIDs finden: http://support.esri.com/index.cfm?fa=knowledgebase.techarticles.articleShow&d=31115
            LayerTypeUIDs[0] = "{EDAD6644-1810-11D1-86AE-0000F8751720}";
            LayerTypeUIDs[1] = "{5CEAE408-4C0A-437F-9DB3-054D83919850}";
            LayerTypeUIDs[2] = "{DBCA59AC-6771-4408-8F48-C7D53389440C}";
            LayerTypeUIDs[3] = "{D02371C7-35F7-11D2-B1F2-00C04F8EDEFF}";
            LayerTypeUIDs[4] = "{605BC37A-15E9-40A0-90FB-DE4CC376838C}";
            LayerTypeUIDs[5] = "{E156D7E5-22AF-11D3-9F99-00C04F6BC78E}";
            LayerTypeUIDs[6] = "";

            if (InitializeLicense() == esriLicenseStatus.esriLicenseCheckedOut)
            {
                mapDoc = new MapDocumentClass();
                if (mapDoc.get_IsPresent(path))
                {
                    if (mapDoc.get_IsMapDocument(path))
                    {
                        mapDoc.Open(path, null);
                        if (mapDoc.DocumentType == esriMapDocumentType.esriMapDocumentTypeMxd)
                        {
                            activateMapDocument();

                            // alle Layer holen
                            layerList = getLayerList(null);

                            // alle GroupLayer holen
                            processLayer(LayerTypes.GroupLayer);

                            // alle AnnotationLayer holen
                            processLayer(LayerTypes.AnnotationLayer);

                            // alle AnnotationSubLayer holen
                            processLayer(LayerTypes.AnnotationSubLayer);

                            // alle RasterLayer holen
                            processLayer(LayerTypes.RasterLayer);

                            // alle RasterCatalogLayer holen
                            processLayer(LayerTypes.RasterCatalogLayer);

                            // alle FeatureLayer holen
                            processLayer(LayerTypes.FeatureLayer);

                            // übrige Layer holen
                            foreach (ILayer lyr in layerList)
                            {
                                if (!processedLayers.Contains(lyr))
                                {
                                    LayerInfo lyrInfo = new LayerInfo(mapDoc);
                                    lyrInfo.processOtherLayer(lyr);
                                    lyrInfos.Add(lyrInfo);
                                    processedLayers.Add(lyr);
                                }
                            }

                            // Resultate ausgeben
                            foreach (LayerInfo info in lyrInfos)
                            {
                                Console.WriteLine(info.writeCSV());
                            }

                            // Dokument schliessen
                            mapDoc.Close();

                        } else {
                            Console.Error.WriteLine("FEHLER: kein gültiges MXD-File");
                        }
                    } else {
                        Console.Error.WriteLine("FEHLER: kein gültiges MXD-File");
                    }
                } else {
                    Console.Error.WriteLine("FEHLER: Angegebenes File nicht gefunden");
                }

            } else
            {
                Console.Error.WriteLine("FEHLER: Keine ArcView-Lizenz verfügbar");
            }

            // Lizenz zurückgeben
            TerminateLicense();
        }
Ejemplo n.º 3
0
 private void processLayer(LayerTypes lt)
 {
     UID pID = new UIDClass();
     int layerTypeID = (int)lt;
     pID.Value = LayerTypeUIDs[(int)lt];
     List<ILayer> FoundLayerList = getLayerList(pID);
     foreach (ILayer lyr in FoundLayerList)
     {
         if (!processedLayers.Contains(lyr))
         {
             LayerInfo lyrInfo = new LayerInfo(mapDoc);
             switch (lt)
             {
                 case LayerTypes.GroupLayer:
                     lyrInfo.processGroupLayer(lyr);
                     break;
                 case LayerTypes.AnnotationLayer:
                     lyrInfo.processAnnotationLayer(lyr);
                     break;
                 case LayerTypes.AnnotationSubLayer:
                     lyrInfo.processAnnotationSubLayer(lyr);
                     break;
                 case LayerTypes.RasterLayer:
                     lyrInfo.processRasterLayer(lyr);
                     break;
                 case LayerTypes.RasterCatalogLayer:
                     lyrInfo.processRasterCatalogLayer(lyr);
                     break;
                 case LayerTypes.FeatureLayer:
                     lyrInfo.processFeatureLayer(lyr);
                     break;
                 case LayerTypes.OtherLayer:
                     lyrInfo.processOtherLayer(lyr);
                     break;
             }
             lyrInfos.Add(lyrInfo);
             processedLayers.Add(lyr);
         }
     }
 }
Ejemplo n.º 4
0
        public MXD(string mxdPath)
        {
            path = mxdPath;
            // GUIDs finden: http://support.esri.com/index.cfm?fa=knowledgebase.techarticles.articleShow&d=31115
            LayerTypeUIDs[0] = "{EDAD6644-1810-11D1-86AE-0000F8751720}";
            LayerTypeUIDs[1] = "{5CEAE408-4C0A-437F-9DB3-054D83919850}";
            LayerTypeUIDs[2] = "{DBCA59AC-6771-4408-8F48-C7D53389440C}";
            LayerTypeUIDs[3] = "{D02371C7-35F7-11D2-B1F2-00C04F8EDEFF}";
            LayerTypeUIDs[4] = "{605BC37A-15E9-40A0-90FB-DE4CC376838C}";
            LayerTypeUIDs[5] = "{E156D7E5-22AF-11D3-9F99-00C04F6BC78E}";
            LayerTypeUIDs[6] = "";

            if (InitializeLicense() == esriLicenseStatus.esriLicenseCheckedOut)
            {
                mapDoc = new MapDocumentClass();
                if (mapDoc.get_IsPresent(path))
                {
                    if (mapDoc.get_IsMapDocument(path))
                    {
                        mapDoc.Open(path, null);
                        if (mapDoc.DocumentType == esriMapDocumentType.esriMapDocumentTypeMxd)
                        {
                            activateMapDocument();

                            // alle Layer holen
                            layerList = getLayerList(null);

                            // alle GroupLayer holen
                            processLayer(LayerTypes.GroupLayer);

                            // alle AnnotationLayer holen
                            processLayer(LayerTypes.AnnotationLayer);

                            // alle AnnotationSubLayer holen
                            processLayer(LayerTypes.AnnotationSubLayer);

                            // alle RasterLayer holen
                            processLayer(LayerTypes.RasterLayer);

                            // alle RasterCatalogLayer holen
                            processLayer(LayerTypes.RasterCatalogLayer);

                            // alle FeatureLayer holen
                            processLayer(LayerTypes.FeatureLayer);

                            // übrige Layer holen
                            foreach (ILayer lyr in layerList)
                            {
                                if (!processedLayers.Contains(lyr))
                                {
                                    LayerInfo lyrInfo = new LayerInfo(mapDoc);
                                    lyrInfo.processOtherLayer(lyr);
                                    lyrInfos.Add(lyrInfo);
                                    processedLayers.Add(lyr);
                                }
                            }

                            // Resultate ausgeben
                            foreach (LayerInfo info in lyrInfos)
                            {
                                Console.WriteLine(info.writeCSV());
                            }

                            // Dokument schliessen
                            mapDoc.Close();
                        }
                        else
                        {
                            Console.Error.WriteLine("FEHLER: kein gültiges MXD-File");
                        }
                    }
                    else
                    {
                        Console.Error.WriteLine("FEHLER: kein gültiges MXD-File");
                    }
                }
                else
                {
                    Console.Error.WriteLine("FEHLER: Angegebenes File nicht gefunden");
                }
            }
            else
            {
                Console.Error.WriteLine("FEHLER: Keine ArcView-Lizenz verfügbar");
            }

            // Lizenz zurückgeben
            TerminateLicense();
        }