コード例 #1
0
 public static void GenerateBlockImages(Document doc, MSCDataset dataset)
 {
     try
     {
         ToolPalette.InitializePaletteFolders();
         Database database = doc.Database;
         using (doc.LockDocument())
         {
             using (Transaction transaction = database.TransactionManager.StartTransaction())
             {
                 foreach (MSCFeatureService current in dataset.FeatureServices.Values)
                 {
                     if (!current.QueryOnly && current.GeometryType == MSCFeatureClass.fcTypeCode.fcTypePoint)
                     {
                         ObjectId blockDefinition = DocUtil.GetBlockDefinition(doc, current.LayerName);
                         if (!(blockDefinition == ObjectId.Null))
                         {
                             ToolPalette.CreateBlockImage(transaction, doc, ToolPalette.ImageFolder, blockDefinition);
                         }
                     }
                 }
                 transaction.Commit();
             }
         }
     }
     catch
     {
     }
 }
コード例 #2
0
 private void OnExtractAllFeatureServices_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         MSCDataset docDataset = AfaDocData.ActiveDocData.DocDataset;
         if (docDataset.FeatureServices.Count == 0)
         {
             AfaDocData.ActiveDocData.Document.Editor.WriteMessage(AfaStrings.NoFeatureServicesFound);
         }
         else
         {
             List <string> list = new List <string>();
             foreach (MSCFeatureService current in docDataset.FeatureServices.Values)
             {
                 string          name            = current.Name;
                 MSCFeatureClass mSCFeatureClass = current.Disconnect();
                 if (mSCFeatureClass != null)
                 {
                     list.Add(name);
                 }
             }
             foreach (string current2 in list)
             {
                 docDataset.FeatureServices.Remove(current2);
             }
             MSCDataset.SetDefaultActiveFeatureClass();
             ToolPalette.UpdatePalette(docDataset.ParentDocument, docDataset, false);
         }
     }
     catch
     {
     }
 }
コード例 #3
0
        public static void CreatePaletteSchemesTest(Document doc, MSCDataset dataset)
        {
            ToolPaletteManager manager = ToolPaletteManager.Manager;

            try
            {
                try
                {
                    if (manager.Catalogs.Count > 0)
                    {
                        manager.SaveCatalogs();
                    }
                }
                catch
                {
                }
                ToolPalette.InitializePaletteFolders();
                ToolPalette.IncludeFolderLocation(ToolPalette.GroupFolder);
                ToolPalette.CreatePaletteFile(doc, dataset);
                if (!ToolPalette.GroupExists(doc))
                {
                    ToolPalette.CreateGroup();
                }
                Scheme scheme = new Scheme("ArcGIS");
                scheme.LoadCatalogs();
                scheme.SaveCatalogs();
                manager.Schemes.Add("ArcGIS");
            }
            catch
            {
            }
        }
コード例 #4
0
 public static void UpdatePalette(Document doc, MSCDataset dataset)
 {
     try
     {
         ToolPalette.CreatePalette(doc, dataset);
     }
     catch
     {
     }
 }
コード例 #5
0
 public static void ShowPalette(Document doc, MSCDataset dataset)
 {
     try
     {
         ToolPalette.UpdatePalette(doc, dataset);
         string cmdString = "(command \"tpnavigate\" \"ArcGIS Feature Services\")";
         CmdLine.ExecuteQuietCommand(cmdString);
     }
     catch
     {
     }
 }
コード例 #6
0
 public static void UpdatePalette(Document doc, MSCDataset dataset, bool generateIcons)
 {
     try
     {
         if (generateIcons)
         {
             ToolPalette.GenerateBlockImages(doc, dataset);
         }
         ToolPalette.CreatePalette(doc, dataset);
     }
     catch
     {
     }
 }
