public object ESRI_SetCurrentFeatureService(ResultBuffer rb)
        {
            object result;

            try
            {
                TypedValue[] array = rb.AsArray();
                if (array.Count <TypedValue>() < 1)
                {
                    result = null;
                }
                else
                {
                    TypedValue typedValue = array[0];
                    if (typedValue.TypeCode != 5005)
                    {
                        result = null;
                    }
                    else
                    {
                        string          name            = typedValue.Value.ToString();
                        MSCFeatureClass mSCFeatureClass = this.GetFeatureClassOrService(name);
                        if (mSCFeatureClass == null)
                        {
                            result = null;
                        }
                        else if (!(mSCFeatureClass is MSCFeatureService))
                        {
                            result = null;
                        }
                        else
                        {
                            if (array.Count <TypedValue>() > 1)
                            {
                                TypedValue typedValue2 = array[1];
                                if (typedValue2.TypeCode != 5005)
                                {
                                    result = null;
                                    return(result);
                                }
                                string stName = typedValue2.Value.ToString();
                                MSCFeatureClassSubType mSCFeatureClassSubType = mSCFeatureClass.FindSubtypeName(stName);
                                if (mSCFeatureClassSubType != null)
                                {
                                    mSCFeatureClass = mSCFeatureClassSubType;
                                }
                            }
                            ArcGISRibbon.SetActiveFeatureClass(mSCFeatureClass);
                            result = mSCFeatureClass.Name;
                        }
                    }
                }
            }
            catch
            {
                result = null;
            }
            return(result);
        }
        private void OnClickNext(object sender, RoutedEventArgs e)
        {
            this.lblErrorMessage.Content = "";
            if (string.IsNullOrEmpty(this.tbName.Text))
            {
                this.lblErrorMessage.Content = AfaStrings.NameCannotBeBlank;
                return;
            }
            string text = this.tbName.Text;

            if (!string.IsNullOrEmpty(text))
            {
                text = text.Trim();
            }
            if (string.IsNullOrEmpty(text))
            {
                this.lblErrorMessage.Content = AfaStrings.NameCannotBeBlank;
                return;
            }
            text = NewFeatureClass.FixFeatureClassName(text);
            MSCDataset      docDataset      = AfaDocData.ActiveDocData.DocDataset;
            MSCFeatureClass mSCFeatureClass = new MSCFeatureClass(docDataset);

            this.tbName.Text     = text;
            mSCFeatureClass.Name = text;
            mSCFeatureClass.SetGeometryType(this.cbType.SelectedValue.ToString());
            mSCFeatureClass.Query = new ResultBuffer(new TypedValue[]
            {
                new TypedValue(8, "*")
            });
            mSCFeatureClass.Write(AfaDocData.ActiveDocData.Document);
            docDataset.FeatureClasses.Add(mSCFeatureClass.Name, mSCFeatureClass);
            docDataset.FeatureClassViewList.Add(new FCView(mSCFeatureClass));
            base.Close();
            FeatureClassProperties featureClassProperties = new FeatureClassProperties(mSCFeatureClass);

            try
            {
                Application.ShowModalWindow(featureClassProperties);
            }
            catch (Exception)
            {
            }
            AfaDocData.ActiveDocData.SetActiveFeatureClass(mSCFeatureClass);
            ArcGISRibbon.SetActiveFeatureClass(mSCFeatureClass);
        }
