/// <summary> /// Get Top Origin Point /// </summary> /// <param name="m_gtLineGeometry"></param> /// <returns></returns> private IGTPoint GetTopOriginPoint(IGTGeometry m_gtLineGeometry) { try { IGTPoint m_gtTopOriginPoint = null; //create offset geoemtry IGTGeometry[] geoms = m_gtLineGeometry.CreateOffsetGeometries(xOffset); if ((m_rlnode1 != 0) && (m_rlnode1 == m_rpnode1)) { m_gtTopOriginPoint = geoms[0].FirstPoint; } if ((m_rlnode2 != 0) && (m_rlnode2 == m_rpnode1)) { m_gtTopOriginPoint = geoms[0].LastPoint; } return(m_gtTopOriginPoint); } catch { throw; } }
/// <summary> /// Get Origin /// </summary> /// <param name="m_gtComponents"></param> /// <param name="m_gtRelativeComponent"></param> /// <param name="xOffset"></param> /// <param name="pointLocation"></param> /// <returns></returns> private IGTPoint GetOrigin(IGTKeyObject KeyObject, IGTComponents m_gtComponents, IGTGraphicComponent m_gtRelativeComponent, double xOffset, string pointLocation) { try { IGTPoint m_gtOriginPoint = null; m_gtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Isolation Point placement is in Progress......"); //Get the related Point feature IGTKeyObject m_gtRelativePoint = m_gtApplication.DataContext.OpenFeature(m_gtRelativeComponent.FNO, m_gtRelativeComponent.FID); //get the related lines IGTKeyObjects m_gtRelativeLines = GetRelatedFeature(m_gtRelativePoint, iRNO, linearFNO); //get the related Linear features in case they are not connected to relativepoint if (m_gtRelativeLines.Count == 0) { IGTKeyObjects m_gtBypasspt = GetRelatedFeature(m_gtRelativePoint, iRNO, KeyobjectFNO); if (m_gtBypasspt.Count > 0) { m_gtRelativeLines = GetRelatedFeature(m_gtBypasspt[0], iRNO, linearFNO); } } //Check if related line geometry is not null if (m_gtRelativeLines != null && m_gtRelativeLines.Count > 0) { EstablishRelationship(m_gtRelativePoint, m_gtRelativeLines); IGTGeometry m_gtLineGeometry = m_gtRelativeLines[0].Components.GetComponent(primaryCNO).Geometry; if (m_gtLineGeometry != null) { //Get node values GetNodeValues(m_gtRelativePoint, m_gtRelativeLines); //create offset geoemtry if ((m_rlnode2 != 0) && (m_rlnode2 == m_rpnode1)) { IGTGeometry[] geoms = m_gtLineGeometry.CreateOffsetGeometries(xOffset); m_gtOriginPoint = geoms[0].LastPoint; //set the node value m_gtComponents.GetComponent(ConnectivityCNO).Recordset.Fields["NODE_1_ID"].Value = m_rlnode2; m_gtRelativePoint.Components.GetComponent(ConnectivityCNO).Recordset.Fields["NODE_1_ID"].Value = 0; m_gtRelativePoint.Components.GetComponent(ConnectivityCNO).Recordset.Fields["NODE_2_ID"].Value = 0; m_gtRelativePoint.Components.GetComponent(ConnectivityCNO).Recordset.Update(); m_gtComponents.GetComponent(ConnectivityCNO).Recordset.Update(); //set the node value if (m_gtRelativePoint.FNO == transformerUGFNO) { if (m_gtRelativeLines.Count > 1) { m_gtRelativeLines[1].Components.GetComponent(ConnectivityCNO).Recordset.Fields["NODE_1_ID"].Value = m_rlnode2; m_gtRelativeLines[1].Components.GetComponent(ConnectivityCNO).Recordset.Update(); } } } else { IGTGeometry[] geoms = m_gtLineGeometry.CreateOffsetGeometries(xOffset); m_gtOriginPoint = geoms[0].FirstPoint; //set the node value m_gtComponents.GetComponent(ConnectivityCNO).Recordset.Fields["NODE_1_ID"].Value = m_rlnode1; m_gtRelativePoint.Components.GetComponent(ConnectivityCNO).Recordset.Fields["NODE_1_ID"].Value = 0; m_gtRelativePoint.Components.GetComponent(ConnectivityCNO).Recordset.Fields["NODE_2_ID"].Value = 0; m_gtRelativePoint.Components.GetComponent(ConnectivityCNO).Recordset.Update(); m_gtComponents.GetComponent(ConnectivityCNO).Recordset.Update(); //set the node value if (m_gtRelativePoint.FNO == transformerUGFNO) { if (m_gtRelativeLines.Count > 1) { m_gtRelativeLines[1].Components.GetComponent(ConnectivityCNO).Recordset.Fields["NODE_1_ID"].Value = m_rlnode1; m_gtRelativeLines[1].Components.GetComponent(ConnectivityCNO).Recordset.Update(); } } } } if (m_gtOriginPoint == null) { m_gtOriginPoint = m_gtRelativeComponent.Geometry.FirstPoint; } } else { if (pointLocation == "R") { MessageBox.Show("Error: Unable to place Isolation Points as the linear feature is not selected properly", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Error); } } return(m_gtOriginPoint); } catch (Exception) { throw; } }