Пример #1
0
        protected override void OnClick()
        {
            ICadastralFabric pCadaFab = null;
            IApplication     pApp     = (IApplication)ArcMap.Application;

            if (pApp == null)
            {
                pApp = (IApplication)ArcCatalog.Application; //if the app is null then try ArcCatalog
            }
            if (pApp == null)
            {
                MessageBox.Show("Could not access the application.", "No Application found");
                return;
            }
            stdole.IUnknown pUnk = null;
            try
            {
                IGxApplication pGXApp = (IGxApplication)pApp;
                pUnk = (stdole.IUnknown)pGXApp.SelectedObject.InternalObjectName.Open();
                if (!(pUnk is ICadastralFabric))
                {
                    MessageBox.Show("Please select a parcel fabric in the Catalog window and try again.", "Not a parcel fabric");
                    return;
                }
                pCadaFab = pUnk as ICadastralFabric;
            }
            catch (Exception ex)
            {
                MessageBox.Show("There was a problem opening this fabric." + Environment.NewLine +
                                ex.Message);
                return;
            }

            int  iV     = GetFabricVersion(pCadaFab);
            bool bCanDo = (iV >= 3);

            if (!bCanDo)
            {
                MessageBox.Show("This extended property is not available with this version of the fabric's schema." +
                                Environment.NewLine + "Please upgrade the fabric and try again.", "Extended Properties");
                return;
            }

            bool   bIsReducedRegenerateTolerance = GetReducedRegenerateTolerance(pCadaFab);
            string sCurrentState_ON_or_OFF       = bIsReducedRegenerateTolerance ? "REDUCED":"NORMAL";
            string sProposedtState_ON_or_OFF     = bIsReducedRegenerateTolerance ? "NORMAL": "REDUCED";

            if (MessageBox.Show("The regenerate tolerance is currently set to "
                                + sCurrentState_ON_or_OFF + Environment.NewLine
                                + "Would you like to set it to " + sProposedtState_ON_or_OFF + " ?" + Environment.NewLine + Environment.NewLine
                                + "Set the REDUCED property to regenerate the fabric with a tolerance 100 times smaller than the "
                                + "default XY tolerance of the dataset." + Environment.NewLine
                                + "Use this REDUCED tolerance for the first regenerate after a data load or after an append to the fabric."
                                + "Then reset it back to NORMAL for subsequent standard editing workflows."
                                , "Regenerate Tolerance"
                                , MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                SetReducedRegenerateTolerance(pCadaFab, !bIsReducedRegenerateTolerance);
            }
        }
Пример #2
0
 public void Activate(ESRI.ArcGIS.CatalogUI.IGxApplication Application, ESRI.ArcGIS.Catalog.IGxCatalog Catalog)
 {
     m_pApp       = Application;
     m_pCatalog   = Catalog;
     m_pSelection = (GxSelection)Catalog.Selection;
     m_pSelection.OnSelectionChanged += new IGxSelectionEvents_OnSelectionChangedEventHandler(m_pSelection_OnSelectionChanged);
     frmGxStyleView.GxStyleView       = this;
     Refresh();
 }
Пример #3
0
        /// <summary>
        /// Method to initiate publication request
        /// </summary>
        private void publish()
        {
            displayLogsTxtBox.Text = "";
            PublicationParams parameters = new PublicationParams();

            parameters.Password       = txtPassword.Text.Trim();
            parameters.UserName       = txtUsername.Text.Trim();
            parameters.ServerUrl      = txtServer.Text.Trim();
            parameters.Service        = txtService.Text.Trim();
            parameters.LogFilePath    = logFilePath;
            parameters.CurrentWorkDir = workDirectory;
            us.Params = parameters;
            System.Windows.Forms.Cursor.Current = Cursors.WaitCursor;
            pr = new PublicationRequest(parameters);
            pr.determineEndPoint();
            try
            {
                IGxApplication catalog = null;

                if (ArcCatalog.Application != null)
                {
                    catalog = (IGxApplication)ArcCatalog.Application;
                }

                if (ArcMap.Application != null)
                {
                    catalog = (IGxApplication)ArcMap.Application;
                }
                IGxObject pGxObject      = catalog.Catalog.SelectedObject;
                String    category       = pGxObject.Category;
                String    parentCategory = pGxObject.Parent.Category;

                StringBuilder sb = new StringBuilder();
                sb.AppendLine("************ Metadata Publishing started at   " + System.DateTime.Now + " ************");
                sb.AppendLine("Publication Parameters ");
                sb.AppendLine("============================================================");
                sb.AppendLine("Metadata Server Url           : " + parameters.ServerUrl);
                sb.AppendLine("Publish Metadata Service Name : " + parameters.Service);
                sb.AppendLine("Selected Workspace Name       : " + pGxObject.FullName);
                sb.AppendLine("Selected container category   : " + category);
                sb.AppendLine("============================================================");
                writeLogs(sb.ToString());

                publishMetadata(pGxObject, pr);

                //sb.AppendLine(displayLogsTxtBox.Text);
                writeLogs("************ Metadata Publishing completed at " + System.DateTime.Now + " ************");
                saveSettings();
                System.Windows.Forms.Cursor.Current = Cursors.Default;
                ShowSuccessMessageBox(StringMessages.PublishSuccessMsg + " " + logFilePath + StringMessages.LogFilePath);
            }
            catch (Exception ex)
            {
                PublishForm.ShowErrorMessageBox(StringMessages.PublishFailureMsg + " " + logFilePath + StringMessages.LogFilePath);
            }
        }
Пример #4
0
        /// <summary>
        /// Occurs when this command is clicked
        /// </summary>
        public override void OnClick()
        {
            // TODO: Add GetFeatureCountMenuContext.OnClick implementation
            IGxApplication pGxApplication = m_application as IGxApplication;
            IGxObject      pGxObject      = pGxApplication.SelectedObject;
            IName          pName          = pGxObject.InternalObjectName;
            IFeatureClass  pFC            = pName.Open() as IFeatureClass;

            MessageBox.Show(pFC.FeatureCount(null).ToString());
        }
Пример #5
0
        protected override void OnClick()
        {
            IGxApplication gxApplication = (IGxApplication)ArcCatalog.Application;

            IGxAGSObject3 agsObject3 = (IGxAGSObject3)gxApplication.SelectedObject;

            IServerObjectConfiguration config = agsObject3.ServerObjectConfiguration;

            IPropertySet propSet = config.Properties;

            GetProperties(propSet); //Look at each property and value in the Property Set object (logged to output)

            string path = (string)config.Properties.GetProperty("FilePath");

            string mxdPath = "";

            string keyString = ".MapServer";

            if (path.Contains(keyString))
            {
                int indexOf = path.IndexOf(keyString);

                string editPath = path.Remove(indexOf + keyString.Length) + "\\extracted\\manifest.xml";

                XmlDocument xmlDoc = new XmlDocument();  // Read the manifest.xml file to get the full MXD file path

                xmlDoc.Load(editPath);

                XmlNodeList nodes = xmlDoc.SelectNodes("//OnPremisePath");

                foreach (XmlNode item in nodes)
                {
                    if (item.ParentNode.Name == "SVCResource" && item.InnerText.Contains(".mxd"))
                    {
                        mxdPath = item.InnerText; //Store the MXD file path in this variable
                    }
                }
            }

            MessageBox.Show(mxdPath);


            //String token = GetToken(m_token);

            //string logresponse = GetLog(m_logurl, token);

            //MessageBox.Show(logresponse.ToString());
        }
Пример #6
0
        private void btnRename_Click(object sender, EventArgs e)
        {
            IGxApplication pApp         = ArcMap.Application as IGxApplication;
            string         pathFileName = pApp.SelectedObject.FullName;
            string         root         = System.IO.Path.GetDirectoryName(pathFileName);
            string         filename     = System.IO.Path.GetFileNameWithoutExtension(pathFileName);
            IFeatureClass  fc           = GetFeatureClassFromShapefileOnDisk(root, filename);
            IDataset       ds           = fc as IDataset;

            //Construct layer name
            //ConstructLayerName newLayer = new ConstructLayerName();
            //string newLayerName = newLayer.LoopThroughNameElements(GetFormElementValues());
            string newLayerName = createNewLayerName();

            //Rename the layer
            ds.Rename(newLayerName);
            pApp.Refresh(root);
            this.Close();
        }
        protected override void OnClick()
        {
            // set
            m_pApp = (IGxApplication)CustomGxFilter_CS.ArcCatalog.Application;
            IGxCatalog      pCat        = null;
            IGxFileFilter   pFileFilter = null;
            IEnumGxObject   pSelection  = null;
            IGxDialog       pDlg        = null;
            IGxObjectFilter pFilter     = null;

            try
            {
                pDlg        = new GxDialog();
                pCat        = pDlg.InternalCatalog;
                pFileFilter = pCat.FileFilter;
                if (pFileFilter.FindFileType("py") < 0)
                {
                    //enter the third parameter with the location of the icon as needed
                    pFileFilter.AddFileType("PY", "Python file", "");
                }

                pFilter               = new CustomGxFilter_CS.CustomFilter();
                pDlg.ObjectFilter     = pFilter;
                pDlg.Title            = "Please select a .Py file";
                pDlg.AllowMultiSelect = true;
                pDlg.DoModalOpen(0, out pSelection);
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.ToString());
            }
            finally
            {
                pCat        = null;
                pFileFilter = null;
                pSelection  = null;
                pDlg        = null;
                pFilter     = null;
            }
        }
        protected override void OnClick()
        {
            // set
            m_pApp = (IGxApplication)CustomGxFilter_CS.ArcCatalog.Application;
            IGxCatalog pCat = null;
            IGxFileFilter pFileFilter = null;
            IEnumGxObject pSelection = null;
            IGxDialog pDlg = null;
            IGxObjectFilter pFilter = null;
            try
            {
                pDlg = new GxDialog();
                pCat = pDlg.InternalCatalog ;
                pFileFilter = pCat.FileFilter;
                if (pFileFilter.FindFileType("py") < 0)
                {
                    //enter the third parameter with the location of the icon as needed
                    pFileFilter.AddFileType("PY", "Python file", "");
                }

                pFilter = new CustomGxFilter_CS.CustomFilter();
                pDlg.ObjectFilter = pFilter;
                pDlg.Title = "Please select a .Py file";
                pDlg.AllowMultiSelect = true;
                pDlg.DoModalOpen(0, out pSelection);
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.ToString());
            }
            finally
            {
                pCat = null;
                pFileFilter = null;
                pSelection = null;
                pDlg = null;
                pFilter = null;
            }
        }