Ejemplo n.º 3
0
 private static void DocumentActivated(object sender, DocumentCollectionEventArgs e)
 {
     try
     {
         if (DocumentDataObject.ActiveDocData != null)
         {
             MSCFeatureClass topActiveFeatureClass = AfaDocData.ActiveDocData.GetTopActiveFeatureClass();
             if (topActiveFeatureClass != null)
             {
                 ArcGISRibbon.SetActiveFeatureClass(topActiveFeatureClass);
             }
             MSCFeatureClass activeSubtype = AfaDocData.ActiveDocData.GetActiveSubtype();
             if (activeSubtype != null)
             {
                 ArcGISRibbon.SetActiveFeatureClass(activeSubtype);
             }
             if (AfaDocData.ActiveDocData.DocDataset.FeatureServices != null)
             {
                 AfaDocData.ActiveDocData.DocDataset.ShowFeatureServiceLayers(true);
                 if (AfaDocData.ActiveDocData.DocDataset.FeatureServices.Count > 0)
                 {
                     ArcGISRibbon.EnableFeatureServiceButtons(true);
                 }
                 else
                 {
                     ArcGISRibbon.EnableFeatureServiceButtons(false);
                 }
             }
             if (AfaDocData.ActiveDocData.CurrentMapService != null)
             {
                 ArcGISRibbon.SetActiveRasterService(AfaDocData.ActiveDocData.CurrentMapService);
             }
             else if (AfaDocData.ActiveDocData.CurrentImageService != null)
             {
                 ArcGISRibbon.SetActiveRasterService(AfaDocData.ActiveDocData.CurrentImageService);
             }
             ToolPalette.UpdatePalette(AfaDocData.ActiveDocData.Document, AfaDocData.ActiveDocData.DocDataset);
         }
     }
     catch
     {
     }
 }
 private void CreateLocationsFeatureClass()
 {
     if (AfaDocData.ActiveDocData.DocDataset.FeatureClasses.ContainsKey("ESRI_Locations"))
     {
         ArcGISRibbon.SetActiveFeatureClass(AfaDocData.ActiveDocData.DocDataset.FeatureClasses["ESRI_Locations"]);
         return;
     }
     try
     {
         MSCDataset.AddSimpleFeatureClass("ESRI_Locations", "esriGeometryPoint", new List <string>
         {
             "ESRI_Locations"
         }, new List <CadField>
         {
             new CadField
             {
                 Name     = "Score",
                 Value    = new TypedValue(90, 100),
                 ReadOnly = true
             },
             new CadField
             {
                 Name     = AfaStrings.SearchString,
                 Value    = new TypedValue(1, ""),
                 Length   = 254,
                 ReadOnly = true
             },
             new CadField
             {
                 Name     = "Address",
                 Value    = new TypedValue(1, "Address"),
                 Length   = 254,
                 ReadOnly = true
             }
         }, true, null);
         ArcGISRibbon.SetActiveFeatureClass(AfaDocData.ActiveDocData.DocDataset.FeatureClasses["ESRI_Locations"]);
     }
     catch
     {
     }
 }
        private void UpdateFromClass(Identify.IdentifyFeatureClassItem newItem)
        {
            Document document = AfaDocData.ActiveDocData.Document;

            using (document.LockDocument())
            {
                FCTag           tag = newItem.Tag;
                MSCFeatureClass activeFeatureClass = AfaDocData.ActiveDocData.SetActiveFeatureClass(tag.GetFeatureClass(AfaDocData.ActiveDocData.DocDataset));
                ArcGISRibbon.SetActiveFeatureClass(activeFeatureClass);
                ObjectId[] iDs    = newItem.IDs;
                Editor     editor = AfaDocData.ActiveDocData.Document.Editor;
                document.Editor.SetImpliedSelection(DocUtil.ExpandGroupObjectIds(AfaDocData.ActiveDocData.Document, iDs));
                ObjectIdCollection objectIds = null;
                if (iDs != null)
                {
                    objectIds = new ObjectIdCollection(iDs);
                }
                this.SetObjectIds(objectIds);
                editor.Regen();
            }
        }
 private void SetActiveFeatureClass(object obj)
 {
     if (obj.GetType() == typeof(FCTag))
     {
         FCTag           fCTag        = (FCTag)obj;
         MSCFeatureClass featureClass = fCTag.GetFeatureClass(AfaDocData.ActiveDocData.DocDataset);
         AfaDocData.ActiveDocData.SetActiveFeatureClass(featureClass);
         ArcGISRibbon.SetActiveFeatureClass(AfaDocData.ActiveDocData.GetActiveFeatureClassOrSubtype());
     }
     if (obj.GetType() == typeof(FCView))
     {
         FCView          fCView        = (FCView)obj;
         MSCFeatureClass featureClass2 = fCView.FC.GetFeatureClass(AfaDocData.ActiveDocData.DocDataset);
         AfaDocData.ActiveDocData.SetActiveFeatureClass(featureClass2);
         ArcGISRibbon.SetActiveFeatureClass(AfaDocData.ActiveDocData.GetActiveFeatureClassOrSubtype());
     }
     if (obj.GetType() == typeof(KeyValuePair <string, MSCFeatureClass>))
     {
         KeyValuePair <string, MSCFeatureClass> keyValuePair = (KeyValuePair <string, MSCFeatureClass>)obj;
         AfaDocData.ActiveDocData.SetActiveFeatureClass(keyValuePair.Value);
         ArcGISRibbon.SetActiveFeatureClass(AfaDocData.ActiveDocData.GetActiveFeatureClassOrSubtype());
         return;
     }
     if (obj.GetType() == typeof(KeyValuePair <string, MSCFeatureService>))
     {
         KeyValuePair <string, MSCFeatureService> keyValuePair2 = (KeyValuePair <string, MSCFeatureService>)obj;
         AfaDocData.ActiveDocData.SetActiveFeatureClass(keyValuePair2.Value);
         ArcGISRibbon.SetActiveFeatureClass(AfaDocData.ActiveDocData.GetActiveFeatureClassOrSubtype());
         return;
     }
     if (obj is MSCFeatureClass || obj is MSCFeatureService || obj is MSCFeatureClassSubType)
     {
         AfaDocData.ActiveDocData.SetActiveFeatureClass((MSCFeatureClass)obj);
         ArcGISRibbon.SetActiveFeatureClass(AfaDocData.ActiveDocData.GetActiveFeatureClassOrSubtype());
     }
 }
 private void featureClassComboBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         this.featureClassFieldsListBox.Items.Clear();
         this.uniqueValuesListBox.Items.Clear();
         MSCFeatureClass mSCFeatureClass = (MSCFeatureClass)this.featureClassComboBox.SelectedItem;
         foreach (CadField current in mSCFeatureClass.Fields)
         {
             this.featureClassFieldsListBox.Items.Add(current.Name);
         }
         AfaDocData.ActiveDocData.SetActiveFeatureClass(mSCFeatureClass);
         ArcGISRibbon.SetActiveFeatureClass(mSCFeatureClass);
         this.updateDataTable((MSCFeatureClass)this.featureClassComboBox.SelectedItem);
         this.uniqueValuesButton.Enabled = false;
         this.uniqueValuesListBox.Items.Clear();
         this.uniqueValuesListBox.Enabled   = false;
         this.uniqueValuesListBox.BackColor = this.BackColor;
         this.gotoTextBox.Enabled           = false;
         this.gotoTextBox.BackColor         = this.BackColor;
     }
     catch (Exception ex)
     {
         if (SingletonsList.ed != null)
         {
             SingletonsList.ed.WriteMessage("\n" + AfaStrings.Error + " " + ex.Message);
         }
     }
     catch (SystemException ex2)
     {
         if (SingletonsList.ed != null)
         {
             SingletonsList.ed.WriteMessage("\n" + AfaStrings.Error + " " + ex2.Message);
         }
     }
 }
