Beispiel #1
0
        private void DeleteNodeRelatedfeatures(GTRelationshipOrdinalConstants ordinal, IGTKeyObject m_feature)
        {
            try
            {
                using (IGTRelationshipService oRel = GTClassFactory.Create <IGTRelationshipService>())
                {
                    oRel.DataContext   = m_dataContext;
                    oRel.ActiveFeature = m_feature;

                    IGTKeyObjects relatedFeatures = GTClassFactory.Create <IGTKeyObjects>();
                    try
                    {
                        relatedFeatures = oRel.GetRelatedFeatures(14, ordinal);
                    }
                    catch
                    {
                    }

                    if (relatedFeatures != null)
                    {
                        foreach (IGTKeyObject feature in relatedFeatures)
                        {
                            if (m_IsoScenarioselectedFeatureFNOs.Contains(feature.FNO))
                            {
                                oRel.SilentDelete(14, ordinal);
                            }
                        }
                    }
                }
            }
            catch
            {
                throw;
            }
        }
Beispiel #2
0
        /// <summary>
        /// Get Left Origin Point
        /// </summary>
        /// <param name="m_gtComponents"></param>
        /// <param name="m_gtRelativePoint"></param>
        /// <param name="m_gtLineGeometry"></param>
        /// <returns></returns>
        private IGTPoint GetLeftOriginPoint(IGTComponents m_gtComponents, IGTKeyObject m_gtRelativePoint, IGTGeometry m_gtLineGeometry, IGTKeyObjects m_gtRelativeLines)
        {
            try
            {
                //Get Left Origin Point
                IGTPoint m_gtLeftOriginPoint = null;
                IGTRelationshipService m_gtRelationshipService = GTClassFactory.Create <IGTRelationshipService>();

                if ((m_gtRelativePoint.FNO == transformerUGFNO) || (m_gtRelativePoint.FNO == AutotransfomerFNO))
                {
                    //establish the connectivity for Relative point with Linear feature
                    EstablishRelationship(m_gtRelativePoint, m_gtRelativeLines);
                }
                else
                {
                    //set the node value for Bypass point placed at top
                    if (m_KeyObjectCollection[1] != null)
                    {
                        m_gtRelationshipService.DataContext   = m_gtApplication.DataContext;
                        m_gtRelationshipService.ActiveFeature = m_KeyObjectCollection[1];
                        m_gtRelationshipService.SilentDelete(iRNO);
                        IGTComponent m_gtBypassComp = m_KeyObjectCollection[1].Components.GetComponent(ConnectivityCNO);
                        m_gtBypassComp.Recordset.Fields["NODE_1_ID"].Value = 0;
                        m_gtBypassComp.Recordset.Fields["NODE_2_ID"].Value = 0;
                        m_gtBypassComp.Recordset.Update();
                    }
                }

                //set the node value  for Bypass point placed at Left
                if ((m_rlnode2 != 0) && (m_rlnode2 == m_rpnode1))
                {
                    m_gtLeftOriginPoint = PointAtDistanceBetweenTwoPoints(m_gtLineGeometry.FirstPoint, m_gtLineGeometry.LastPoint, xOffset, 0);
                    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_gtComponents.GetComponent(ConnectivityCNO).Recordset.Update();
                    m_gtRelativePoint.Components.GetComponent(ConnectivityCNO).Recordset.Update();
                }
                else
                {
                    m_gtLeftOriginPoint = PointAtDistanceBetweenTwoPoints(m_gtLineGeometry.LastPoint, m_gtLineGeometry.FirstPoint, -xOffset, 0);
                    m_gtComponents.GetComponent(ConnectivityCNO).Recordset.Fields["NODE_1_ID"].Value = 0;
                    m_gtRelativePoint.Components.GetComponent(ConnectivityCNO).Recordset.Fields["NODE_2_ID"].Value = m_rlnode1;
                    m_gtRelativePoint.Components.GetComponent(ConnectivityCNO).Recordset.Fields["NODE_1_ID"].Value = 0;
                    m_gtComponents.GetComponent(ConnectivityCNO).Recordset.Update();
                    m_gtRelativePoint.Components.GetComponent(ConnectivityCNO).Recordset.Update();
                }
                m_gtRelationshipService = null;
                return(m_gtLeftOriginPoint);
            }
            catch
            {
                throw;
            }
        }