Пример #9
0
 protected override void OnClick()
 {
     try
     {
         IGxApplication pApp         = ArcMap.Application as IGxApplication;
         string         pathFileName = pApp.SelectedObject.FullName;
         string         root         = System.IO.Path.GetDirectoryName(pathFileName);
         string         filename     = System.IO.Path.GetFileNameWithoutExtension(pathFileName);
         IFeatureClass  fc           = GetFeatureClassFromShapefileOnDisk(root, filename);
         IDataset       ds           = fc as IDataset;
         if (fc == null)
         {
             MessageBox.Show("This tool works on the context menu of a shapefile in ArcCatalog.  Please check your installation.", "Error",
                             MessageBoxButtons.OK, MessageBoxIcon.Warning);
             return;
         }
         else
         {
             //Check to see the csv files exist (Check is only for extent.csv)
             if (ConstructLayerName.checkPathToLookupCSV())
             {
                 frmMain dlg = new frmMain();
                 dlg.ShowDialog();
             }
             else
             {
                 MessageBox.Show("The path to the CSV files is incorrect.  Please set the correct path in the config tool.", "Error",
                                 MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 return;
             }
         }
     }
     catch (Exception e)
     {
         Debug.WriteLine(e.Message);
         return;
     }
 }
Пример #10
0
 /// <summary>
 ///     Activates the specified view.
 /// </summary>
 /// <param name="application">The application.</param>
 /// <param name="catalog">The catalog.</param>
 /// <remarks>
 ///     Use the Activate method to hold on to the application reference and GxCatalog objects that are passed in as
 ///     parameters.
 /// </remarks>
 public abstract void Activate(IGxApplication application, IGxCatalog catalog);
Пример #11
0
 public removeAllExt()
 {
     this.pGxApp       = ArcCatalog.Application as IGxApplication;
     this.contentsView = this.pGxApp as IGxContentsView;
 }
 public RemoveClassExtension()
 {
     this.pGxApp = ArcCatalog.Application as IGxApplication;
 }
Пример #13
0
 public void Deactivate()
 {
     frmGxStyleView.GxStyleView = null;
     m_pApp     = null;
     m_pCatalog = null;
 }
Пример #14
0
        protected override void OnClick()
        {
            m_pApp = (IApplication)ArcMap.Application;
            if (m_pApp == null)
            {
                //if the app is null then could be running from ArcCatalog
                m_pApp = (IApplication)ArcCatalog.Application;
            }

            if (m_pApp == null)
            {
                MessageBox.Show("Could not access the application.", "No Application found");
                return;
            }
            IGxApplication pGXApp = (IGxApplication)m_pApp;

            stdole.IUnknown pUnk = null;
            try
            {
                pUnk = (stdole.IUnknown)pGXApp.SelectedObject.InternalObjectName.Open();
            }
            catch (COMException ex)
            {
                if (ex.ErrorCode == (int)fdoError.FDO_E_DATASET_TYPE_NOT_SUPPORTED_IN_RELEASE ||
                    ex.ErrorCode == -2147220944)
                {
                    MessageBox.Show("The dataset is not supported in this release.", "Could not open the dataset");
                }
                else
                {
                    MessageBox.Show(ex.ErrorCode.ToString(), "Could not open the dataset");
                }
                return;
            }

            if (pUnk is ICadastralFabric)
            {
                m_pCadaFab = (ICadastralFabric)pUnk;
            }
            else
            {
                MessageBox.Show("Please select a parcel fabric and try again.", "Not a parcel fabric");
                return;
            }

            IMouseCursor pMouseCursor = new MouseCursorClass();

            pMouseCursor.SetCursor(2);

            Utils FabricUTILS = new Utils();

            ITable     pTable          = m_pCadaFab.get_CadastralTable(esriCadastralFabricTable.esriCFTParcels);
            IDataset   pDS             = (IDataset)pTable;
            IWorkspace pWS             = pDS.Workspace;
            bool       bIsFileBasedGDB = true;
            bool       bIsUnVersioned  = true;

            FabricUTILS.GetFabricPlatform(pWS, m_pCadaFab, out bIsFileBasedGDB,
                                          out bIsUnVersioned);

            //Do a Start and Stop editing to make sure we're not running in an edit session
            if (!FabricUTILS.StartEditing(pWS, true))
            {//if start editing fails then bail
                if (pUnk != null)
                {
                    Marshal.ReleaseComObject(pUnk);
                }
                Cleanup(pMouseCursor, null, pTable, null, pWS, null, true);
                FabricUTILS = null;
                return;
            }
            FabricUTILS.StopEditing(pWS);

            ITable pPlansTable   = m_pCadaFab.get_CadastralTable(esriCadastralFabricTable.esriCFTPlans);
            ITable pParcelsTable = m_pCadaFab.get_CadastralTable(esriCadastralFabricTable.esriCFTParcels);

            m_pProgressorDialogFact = new ProgressDialogFactoryClass();
            m_pTrackCancel          = new CancelTrackerClass();
            m_pStepProgressor       = m_pProgressorDialogFact.Create(m_pTrackCancel, m_pApp.hWnd);
            IProgressDialog2 pProgressorDialog = (IProgressDialog2)m_pStepProgressor;
            int iRowCount  = pPlansTable.RowCount(null);
            int iRowCount2 = pParcelsTable.RowCount(null);

            m_pStepProgressor.MinRange  = 1;
            m_pStepProgressor.MaxRange  = iRowCount + iRowCount2;
            m_pStepProgressor.StepValue = 1;
            pProgressorDialog.Animation = ESRI.ArcGIS.Framework.esriProgressAnimationTypes.esriProgressSpiral;
            pProgressorDialog.ShowDialog();
            m_pStepProgressor.Message = "Searching " + iRowCount2.ToString() + " parcel records...";

            int iFixCnt = 0;
            //load all the plan names into a string array

            ArrayList             NoPlanParcels        = new ArrayList();
            ArrayList             NoPlanParcelsGrouped = new ArrayList();
            ArrayList             PlansList            = new ArrayList();
            Dictionary <int, int> ParcelLookup         = new Dictionary <int, int>();

            if (!FindNoPlanParcels(pPlansTable, pParcelsTable, ref PlansList, ref NoPlanParcels,
                                   ref NoPlanParcelsGrouped, ref ParcelLookup, out iFixCnt))
            {
                pProgressorDialog.HideDialog();
                if (iFixCnt > 0)
                {
                    MessageBox.Show("Canceled searching for parcels with no plan.", "Fix Parcels With No Name");
                }

                NoPlanParcels = null;

                Cleanup(pMouseCursor, null, pTable, pPlansTable, pWS, pProgressorDialog, true);
                return;
            }

            m_pStepProgressor.Message = "Search complete.";

            NoPlanParcels.Sort();

            dlgFixParcelsWithNoPlan MissingPlansDialog = new dlgFixParcelsWithNoPlan();

            FillTheList(MissingPlansDialog.listView1, NoPlanParcels);
            FillTheList(MissingPlansDialog.listViewByGroup, NoPlanParcelsGrouped);
            FillTheListBox(MissingPlansDialog.listPlans, PlansList);

            MissingPlansDialog.ThePlansList = PlansList;

            MissingPlansDialog.label1.Text = "Found " + iFixCnt.ToString() +
                                             " parcels that have a missing plan record.";
            MissingPlansDialog.lblSelectionCount.Text = "(" + iFixCnt.ToString() + " of "
                                                        + iFixCnt.ToString() + " selected to fix)";

            //cleanup
            Cleanup(null, null, null, null, null, pProgressorDialog, false);


            DialogResult dResult = MissingPlansDialog.ShowDialog();

            if (dResult == DialogResult.Cancel)
            {
                Cleanup(null, null, pTable, pPlansTable, pWS, pProgressorDialog, true);
                return;
            }

            //re-initilize the progressor
            m_pProgressorDialogFact = new ProgressDialogFactoryClass();
            m_pTrackCancel          = new CancelTrackerClass();
            m_pStepProgressor       = m_pProgressorDialogFact.Create(m_pTrackCancel, m_pApp.hWnd);
            pProgressorDialog       = (IProgressDialog2)m_pStepProgressor;

            m_pStepProgressor.MinRange  = 1;
            m_pStepProgressor.MaxRange  = MissingPlansDialog.listView1.CheckedItems.Count;
            m_pStepProgressor.StepValue = 1;
            pProgressorDialog.Animation = ESRI.ArcGIS.Framework.esriProgressAnimationTypes.esriProgressSpiral;
            pProgressorDialog.ShowDialog();
            m_pStepProgressor.Message = "Fixing parcels without a plan...";


            if (!FabricUTILS.StartEditing(pWS, bIsUnVersioned))
            {
                pProgressorDialog.HideDialog();
                Cleanup(null, null, pTable, pPlansTable, pWS, pProgressorDialog, true);
                FabricUTILS = null;
                return;
            }
            int iNewPlanID = 0;

            //Need to collect the choices from the UI and write the results to the DB
            ICadastralFabricSchemaEdit2 pSchemaEd = (ICadastralFabricSchemaEdit2)m_pCadaFab;

            if (MissingPlansDialog.radioBtnExistingPlan.Checked)
            {//Get the id of the EXISTING Plan
                string   sPlanString = MissingPlansDialog.listPlans.SelectedItem.ToString();
                string[] sPlanOID    = Regex.Split(sPlanString, "oid:");
                sPlanOID[1].Trim();
                iNewPlanID = Convert.ToInt32(sPlanOID[1].Remove(sPlanOID[1].LastIndexOf(")")));
            }

            Dictionary <string, int> PlanLookUp = new Dictionary <string, int>();
            ArrayList iUnitsAndFormat           = new ArrayList();

            iUnitsAndFormat.Add(m_AngleUnits);
            iUnitsAndFormat.Add(m_AreaUnits);
            iUnitsAndFormat.Add(m_DistanceUnits);
            iUnitsAndFormat.Add(m_DirectionFormat);
            iUnitsAndFormat.Add(m_LineParams);

            if (MissingPlansDialog.radioBtnUserDef.Checked)
            {                                                                                        //create a NEW plan named with user's entered text
                ArrayList sPlanInserts = new ArrayList();
                pSchemaEd.ReleaseReadOnlyFields(pPlansTable, esriCadastralFabricTable.esriCFTPlans); //release safety-catch
                sPlanInserts.Add(MissingPlansDialog.txtPlanName.Text);
                FabricUTILS.InsertPlanRecords(pPlansTable, sPlanInserts, iUnitsAndFormat, PlansList, bIsUnVersioned,
                                              null, null, ref PlanLookUp);
                if (!PlanLookUp.TryGetValue(MissingPlansDialog.txtPlanName.Text, out iNewPlanID))
                {
                    Cleanup(null, null, pTable, pPlansTable, pWS, pProgressorDialog, true);
                    FabricUTILS = null;
                    return;
                }
            }

            if (MissingPlansDialog.radioBtnPlanID.Checked)
            {//create multiple new plans for each PlanID
                ArrayList sPlanInserts = new ArrayList();
                foreach (ListViewItem listItem in MissingPlansDialog.listViewByGroup.CheckedItems)
                {
                    sPlanInserts.Add("[" + listItem.SubItems[0].Text + "]");
                }

                pSchemaEd.ReleaseReadOnlyFields(pPlansTable, esriCadastralFabricTable.esriCFTPlans); //release safety-catch
                FabricUTILS.InsertPlanRecords(pPlansTable, sPlanInserts, iUnitsAndFormat, PlansList, bIsUnVersioned,
                                              null, null, ref PlanLookUp);
            }

            ArrayList sParcelUpdates = new ArrayList();

            sParcelUpdates.Add("");
            int i           = 0;
            int iCnt        = 0;
            int iTokenLimit = 995;

            foreach (ListViewItem listItem in MissingPlansDialog.listView1.CheckedItems)
            {
                string   s      = listItem.SubItems[1].Text;
                string[] sItems = Regex.Split(s, "id:");
                if (iCnt >= iTokenLimit)    //time to start a new row
                {
                    sParcelUpdates.Add(""); //add a new item to the arraylist
                    iCnt = 0;               //reset token counter
                    i++;                    //increment array index
                }
                sItems[1] = sItems[1].Remove(sItems[1].LastIndexOf(")"));

                if (iCnt == 0)
                {
                    sParcelUpdates[i] += sItems[1];
                }
                else
                {
                    sParcelUpdates[i] += "," + sItems[1];
                }
                iCnt++;
            }

            //============edit block==========
            try
            {
                pSchemaEd.ReleaseReadOnlyFields(pTable, esriCadastralFabricTable.esriCFTParcels); //release safety-catch

                if (MissingPlansDialog.radioBtnUserDef.Checked || MissingPlansDialog.radioBtnExistingPlan.Checked)
                {
                    if (!FabricUTILS.UpdateParcelRecords(pTable, sParcelUpdates, iNewPlanID, bIsUnVersioned,
                                                         m_pStepProgressor, m_pTrackCancel))
                    {
                        pSchemaEd.ResetReadOnlyFields(esriCadastralFabricTable.esriCFTParcels);
                        pSchemaEd.ResetReadOnlyFields(esriCadastralFabricTable.esriCFTPlans);
                        FabricUTILS.AbortEditing(pWS);
                        Cleanup(null, null, pTable, pPlansTable, pWS, pProgressorDialog, true);
                        FabricUTILS = null;
                        return;
                    }
                }
                if (MissingPlansDialog.radioBtnPlanID.Checked)
                {
                    if (!FabricUTILS.UpdateParcelRecordsByPlanGroup(pTable, sParcelUpdates, PlanLookUp,
                                                                    ParcelLookup, bIsUnVersioned, m_pStepProgressor, m_pTrackCancel))
                    {
                        pSchemaEd.ResetReadOnlyFields(esriCadastralFabricTable.esriCFTParcels);
                        pSchemaEd.ResetReadOnlyFields(esriCadastralFabricTable.esriCFTPlans);
                        FabricUTILS.AbortEditing(pWS);
                        Cleanup(null, null, pTable, pPlansTable, pWS, pProgressorDialog, true);
                        FabricUTILS = null;
                        return;
                    }
                }

                pSchemaEd.ResetReadOnlyFields(esriCadastralFabricTable.esriCFTParcels);
                pSchemaEd.ResetReadOnlyFields(esriCadastralFabricTable.esriCFTPlans);

                FabricUTILS.StopEditing(pWS);

                //Cleanup(null, null, pTable, pPlansTable, pWS, pProgressorDialog, true);
                //FabricUTILS = null;
            }
            catch (COMException Ex)
            {
                MessageBox.Show(Ex.ErrorCode.ToString() + ":" + Ex.Message, "Fix Missing Plans");
            }
            finally
            {
                Cleanup(null, null, pTable, pPlansTable, pWS, pProgressorDialog, true);
                FabricUTILS = null;
            }
        }
Пример #15
0
        protected override void OnClick()
        {
            IApplication     pApp;
            ICadastralFabric m_pCadaFab;

            #region Get Fabric

            pApp = (IApplication)ArcMap.Application;
            if (pApp == null)
            {
                //if the app is null then could be running from ArcCatalog
                pApp = (IApplication)ArcCatalog.Application;
            }

            if (pApp == null)
            {
                MessageBox.Show("Could not access the application.", "No Application found");
                return;
            }

            IGxApplication  pGXApp = (IGxApplication)pApp;
            stdole.IUnknown pUnk   = null;
            try
            {
                pUnk = (stdole.IUnknown)pGXApp.SelectedObject.InternalObjectName.Open();
            }
            catch (COMException ex)
            {
                if (ex.ErrorCode == (int)fdoError.FDO_E_DATASET_TYPE_NOT_SUPPORTED_IN_RELEASE ||
                    ex.ErrorCode == -2147220944)
                {
                    MessageBox.Show("The dataset is not supported in this release.", "Could not open the dataset");
                }
                else
                {
                    MessageBox.Show(ex.ErrorCode.ToString(), "Could not open the dataset");
                }
                return;
            }

            if (pUnk is ICadastralFabric)
            {
                m_pCadaFab = (ICadastralFabric)pUnk;
            }
            else
            {
                MessageBox.Show("Please select a parcel fabric and try again.", "Not a parcel fabric");
                return;
            }
            #endregion


            IName pName = pGXApp.SelectedObject.InternalObjectName as IName;
            ICadastralFabricName pCFName = pName as ICadastralFabricName;

            IFabricImporterUI pFabImporterUI = new FabricCogoImporterUIClass();
            pFabImporterUI.CadastralFabric = pCFName;
            pFabImporterUI.DoModal(pApp.hWnd);

            //ArcMap.Application.CurrentTool = null;
        }
Пример #16
0
        public void Import(string connectionString, string tableName)
        {
            if (string.IsNullOrEmpty(connectionString))
            {
                MessageBox.Show("Unable to obtain connection SQL 2008 information.", "Error", MessageBoxButtons.OK);
                return;
            }

            IGxApplication gxApp  = m_application as IGxApplication;
            IGxView        gxView = gxApp.View;

            if (gxApp.Selection.Count > 0)
            {
                if (gxApp.Selection.Count == 1)
                {
                    IGxObject gxObj  = gxApp.SelectedObject;
                    object    selObj = gxObj.InternalObjectName.Open();
                    if (selObj is IFeatureClass)
                    {
                        IFeatureClass featureClass = selObj as IFeatureClass;
                        //ConnectionStringSettings connStr = m_config.ConnectionStrings.ConnectionStrings[ "SQL2008" ];
                        SqlConnection sqlConnection = new SqlConnection(connectionString);
                        sqlConnection.Open();
                        SQL2008Database sqlDatabase = new SQL2008Database(connectionString);

                        DefaultAoGeometryTypeProvider aoGeometryTypeProvider = new DefaultAoGeometryTypeProvider();
                        string geometryType = aoGeometryTypeProvider.GetGeometryType(featureClass.ShapeType);

                        if (String.IsNullOrEmpty(geometryType))
                        {
                            MessageBox.Show("The geometry type of the source FeatureClass is not supported.", "Error", MessageBoxButtons.OK);
                            return;
                        }

                        System.Collections.IDictionary parameters = new System.Collections.Hashtable();
                        parameters.Add("featureClass", featureClass);
                        parameters.Add("layerName", tableName);
                        parameters.Add("keyFieldName", featureClass.OIDFieldName);
                        AoFCLayer shapeFileLayer = container.Resolve <AoFCLayer>("Ao" + geometryType, parameters);

                        if (shapeFileLayer == null)
                        {
                            MessageBox.Show("Unable to create the input framework layer for the FeatureClass. Please check the component configuration.", "Error", MessageBoxButtons.OK);
                            return;
                        }

                        if (sqlDatabase.ContainsTable(tableName))
                        {
                            if (MessageBox.Show("Overwrite existing table?", "Overwrite", MessageBoxButtons.YesNo) == DialogResult.Yes)
                            {
                                sqlDatabase.DeleteTable(tableName);
                            }
                            else
                            {
                                MessageBox.Show("Exiting export operation", "Information", MessageBoxButtons.OK);
                                return;
                            }
                        }

                        ISupportsGISFields shapeFileFields = shapeFileLayer as ISupportsGISFields;
                        IGISFields         inputFields     = shapeFileFields.GetGISFields();

                        SqlCommand sqlCommand;

                        int?srid = null;
                        if (shapeFileLayer is ISupportsSRID)
                        {
                            srid = (shapeFileLayer as ISupportsSRID).Srid;
                        }

                        IGISLayer sql2008Layer = null;
                        //Create the dictionary with the parameters to create the corresponding SQL 2008 layer
                        System.Collections.IDictionary sqlParameters = new System.Collections.Hashtable();
                        sqlParameters.Add("tableName", tableName);
                        sqlParameters.Add("shapeFieldName", "SHAPE");
                        sqlParameters.Add("layerName", tableName);
                        sqlParameters.Add("keyFieldName", featureClass.OIDFieldName);

                        if (srid.HasValue && WKIDRanges.IsGeographic(srid.Value))
                        {
                            //Create the geography table with the fields from the FeatureClass
                            sqlDatabase.CreateGeographyTable(inputFields, tableName, "SHAPE");
                            sqlCommand = new SqlCommand("Select * from " + tableName, sqlConnection);
                            sqlParameters.Add("dbCommand", sqlCommand);
                            sql2008Layer = container.Resolve <IGISLayer>("Sql2008Geog" + geometryType, sqlParameters);
                        }
                        else
                        {
                            //Create the geometry table with the fields from the FeatureClass
                            sqlDatabase.CreateGeometryTable(inputFields, tableName, "SHAPE");
                            sqlCommand = new SqlCommand("Select * from " + tableName, sqlConnection);
                            sqlParameters.Add("dbCommand", sqlCommand);
                            sql2008Layer = container.Resolve <IGISLayer>("Sql2008Geom" + geometryType, sqlParameters);
                        }

                        //Get the editable layer reference to the destination sql table layer
                        IGISEditableLayer editableLayer = sql2008Layer as IGISEditableLayer;

                        //Quit the application if a valid editable layer reference could not be obtained
                        if (editableLayer == null)
                        {
                            MessageBox.Show("The destination is either invalid or does not support editing.", "Error", MessageBoxButtons.OK);
                            return;
                        }

                        shapeFileLayer.Search(null);
                        string keyFieldName = shapeFileLayer.KeyFieldName;
                        while (shapeFileLayer.MoveNext())
                        {
                            try
                            {
                                editableLayer.Add(shapeFileLayer.Current);
                            }
                            catch (Exception ex)
                            {
                                string msg = ex.Message + " Feature ID:- " + shapeFileLayer.Current.Attributes.GetValue(keyFieldName).ToString();
                                _log.Error(msg, ex);
                            }
                        }

                        MessageBox.Show("Import completed.", "Information", MessageBoxButtons.OK);
                    }
                    else
                    {
                        MessageBox.Show("Only FeatureClasses can be exported to SQL 2008", "Information", MessageBoxButtons.OK);
                    }
                }
                else
                {
                    MessageBox.Show("Please only one FeatureClass to export to SQL 2008.");
                    return;
                }
            }
            else
            {
                MessageBox.Show("Please select a FeatureClass to export to SQL 2008.");
                return;
            }
        }
        protected override void OnClick()
        {
            m_pApp = (IApplication)ArcMap.Application;
            if (m_pApp == null)
            {
                //if the app is null then could be running from ArcCatalog
                m_pApp = (IApplication)ArcCatalog.Application;
            }

            if (m_pApp == null)
            {
                MessageBox.Show("Could not access the application.", "No Application found");
                return;
            }

            IGxApplication pGXApp = (IGxApplication)m_pApp;

            stdole.IUnknown pUnk = null;
            try
            {
                pUnk = (stdole.IUnknown)pGXApp.SelectedObject.InternalObjectName.Open();
            }
            catch (COMException ex)
            {
                if (ex.ErrorCode == (int)fdoError.FDO_E_DATASET_TYPE_NOT_SUPPORTED_IN_RELEASE ||
                    ex.ErrorCode == -2147220944)
                {
                    MessageBox.Show("The dataset is not supported in this release.", "Could not open the dataset");
                }
                else
                {
                    MessageBox.Show(ex.ErrorCode.ToString(), "Could not open the dataset");
                }
                return;
            }

            if (pUnk is ICadastralFabric)
            {
                m_pCadaFab = (ICadastralFabric)pUnk;
            }
            else
            {
                MessageBox.Show("Please select a parcel fabric and try again.", "Not a parcel fabric");
                return;
            }

            IMouseCursor pMouseCursor = new MouseCursorClass();

            pMouseCursor.SetCursor(2);

            clsFabricUtils   FabricUTILS       = new clsFabricUtils();
            IProgressDialog2 pProgressorDialog = null;

            ITable     pTable          = m_pCadaFab.get_CadastralTable(esriCadastralFabricTable.esriCFTParcels);
            IDataset   pDS             = (IDataset)pTable;
            IWorkspace pWS             = pDS.Workspace;
            bool       bIsFileBasedGDB = true;
            bool       bIsUnVersioned  = true;

            FabricUTILS.GetFabricPlatform(pWS, m_pCadaFab, out bIsFileBasedGDB,
                                          out bIsUnVersioned);

            if (!bIsFileBasedGDB && !bIsUnVersioned)
            {
                MessageBox.Show("Truncate operates on non-versioned fabrics."
                                + Environment.NewLine +
                                "Please unversion the fabric and try again.", "Tables are versioned");
                return;
            }


            //Do a Start and Stop editing to make sure truncate it not running within an edit session
            if (!FabricUTILS.StartEditing(pWS, bIsUnVersioned))
            {//if start editing fails then bail
                Cleanup(pProgressorDialog, pMouseCursor);
                return;
            }
            FabricUTILS.StopEditing(pWS);

            dlgTruncate pTruncateDialog = new dlgTruncate();
            IArray      TableArray      = new ESRI.ArcGIS.esriSystem.ArrayClass();

            pTruncateDialog.TheFabric     = m_pCadaFab;
            pTruncateDialog.TheTableArray = TableArray;

            //Display the dialog
            DialogResult pDialogResult = pTruncateDialog.ShowDialog();

            if (pDialogResult != DialogResult.OK)
            {
                pTruncateDialog = null;
                if (TableArray != null)
                {
                    TableArray.RemoveAll();
                }
                return;
            }

            m_pProgressorDialogFact     = new ProgressDialogFactoryClass();
            m_pTrackCancel              = new CancelTrackerClass();
            m_pStepProgressor           = m_pProgressorDialogFact.Create(m_pTrackCancel, m_pApp.hWnd);
            pProgressorDialog           = (IProgressDialog2)m_pStepProgressor;
            m_pStepProgressor.MinRange  = 0;
            m_pStepProgressor.MaxRange  = pTruncateDialog.DropRowCount;
            m_pStepProgressor.StepValue = 1;
            pProgressorDialog.Animation = ESRI.ArcGIS.Framework.esriProgressAnimationTypes.esriProgressSpiral;
            bool bSuccess         = false;
            int  iControlRowCount = 0;
            //look in registry to get flag on whether to run truncate on standard tables, or to delete by row.
            string sDesktopVers = FabricUTILS.GetDesktopVersionFromRegistry();

            if (sDesktopVers.Trim() == "")
            {
                sDesktopVers = "Desktop10.0";
            }
            else
            {
                sDesktopVers = "Desktop" + sDesktopVers;
            }

            bool bDeleteTablesByRowInsteadOfTruncate = false;

            string sValues = FabricUTILS.ReadFromRegistry(RegistryHive.CurrentUser, "Software\\ESRI\\" + sDesktopVers + "\\ArcMap\\Cadastral",
                                                          "AddIn.DeleteFabricRecords_Truncate");

            if (sValues.Trim().ToLower() == "deletebytruncateonstandardtables" || bIsFileBasedGDB)
            {
                bDeleteTablesByRowInsteadOfTruncate = false;
            }

            if (sValues.Trim().ToLower() == "deletebyrowonstandardtables")
            {
                bDeleteTablesByRowInsteadOfTruncate = true;
            }

            if (pTruncateDialog.TruncateControl && !pTruncateDialog.TruncateParcelsLinesPoints)
            { // get the control point count
                ITable pControlTable = m_pCadaFab.get_CadastralTable(esriCadastralFabricTable.esriCFTControl);
                iControlRowCount = pControlTable.RowCount(null);
            }

            try
            {
                //Work on the table array
                pTable = null;

                m_pFIDSet = new FIDSetClass();
                for (int i = 0; i <= TableArray.Count - 1; i++)
                {
                    //if (TableArray.get_Element(i) is ITable) ...redundant
                    {
                        pTable = (ITable)TableArray.get_Element(i);
                        IDataset pDataSet = (IDataset)pTable;
                        //Following code uses the truncate method
                        //***
                        if (pTable is IFeatureClass || !bDeleteTablesByRowInsteadOfTruncate)
                        {
                            ITableWrite2 pTableWr = (ITableWrite2)pTable;
                            m_pStepProgressor.Message = "Deleting all rows in " + pDataSet.Name;
                            int RowCnt = pTable.RowCount(null);
                            pTableWr.Truncate();
                            m_pStepProgressor.MaxRange -= RowCnt;
                            //now re-insert the default plan
                            string sName = pDataSet.Name.ToUpper().Trim();
                            if (sName.EndsWith("_PLANS"))
                            {
                                int idxPlanName               = pTable.FindField("Name");
                                int idxPlanDescription        = pTable.FindField("Description");
                                int idxPlanAngleUnits         = pTable.FindField("AngleUnits");
                                int idxPlanAreaUnits          = pTable.FindField("AreaUnits");
                                int idxPlanDistanceUnits      = pTable.FindField("DistanceUnits");
                                int idxPlanDirectionFormat    = pTable.FindField("DirectionFormat");
                                int idxPlanLineParameters     = pTable.FindField("LineParameters");
                                int idxPlanCombinedGridFactor = pTable.FindField("CombinedGridFactor");
                                int idxPlanTrueMidBrg         = pTable.FindField("TrueMidBrg");
                                int idxPlanAccuracy           = pTable.FindField("Accuracy");
                                int idxPlanInternalAngles     = pTable.FindField("InternalAngles");

                                ICursor pCur = pTableWr.InsertRows(false);

                                IRowBuffer pRowBuff = pTable.CreateRowBuffer();

                                double dOneMeterEquals = FabricUTILS.ConvertMetersToFabricUnits(1, m_pCadaFab);
                                bool   bIsMetric       = (dOneMeterEquals == 1);

                                //write category 1
                                pRowBuff.set_Value(idxPlanName, "<map>");
                                pRowBuff.set_Value(idxPlanDescription, "System default plan");
                                pRowBuff.set_Value(idxPlanAngleUnits, 3);

                                //
                                if (bIsMetric)
                                {
                                    pRowBuff.set_Value(idxPlanAreaUnits, 5);
                                    pRowBuff.set_Value(idxPlanDistanceUnits, 9001);
                                    pRowBuff.set_Value(idxPlanDirectionFormat, 1);
                                }
                                else
                                {
                                    pRowBuff.set_Value(idxPlanAreaUnits, 4);
                                    pRowBuff.set_Value(idxPlanDistanceUnits, 9003);
                                    pRowBuff.set_Value(idxPlanDirectionFormat, 4);
                                }

                                pRowBuff.set_Value(idxPlanLineParameters, 4);
                                pRowBuff.set_Value(idxPlanCombinedGridFactor, 1);
                                //pRowBuff.set_Value(idxPlanTrueMidBrg, 1);
                                pRowBuff.set_Value(idxPlanAccuracy, 4);
                                pRowBuff.set_Value(idxPlanInternalAngles, 0);

                                pCur.InsertRow(pRowBuff);

                                pCur.Flush();
                                if (pRowBuff != null)
                                {
                                    Marshal.ReleaseComObject(pRowBuff);
                                }
                                if (pCur != null)
                                {
                                    Marshal.ReleaseComObject(pCur);
                                }
                            }
                        }
                    }
                }
            }
            catch (COMException ex)
            {
                MessageBox.Show(ex.Message + ": " + Convert.ToString(ex.ErrorCode));
                Cleanup(pProgressorDialog, pMouseCursor);
                return;
            }

            //do the loop again, this time within the edit transaction and using the delete function for the chosen tables
            try
            {
                //Start an Edit Transaction
                if (!FabricUTILS.StartEditing(pWS, bIsUnVersioned))
                {//if start editing fails then bail
                    Cleanup(pProgressorDialog, pMouseCursor);
                    return;
                }
                for (int i = 0; i <= TableArray.Count - 1; i++)
                {
                    //if (TableArray.get_Element(i) is ITable)
                    {
                        pTable = (ITable)TableArray.get_Element(i);
                        IDataset pDataSet = (IDataset)pTable;

                        if (pTable is IFeatureClass || !bDeleteTablesByRowInsteadOfTruncate)
                        {
                        }
                        else
                        {
                            //The following code is in place to workaround a limitation of truncate for fabric classes
                            //without a shapefield. It uses an alternative method for removing all the rows
                            //with the Delete function.
                            //General note: This method could be used exclusively, without needing the truncate method.
                            //One advantage is that it allows the option to cancel the whole
                            //operation using the cancel tracker. Truncate is faster, but is problematic if
                            //the truncate fails, and leaves a partially deleted fabric. For example, if the
                            //lines table is deleted but the points table truncate fails, the fabric would be in a
                            //corrupt state.
                            //****

                            m_pFIDSet.SetEmpty();
                            string sName = pDataSet.Name.ToUpper().Trim();
                            m_pStepProgressor.Message = "Loading rows from " + pDataSet.Name;

                            if (sName.EndsWith("_PLANS"))
                            {//for Plans table make sure the default plan is not deleted
                                IQueryFilter pQF = new QueryFilterClass();
                                string       sPref; string sSuff;
                                ISQLSyntax   pSQLSyntax = (ISQLSyntax)pWS;
                                sPref = pSQLSyntax.GetSpecialCharacter(esriSQLSpecialCharacters.esriSQL_DelimitedIdentifierPrefix);
                                sSuff = pSQLSyntax.GetSpecialCharacter(esriSQLSpecialCharacters.esriSQL_DelimitedIdentifierSuffix);
                                string sFieldName = "NAME";
                                //pQF.WhereClause = sPref + sFieldName + sSuff + " <> '<map>'";
                                pQF.WhereClause = sFieldName + " <> '<map>'";
                                if (!BuildFIDSetFromTable(pTable, pQF, ref m_pFIDSet))
                                {
                                    FabricUTILS.AbortEditing(pWS);
                                    Cleanup(pProgressorDialog, pMouseCursor);
                                    return;
                                }
                            }
                            else
                            {
                                if (!BuildFIDSetFromTable(pTable, null, ref m_pFIDSet))
                                {
                                    FabricUTILS.AbortEditing(pWS);
                                    Cleanup(pProgressorDialog, pMouseCursor);
                                    return;
                                }
                            }

                            if (m_pFIDSet.Count() == 0)
                            {
                                continue;
                            }

                            m_pStepProgressor.Message = "Deleting all rows in " + pDataSet.Name;
                            bSuccess = FabricUTILS.DeleteRowsUnversioned(pWS, pTable, m_pFIDSet,
                                                                         m_pStepProgressor, m_pTrackCancel);
                            if (!bSuccess)
                            {
                                FabricUTILS.AbortEditing(pWS);
                                Cleanup(pProgressorDialog, pMouseCursor);
                                return;
                            }
                        }
                    }
                }



                //now need to Fix control-to-point associations if one table was truncated
                //and the other was not
                if (pTruncateDialog.TruncateControl && !pTruncateDialog.TruncateParcelsLinesPoints)
                {
                    IQueryFilter pQF = new QueryFilterClass();
                    string       sPref; string sSuff;
                    ISQLSyntax   pSQLSyntax = (ISQLSyntax)pWS;
                    sPref = pSQLSyntax.GetSpecialCharacter(esriSQLSpecialCharacters.esriSQL_DelimitedIdentifierPrefix);
                    sSuff = pSQLSyntax.GetSpecialCharacter(esriSQLSpecialCharacters.esriSQL_DelimitedIdentifierSuffix);
                    ITable PointTable = m_pCadaFab.get_CadastralTable(esriCadastralFabricTable.esriCFTPoints);
                    m_pStepProgressor.Message = "Resetting control associations on points...please wait.";
                    int    idxFld     = PointTable.FindField("NAME");
                    string sFieldName = PointTable.Fields.get_Field(idxFld).Name;

                    //NAME IS NOT NULL AND (NAME <>'' OR NAME <>' ')
                    //pQF.WhereClause = sPref + sFieldName + sSuff + " IS NOT NULL AND (" +
                    //  sPref + sFieldName + sSuff + "<>'' OR " + sPref + sFieldName + sSuff + " <>' ')";
                    //pQF.WhereClause = sFieldName + " IS NOT NULL AND (" + sFieldName + "<>'' OR " + sFieldName + " <>' ')";
                    pQF.WhereClause = sFieldName + " IS NOT NULL AND " + sFieldName + " > ''"; //changed 1/14/2016

                    ICadastralFabricSchemaEdit2 pSchemaEd = (ICadastralFabricSchemaEdit2)m_pCadaFab;
                    pSchemaEd.ReleaseReadOnlyFields(PointTable, esriCadastralFabricTable.esriCFTPoints);

                    m_pStepProgressor.MinRange = 0;
                    m_pStepProgressor.MaxRange = iControlRowCount;

                    if (!ResetPointAssociations(PointTable, pQF, true, m_pStepProgressor, m_pTrackCancel))
                    {
                        pSchemaEd.ResetReadOnlyFields(esriCadastralFabricTable.esriCFTPoints);
                        FabricUTILS.AbortEditing(pWS);
                        Cleanup(pProgressorDialog, pMouseCursor);
                        return;
                    }

                    pSchemaEd.ResetReadOnlyFields(esriCadastralFabricTable.esriCFTPoints);
                }

                else if (pTruncateDialog.TruncateParcelsLinesPoints && !pTruncateDialog.TruncateControl)
                {
                    IQueryFilter pQF = new QueryFilterClass();
                    string       sPref; string sSuff;
                    ISQLSyntax   pSQLSyntax = (ISQLSyntax)pWS;
                    sPref = pSQLSyntax.GetSpecialCharacter(esriSQLSpecialCharacters.esriSQL_DelimitedIdentifierPrefix);
                    sSuff = pSQLSyntax.GetSpecialCharacter(esriSQLSpecialCharacters.esriSQL_DelimitedIdentifierSuffix);
                    //POINTID >=0 AND POINTID IS NOT NULL
                    m_pStepProgressor.Message = "Resetting associations on control points...please wait.";
                    ITable ControlTable = m_pCadaFab.get_CadastralTable(esriCadastralFabricTable.esriCFTControl);
                    int    idxFld       = ControlTable.FindField("POINTID");
                    string sFieldName   = ControlTable.Fields.get_Field(idxFld).Name;

                    //pQF.WhereClause = sPref + sFieldName + sSuff + " IS NOT NULL AND " +
                    //  sPref + sFieldName + sSuff + " >=0";
                    pQF.WhereClause = sFieldName + " IS NOT NULL AND " + sFieldName + " >=0";

                    ICadastralFabricSchemaEdit2 pSchemaEd = (ICadastralFabricSchemaEdit2)m_pCadaFab;
                    pSchemaEd.ReleaseReadOnlyFields(ControlTable, esriCadastralFabricTable.esriCFTControl);
                    if (!FabricUTILS.ResetControlAssociations(ControlTable, null, true))
                    {
                        pSchemaEd.ResetReadOnlyFields(esriCadastralFabricTable.esriCFTControl);
                        FabricUTILS.AbortEditing(pWS);
                        Cleanup(pProgressorDialog, pMouseCursor);
                        return;
                    }
                    pSchemaEd.ResetReadOnlyFields(esriCadastralFabricTable.esriCFTControl);
                }

                //now need to re-assign default accuracy table values, if the option was checked
                if (pTruncateDialog.ResetAccuracyTableDefaults)
                {
                    double dCat1 = FabricUTILS.ConvertMetersToFabricUnits(0.001, m_pCadaFab);
                    double dCat2 = FabricUTILS.ConvertMetersToFabricUnits(0.01, m_pCadaFab);
                    double dCat3 = FabricUTILS.ConvertMetersToFabricUnits(0.02, m_pCadaFab);
                    double dCat4 = FabricUTILS.ConvertMetersToFabricUnits(0.05, m_pCadaFab);
                    double dCat5 = FabricUTILS.ConvertMetersToFabricUnits(0.2, m_pCadaFab);
                    double dCat6 = FabricUTILS.ConvertMetersToFabricUnits(1, m_pCadaFab);
                    double dCat7 = FabricUTILS.ConvertMetersToFabricUnits(10, m_pCadaFab);

                    ITable       pAccTable      = m_pCadaFab.get_CadastralTable(esriCadastralFabricTable.esriCFTAccuracy);
                    int          idxBrgSD       = pAccTable.FindField("BrgSD");
                    int          idxDistSD      = pAccTable.FindField("DistSD");
                    int          idxPPM         = pAccTable.FindField("PPM");
                    int          idxCategory    = pAccTable.FindField("Category");
                    int          idxDescription = pAccTable.FindField("Description");
                    ITableWrite2 pTableWr       = (ITableWrite2)pAccTable;
                    ICursor      pCur           = pTableWr.InsertRows(false);

                    IRowBuffer pRowBuff = pAccTable.CreateRowBuffer();

                    //write category 1
                    pRowBuff.set_Value(idxCategory, 1);
                    pRowBuff.set_Value(idxBrgSD, 5);
                    pRowBuff.set_Value(idxDistSD, dCat1);
                    pRowBuff.set_Value(idxPPM, 5);
                    pRowBuff.set_Value(idxDescription, "1 - Highest");
                    pCur.InsertRow(pRowBuff);

                    //write category 2
                    pRowBuff.set_Value(idxCategory, 2);
                    pRowBuff.set_Value(idxBrgSD, 30);
                    pRowBuff.set_Value(idxDistSD, dCat2);
                    pRowBuff.set_Value(idxPPM, 25);
                    pRowBuff.set_Value(idxDescription, "2 - After 1980");
                    pCur.InsertRow(pRowBuff);

                    //write category 3
                    pRowBuff.set_Value(idxCategory, 3);
                    pRowBuff.set_Value(idxBrgSD, 60);
                    pRowBuff.set_Value(idxDistSD, dCat3);
                    pRowBuff.set_Value(idxPPM, 50);
                    pRowBuff.set_Value(idxDescription, "3 - 1908 to 1980");
                    pCur.InsertRow(pRowBuff);

                    //write category 4
                    pRowBuff.set_Value(idxCategory, 4);
                    pRowBuff.set_Value(idxBrgSD, 120);
                    pRowBuff.set_Value(idxDistSD, dCat4);
                    pRowBuff.set_Value(idxPPM, 125);
                    pRowBuff.set_Value(idxDescription, "4 - 1881 to 1907");
                    pCur.InsertRow(pRowBuff);

                    //write category 5
                    pRowBuff.set_Value(idxCategory, 5);
                    pRowBuff.set_Value(idxBrgSD, 300);
                    pRowBuff.set_Value(idxDistSD, dCat5);
                    pRowBuff.set_Value(idxPPM, 125);
                    pRowBuff.set_Value(idxDescription, "5 - Before 1881");
                    pCur.InsertRow(pRowBuff);

                    //write category 6
                    pRowBuff.set_Value(idxCategory, 6);
                    pRowBuff.set_Value(idxBrgSD, 3600);
                    pRowBuff.set_Value(idxDistSD, dCat6);
                    pRowBuff.set_Value(idxPPM, 1000);
                    pRowBuff.set_Value(idxDescription, "6 - 1800");
                    pCur.InsertRow(pRowBuff);

                    //write category 7
                    pRowBuff.set_Value(idxCategory, 7);
                    pRowBuff.set_Value(idxBrgSD, 6000);
                    pRowBuff.set_Value(idxDistSD, dCat7);
                    pRowBuff.set_Value(idxPPM, 5000);
                    pRowBuff.set_Value(idxDescription, "7 - Lowest");
                    pCur.InsertRow(pRowBuff);

                    pCur.Flush();
                    if (pRowBuff != null)
                    {
                        Marshal.ReleaseComObject(pRowBuff);
                    }
                    if (pCur != null)
                    {
                        Marshal.ReleaseComObject(pCur);
                    }
                }

                //now need to cleanup the IDSequence table if ALL the tables were truncated
                if (pTruncateDialog.TruncateControl &&
                    pTruncateDialog.TruncateParcelsLinesPoints &&
                    pTruncateDialog.TruncateJobs &&
                    pTruncateDialog.TruncateAdjustments)
                {
                    IWorkspace2       pWS2        = (IWorkspace2)pWS;
                    IDataset          TheFabricDS = (IDataset)m_pCadaFab;
                    string            sFabricName = TheFabricDS.Name;
                    string            sName       = sFabricName + "_IDSequencer";
                    bool              bExists     = pWS2.get_NameExists(esriDatasetType.esriDTTable, sName);
                    IFeatureWorkspace pFWS        = (IFeatureWorkspace)pWS;
                    ITable            pSequencerTable;
                    if (bExists)
                    {
                        pSequencerTable = pFWS.OpenTable(sName);
                        IFIDSet pFIDSet = new FIDSetClass();
                        if (BuildFIDSetFromTable(pSequencerTable, null, ref pFIDSet))
                        {
                            FabricUTILS.DeleteRowsUnversioned(pWS, pSequencerTable, pFIDSet, null, null);
                        }
                    }
                }

                Cleanup(pProgressorDialog, pMouseCursor);

                if (TableArray != null)
                {
                    TableArray.RemoveAll();
                }
                FabricUTILS.StopEditing(pWS);
            }
            catch (Exception ex)
            {
                FabricUTILS.AbortEditing(pWS);
                Cleanup(pProgressorDialog, pMouseCursor);
                MessageBox.Show(Convert.ToString(ex.Message));
            }
        }
Пример #18
0
        protected override void OnClick()
        {
            m_pApp = (IApplication)ArcMap.Application;
            if (m_pApp == null)
            {
                //if the app is null then could be running from ArcCatalog
                m_pApp = (IApplication)ArcCatalog.Application;
            }

            if (m_pApp == null)
            {
                MessageBox.Show("Could not access the application.", "No Application found");
                return;
            }
            IGxApplication pGXApp = (IGxApplication)m_pApp;

            stdole.IUnknown pUnk = null;
            try
            {
                pUnk = (stdole.IUnknown)pGXApp.SelectedObject.InternalObjectName.Open();
            }
            catch (COMException ex)
            {
                if (ex.ErrorCode == (int)fdoError.FDO_E_DATASET_TYPE_NOT_SUPPORTED_IN_RELEASE ||
                    ex.ErrorCode == -2147220944)
                {
                    MessageBox.Show("The dataset is not supported in this release.", "Could not open the dataset");
                }
                else
                {
                    MessageBox.Show(ex.ErrorCode.ToString(), "Could not open the dataset");
                }
                return;
            }

            if (pUnk is ICadastralFabric)
            {
                m_pCadaFab = (ICadastralFabric)pUnk;
            }
            else
            {
                MessageBox.Show("Please select a parcel fabric and try again.", "Not a parcel fabric");
                return;
            }

            IMouseCursor pMouseCursor = new MouseCursorClass();

            pMouseCursor.SetCursor(2);

            Utils FabricUTILS = new Utils();

            ITable     pTable          = m_pCadaFab.get_CadastralTable(esriCadastralFabricTable.esriCFTParcels);
            IDataset   pDS             = (IDataset)pTable;
            IWorkspace pWS             = pDS.Workspace;
            bool       bIsFileBasedGDB = true;
            bool       bIsUnVersioned  = true;

            FabricUTILS.GetFabricPlatform(pWS, m_pCadaFab, out bIsFileBasedGDB,
                                          out bIsUnVersioned);

            //Do a Start and Stop editing to make sure we're not running in an edit session
            if (!FabricUTILS.StartEditing(pWS, true))
            {//if start editing fails then bail
                if (pUnk != null)
                {
                    Marshal.ReleaseComObject(pUnk);
                }
                Cleanup(pMouseCursor, null, pTable, null, pWS, null);
                FabricUTILS = null;
                return;
            }
            FabricUTILS.StopEditing(pWS);
            IFIDSet pPlansToDelete = null;

            try
            {
                string[] SummaryNames = new string[0]; //define as dynamic array
                string[] RepeatPlans  = new string[0]; //define as dynamic array
                ITable   pPlansTable  = m_pCadaFab.get_CadastralTable(esriCadastralFabricTable.esriCFTPlans);
                //load all the plan names into a string array
                m_pProgressorDialogFact = new ProgressDialogFactoryClass();
                m_pTrackCancel          = new CancelTrackerClass();
                m_pStepProgressor       = m_pProgressorDialogFact.Create(m_pTrackCancel, m_pApp.hWnd);
                IProgressDialog2 pProgressorDialog = (IProgressDialog2)m_pStepProgressor;
                int iRowCount = pPlansTable.RowCount(null);
                m_pStepProgressor.MinRange  = 1;
                m_pStepProgressor.MaxRange  = iRowCount * 2;
                m_pStepProgressor.StepValue = 1;
                pProgressorDialog.Animation = ESRI.ArcGIS.Framework.esriProgressAnimationTypes.esriProgressSpiral;
                pProgressorDialog.ShowDialog();
                m_pStepProgressor.Message = "Finding same-name plans to merge...";

                int iRepeatCnt = 0;

                if (!FindRepeatPlans(pPlansTable, out RepeatPlans, out SummaryNames, out iRepeatCnt))
                {
                    pProgressorDialog.HideDialog();
                    if (iRepeatCnt == 0)
                    {
                        MessageBox.Show("All plans in the fabric have unique names." +
                                        Environment.NewLine + "There are no plans to merge.", "Merge plans by name");
                    }
                    else
                    {
                        MessageBox.Show("There was a problem searching for repeat plans.", "Merge plans by name");
                    }
                    SummaryNames = null;
                    RepeatPlans  = null;
                    Cleanup(pMouseCursor, null, pTable, pPlansTable, pWS, pProgressorDialog);
                    return;
                }

                dlgMergeSameNamePlans TheSummaryDialog = new dlgMergeSameNamePlans();

                FillTheSummaryList(TheSummaryDialog, SummaryNames);

                DialogResult dResult = TheSummaryDialog.ShowDialog();

                if (dResult == DialogResult.Cancel)
                {
                    pProgressorDialog.HideDialog();
                    SummaryNames = null;
                    RepeatPlans  = null;
                    Cleanup(pMouseCursor, null, pTable, pPlansTable, pWS, pProgressorDialog);
                    pPlansTable = null;
                    return;
                }

                //get the time now
                m_pStartTime = new TimeClass();
                m_pStartTime.SetFromCurrentLocalTime();

                Dictionary <int, int> Lookup = new Dictionary <int, int>();
                string[] InClause            = new string[0]; //define as dynamic array

                m_pStepProgressor.Message = "Creating the merge query...";
                FabricUTILS.BuildSearchMapAndQuery(RepeatPlans, out Lookup, out InClause, out pPlansToDelete);

                ICadastralFabricSchemaEdit2 pSchemaEd = (ICadastralFabricSchemaEdit2)m_pCadaFab;
                ITable ParcelTable = m_pCadaFab.get_CadastralTable(esriCadastralFabricTable.esriCFTParcels);
                pSchemaEd.ReleaseReadOnlyFields(ParcelTable, esriCadastralFabricTable.esriCFTParcels); //release safety-catch

                if (!FabricUTILS.StartEditing(pWS, bIsUnVersioned))
                {
                    Cleanup(pMouseCursor, pPlansToDelete, pTable, pPlansTable, pWS, pProgressorDialog);
                    InClause = null;
                    Lookup.Clear();
                    Lookup = null;
                    return;
                }

                //setup progressor dialog for merge
                m_pStepProgressor.Message = "Moving parcels from source to target plans...";

                if (!FabricUTILS.MergePlans(ParcelTable, Lookup, InClause, bIsUnVersioned, m_pStepProgressor, m_pTrackCancel))
                {
                    FabricUTILS.AbortEditing(pWS);
                    pSchemaEd.ResetReadOnlyFields(esriCadastralFabricTable.esriCFTParcels);
                    Cleanup(pMouseCursor, pPlansToDelete, pTable, pPlansTable, pWS, pProgressorDialog);
                    InClause = null;
                    Lookup.Clear();
                    Lookup = null;
                    return;
                }

                if (TheSummaryDialog.checkBox1.Checked)
                {
                    //setup progressor dialog for Delete
                    m_pStepProgressor.MaxRange = pPlansToDelete.Count();
                    m_pStepProgressor.Message  = "Deleting source plans...";

                    if (bIsUnVersioned)
                    {
                        if (!FabricUTILS.DeleteRowsUnversioned(pWS, pPlansTable, pPlansToDelete, m_pStepProgressor, m_pTrackCancel))
                        {
                            Cleanup(pMouseCursor, pPlansToDelete, pTable, pPlansTable, pWS, pProgressorDialog);
                        }
                    }
                    else
                    {
                        if (!FabricUTILS.DeleteRowsByFIDSet(pPlansTable, pPlansToDelete, m_pStepProgressor, m_pTrackCancel))
                        {
                            Cleanup(pMouseCursor, pPlansToDelete, pTable, pPlansTable, pWS, pProgressorDialog);
                        }
                    }
                }

                pSchemaEd.ResetReadOnlyFields(esriCadastralFabricTable.esriCFTParcels);

                m_pEndTime = new TimeClass();
                m_pEndTime.SetFromCurrentLocalTime();
                ITimeDuration HowLong = m_pEndTime.SubtractTime(m_pStartTime);

                m_pStepProgressor.Message = "["
                                            + HowLong.Hours.ToString("00") + "h "
                                            + HowLong.Minutes.ToString("00") + "m "
                                            + HowLong.Seconds.ToString("00") + "s]" + "  Saving changes...please wait.";

                FabricUTILS.StopEditing(pWS);
                Cleanup(pMouseCursor, pPlansToDelete, pTable, pPlansTable, pWS, pProgressorDialog);
            }
            catch (COMException ex)
            {
                MessageBox.Show(Convert.ToString(ex.ErrorCode));
                Cleanup(pMouseCursor, pPlansToDelete, pTable, null, pWS, null);
            }
        }
        protected override void OnClick()
        {
            IApplication     pApp;
            ICadastralFabric m_pCadaFab;
            IQueryFilter     m_pQF;

            #region Get Fabric

            pApp = (IApplication)ArcMap.Application;
            if (pApp == null)
            {
                //if the app is null then could be running from ArcCatalog
                pApp = (IApplication)ArcCatalog.Application;
            }

            if (pApp == null)
            {
                MessageBox.Show("Could not access the application.", "No Application found");
                return;
            }

            IGxApplication  pGXApp = (IGxApplication)pApp;
            stdole.IUnknown pUnk   = null;
            try
            {
                pUnk = (stdole.IUnknown)pGXApp.SelectedObject.InternalObjectName.Open();
            }
            catch (COMException ex)
            {
                if (ex.ErrorCode == (int)fdoError.FDO_E_DATASET_TYPE_NOT_SUPPORTED_IN_RELEASE ||
                    ex.ErrorCode == -2147220944)
                {
                    MessageBox.Show("The dataset is not supported in this release.", "Could not open the dataset");
                }
                else
                {
                    MessageBox.Show(ex.ErrorCode.ToString(), "Could not open the dataset");
                }
                return;
            }

            if (pUnk is ICadastralFabric)
            {
                m_pCadaFab = (ICadastralFabric)pUnk;
            }
            else
            {
                MessageBox.Show("Please select a parcel fabric and try again.", "Not a parcel fabric");
                return;
            }
            #endregion

            IFeatureClass pFabricPointClass = (IFeatureClass)m_pCadaFab.get_CadastralTable(esriCadastralFabricTable.esriCFTPoints);
            IDataset      pDS = (IDataset)pFabricPointClass;
            IWorkspace    pWS = pDS.Workspace;

            bool      bIsFileBasedGDB = true;
            bool      bIsUnVersioned  = true;
            Utilities FabricUTILS     = new Utilities();
            FabricUTILS.GetFabricPlatform(pWS, m_pCadaFab, out bIsFileBasedGDB,
                                          out bIsUnVersioned);


            if (!FabricUTILS.StartEditing(pWS, bIsUnVersioned))
            {
                return;
            }
            m_pQF             = new QueryFilterClass();
            m_pQF.WhereClause = "";
            int iChangePointCount = 0;
            try
            {
                //next need to use an in clause to update the points, ...
                ICadastralFabricSchemaEdit2 pSchemaEd = (ICadastralFabricSchemaEdit2)m_pCadaFab;
                pSchemaEd.ReleaseReadOnlyFields((ITable)pFabricPointClass, esriCadastralFabricTable.esriCFTPoints);

                IGeoDataset pGeoDS = (IGeoDataset)pFabricPointClass;
                ISpatialReferenceTolerance pSRTol = (ISpatialReferenceTolerance)pGeoDS.SpatialReference;
                double dTolerance = pSRTol.XYTolerance;

                if (!UpdatePointXYFromGeometry((ITable)pFabricPointClass, m_pQF, (bIsUnVersioned || bIsFileBasedGDB), dTolerance, out iChangePointCount))
                {
                    FabricUTILS.AbortEditing(pWS);
                    return;
                }

                FabricUTILS.StopEditing(pWS);
                pSchemaEd.ResetReadOnlyFields(esriCadastralFabricTable.esriCFTPoints);

                MessageBox.Show("Updated " + iChangePointCount.ToString() + " points that had coordinates different" + Environment.NewLine + "from their geometry by more than " +
                                dTolerance.ToString("0.00000000").TrimEnd('0'), "Coordinate Inverse", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                FabricUTILS.AbortEditing(pWS);
            }
            finally
            {
            }
        }
Пример #20
0
        protected override void OnClick()
        {
            m_pApp = (IApplication)ArcMap.Application;
            if (m_pApp == null)
            {
                //if the app is null then could be running from ArcCatalog
                m_pApp = (IApplication)ArcCatalog.Application;
            }

            if (m_pApp == null)
            {
                MessageBox.Show("Could not access the application.", "No Application found");
                return;
            }
            IGxApplication pGXApp = (IGxApplication)m_pApp;

            stdole.IUnknown pUnk = null;
            try
            {
                pUnk = (stdole.IUnknown)pGXApp.SelectedObject.InternalObjectName.Open();
            }
            catch (COMException ex)
            {
                if (ex.ErrorCode == (int)fdoError.FDO_E_DATASET_TYPE_NOT_SUPPORTED_IN_RELEASE ||
                    ex.ErrorCode == -2147220944)
                {
                    MessageBox.Show("The dataset is not supported in this release.", "Could not open the dataset");
                }
                else
                {
                    MessageBox.Show(ex.ErrorCode.ToString(), "Could not open the dataset");
                }
                return;
            }

            if (pUnk is ICadastralFabric)
            {
                m_pCadaFab = (ICadastralFabric)pUnk;
            }
            else
            {
                MessageBox.Show("Please select a parcel fabric and try again.", "Not a parcel fabric");
                return;
            }


            Utils FabricUTILS = new Utils();

            ITable     pTable = m_pCadaFab.get_CadastralTable(esriCadastralFabricTable.esriCFTPlans);
            IDataset   pDS    = (IDataset)pTable;
            IWorkspace pWS    = pDS.Workspace;

            //Do a Start and Stop editing to make sure we're not running in an edit session
            if (!FabricUTILS.StartEditing(pWS, true))
            {//if start editing fails then bail
                if (pUnk != null)
                {
                    Marshal.ReleaseComObject(pUnk);
                }
                Cleanup(pTable, pWS);
                FabricUTILS = null;
                return;
            }
            FabricUTILS.StopEditing(pWS);

            bool bAddedField = false;

            if (FabricUTILS.GetFabricVersion((ICadastralFabric2)m_pCadaFab) < 2)
            {
                bAddedField = FabricUTILS.CadastralTableAddFieldV1(m_pCadaFab, esriCadastralFabricTable.esriCFTPlans, esriFieldType.esriFieldTypeInteger,
                                                                   "KeepOnMerge", "KeepOnMerge", 1);
            }
            else
            {
                bAddedField = FabricUTILS.CadastralTableAddField(m_pCadaFab, esriCadastralFabricTable.esriCFTPlans, esriFieldType.esriFieldTypeInteger,
                                                                 "KeepOnMerge", "KeepOnMerge", 1);
            }

            if (bAddedField)
            {
                MessageBox.Show("Plan-merge helper field 'KeepOnMerge' added.", "Add Field");
            }
            else
            {
                MessageBox.Show("Field 'KeepOnMerge' could not be added." + Environment.NewLine + "The field may already exist.",
                                "Add Field");
            }

            if (bAddedField)
            {
                //if the field was added succesfully, add the Yes/No domain
                IDomain pDom = new CodedValueDomainClass();
                try
                {
                    IWorkspaceDomains2 pWSDoms = (IWorkspaceDomains2)pWS;
                    pDom.FieldType   = esriFieldType.esriFieldTypeInteger;
                    pDom.Name        = "Flag for Keep on Plan Merge";
                    pDom.Description = "Flag for Keep on Plan Merge";
                    ICodedValueDomain pCVDom = (ICodedValueDomain)pDom;
                    //pCVDom.AddCode(0, "No");
                    pCVDom.AddCode(1, "Keep On Merge");
                    pWSDoms.AddDomain(pDom);
                }
                catch (COMException ex)
                {
                    MessageBox.Show(ex.ErrorCode.ToString());
                }

                //Get the field
                int iFld = pTable.FindField("KeepOnMerge");
                if (iFld >= 0)
                {
                    IField pFld = pTable.Fields.get_Field(iFld);
                    // Check that the field and domain have the same field type.
                    if (pFld.Type == pDom.FieldType)
                    {
                        // Cast the feature class to the ISchemaLock and IClassSchemaEdit interfaces.
                        ISchemaLock      schemaLock      = (ISchemaLock)pTable;
                        IClassSchemaEdit classSchemaEdit = (IClassSchemaEdit)pTable;

                        // Attempt to get an exclusive schema lock.
                        try
                        {
                            // Lock the class and alter the domain.
                            schemaLock.ChangeSchemaLock(esriSchemaLock.esriExclusiveSchemaLock);
                            classSchemaEdit.AlterDomain("KeepOnMerge", pDom);
                            Console.WriteLine("The domain was successfully assigned.");
                        }
                        catch (COMException exc)
                        {
                            // Handle the exception in a way appropriate for the application.
                            Console.WriteLine(exc.Message);
                        }
                        finally
                        {
                            // Set the schema lock to be a shared lock.
                            schemaLock.ChangeSchemaLock(esriSchemaLock.esriSharedSchemaLock);
                        }
                    }
                }

                if (pDom != null)
                {
                    Marshal.ReleaseComObject(pDom);
                }
            }
            Cleanup(pTable, pWS);
            FabricUTILS = null;
        }
Пример #21
0
 /// <summary>
 ///     Called when the command is created inside the application.
 /// </summary>
 /// <param name="hook">
 ///     A reference to the application in which the command was created.
 ///     The hook may be an IApplication reference (for commands created in ArcGIS Desktop applications)
 ///     or an IHookHelper reference (for commands created on an Engine ToolbarControl).
 /// </param>
 /// <remarks>
 ///     Note to inheritors: classes inheriting from BaseCommand must always
 ///     override the OnCreate method. Use this method to store a reference to the host
 ///     application, passed in via the hook parameter.
 /// </remarks>
 public override void OnCreate(object hook)
 {
     this.GxApplication = (IGxApplication)hook;
 }
        /// <summary>
        /// Occurs when this command is clicked
        /// </summary>
        public override void OnClick()
        {
            IGxApplication  gxApp     = m_application as IGxApplication;
            IGxDataset      gxDataset = null;
            esriDatasetType dsType    = esriDatasetType.esriDTAny;

            if (gxApp != null)
            {
                gxDataset = gxApp.SelectedObject as IGxDataset;
                dsType    = gxDataset.Type;
            }

            if (dsType != esriDatasetType.esriDTNetworkDataset)
            {
                return;
            }

            IDataset ds = gxDataset.Dataset;

            if (ds == null)
            {
                return;
            }

            INetworkDataset nds = ds as INetworkDataset;

            if (nds == null)
            {
                return;
            }

            if (!nds.Buildable)
            {
                return;
            }

            INetworkBuild netBuild = nds as INetworkBuild;

            if (netBuild == null)
            {
                return;
            }

            IDatasetComponent dsComponent = nds as IDatasetComponent;
            IDENetworkDataset deNet       = null;

            if (dsComponent != null)
            {
                deNet = dsComponent.DataElement as IDENetworkDataset;
            }

            if (deNet == null)
            {
                return;
            }

            FilterSubsetEvaluator.RemoveFilterSubsetAttribute(deNet);
            ScaleSubsetEvaluator.RemoveScaleSubsetAttributes(deNet);

            FilterSubsetEvaluator.AddFilterSubsetAttribute(deNet);
            ScaleSubsetEvaluator.AddScaleSubsetAttributes(deNet);

            netBuild.UpdateSchema(deNet);
        }
 public void Activate(ESRI.ArcGIS.CatalogUI.IGxApplication Application, ESRI.ArcGIS.Catalog.IGxCatalog Catalog)
 {
     m_pApp = Application;
     m_pCatalog = Catalog;
     m_pSelection = (GxSelection)Catalog.Selection;
     m_pSelection.OnSelectionChanged += new IGxSelectionEvents_OnSelectionChangedEventHandler(m_pSelection_OnSelectionChanged);
     frmGxStyleView.GxStyleView = this;
     Refresh();
 }
 public void Deactivate()
 {
     frmGxStyleView.GxStyleView = null;
     m_pApp = null;
     m_pCatalog = null;
 }
Пример #25
0
 public RemoveInstanceClass()
 {
     this.pGxApp = ArcCatalog.Application as IGxApplication;
     this.featureClassDescription = new FeatureClassDescriptionClass();
 }