コード例 #7
0
 public static void GenerateBlockIcons(Document doc, MSCDataset dataset)
 {
     try
     {
         Database        database = doc.Database;
         List <ObjectId> list     = new List <ObjectId>();
         using (doc.LockDocument())
         {
             using (Transaction transaction = database.TransactionManager.StartTransaction())
             {
                 foreach (MSCFeatureService current in dataset.FeatureServices.Values)
                 {
                     if (!current.QueryOnly && current.GeometryType == MSCFeatureClass.fcTypeCode.fcTypePoint)
                     {
                         ObjectId blockDefinition = DocUtil.GetBlockDefinition(doc, current.LayerName);
                         if (!(blockDefinition == ObjectId.Null))
                         {
                             list.Add(blockDefinition);
                             foreach (MSCFeatureClassSubType current2 in current.SubTypes)
                             {
                                 ObjectId blockDefinition2 = DocUtil.GetBlockDefinition(doc, current2.CadLayerName);
                                 if (!(blockDefinition2 == ObjectId.Null))
                                 {
                                     list.Add(blockDefinition2);
                                 }
                             }
                         }
                     }
                 }
                 if (list.Count > 0)
                 {
                     ToolPalette.CreateBlockIcons(transaction, doc, list.ToArray());
                 }
                 transaction.Commit();
             }
         }
     }
     catch
     {
     }
 }
コード例 #8
0
        public static void CreatePalette(Document doc, MSCDataset dataset)
        {
            ToolPaletteManager manager = ToolPaletteManager.Manager;

            try
            {
                try
                {
                    if (manager.Catalogs.Count > 0)
                    {
                        manager.SaveCatalogs();
                    }
                }
                catch
                {
                }
                ToolPalette.InitializePaletteFolders();
                ToolPalette.IncludeFolderLocation(ToolPalette.GroupFolder);
                ToolPalette.CreatePaletteFile(doc, dataset);
                if (!ToolPalette.GroupExists(doc))
                {
                    ToolPalette.CreateGroup();
                }
                if (manager.Catalogs.Count > 0)
                {
                    if (dataset.FeatureServices.Count != 0)
                    {
                        manager.LoadCatalogs();
                    }
                    else if (ToolPalette.PaletteVisible())
                    {
                        manager.LoadCatalogs();
                    }
                }
            }
            catch
            {
            }
        }
コード例 #9
0
 private static void CreateEmptyPalette()
 {
     try
     {
         ToolPalette.InitializePaletteFolders();
         if (File.Exists(ToolPalette.fullPaletteFileName))
         {
             File.Delete(ToolPalette.fullPaletteFileName);
         }
         using (FileStream fileStream = new FileStream(ToolPalette.fullPaletteFileName, FileMode.Create))
         {
             using (StreamWriter streamWriter = new StreamWriter(fileStream))
             {
                 streamWriter.Write(tpResources.xmlEmptyPalette);
                 streamWriter.Close();
             }
         }
     }
     catch
     {
     }
 }
コード例 #10
0
 private static void CreatePaletteFile(Document doc, MSCDataset dataset)
 {
     try
     {
         ToolPalette.InitializePaletteFolders();
         Database database = doc.Database;
         if (!dataset.HasFeatureServicesOpenedForEditing())
         {
             ToolPalette.CreateEmptyPalette();
         }
         else
         {
             bool flag = false;
             foreach (MSCFeatureService current in dataset.FeatureServices.Values)
             {
                 if (!current.QueryOnly)
                 {
                     flag = true;
                     break;
                 }
             }
             if (!flag)
             {
                 ToolPalette.CreateEmptyPalette();
             }
             else
             {
                 if (File.Exists(ToolPalette.fullPaletteFileName))
                 {
                     File.Delete(ToolPalette.fullPaletteFileName);
                 }
                 using (FileStream fileStream = new FileStream(ToolPalette.fullPaletteFileName, FileMode.Create))
                 {
                     using (StreamWriter streamWriter = new StreamWriter(fileStream))
                     {
                         streamWriter.Write(tpResources.xmlPaletteBeginning);
                         using (doc.LockDocument())
                         {
                             using (Transaction transaction = database.TransactionManager.StartTransaction())
                             {
                                 foreach (MSCFeatureService current2 in dataset.FeatureServices.Values)
                                 {
                                     if (!current2.QueryOnly)
                                     {
                                         if (current2.SubTypes.Count == 0)
                                         {
                                             ToolPalette.WriteTool(current2, current2.LayerName, streamWriter, doc, transaction);
                                         }
                                         foreach (MSCFeatureClassSubType current3 in current2.SubTypes)
                                         {
                                             ToolPalette.WriteTool(current3, current3.CadLayerName, streamWriter, doc, transaction);
                                         }
                                     }
                                 }
                                 transaction.Commit();
                             }
                             streamWriter.Write(tpResources.xmlPaletteClose);
                             streamWriter.Close();
                         }
                     }
                 }
             }
         }
     }
     catch
     {
     }
 }
