Ejemplo n.º 1
0
        //Creates lastValueProperties Property Set which stores fields and values for last value method
        private void constructFieldArray()
        {
            // Assume we are in an edit session
            if (ArcMap.Editor.EditWorkspace == null)
            {
                return;
            }

            // Open defaults table
            IDataset     dataset = m_dynDefaults as IDataset;
            IQueryFilter qFilter = new QueryFilterClass();

            qFilter.WhereClause = "ValueMethod = 'LAST_VALUE'";

            lastValueProperties = new PropertySetClass();

            if (m_dynDefaults != null)
            {
                ICursor tabCursor = m_dynDefaults.Search(qFilter, true);
                IRow    row       = tabCursor.NextRow();
                while (row != null)
                {
                    object objRow     = row.get_Value(dynTargetField);
                    object nullObject = null;
                    lastValueProperties.SetProperty(objRow.ToString(), nullObject);
                    row = tabCursor.NextRow();
                }
            }
        }
        public static void createLastValuePropertySet()
        {
            try
            {
                if (AAState._dt == null)
                    return;

                object nullObject = null;
                if (AAState.lastValueProperties == null || _clearLastValue == true)
                {
                    AAState.lastValueProperties = new PropertySetClass();
                }

                if (AAState._dt.Columns["ON_CHANGEGEO"] == null)
                {
                    MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_1c"));

                }
                if (AAState._dt.Columns["ON_CHANGE"] == null)
                {
                    MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_1d"));

                }
                if (AAState._dt.Columns["ON_CREATE"] == null)
                {
                    MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_1e"));

                }
                if (AAState._dt.Columns["ON_MANUAL"] == null)
                {
                    MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_1f"));

                }
                DataView dv = new DataView(AAState._dt);
                dv.RowFilter = "ValueMethod = 'LAST_VALUE'";
                string[] args;

                foreach (DataRowView drv in dv)
                {
                    if (drv["FIELDNAME"].ToString() == "SHAPE")
                    {
                        MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_1g"));

                    }
                    else
                    {
                        if (_clearLastValue)
                        {
                            LastValueEntry lstV = new LastValueEntry();
                            lstV.Value = nullObject;
                            lstV.On_ChangeAtt = Globals.toBoolean(drv["ON_CHANGE"].ToString());

                            if (drv.DataView.Table.Columns["ON_CHANGEGEO"] != null)
                            {
                                lstV.On_ChangeGeo = Globals.toBoolean(drv["ON_CHANGEGEO"].ToString());
                            }

                            lstV.On_Create = Globals.toBoolean(drv["ON_CREATE"].ToString());
                            lstV.On_Manual = Globals.toBoolean(drv["ON_MANUAL"].ToString());

                            AAState.lastValueProperties.SetProperty(drv["FIELDNAME"].ToString(), lstV);
                            lstV = null;

                        }
                        else
                        {
                            string valData = drv["VALUEINFO"].ToString().Trim();
                            if (valData.Contains(Environment.NewLine))
                            {
                                valData = valData.Substring(0, valData.IndexOf(Environment.NewLine));

                            }
                            if (valData.Trim() == "")
                            {
                                nullObject = null;
                            }
                            else
                            {
                                args = valData.Split('|');
                                if (args.Length == 2)
                                {
                                    nullObject = args[1] as System.Object;

                                }
                            }
                            try
                            {
                                object temp = AAState.lastValueProperties.GetProperty(drv["FIELDNAME"].ToString());
                                if (nullObject != null && temp == null)
                                {
                                    LastValueEntry lstV = new LastValueEntry();
                                    lstV.Value = nullObject;
                                    lstV.On_ChangeAtt = Globals.toBoolean(drv["ON_CHANGE"].ToString());
                                    if (drv.DataView.Table.Columns["ON_CHANGEGEO"] != null)
                                    {
                                        lstV.On_ChangeGeo = Globals.toBoolean(drv["ON_CHANGEGEO"].ToString());
                                    }
                                    lstV.On_Create = Globals.toBoolean(drv["ON_CREATE"].ToString());
                                    lstV.On_Manual = Globals.toBoolean(drv["ON_MANUAL"].ToString());

                                    AAState.lastValueProperties.SetProperty(drv["FIELDNAME"].ToString(), lstV);
                                    lstV = null;

                                }
                            }
                            catch
                            {

                                LastValueEntry lstV = new LastValueEntry();
                                lstV.Value = nullObject;
                                lstV.On_ChangeAtt = Globals.toBoolean(drv["ON_CHANGE"].ToString());
                                if (drv.DataView.Table.Columns["ON_CHANGEGEO"] != null)
                                {
                                    lstV.On_ChangeGeo = Globals.toBoolean(drv["ON_CHANGEGEO"].ToString());
                                }
                                lstV.On_Create = Globals.toBoolean(drv["ON_CREATE"].ToString());
                                lstV.On_Manual = Globals.toBoolean(drv["ON_MANUAL"].ToString());

                                AAState.lastValueProperties.SetProperty(drv["FIELDNAME"].ToString(), lstV);
                                lstV = null;
                            }

                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain1") + ex.Message);
            }
        }
        public static void createLastValuePropertySet()
        {
            try
            {

                object nullObject = null;
                if (AAState.lastValueProperties == null || _clearLastValue == true)
                {
                    AAState.lastValueProperties = new PropertySetClass();
                }

                if (AAState._dt.Columns["ON_CHANGEGEO"] == null)
                {
                    MessageBox.Show("Dynamic value table is missing the ON_CHANGEGEO Column");

                }
                if (AAState._dt.Columns["ON_CHANGE"] == null)
                {
                    MessageBox.Show("Dynamic value table is missing the ON_CHANGE Column");

                }
                if (AAState._dt.Columns["ON_CREATE"] == null)
                {
                    MessageBox.Show("Dynamic value table is missing the ON_CREATE Column");

                }
                if (AAState._dt.Columns["ON_MANUAL"] == null)
                {
                    MessageBox.Show("Dynamic value table is missing the ON_MANUAL Column");

                }
                DataView dv = new DataView(AAState._dt);
                dv.RowFilter = "ValueMethod = 'LAST_VALUE'";
                string[] args;

                foreach (DataRowView drv in dv)
                {
                    if (drv["FIELDNAME"].ToString() == "SHAPE")
                    {
                        MessageBox.Show("You have specified SHAPE in a last value entry in the Attribute Assistant, this is not supported");

                    }
                    else
                    {
                        if (_clearLastValue)
                        {
                            LastValueEntry lstV = new LastValueEntry();
                            lstV.Value = nullObject;
                            lstV.On_ChangeAtt = Globals.toBoolean(drv["ON_CHANGE"].ToString());

                            if (drv.DataView.Table.Columns["ON_CHANGEGEO"] != null)
                            {
                                lstV.On_ChangeGeo = Globals.toBoolean(drv["ON_CHANGEGEO"].ToString());
                            }

                            lstV.On_Create = Globals.toBoolean(drv["ON_CREATE"].ToString());
                            lstV.On_Manual = Globals.toBoolean(drv["ON_MANUAL"].ToString());

                            AAState.lastValueProperties.SetProperty(drv["FIELDNAME"].ToString(), lstV);
                            lstV = null;

                        }
                        else
                        {
                            string valData = drv["VALUEINFO"].ToString().Trim();
                            if (valData.Contains(Environment.NewLine))
                            {
                                valData = valData.Substring(0, valData.IndexOf(Environment.NewLine));

                            }
                            if (valData.Trim() == "")
                            {
                                nullObject = null;
                            }
                            else
                            {
                                args = valData.Split('|');
                                if (args.Length == 2)
                                {
                                    nullObject = args[1] as System.Object;

                                }
                            }
                            try
                            {
                                object temp = AAState.lastValueProperties.GetProperty(drv["FIELDNAME"].ToString());
                                if (nullObject != null && temp == null)
                                {
                                    LastValueEntry lstV = new LastValueEntry();
                                    lstV.Value = nullObject;
                                    lstV.On_ChangeAtt = Globals.toBoolean(drv["ON_CHANGE"].ToString());
                                    if (drv.DataView.Table.Columns["ON_CHANGEGEO"] != null)
                                    {
                                        lstV.On_ChangeGeo = Globals.toBoolean(drv["ON_CHANGEGEO"].ToString());
                                    }
                                    lstV.On_Create = Globals.toBoolean(drv["ON_CREATE"].ToString());
                                    lstV.On_Manual = Globals.toBoolean(drv["ON_MANUAL"].ToString());

                                    AAState.lastValueProperties.SetProperty(drv["FIELDNAME"].ToString(), lstV);
                                    lstV = null;

                                }
                            }
                            catch
                            {

                                LastValueEntry lstV = new LastValueEntry();
                                lstV.Value = nullObject;
                                lstV.On_ChangeAtt = Globals.toBoolean(drv["ON_CHANGE"].ToString());
                                if (drv.DataView.Table.Columns["ON_CHANGEGEO"] != null)
                                {
                                    lstV.On_ChangeGeo = Globals.toBoolean(drv["ON_CHANGEGEO"].ToString());
                                }
                                lstV.On_Create = Globals.toBoolean(drv["ON_CREATE"].ToString());
                                lstV.On_Manual = Globals.toBoolean(drv["ON_MANUAL"].ToString());

                                AAState.lastValueProperties.SetProperty(drv["FIELDNAME"].ToString(), lstV);
                                lstV = null;
                            }

                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("createLastValueProperrtySet: " + ex.Message);
            }
        }
        /// <summary>
        /// Signals the telecom workspace helpers objects to stop listening for edits etc.
        /// </summary>
        /// <param name="save">Should any edits be saved</param>
        private void m_editEvents_OnStopEditing(Boolean save)
        {
            _logHelper.addLogEntry(DateTime.Now.ToString(), "INFO", "On stop editing");

            try
            {
                _logHelper.addLogEntry(DateTime.Now.ToString(), "INFO", "Stopped editing telecom workspace.");

                // -------------------------------------
                // Hide the cable configuration window
                // -------------------------------------
                //UID dockWinID = new UIDClass();
                //dockWinID.Value = @"esriTelcoTools_FiberCableConfigWindow";
                //IDockableWindow dockWindow = ArcMap.DockableWindowManager.GetDockableWindow(dockWinID);
                //dockWindow.Show(false);

                // ------------------------------------
                // Stop the helpers to deal with
                // telecom workspace editing.
                // ------------------------------------
                _logHelper.addLogEntry(DateTime.Now.ToString(), "INFO", "Stopping telecom helpers.");
                _fiberCableHelper.onStopEditing();
                _fiberDeviceHelper.onStopEditing();

                // If we are dealing with non-shapefile, non-coverage data no need to remove
                // event handlers since no GDB relationships etc can exist.
                if (ArcMap.Editor.EditWorkspace.Type == esriWorkspaceType.esriRemoteDatabaseWorkspace ||
                    ArcMap.Editor.EditWorkspace.Type == esriWorkspaceType.esriLocalDatabaseWorkspace)
                {
                    // --------------------------------------------
                    // Stop listening for feature template changes
                    // --------------------------------------------
                    Events5.OnCurrentTemplateChanged -= new IEditEvents5_OnCurrentTemplateChangedEventHandler(Events5_OnCurrentTemplateChanged);

                    // -----------------------------
                    // Stop listening for deletions
                    // -----------------------------
                    Events.OnDeleteFeature -= new IEditEvents_OnDeleteFeatureEventHandler(Events_OnDeleteFeature);

                    // -----------------------------------
                    //  Stop listening for Dynamic Values changes
                    // -----------------------------------
                    Events.OnChangeFeature += new IEditEvents_OnChangeFeatureEventHandler(m_editEvents_OnChangeFeature);
                    Events.OnCreateFeature += new IEditEvents_OnCreateFeatureEventHandler(m_editEvents_OnCreateFeature);
                }

                if (!save)
                {
                    lastValueProperties = null;
                }

                // ---------------------------------------
                // Remove non feature class event tracking
                // ---------------------------------------
                if (null != _nonFeatureObjClassEvents)
                {
                    for (int i = _nonFeatureObjClassEvents.Count - 1; i > -1; i--)
                    {
                        ESRI.ArcGIS.Geodatabase.IObjectClassEvents_Event nonFtClassOCE = _nonFeatureObjClassEvents[i];
                        nonFtClassOCE.OnCreate -= new IObjectClassEvents_OnCreateEventHandler(m_editEvents_OnCreateFeature);
                        nonFtClassOCE.OnChange -= new IObjectClassEvents_OnChangeEventHandler(m_editEvents_OnChangeFeature);
                        _nonFeatureObjClassEvents.Remove(nonFtClassOCE);
                    }
                    _nonFeatureObjClassEvents = null;
                }
            }
            catch (Exception ex)
            {
                _logHelper.addLogEntry(DateTime.Now.ToString(), "ERROR", "Error on stop editing.", ex.ToString());

                MessageBox.Show("Error: \n" + ex.ToString());
            }
        }
        //Creates lastValueProperties Property Set which stores fields and values for last value method
        private void constructFieldArray()
        {
            // Assume we are in an edit session
            if (ArcMap.Editor.EditWorkspace == null) return;

            // Open defaults table
            IDataset dataset = m_dynDefaults as IDataset;
            IQueryFilter qFilter = new QueryFilterClass();
            qFilter.WhereClause = "ValueMethod = 'LAST_VALUE'";

            lastValueProperties = new PropertySetClass();

            if (m_dynDefaults != null)
            {
                ICursor tabCursor = m_dynDefaults.Search(qFilter, true);
                IRow row = tabCursor.NextRow();
                while (row != null)
                {
                    object objRow = row.get_Value(dynTargetField);
                    object nullObject = null;
                    lastValueProperties.SetProperty(objRow.ToString(), nullObject);
                    row = tabCursor.NextRow();
                }
            }
        }
        public static void createLastValueProperrtySet()
        {
            try
            {

                object nullObject = null;
                if (AAState.lastValueProperties == null || _clearLastValue == true)
                {
                    AAState.lastValueProperties = new PropertySetClass();
                }

                DataView dv = new DataView(AAState._dt);
                dv.RowFilter = "ValueMethod = 'LAST_VALUE'";
                string[] args;

                foreach (DataRowView drv in dv)
                {
                    if (drv["FIELDNAME"].ToString() == "SHAPE")
                    {
                        MessageBox.Show("You have specified SHAPE in a last value entry in the Attribute Assistant, this is not supported");

                    }
                    else
                    {
                        if (_clearLastValue)
                            AAState.lastValueProperties.SetProperty(drv["FIELDNAME"].ToString(), nullObject);
                        else
                        {
                            string valData = drv["VALUEINFO"].ToString().Trim();
                            if (valData.Contains(Environment.NewLine))
                            {
                                valData = valData.Substring(0, valData.IndexOf(Environment.NewLine));

                            }
                            if (valData.Trim() == "")
                            {
                                nullObject = null;
                            }
                            else
                            {
                                args = valData.Split('|');
                                if (args.Length == 2)
                                {
                                    nullObject = args[1] as System.Object;

                                }
                            }
                            try
                            {
                                object temp = AAState.lastValueProperties.GetProperty(drv["FIELDNAME"].ToString());
                                if (nullObject != null && temp == null)
                                {
                                    AAState.lastValueProperties.SetProperty(drv["FIELDNAME"].ToString(), nullObject);
                                }
                            }
                            catch
                            {
                                AAState.lastValueProperties.SetProperty(drv["FIELDNAME"].ToString(), nullObject);
                            }

                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("createLastValueProperrtySet: " + ex.Message);
            }
        }
        public static void createLastValueProperrtySet()
        {
            try
            {

                object nullObject = null;
                if (AAState.lastValueProperties == null || _clearLastValue == true)
                {
                    AAState.lastValueProperties = new PropertySetClass();
                }

                DataView dv = new DataView(AAState._dt);
                dv.RowFilter = "ValueMethod = 'LAST_VALUE'";

                foreach (DataRowView drv in dv)
                {
                    if (drv[dynTargetField].ToString() == "SHAPE")
                    {
                        MessageBox.Show("You have specified SHAPE in a last value entry in the Attribute Assistant, this is not supported");

                    }
                    else
                    {
                        if (_clearLastValue)
                            AAState.lastValueProperties.SetProperty(drv[dynTargetField].ToString(), nullObject);
                        else
                        {
                            try
                            {
                                object temp = AAState.lastValueProperties.GetProperty(drv[dynTargetField].ToString());

                            }
                            catch
                            {
                                AAState.lastValueProperties.SetProperty(drv[dynTargetField].ToString(), nullObject);
                            }

                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("GetView: " + ex.Message);
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Signals the telecom workspace helpers objects to stop listening for edits etc.
        /// </summary>
        /// <param name="save">Should any edits be saved</param>
        private void m_editEvents_OnStopEditing(Boolean save)
        {
            _logHelper.addLogEntry(DateTime.Now.ToString(), "INFO", "On stop editing");

            try
            {
                _logHelper.addLogEntry(DateTime.Now.ToString(), "INFO", "Stopped editing telecom workspace.");

                // -------------------------------------
                // Hide the cable configuration window
                // -------------------------------------
                //UID dockWinID = new UIDClass();
                //dockWinID.Value = @"esriTelcoTools_FiberCableConfigWindow";
                //IDockableWindow dockWindow = ArcMap.DockableWindowManager.GetDockableWindow(dockWinID);
                //dockWindow.Show(false);

                // ------------------------------------
                // Stop the helpers to deal with
                // telecom workspace editing.
                // ------------------------------------
                _logHelper.addLogEntry(DateTime.Now.ToString(), "INFO", "Stopping telecom helpers.");
                _fiberCableHelper.onStopEditing();
                _fiberDeviceHelper.onStopEditing();

                // If we are dealing with non-shapefile, non-coverage data no need to remove
                // event handlers since no GDB relationships etc can exist.
                if (ArcMap.Editor.EditWorkspace.Type == esriWorkspaceType.esriRemoteDatabaseWorkspace ||
                    ArcMap.Editor.EditWorkspace.Type == esriWorkspaceType.esriLocalDatabaseWorkspace)
                {
                    // --------------------------------------------
                    // Stop listening for feature template changes
                    // --------------------------------------------
                    Events5.OnCurrentTemplateChanged -= new IEditEvents5_OnCurrentTemplateChangedEventHandler(Events5_OnCurrentTemplateChanged);

                    // -----------------------------
                    // Stop listening for deletions
                    // -----------------------------
                    Events.OnDeleteFeature -= new IEditEvents_OnDeleteFeatureEventHandler(Events_OnDeleteFeature);

                    // -----------------------------------
                    //  Stop listening for Dynamic Values changes
                    // -----------------------------------
                    Events.OnChangeFeature += new IEditEvents_OnChangeFeatureEventHandler(m_editEvents_OnChangeFeature);
                    Events.OnCreateFeature += new IEditEvents_OnCreateFeatureEventHandler(m_editEvents_OnCreateFeature);
                }

                if (!save)
                {
                    lastValueProperties = null;
                }

                // ---------------------------------------
                // Remove non feature class event tracking
                // ---------------------------------------
                if (null != _nonFeatureObjClassEvents)
                {
                    for (int i = _nonFeatureObjClassEvents.Count - 1; i > -1; i--)
                    {
                        ESRI.ArcGIS.Geodatabase.IObjectClassEvents_Event nonFtClassOCE = _nonFeatureObjClassEvents[i];
                        nonFtClassOCE.OnCreate -= new IObjectClassEvents_OnCreateEventHandler(m_editEvents_OnCreateFeature);
                        nonFtClassOCE.OnChange -= new IObjectClassEvents_OnChangeEventHandler(m_editEvents_OnChangeFeature);
                        _nonFeatureObjClassEvents.Remove(nonFtClassOCE);
                    }
                    _nonFeatureObjClassEvents = null;
                }
            }
            catch (Exception ex)
            {
                _logHelper.addLogEntry(DateTime.Now.ToString(), "ERROR", "Error on stop editing.", ex.ToString());

                MessageBox.Show("Error: \n" + ex.ToString());
            }
        }