Ejemplo n.º 8
0
        public object ESRI_AddFeatureClass(ResultBuffer rb)
        {
            object result;

            try
            {
                TypedValue[] array = rb.AsArray();
                if (array.Count <TypedValue>() == 0)
                {
                    result = null;
                }
                else
                {
                    TypedValue typedValue = array[0];
                    if (typedValue.TypeCode != 5005)
                    {
                        result = null;
                    }
                    else
                    {
                        string          text = typedValue.Value.ToString();
                        MSCFeatureClass localFeatureClass = this.GetLocalFeatureClass(text);
                        if (localFeatureClass != null)
                        {
                            result = null;
                        }
                        else
                        {
                            string assocParam  = LspUtil.GetAssocParam(rb, "GeomType", "Point");
                            string assocParam2 = LspUtil.GetAssocParam(rb, "LayerFilter", "*");
                            if (string.IsNullOrEmpty(text))
                            {
                                result = null;
                            }
                            else if (string.IsNullOrEmpty(assocParam))
                            {
                                result = null;
                            }
                            else if (string.IsNullOrEmpty(assocParam2))
                            {
                                result = null;
                            }
                            else
                            {
                                MSCFeatureClass mSCFeatureClass = AfaDocData.ActiveDocData.DocDataset.CreateFeatureClass(text);
                                mSCFeatureClass.GeometryType = MSCFeatureClass.GetGeomType(assocParam);
                                TypedValue typedValue2 = new TypedValue(8, assocParam2);
                                mSCFeatureClass.Query = new ResultBuffer(new TypedValue[]
                                {
                                    typedValue2
                                });
                                mSCFeatureClass.Write(AfaDocData.ActiveDocData.Document);
                                AfaDocData.ActiveDocData.DocDataset.FeatureClasses.Add(text, mSCFeatureClass);
                                AfaDocData.ActiveDocData.DocDataset.FeatureClassViewList.Add(new FCView(mSCFeatureClass));
                                AfaDocData.ActiveDocData.SetActiveFeatureClass(mSCFeatureClass);
                                ArcGISRibbon.SetActiveFeatureClass(mSCFeatureClass);
                                result = mSCFeatureClass.Name;
                            }
                        }
                    }
                }
            }
            catch
            {
                result = null;
            }
            return(result);
        }