Beispiel #3
0
        /// <summary>
        /// Set Right Node Values
        /// </summary>
        /// <param name="m_gtComponents"></param>
        /// <param name="m_gtRelativePoint"></param>
        /// <param name="m_gtLineGeometry"></param>
        /// <returns></returns>
        private IGTPoint GetRightOriginPoint(IGTKeyObject m_KeyObject, IGTKeyObject m_gtRelativeLine, IGTKeyObject m_gtRelativePoint, IGTGeometry m_gtLineGeometry)
        {
            try
            {
                IGTPoint m_gtRightOriginPoint = null;
                IGTRelationshipService m_gtRelationshipService = GTClassFactory.Create <IGTRelationshipService>();
                m_gtRelationshipService.DataContext = m_gtApplication.DataContext;
                //get the related feature
                IGTKeyObjects m_gtElbow = GetRelatedFeature(m_gtRelativePoint, iRNO, m_KeyObject.FNO);

                //delete the relationship to remove primary conductor
                m_gtRelationshipService.ActiveFeature = m_gtRelativePoint;
                m_gtRelationshipService.SilentDelete(iRNO, GTRelationshipOrdinalConstants.gtrelRelationshipOrdinal1);
                m_gtRelativePoint.Components.GetComponent(ConnectivityCNO).Recordset.Update();
                m_gtElbow[0].Components.GetComponent(ConnectivityCNO).Recordset.Update();
                m_gtRelativeLine.Components.GetComponent(ConnectivityCNO).Recordset.Update();

                //establish the relationhip
                m_gtRelationshipService.SilentEstablish(iRNO, m_gtElbow[0], GTRelationshipOrdinalConstants.gtrelRelationshipOrdinal1, GTRelationshipOrdinalConstants.gtrelRelationshipOrdinal2);
                m_gtRelativePoint.Components.GetComponent(ConnectivityCNO).Recordset.Update();
                m_gtElbow[0].Components.GetComponent(ConnectivityCNO).Recordset.Update();

                if (m_rlnode1 != 0)
                {
                    m_gtRightOriginPoint = PointAtDistanceBetweenTwoPoints(m_gtLineGeometry.LastPoint, m_gtLineGeometry.FirstPoint, xOffset, 0);
                    m_gtRelativeLine.Components.GetComponent(ConnectivityCNO).Recordset.Fields["NODE_1_ID"].Value = 0;
                    m_gtRelativeLine.Components.GetComponent(ConnectivityCNO).Recordset.Update();
                    //establish the relationhip
                    m_gtRelationshipService.ActiveFeature = m_KeyObject;
                    m_gtRelationshipService.SilentEstablish(iRNO, m_gtRelativeLine, GTRelationshipOrdinalConstants.gtrelRelationshipOrdinal2, GTRelationshipOrdinalConstants.gtrelRelationshipOrdinal1);
                    m_KeyObject.Components.GetComponent(ConnectivityCNO).Recordset.Update();
                }
                else
                {
                    m_gtRightOriginPoint = PointAtDistanceBetweenTwoPoints(m_gtLineGeometry.FirstPoint, m_gtLineGeometry.LastPoint, -xOffset, 0);
                    m_gtRelativeLine.Components.GetComponent(ConnectivityCNO).Recordset.Fields["NODE_1_ID"].Value = 0;
                }
                m_gtRelativeLine.Components.GetComponent(ConnectivityCNO).Recordset.Update();
                m_gtRelationshipService = null;
                return(m_gtRightOriginPoint);
            }
            catch
            {
                throw;
            }
        }
