Exemplo n.º 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);
        }
Exemplo n.º 2
0
        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;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Adds the results of the trace to the legend.
        /// </summary>
        /// <param name="displayRS">The trace recordset to display</param>
        /// <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>
        /// <param name="symbology">Symbology overrides for the trace</param>
        /// <param name="overrideStyle">True if style should be overridden</param>
        /// <param name="primaryGraphicsOnly">True if only the primary graphic should be displayed</param>
        /// <param name="activeWindowOnly">True if the results should only be displayed in the active window</param>
        /// <param name="removeItem">True if the existing item should be removed from the legend</param>
        /// <returns>Boolean indicating status</returns>
        public bool DisplayResults(Recordset displayRS, string displayPathName, string displayName, IGTSymbology symbology,
                                   bool overrideStyle, bool primaryGraphicsOnly, bool activeWindowOnly, bool removeItem)
        {
            IGTMapWindow      gtMapWindow      = default(IGTMapWindow);
            IGTMapWindows     gtMapWindows     = default(IGTMapWindows);
            IGTDisplayService gtDisplayService = default(IGTDisplayService);

            bool returnValue = false;

            try
            {
                if (removeItem)
                {
                    // Remove existing item from the Display Control window
                    try
                    {
                        if (activeWindowOnly)
                        {
                            gtMapWindow = m_Application.ActiveMapWindow;
                            gtMapWindow.DisplayService.Remove(displayPathName, displayName);
                        }
                        else
                        {
                            gtMapWindows = m_Application.GetMapWindows(GTMapWindowTypeConstants.gtapmtGeographic);

                            foreach (IGTMapWindow mapWindow in gtMapWindows)
                            {
                                mapWindow.DisplayService.Remove(displayPathName, displayName);
                            }
                        }
                    }
                    catch
                    {
                        // Ignore error if item is not on the legend
                    }
                }

                if (displayRS.RecordCount > 0)
                {
                    if (activeWindowOnly)
                    {
                        gtMapWindow      = m_Application.ActiveMapWindow;
                        gtDisplayService = gtMapWindow.DisplayService;

                        if (overrideStyle)
                        {
                            gtDisplayService.AppendQuery(displayPathName, displayName, displayRS, symbology, primaryGraphicsOnly);
                        }
                        else
                        {
                            gtDisplayService.AppendQuery(displayPathName, displayName, displayRS);
                        }
                    }
                    else
                    {
                        gtMapWindows = m_Application.GetMapWindows(GTMapWindowTypeConstants.gtapmtAll);
                        foreach (IGTMapWindow mapWindow in gtMapWindows)
                        {
                            gtDisplayService = mapWindow.DisplayService;

                            if (overrideStyle)
                            {
                                gtDisplayService.AppendQuery(displayPathName, displayName, displayRS, symbology, primaryGraphicsOnly);
                            }
                            else
                            {
                                gtDisplayService.AppendQuery(displayPathName, displayName, displayRS);
                            }
                        }
                    }
                }

                m_Application.RefreshWindows();

                returnValue = true;
            }
            catch
            {
                returnValue = false;
            }
            finally
            {
                gtMapWindow      = null;
                gtMapWindows     = null;
                gtDisplayService = null;
            }

            return(returnValue);
        }