示例#1
0
        /// <summary>
        /// Delete the trace from the legend.
        /// </summary>
        /// <param name="displayPathName">Node on the legend that contains the trace entry</param>
        /// <param name="displayName">Name of the trace entry on the legend</param>
        /// <returns>Boolean indicating status</returns>
        public bool RemoveTraceLegendItem(string displayPathName, string displayName)
        {
            bool returnValue = false;

            try
            {
                // --- Remove from display control
                IGTMapWindows gtMapWindows = m_Application.GetMapWindows(GTMapWindowTypeConstants.gtapmtGeographic);

                foreach (IGTMapWindow gtMapWindow in gtMapWindows)
                {
                    try
                    {
                        gtMapWindow.DisplayService.Remove(displayPathName, displayName);
                    }
                    catch
                    {
                        // Ignore error if node is not on display control
                    }
                }

                gtMapWindows = null;

                m_Application.RefreshWindows();

                returnValue = true;
            }
            catch (Exception ex)
            {
                if (m_InteractiveMode)
                {
                    MessageBox.Show(m_Application.ApplicationWindow, TRACE_DELETE_LEGEND_ERROR + ": " + ex.Message, ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                WriteToCommandLog("ERROR", TRACE_DELETE_LEGEND_ERROR + ": " + ex.Message, "commonTraceHelper.RemoveTraceLegendItem");
                returnValue = false;
            }

            return(returnValue);
        }
        public void Execute()
        {
            if (Convert.ToInt32(_components[_componentName].Recordset.Fields["g3E_fno"].Value) != 106)
            {
                return;
            }

            ADODB.Recordset rs          = null;
            IGTComponent    gtComponent = _components["MANHOLE_DP"];
            double          xCoord      = 0;
            double          yCoord      = 0;
            IGTMapWindow    mapWindow   = null;

            try
            {
                if (gtComponent.Recordset.RecordCount == 0)
                {
                    if (_components["MANHOLE_N"].Recordset != null)
                    {
                        if (_components["MANHOLE_N"].Recordset.RecordCount > 0)
                        {
                            _components["MANHOLE_N"].Recordset.MoveFirst();
                        }
                    }

                    // Check Mamhole Detail Footprint component count if count==0 then call procedure to generate Footprint Detial components instance otherwise skip
                    _gtApp      = GTClassFactory.Create <IGTApplication>();
                    gtComponent = _components["DETAILIND_T"];
                    //Check Manhole Map window exists otherwise throw message to create Detial Map winod
                    if (gtComponent.Recordset.RecordCount > 0 && _components["MANHOLE_N"].Recordset.Fields["TYPE_C"].Value.GetType() != typeof(DBNull))
                    {
                        rs = gtComponent.Recordset;
                        rs.MoveFirst();
                        //Get MBR X and Y . Calculate midpoint
                        xCoord = (Convert.ToDouble(rs.Fields["MBR_X_HIGH"].Value) + Convert.ToDouble(rs.Fields["MBR_X_LOW"].Value)) / 2;
                        yCoord = (Convert.ToDouble(rs.Fields["MBR_Y_HIGH"].Value) + Convert.ToDouble(rs.Fields["MBR_Y_LOW"].Value)) / 2;

                        //Pass ,fid,Detialid,X and Y,Manhole Type to place Detail Footprint in Detail window
                        PlaceManholeFootprint(Convert.ToInt32(rs.Fields["G3e_FID"].Value), Convert.ToInt32(rs.Fields["G3E_DETAILID"].Value), xCoord, yCoord, _components["MANHOLE_N"].Recordset.Fields["TYPE_C"].Value.ToString());

                        if (_components["MANHOLE_DP"].Recordset.RecordCount > 0)
                        {
                            _components["MANHOLE_DP"].Recordset.Update();
                        }

                        IGTMapWindows maps = _gtApp.GetMapWindows(GTMapWindowTypeConstants.gtapmtDetail);
                        foreach (IGTMapWindow detWindow in _gtApp.GetMapWindows(GTMapWindowTypeConstants.gtapmtAll))
                        {
                            if (detWindow.DetailID == Convert.ToInt32(rs.Fields["G3E_DETAILID"].Value))
                            {
                                mapWindow = detWindow;
                                break;
                            }
                        }
                        if (mapWindow != null)
                        {
                            mapWindow.CenterSelectedObjects();
                        }
                        _gtApp.RefreshWindows();
                    }
                }
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show("Error in fiManholeFootPrintPlacement " + ex.StackTrace, "G/Technology");
                throw ex;
            }
        }