Beispiel #4
0
        private void EstablishIsolationPointConnectivity(IGTKeyObject oIsolationPointParent, IGTKeyObject oIsolationPointNew, GTRelationshipOrdinalConstants node)
        {
            try
            {
                IGTKeyObjects oldIsoRelatedFeatures = GTClassFactory.Create <IGTKeyObjects>();

                using (IGTRelationshipService oRel = GTClassFactory.Create <IGTRelationshipService>())
                {
                    oRel.ActiveFeature = oIsolationPointParent;
                    oRel.DataContext   = m_dataContext;
                    try
                    {
                        oldIsoRelatedFeatures = oRel.GetRelatedFeatures(14, node);
                    }
                    catch
                    {
                    }

                    oRel.ActiveFeature = oIsolationPointNew;

                    oRel.SilentDelete(14, node);
                    GTRelationshipOrdinalConstants relatedNode = GTRelationshipOrdinalConstants.gtrelRelationshipOrdinal1;

                    foreach (IGTKeyObject feature in oldIsoRelatedFeatures)
                    {
                        if (m_isolationScenarioType == IsolationScenarios.BYPASS && feature.FNO == 40)
                        {
                            continue;
                        }
                        else
                        {
                            DetermineConnectivityNode(oIsolationPointParent, feature, ref relatedNode);
                            EstablishConnectivity(oIsolationPointNew, feature, node, relatedNode);
                        }
                    }
                }
            }
            catch
            {
                throw;
            }
        }