コード例 #11
0
 private static void WriteTool(MSCFeatureClass fs, string layerName, StreamWriter writer, Document doc, Transaction t)
 {
     try
     {
         Database database = doc.Database;
         if (fs.GeometryType == MSCFeatureClass.fcTypeCode.fcTypePoint)
         {
             if (DocUtil.IsNewDrawing(doc))
             {
                 doc.Editor.WriteMessage(AfaStrings.UnableToAddPointTool);
             }
             else
             {
                 ObjectId blockDefinition = DocUtil.GetBlockDefinition(doc, layerName);
                 if (blockDefinition != ObjectId.Null)
                 {
                     string value = ToolPalette.CreateBlockImage(t, doc, ToolPalette.ImageFolder, blockDefinition);
                     writer.Write(tpResources.xmlPointToolPart1);
                     writer.Write(fs.Name);
                     writer.Write(tpResources.xmlPointToolPart2);
                     writer.Write(value);
                     writer.Write(tpResources.xmlPointToolPart3);
                     writer.Write(value);
                     writer.Write(tpResources.xmlPointToolPart4a);
                     writer.Write(AfaStrings.CreatePointFeatures);
                     writer.Write(tpResources.xmlPointToolPart4b);
                     writer.Write(layerName);
                     writer.Write(tpResources.xmlPointToolPart5);
                     writer.Write(layerName);
                     writer.Write(tpResources.xmlPointToolPart6);
                     writer.Write(layerName);
                     writer.Write(tpResources.xmlPointToolPart7);
                     writer.Write(database.Filename);
                     writer.Write(tpResources.xmlPointToolPart8);
                 }
                 else
                 {
                     writer.Write(tpResources.xmlPtToolPart1);
                     writer.Write(fs.Name);
                     writer.Write(tpResources.xmlPtToolPart2);
                     writer.Write(layerName);
                     writer.Write(tpResources.xmlPtToolPart3);
                     writer.Write(layerName);
                     writer.Write(tpResources.xmlPtToolPart4);
                 }
             }
         }
         else if (fs.GeometryType == MSCFeatureClass.fcTypeCode.fcTypePolyline)
         {
             string value2 = string.Concat(new string[]
             {
                 tpResources.xmlLineToolPart1a,
                 Guid.NewGuid().ToString("B"),
                 tpResources.xmlLineToolPart1b,
                 fs.Name,
                 tpResources.xmlLineToolPart2,
                 AfaStrings.CreateLineFeatures,
                 tpResources.xmlLineToolPart3,
                 layerName,
                 tpResources.xmlLineToolPart4,
                 layerName,
                 tpResources.xmlLineToolPart5
             });
             writer.Write(value2);
         }
         else if (fs.GeometryType == MSCFeatureClass.fcTypeCode.fcTypePolygon)
         {
             string value3 = string.Concat(new string[]
             {
                 tpResources.xmlAreaToolPart1a,
                 Guid.NewGuid().ToString("B"),
                 tpResources.xmlAreaToolPart1b,
                 fs.Name,
                 tpResources.xmlAreaToolPart2,
                 AfaStrings.CreateAreaFeatures,
                 tpResources.xmlAreaToolPart3,
                 layerName,
                 tpResources.xmlAreaToolPart3b,
                 layerName,
                 tpResources.xmlAreaToolPart4
             });
             writer.Write(value3);
         }
     }
     catch
     {
     }
 }