private void DoExit() { try { SetStatusBarText("Exiting Street Light History..."); // This is not in the design; however, if nothing is found to display, // the system appears to have done nothing at all and this // at least gives some feedback in that case. if (0 == this.oActiveList.Count) { MessageBox.Show("No historical Street Light information was found for the features in the active map window.", "G/Technology", System.Windows.Forms.MessageBoxButtons.OK); } if (this.oCustomCmdHelper != null) { this.oDC = null; this.oMap = null; this.oApp = null; this.oCustomCmdHelper.Complete(); } } catch (Exception ex) { CommandUtilities.LogException(oDiag, "StreetLightHistory.DoExit", ex); throw ex; } }
/// <summary> /// Method is called when pad/vault mounted switch gear placement is started /// </summary> /// <param name="PTHelper"></param> /// <param name="KeyObject"></param> /// <param name="KeyObjectCollection"></param> public void StartPlacement(IGTPlacementTechniqueHelper PTHelper, IGTKeyObject KeyObject, IGTKeyObjects KeyObjectCollection) { try { m_PTHelper = PTHelper; m_KeyObject = KeyObject; m_KeyObjectCollection = KeyObjectCollection; m_PTHelper.ConstructionAidsEnabled = Intergraph.GTechnology.API.GTConstructionAidsEnabledConstants.gtptConstructionAidsNone; m_PTHelper.ConstructionAidDynamicsEnabled = false; m_PTHelper.StatusBarPromptsEnabled = false; m_PTHelper.StartPlacement(m_KeyObject, m_KeyObjectCollection); m_GTApplication = GTClassFactory.Create <IGTApplication>().Application; m_Arguments = m_ActiveGraphicComponent.Arguments; m_ActiveMapWindow = m_GTApplication.ActiveMapWindow; string ownerFeatureName = m_ActiveMapWindow.DetailID == 0 ? "Pad" : "Vault"; m_GTApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Click to select an existing " + ownerFeatureName + " feature to Own the Primary switch gear which is to be placed adjacent to it."); } catch (Exception ex) { MessageBox.Show(ex.Message, Caption); } }
private void ExtendFollowingAutoFitRules(IGTMapWindow window, IGTWorldRange range) { try { double extentX = range.TopRight.X - range.BottomLeft.X; double extentY = range.TopRight.Y - range.BottomLeft.Y; double extendBY; if (extentY < 0 || extentX < 0) { return; } if (extentY < 1 && extentX < 1) { extendBY = AverageSymbolSize * 4; } else { extendBY = Math.Max(extentX, extentY) * (window.SelectBehaviorZoomFactor - 1); } IGTPoint tr = GTClassFactory.Create <IGTPoint>(range.TopRight.X + extendBY, range.TopRight.Y + extendBY, 0); IGTPoint bl = GTClassFactory.Create <IGTPoint>(range.BottomLeft.X - extendBY, range.BottomLeft.Y - extendBY, 0); range.BottomLeft = bl; range.TopRight = tr; } catch (Exception ex) { throw ex; } }
public virtual void MouseMove(IGTMapWindow MapWindow, Intergraph.GTechnology.API.IGTPoint UserPoint, int ShiftState, Intergraph.GTechnology.API.IGTDDCKeyObjects LocatedObjects, Intergraph.GTechnology.API.IGTPlacementTechniqueEventMode EventMode) { if (!bSilent) { if (m_PTHelper != null) { m_PTHelper.MouseMove(UserPoint, ShiftState); } if (m_gtApplication != null) { m_gtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Please click on related Primary Conductor feature."); } } }
public virtual void MouseDblClick(IGTMapWindow MapWindow, Intergraph.GTechnology.API.IGTPoint UserPoint, int ShiftState, Intergraph.GTechnology.API.IGTDDCKeyObjects LocatedObjects) { try { if (!bSilent) { if (m_PTHelper != null) { m_PTHelper.MouseDblClick(UserPoint, ShiftState); } } } catch { throw; } }
private void InitializeAppResources() { try { this.oApp = GTClassFactory.Create <IGTApplication>(); if (this.oApp == null) { CommandUtilities.LogMessage(oDiag, "GTAssetTracker.InitializeResources", "IGTApplicationError", "Cannot initialize IGTApplication."); DoExit(); } SetStatusBarText("Initializing..."); this.oMap = oApp.ActiveMapWindow; if (this.oMap == null) { CommandUtilities.LogMessage(oDiag, "GTAssetTracker.InitializeResources", "MapWindowError", "There is no active map window."); throw new Exception("IGTMapWindow"); } oDisplay = oMap.DisplayService; if (oDisplay == null) { CommandUtilities.LogMessage(oDiag, "GTAssetTracker.InitializeResources", "DisplayService", "No display service for the active map window."); throw new Exception("IGTDisplayService"); } this.oDC = oApp.DataContext; if (this.oDC == null) { CommandUtilities.LogMessage(oDiag, "GTAssetTracker.InitializeResources", "DataContextError", "No data context was obtained from IGTApplication."); throw new Exception("IGTDataContext"); } this.oLocate = this.oMap.LocateService; if (this.oLocate == null) { CommandUtilities.LogMessage(oDiag, "GTAssetTracker.InitializeResources", "IGTLocateService", "No IGTLocateService was obtained from IGTMapWindow."); throw new Exception("IGTLocateService"); } this.oRelationService = GTClassFactory.Create <IGTRelationshipService>(); this.oRelationService.DataContext = this.oDC; this.oGenParams = new GTSysGenParam(); if (!CommandUtilities.GetSysGeneralParameters(this.oDC, this.oDiag, ref this.oGenParams)) { throw new Exception("No General Parameters have been defined."); } this.oActiveList = new List <GTActiveStreetLight>(); this.oActiveStructureList = new List <GTActiveStructure>(); SetStatusBarText("Initialized."); } catch (Exception ex) { CommandUtilities.LogException(oDiag, "GTAssetTracker.InitializeResources", ex); throw ex; } }
public void MouseDblClick(IGTMapWindow MapWindow, IGTPoint UserPoint, int ShiftState, IGTDDCKeyObjects LocatedObjects) { //throw new Exception("The method or operation is not implemented."); m_PTHelper.MouseDblClick(UserPoint, ShiftState); }
public void FilterLocatedCandidates(bool CanBreak, IGTDDCKeyObjects Candidates, IGTPoint gTPoint, IGTMapWindow gTMapWindow) { }
/// <summary> /// Fires when left mouse button is double clicked /// </summary> /// <param name="MapWindow"></param> /// <param name="UserPoint"></param> /// <param name="ShiftState"></param> /// <param name="LocatedObjects"></param> public void MouseDblClick(IGTMapWindow MapWindow, IGTPoint UserPoint, int ShiftState, IGTDDCKeyObjects LocatedObjects) { m_PTHelper.MouseDblClick(UserPoint, ShiftState); }
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; } }
public void FilterLocatedCandidates(bool CanBreak, IGTDDCKeyObjects Candidates, IGTPoint WorldPoint, IGTMapWindow MapWindow) { try { //Added an additional check to see if there are ANY candidate connections to check if (ActiveFeature.FNO == Bypass_FNO) { if (Candidates.Count > 0) { for (int currentCandidateIdx = 1; currentCandidateIdx >= 0; currentCandidateIdx--) { Candidates.RemoveAt(currentCandidateIdx); } } } } catch (Exception ex) { throw ex; } }
public virtual void KeyUp(IGTMapWindow MapWindow, int KeyCode, int ShiftState, Intergraph.GTechnology.API.IGTPlacementTechniqueEventMode EventMode) { if (!bSilent) { } }
public override void MouseClick(IGTMapWindow MapWindow, Intergraph.GTechnology.API.IGTPoint UserPoint, int Button, int ShiftState, Intergraph.GTechnology.API.IGTDDCKeyObjects LocatedObjects, Intergraph.GTechnology.API.IGTPlacementTechniqueEventMode EventMode) { try { if (!bSilent) { bool pointSelected = false; bool lineSelected = false; IGTPoint m_gtOrientedPoint = null; //verify if the located object is point feature for (int i = 0; i < LocatedObjects.Count; i++) { if (LocatedObjects[i].Geometry.Type == "OrientedPointGeometry") { pointSelected = true; break; } else { for (int indx = 0; indx < linearFNOs.Count; indx++) { if (linearFNOs[indx] == LocatedObjects[i].FNO) { if (!lineSelected) { //Get point and angle of the located linear feature m_gtOrientedPoint = GetPointAndAngle(LocatedObjects[i].Geometry, UserPoint); lineSelected = true; //Add Property "LinearFno" to Session to hold value located Linear fno and used by ByPassSPT Placement Technique //ByPassSPT Placement Technique get located Linear Fno AddProperty("LinearFno", linearFNOs[indx]); break; } } } } } if ((!pointSelected) && (m_gtOrientedPoint != null)) { pointSelected = true; m_GComp.Geometry.FirstPoint.X = m_gtOrientedPoint.X; m_GComp.Geometry.FirstPoint.Y = m_gtOrientedPoint.Y; m_gtPointGeometry = (IGTOrientedPointGeometry)m_GComp.Geometry; m_gtPointGeometry.Origin = m_gtOrientedPoint; //set the orientation of the point feature same as located linear feature m_gtPointGeometry.Orientation = VectorByAngle(ang); m_PTHelper.SetGeometry(m_gtPointGeometry); m_PTHelper.EndPlacement(); flag = true; } else { MessageBox.Show("Please click on related Primary Conductor feature.", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } catch (Exception ex) { MessageBox.Show("Please click on related Primary Conductor feature. \n" + ex.Message, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Error); AbortPlacement(); } finally { if (flag) { Exitcommand(); } } }
/// <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); }