Beispiel #5
0
        /// <summary>
        /// Method to validate that the Isolation Scenario is configured correctly.
        /// If configured correctly then no action.
        /// Else, create virtual points and/or establish connectivity as necessary.
        /// </summary>
        public void ValidateIsolationScenario()
        {
            Dictionary <int, GTRelationshipOrdinalConstants> dicRelatedNodes = new Dictionary <int, GTRelationshipOrdinalConstants>();

            try
            {
                bool isoPtExists = false;
                // Check if Isolation Scenario is valid on Node1.
                if (ValidateIsolationPoint(m_IsolationScenarioFeature.RelatedFeaturesNode1, ref isoPtExists, 1))
                {
                    if (!isoPtExists)
                    {
                        // Create Isolation Point since one doesn't exist
                        CreateIsolationPoint(1);
                        m_IsoCommon.SetNormalAndAsOperatedStatus(m_IsolationScenarioFeature.IsolationPoint1, 1);
                    }

                    // Check if Isolation Scenario is valid on Node2.
                    if (ValidateIsolationPoint(m_IsolationScenarioFeature.RelatedFeaturesNode2, ref isoPtExists, 2))
                    {
                        if (!isoPtExists)
                        {
                            // Create Isolation Point since one doesn't exist
                            CreateIsolationPoint(2);
                            m_IsoCommon.SetNormalAndAsOperatedStatus(m_IsolationScenarioFeature.IsolationPoint2, 2);
                        }

                        GTRelationshipOrdinalConstants relatedNode = GTRelationshipOrdinalConstants.gtrelRelationshipOrdinal1;

                        foreach (IGTKeyObject feature in m_IsolationScenarioFeature.RelatedFeaturesNode1)
                        {
                            if (feature.FID != m_IsolationScenarioFeature.IsolationPoint1.FID)
                            {
                                m_IsoCommon.DetermineConnectivityNode(m_IsolationScenarioFeature.GtKeyObject, feature, ref relatedNode);
                                dicRelatedNodes.Add(feature.FID, relatedNode);
                            }
                        }
                        using (IGTRelationshipService oRel = GTClassFactory.Create <IGTRelationshipService>())
                        {
                            oRel.DataContext   = m_dataContext;
                            oRel.ActiveFeature = m_IsolationScenarioFeature.GtKeyObject;
                            oRel.SilentDelete(14, GTRelationshipOrdinalConstants.gtrelRelationshipOrdinal1);

                            // If features related to Isolation Scenario feature are connected directly to Node 1 of Isolation Scenario feature, then
                            // reconnect features to Isolation Point feature.
                            foreach (IGTKeyObject feature in m_IsolationScenarioFeature.RelatedFeaturesNode1)
                            {
                                // Skip the processing for the Isolation Point feature since the Isolation Point was already validated/updated.
                                if (feature.FID != m_IsolationScenarioFeature.IsolationPoint1.FID && dicRelatedNodes.TryGetValue(feature.FID, out relatedNode))
                                {
                                    // m_IsoCommon.DetermineConnectivityNode(m_IsolationScenarioFeature.GtKeyObject, feature, ref relatedNode);
                                    m_IsoCommon.EstablishConnectivity(m_IsolationScenarioFeature.IsolationPoint1, feature, GTRelationshipOrdinalConstants.gtrelRelationshipOrdinal1, relatedNode);
                                }
                            }

                            m_IsoCommon.EstablishConnectivity(m_IsolationScenarioFeature.IsolationPoint1, m_IsolationScenarioFeature.GtKeyObject, GTRelationshipOrdinalConstants.gtrelRelationshipOrdinal2, GTRelationshipOrdinalConstants.gtrelRelationshipOrdinal1);

                            m_IsoCommon.EstablishOwnerShip(m_IsolationScenarioFeature.GtKeyObject, m_IsolationScenarioFeature.IsolationPoint1);

                            m_IsoCommon.PopulateProtectionDeviceIDForIsoPt(m_IsolationScenarioFeature.GtKeyObject, m_IsolationScenarioFeature.IsolationPoint1);



                            dicRelatedNodes.Clear();

                            foreach (IGTKeyObject feature in m_IsolationScenarioFeature.RelatedFeaturesNode2)
                            {
                                if (feature.FID != m_IsolationScenarioFeature.IsolationPoint2.FID)
                                {
                                    m_IsoCommon.DetermineConnectivityNode(m_IsolationScenarioFeature.GtKeyObject, feature, ref relatedNode);
                                    dicRelatedNodes.Add(feature.FID, relatedNode);
                                }
                            }

                            oRel.SilentDelete(14, GTRelationshipOrdinalConstants.gtrelRelationshipOrdinal2);
                        }
                        // If features related to Isolation Scenario feature are connected directly to Node 2 of Isolation Scenario feature, then
                        // reconnect features to Isolation Point feature.
                        foreach (IGTKeyObject feature in m_IsolationScenarioFeature.RelatedFeaturesNode2)
                        {
                            // Skip the processing for the Isolation Point feature since the Isolation Point was already validated/updated.
                            if (feature.FID != m_IsolationScenarioFeature.IsolationPoint2.FID && dicRelatedNodes.TryGetValue(feature.FID, out relatedNode))
                            {
                                //m_IsoCommon.DetermineConnectivityNode(m_IsolationScenarioFeature.GtKeyObject, feature, ref relatedNode);
                                m_IsoCommon.EstablishConnectivity(m_IsolationScenarioFeature.IsolationPoint2, feature, GTRelationshipOrdinalConstants.gtrelRelationshipOrdinal2, relatedNode);
                            }
                        }

                        m_IsoCommon.EstablishConnectivity(m_IsolationScenarioFeature.IsolationPoint2, m_IsolationScenarioFeature.GtKeyObject, GTRelationshipOrdinalConstants.gtrelRelationshipOrdinal1, GTRelationshipOrdinalConstants.gtrelRelationshipOrdinal2);

                        m_IsoCommon.EstablishOwnerShip(m_IsolationScenarioFeature.GtKeyObject, m_IsolationScenarioFeature.IsolationPoint2);

                        m_IsoCommon.PopulateProtectionDeviceIDForIsoPt(m_IsolationScenarioFeature.GtKeyObject, m_IsolationScenarioFeature.IsolationPoint2);
                    }
                }
            }
            catch (Exception ex)
            {
                if (m_IsoCommon.InteractiveMode)
                {
                    MessageBox.Show("Error in Isolation Scenario FI:ValidateIsolationScenario - " + ex.Message, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            finally
            {
                dicRelatedNodes.Clear();
                dicRelatedNodes = null;
            }
        }