Ejemplo n.º 1
0
 public CommonSetCUStandardAttributes(IGTComponents p_component, string p_componentName)
 {
     m_oApp          = GTClassFactory.Create <IGTApplication>();
     m_oDataContext  = m_oApp.DataContext;
     m_oComponents   = p_component;
     m_componentName = p_componentName;
 }
Ejemplo n.º 2
0
        private void SynchronizeWP()
        {
            try
            {
                foreach (IGTDDCKeyObject ddcObject in m_selectedObjects)
                {
                    m_oGTTransactionManager.Begin("Process Synchronize WorkPoints for Copy Ancillary =" + ddcObject.FNO.ToString() + " FID = " + ddcObject.FID.ToString());

                    IGTKeyObject feature = m_dataContext.OpenFeature(ddcObject.FNO, ddcObject.FID);

                    IGTComponents CUComponentsFeature = GTClassFactory.Create <IGTComponents>();

                    foreach (IGTComponent item in feature.Components)
                    {
                        if (item.CNO == 22)
                        {
                            CUComponentsFeature.Add(item);
                        }
                    }
                    WorkPointOperations obj = new WorkPointOperations(CUComponentsFeature, feature, m_dataContext);
                    obj.DoWorkpointOperations();

                    m_oGTTransactionManager.Commit();
                    m_oGTTransactionManager.RefreshDatabaseChanges();
                }
            }
            catch
            {
                throw;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// UpdateWorkpointComponents : Update Workpoint feature  components.
        /// </summary>
        /// <param name="fno">Workpoint Fno</param>
        /// <param name="fid">Workpoint FID</param>
        /// <param name="workPointFeature">Workpoint Feature</param>
        /// <param name="geoUpdate">Bool value indicates the updation of geometry.</param>
        /// <param name="strStructureID">StructureID of Active Key Object</param>
        private void UpdateWorkpointComponents(short fno, int fid, IGTKeyObject workPointFeature, bool geoUpdate,
                                               string strStructureID, int ownerCount, bool isLinear)
        {
            IGTComponents workPointComponents = workPointFeature.Components;

            foreach (IGTComponent component in workPointComponents)
            {
                if (component.Name == "WORKPOINT_N" && geoUpdate)
                {
                    UpdateWorkPointAttributes(component, strStructureID);
                }
                else if (component.Name == "WORKPOINT_CU_N" && ownerCount == 0 && isLinear == true)
                {
                    UpdateWorkpointCUAttributes(workPointFeature.FID, component);
                }
                else if (component.Name == "WORKPOINT_CU_N" && isLinear == false)
                {
                    UpdateWorkpointCUAttributes(workPointFeature.FID, component);
                }
            }

            IGTKeyObject           oKeyObject       = m_dataContext.OpenFeature(fno, fid);
            IGTGeometry            gTGeometry       = oKeyObject.Components.GetComponent(m_gtcommonFunctions.GetPrimaryGraphicCno(fno, true)).Geometry;
            customWorkPointCreator workPointCreator = new customWorkPointCreator(m_dataContext, gTGeometry.FirstPoint.X, gTGeometry.FirstPoint.Y);

            workPointCreator.SynchronizeWPCuLabel(workPointFeature);
        }
Ejemplo n.º 4
0
        private void SynchronizeWP(IGTKeyObject p_KeyObjectFeature)
        {
            try
            {
                m_oGTTransactionManager.Begin("Synchronize WorkPoints for Repeat Reconductoring Feature =" + p_KeyObjectFeature.FNO.ToString() + " FID = " + p_KeyObjectFeature.FID.ToString());

                IGTComponents CUComponentsOldFeature = GTClassFactory.Create <IGTComponents>();

                foreach (IGTComponent item in p_KeyObjectFeature.Components)
                {
                    if (item.CNO == 21 || item.CNO == 22)
                    {
                        CUComponentsOldFeature.Add(item);
                    }
                }
                WorkPointOperations obj = new WorkPointOperations(CUComponentsOldFeature, p_KeyObjectFeature, m_iGtApplication.DataContext);
                obj.DoWorkpointOperations();

                m_oGTTransactionManager.Commit();
                m_oGTTransactionManager.RefreshDatabaseChanges();
            }
            catch (Exception ex)
            {
                if (m_oGTTransactionManager.TransactionInProgress)
                {
                    m_oGTTransactionManager.Rollback();
                }
                throw ex;
            }
        }
Ejemplo n.º 5
0
        private void ProcessWPSync(IGTDDCKeyObject selectedObject)
        {
            try
            {
                WorkPointOperations oWorkPointOperations = null;
                IGTComponents       gTComponents         = GTClassFactory.Create <IGTComponents>();
                IGTKeyObject        feature       = m_iGtApplication.DataContext.OpenFeature(selectedObject.FNO, selectedObject.FID);
                Recordset           cuComponentRs = feature.Components.GetComponent(21).Recordset;
                if (cuComponentRs != null && cuComponentRs.RecordCount > 0)
                {
                    gTComponents.Add(feature.Components.GetComponent(21));
                }
                // Set Activity in Ancillary CU attributes
                if (feature.Components.GetComponent(22) != null)
                {
                    Recordset acuComponentRs = feature.Components.GetComponent(22).Recordset;
                    if (acuComponentRs != null && acuComponentRs.RecordCount > 0)
                    {
                        gTComponents.Add(feature.Components.GetComponent(22));
                    }
                }

                // Synchronize the workpoint
                oWorkPointOperations = new WorkPointOperations(gTComponents, feature, m_DataContext);
                oWorkPointOperations.DoWorkpointOperations();
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Method for Workpoint operations after command execution
        /// </summary>
        private void SynchronizeWP()
        {
            IGTComponents allCUComponents = null;

            try
            {
                foreach (IGTDDCKeyObject ddcobject in m_ooddcKeyObjects)
                {
                    m_ofeature = m_oGTApp.Application.DataContext.OpenFeature(ddcobject.FNO, ddcobject.FID);

                    allCUComponents = GTClassFactory.Create <IGTComponents>();

                    if (m_ofeature != null)
                    {
                        GetAllCUComponents(m_ofeature, ref allCUComponents);

                        if (allCUComponents.Count > 0)
                        {
                            WorkPointOperations oWorkPointOperations = new WorkPointOperations(allCUComponents, m_ofeature, m_oGTApp.Application.DataContext);
                            oWorkPointOperations.DoWorkpointOperations();
                        }
                    }
                }
            }
            catch
            {
                throw;
            }
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Method to Get Component Values Of Differnt Feature
 /// </summary>
 /// <param name="m_trgComponents">Target Component Number</param>
 /// <param name="m_srcComponent">Source Component Number</param>
 /// <param name="k"> Edit index</param>
 /// <returns></returns>
 private void GetComponentValuesOfDifferntFeature(IGTComponents m_trgComponents, IGTComponent m_srcComponent, int k)
 {
     try
     {
         foreach (IGTComponent m_trgComponent in m_trgComponents)
         {
             //check if target component type is same as source component type
             if ((GetGeometryType(m_trgComponent.CNO) == (GetGeometryType(m_srcComponent.CNO))) && (m_trgComponent.TableName != m_srcComponent.TableName) && (GetDetail(m_trgComponent.CNO) == 0))
             {
                 //check if source geometry is valid, if so add to edit service
                 if ((m_srcComponent.Geometry != null && m_trgComponent.Geometry == null))
                 {
                     m_oEditService.AddGeometry(m_srcComponent.Geometry, m_styleID);
                     m_EditObjects.Add(k, m_trgComponent.CNO);
                     m_iEditIndex++;
                     break;
                 }
             }
         }
     }
     catch
     {
         throw;
     }
 }
Ejemplo n.º 8
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(IGTComponents m_gtComponents, IGTKeyObject m_gtRelativePoint, IGTGeometry m_gtLineGeometry)
        {
            try
            {
                IGTPoint m_gtRightOriginPoint = null;
                //set the node value  for Bypass point placed at Right
                if ((m_rlnode1 != 0) && (m_rlnode1 == m_rpnode2))
                {
                    m_gtRightOriginPoint = PointAtDistanceBetweenTwoPoints(m_gtLineGeometry.LastPoint, m_gtLineGeometry.FirstPoint, xOffset, 0);
                    m_gtComponents.GetComponent(ConnectivityCNO).Recordset.Fields["NODE_2_ID"].Value = m_rlnode1;
                    m_gtRelativePoint.Components.GetComponent(ConnectivityCNO).Recordset.Fields["NODE_2_ID"].Value = 0;
                    m_gtComponents.GetComponent(ConnectivityCNO).Recordset.Update();
                    m_gtRelativePoint.Components.GetComponent(ConnectivityCNO).Recordset.Update();
                }
                else
                {
                    m_gtRightOriginPoint = PointAtDistanceBetweenTwoPoints(m_gtLineGeometry.FirstPoint, m_gtLineGeometry.LastPoint, -xOffset, 0);
                    m_gtComponents.GetComponent(ConnectivityCNO).Recordset.Fields["NODE_2_ID"].Value = 0;
                    m_gtRelativePoint.Components.GetComponent(ConnectivityCNO).Recordset.Fields["NODE_2_ID"].Value = 0;
                    m_gtComponents.GetComponent(ConnectivityCNO).Recordset.Update();
                    m_gtRelativePoint.Components.GetComponent(ConnectivityCNO).Recordset.Update();
                }

                return(m_gtRightOriginPoint);
            }
            catch
            {
                throw;
            }
        }
Ejemplo n.º 9
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(IGTKeyObject m_KeyObject, 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>();
                m_gtRelationshipService.DataContext = m_gtApplication.DataContext;
                if (m_rlnode2 != 0)
                {
                    m_gtLeftOriginPoint = PointAtDistanceBetweenTwoPoints(m_gtLineGeometry.FirstPoint, m_gtLineGeometry.LastPoint, xOffset, 0);
                    m_gtRelativeLines[0].Components.GetComponent(ConnectivityCNO).Recordset.Fields["NODE_2_ID"].Value = 0;
                    m_gtRelativeLines[0].Components.GetComponent(ConnectivityCNO).Recordset.Update();

                    //establish the relationship
                    m_gtRelationshipService.ActiveFeature = m_KeyObject;
                    m_gtRelationshipService.SilentEstablish(iRNO, m_gtRelativeLines[0], GTRelationshipOrdinalConstants.gtrelRelationshipOrdinal1, GTRelationshipOrdinalConstants.gtrelRelationshipOrdinal2);
                    m_gtRelativeLines[0].Components.GetComponent(ConnectivityCNO).Recordset.Update();
                    m_gtComponents.GetComponent(ConnectivityCNO).Recordset.Update();
                }
                else
                {
                    m_gtLeftOriginPoint = PointAtDistanceBetweenTwoPoints(m_gtLineGeometry.LastPoint, m_gtLineGeometry.FirstPoint, -xOffset, 0);
                    m_gtRelativeLines[0].Components.GetComponent(ConnectivityCNO).Recordset.Fields["NODE_2_ID"].Value = 0;
                    m_gtRelativeLines[0].Components.GetComponent(ConnectivityCNO).Recordset.Update();
                    m_gtComponents.GetComponent(ConnectivityCNO).Recordset.Update();
                }
                m_gtRelationshipService = null;
                return(m_gtLeftOriginPoint);
            }
            catch
            {
                throw;
            }
        }
Ejemplo n.º 10
0
        private void ModifiedCUComponentCollection()
        {
            try
            {
                foreach (KeyValuePair <IGTKeyObject, IGTComponents> gtKeyObject in m_gTKeyObjects)
                {
                    IGTComponents gTCUComponents = GTClassFactory.Create <IGTComponents>();
                    m_gtAllCUComponents = GTClassFactory.Create <IGTComponents>();

                    m_activeKeyObject = gtKeyObject.Key;
                    m_gtActiveFno     = m_activeKeyObject.FNO;

                    m_gtAllCUComponents = gtKeyObject.Value;

                    if (m_gtAllCUComponents.Count > 0 &&
                        m_gtcommonFunctions.ISPrimaryGraphicComponentExist(m_activeKeyObject.FNO, m_activeKeyObject.FID))
                    {
                        m_CUCompModified = true;
                        ProcessModifiedCUComponents();
                    }
                }
            }
            catch
            {
                throw;
            }
        }
Ejemplo n.º 11
0
        public void SetComponentsChanged(IGTComponents gTChangedComponents)
        {
            Recordset rs = null;

            try
            {
                foreach (IGTComponent gtComp in gTChangedComponents)
                {
                    rs = gtComp.Recordset;
                    if (rs != null && rs.RecordCount > 0)
                    {
                        rs.MoveFirst();
                        while (!rs.EOF)
                        {
                            foreach (Field field in rs.Fields)
                            {
                                if (field.OriginalValue.ToString() != field.Value.ToString())
                                {
                                    if (!m_gtAllCUComponents.Contains(gtComp))//Added by Prathyusha
                                    {
                                        m_gtAllCUComponents.Add(gtComp);
                                    }
                                    break;
                                }
                            }
                            rs.MoveNext();
                        }
                    }
                }
            }
            catch
            {
                throw;
            }
        }
Ejemplo n.º 12
0
        public Dictionary <IGTKeyObject, IGTComponents> GetComponentsChangedCollection(IGTKeyObjects p_KeyObjects)
        {
            Dictionary <IGTKeyObject, IGTComponents> dicReturn = new Dictionary <IGTKeyObject, IGTComponents>();
            IGTComponents gTCUComponents = GTClassFactory.Create <IGTComponents>();

            try
            {
                foreach (IGTKeyObject oKeyObject in p_KeyObjects)
                {
                    if (oKeyObject.Components.GetComponent(21) != null)
                    {
                        gTCUComponents.Add(oKeyObject.Components.GetComponent(21));
                    }

                    if (oKeyObject.Components.GetComponent(22) != null)
                    {
                        gTCUComponents.Add(oKeyObject.Components.GetComponent(22));
                    }
                    IGTComponents oCompCollection = SetComponentsChanged(gTCUComponents);
                    if (oCompCollection.Count > 0)
                    {
                        dicReturn.Add(oKeyObject, oCompCollection);
                    }
                }
            }
            catch
            {
                throw;
            }
            return(dicReturn);
        }
Ejemplo n.º 13
0
        /// <summary>
        ///  Method to check if the feature is an Isolation Scenario feature.
        /// </summary>
        /// <param name="gtComps">IGTComponents used to check for specific attribute values</param>
        /// <param name="fno">Feature number to check</param>
        /// <param name="isIsolationScenario">Indicates if feature takes part in an Isolation Scenario</param>
        /// <param name="isolationScenarioType">Type of Isolation Scenario. Set if isIsolationScenario is true</param>
        /// <returns>Boolean indicating method execution status</returns>
        private bool CheckIsoScenarioFeature(IGTComponents gtComps, short fno, ref bool isIsolationScenario, ref IsolationScenarios isolationScenarioType)
        {
            try
            {
                string feedType = string.Empty;
                if (fno == 59 && gtComps.GetComponent(5901).Recordset != null && gtComps.GetComponent(5901).Recordset.RecordCount > 0)
                {
                    gtComps.GetComponent(5901).Recordset.MoveFirst();
                    feedType = Convert.ToString(gtComps.GetComponent(5901).Recordset.Fields["FEED_TYPE"].Value);
                }
                else if (fno == 60 && gtComps.GetComponent(6002).Recordset != null && gtComps.GetComponent(6002).Recordset.RecordCount > 0)
                {
                    gtComps.GetComponent(6002).Recordset.MoveFirst();
                    feedType = Convert.ToString(gtComps.GetComponent(6002).Recordset.Fields["FEED_TYPE"].Value);
                }

                //ISODUAL
                if (fno == 34) //Autotransformer
                {
                    isIsolationScenario   = true;
                    isolationScenarioType = IsolationScenarios.ISODUAL;
                }
                //ISOSINGLE
                else if (fno == 4 || fno == 12 || fno == 59 || (fno == 60 && feedType.ToUpper() == "RADIAL"))
                {
                    isIsolationScenario   = true;
                    isolationScenarioType = IsolationScenarios.ISOSINGLE;
                }
                //ISOSINGLE NETWORK FEATURES
                else if (fno == 99 || fno == 98)
                {
                    isIsolationScenario   = true;
                    isolationScenarioType = IsolationScenarios.ISOSINGLE;
                }
                //ELBOW
                else if (fno == 5 || (fno == 60 && feedType.ToUpper() == "LOOP"))
                {
                    isIsolationScenario   = true;
                    isolationScenarioType = IsolationScenarios.ELBOW;
                }
                //BYPASS
                else if (fno == 14 || fno == 15 || fno == 36)
                {
                    isIsolationScenario   = true;
                    isolationScenarioType = IsolationScenarios.BYPASS;
                }
                else
                {
                    isIsolationScenario = false;
                }

                return(true);
            }
            catch (Exception ex)
            {
                throw new Exception("Error from Isolation Scenario FI:CheckIsoScenarioFeature: " + ex.Message);
            }
        }
Ejemplo n.º 14
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;
            }
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Method to create work point feature
        /// </summary>
        /// <returns>Work point feature IGTKeyObject</returns>
        public IGTKeyObject CreateWorkPointFeature()
        {
            try
            {
                IGTKeyObject  workPointFeature    = m_dataContext.NewFeature(191);
                IGTComponents workPointComponents = workPointFeature.Components;
                int           wpOffsetX           = 0;
                int           wpOffsetY           = 0;
                GetWorkPointOffset(ref wpOffsetX, ref wpOffsetY);

                foreach (IGTComponent component in workPointComponents)
                {
                    Recordset tempRs = component.Recordset;
                    if (tempRs != null)
                    {
                        if (tempRs.RecordCount > 0)
                        {
                            if (component.CNO == 19102) // Work point symbol
                            {
                                IGTOrientedPointGeometry orientedPtGeometry = GTClassFactory.Create <IGTOrientedPointGeometry>();
                                IGTPoint point = GTClassFactory.Create <IGTPoint>();
                                point.X = m_locationX - wpOffsetX;
                                point.Y = m_locationY - wpOffsetY;
                                orientedPtGeometry.Origin = point;
                                component.Geometry        = orientedPtGeometry;
                            }
                            if (component.CNO == 19103) // Work point Label
                            {
                                IGTTextPointGeometry gTTextPointGeometry = GTClassFactory.Create <IGTTextPointGeometry>();
                                IGTPoint             gTPoint             = GTClassFactory.Create <IGTPoint>();
                                gTPoint.X = m_locationX - wpOffsetX;
                                gTPoint.Y = m_locationY - wpOffsetY;
                                gTTextPointGeometry.Origin    = gTPoint;
                                gTTextPointGeometry.Alignment = GTAlignmentConstants.gtalBottomCenter;
                                component.Geometry            = gTTextPointGeometry;
                                component.Recordset.Update();
                            }
                        }
                    }
                }

                // Leader Line should end at a point 70% of the way toward the structure from center of the Work Point.
                m_locationX = m_locationX - wpOffsetX * .3;
                m_locationY = m_locationY - wpOffsetY * .3;

                CreateLeaderLine(workPointFeature, m_locationX, m_locationY);
                return(workPointFeature);
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Method to set the activity attribute of the CU and ACU components
        /// </summary>
        /// <param name="selectedObject">Selected feature on map window</param>
        private void SetActivity(IGTDDCKeyObject selectedObject)
        {
            Recordset           cuComponentRs        = null;
            Recordset           acuComponentRs       = null;
            WorkPointOperations oWorkPointOperations = null;
            IGTComponents       gTComponents         = GTClassFactory.Create <IGTComponents>();

            try
            {
                IGTKeyObject feature = m_iGtApplication.DataContext.OpenFeature(selectedObject.FNO, selectedObject.FID);
                // Set Activity in CU attributes
                cuComponentRs = feature.Components.GetComponent(21).Recordset;
                if (cuComponentRs != null && cuComponentRs.RecordCount > 0)
                {
                    gTComponents.Add(feature.Components.GetComponent(21));
                    cuComponentRs.MoveFirst();
                    while (!cuComponentRs.EOF)
                    {
                        cuComponentRs.Fields["ACTIVITY_C"].Value = "A";
                        cuComponentRs.MoveNext();
                    }
                }
                // Set Activity in Ancillary CU attributes
                if (feature.Components.GetComponent(22) != null)
                {
                    acuComponentRs = feature.Components.GetComponent(22).Recordset;
                    if (acuComponentRs != null && acuComponentRs.RecordCount > 0)
                    {
                        gTComponents.Add(feature.Components.GetComponent(22));
                        acuComponentRs.MoveFirst();
                        while (!acuComponentRs.EOF)
                        {
                            string retiremenType = Convert.ToString(acuComponentRs.Fields["RETIREMENT_C"].Value);
                            if (retiremenType == "1" || retiremenType == "2")
                            {
                                acuComponentRs.Fields["ACTIVITY_C"].Value = "R";
                            }
                            acuComponentRs.MoveNext();
                        }
                    }
                }

                //// Synchronize the workpoint
                //oWorkPointOperations = new WorkPointOperations(gTComponents, feature, m_DataContext);
                //oWorkPointOperations.DoWorkpointOperations();
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Gets the values to pre-populate on the report.
        /// </summary>
        /// <param name="fno">G3E_FNO of the selected conductor</param>
        /// <param name="fid">G3E_FID of the selected conductor</param>
        /// <returns>Boolean indicating status</returns>
        private bool GetReportData(short fno, int fid)
        {
            bool returnValue = false;

            try
            {
                string cu       = string.Empty;
                string location = string.Empty;

                if (fid != 0)
                {
                    IGTKeyObject  oGTKey        = m_Application.DataContext.OpenFeature(fno, fid);
                    IGTComponents oGTComponents = oGTKey.Components;
                    Recordset     componentRS   = oGTComponents.GetComponent(ConstantsDT.CNO_COMPUNIT).Recordset;

                    if (componentRS.RecordCount > 0)
                    {
                        cu = componentRS.Fields[ConstantsDT.FIELD_COMPUNIT_CU].Value.ToString();
                    }

                    componentRS = oGTComponents.GetComponent(ConstantsDT.CNO_COMMON).Recordset;

                    if (componentRS.RecordCount > 0)
                    {
                        location = componentRS.Fields[ConstantsDT.FIELD_COMMON_LOCATION].Value.ToString();
                    }
                }

                m_EmbeddedDT.ReportName = ConstantsDT.COMMAND_NAME_SAG_CLEARANCE + " " + m_Application.DataContext.ActiveJob + "-" + fid + ".pdf";

                List <KeyValuePair <string, string> > reportValues = new List <KeyValuePair <string, string> >();

                // Add report values
                reportValues.Add(new KeyValuePair <string, string>(ConstantsDT.REPORT_PARAMETER_SAG_PROJECT, CommonDT.WrDescription));
                reportValues.Add(new KeyValuePair <string, string>(ConstantsDT.REPORT_PARAMETER_SAG_LOCATION, location));
                reportValues.Add(new KeyValuePair <string, string>(ConstantsDT.REPORT_PARAMETER_SAG_DESIGNER, Environment.UserName));
                reportValues.Add(new KeyValuePair <string, string>(ConstantsDT.REPORT_PARAMETER_SAG_DATE, DateTime.Now.ToShortDateString()));
                reportValues.Add(new KeyValuePair <string, string>(ConstantsDT.REPORT_PARAMETER_SAG_CONDUCTOR, cu));

                m_EmbeddedDT.ReportValues = reportValues;

                returnValue = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(m_Application.ApplicationWindow, ConstantsDT.ERROR_RETRIEVING_REPORT_DATA + ": " + ex.Message, ConstantsDT.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(false);
            }

            return(returnValue);
        }
Ejemplo n.º 18
0
        private void SetStructureID()
        {
            string        sOldFeatureStructureID = string.Empty;
            IGTComponents oldFeatureComponents   = m_dataContext.OpenFeature(m_oldFeature.FNO, m_oldFeature.FID).Components;

            if (oldFeatureComponents.GetComponent(1).Recordset != null)
            {
                if (oldFeatureComponents.GetComponent(1).Recordset.RecordCount > 0)
                {
                    oldFeatureComponents.GetComponent(1).Recordset.MoveFirst();
                    sOldFeatureStructureID = Convert.ToString(oldFeatureComponents.GetComponent(1).Recordset.Fields["STRUCTURE_ID"].Value);
                    m_newFeature.Components.GetComponent(1).Recordset.Fields["STRUCTURE_ID"].Value = sOldFeatureStructureID;
                }
            }
        }
Ejemplo n.º 19
0
        public void SynchronizeWP(IGTKeyObject p_keyObject)
        {
            IGTComponents CUComponentsNewFeature = GTClassFactory.Create <IGTComponents>();

            foreach (IGTComponent item in p_keyObject.Components)
            {
                if (item.CNO == 21 || item.CNO == 22)
                {
                    CUComponentsNewFeature.Add(item);
                }
            }
            WorkPointOperations obj = new WorkPointOperations(CUComponentsNewFeature, p_keyObject, m_dataContext);

            obj.DoWorkpointOperations();
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Object initialization for the WorkPointOperations class
        /// </summary>
        /// <param name="AllCUComponents"> This is collection of Primary and Ancillary CUs component that are chabnged for which Workpoints oprtaiton is needed</param>
        /// <param name="ActiveKeyObject"> Active Object</param>
        /// <param name="DataContext"> Data Context</param>
        public WorkPointOperations(IGTComponents AllCUComponents, IGTKeyObject ActiveKeyObject, IGTDataContext DataContext, Dictionary <IGTKeyObject, IGTComponents> p_FeaturesCollection = null)
        {
            m_gtcommonFunctions   = new CommonFunctions();
            m_NewWorkpointFidList = new Dictionary <int, int>();
            m_gtAllCUComponents   = AllCUComponents;
            m_activeKeyObject     = ActiveKeyObject;
            m_dataContext         = DataContext;

            if (ActiveKeyObject != null)
            {
                m_gtActiveFno = ActiveKeyObject.FNO;
            }

            m_gTKeyObjects = p_FeaturesCollection;
            // m_calledFromCC = p_CalledFromCC;
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Method Create new feature
        /// </summary>
        /// <param name="srcFno">Source Feature Number</param>
        /// <param name="trgFno">Traget Feature Number</param>
        /// <returns></returns>
        private bool CopyFeature(short srcFno, short trgFno)
        {
            try
            {
                IGTComponents m_srcComponents = m_oGTApplication.DataContext.OpenFeature(srcFno, m_sourceFID).Components;
                m_otrgFeature = m_oGTApplication.DataContext.NewFeature(trgFno);
                IGTComponents m_trgComponents = m_oGTApplication.DataContext.OpenFeature(trgFno, m_otrgFeature.FID).Components;
                foreach (IGTComponent m_srcComponent in m_srcComponents)
                {
                    Recordset rsOldFeature = m_srcComponent.Recordset;
                    //Get target component if target component is same as source component
                    m_trgComponent = m_otrgFeature.Components.GetComponent(m_srcComponent.CNO);

                    //if target component is null for different feature type
                    if (m_trgComponent == null)
                    {
                        if (GetComponentType(m_srcComponent.CNO) != 1)
                        {
                            GetComponentValuesOfDifferntFeature(m_trgComponents, m_srcComponent, m_iEditIndex);
                        }
                    }
                    //if target component is not null
                    else
                    {
                        Recordset rsNewFeature = m_trgComponent.Recordset;
                        //check if target component is 3 if so then set the values
                        if (rsNewFeature != null)
                        {
                            if (m_trgComponent.CNO == 3)
                            {
                                int m_newG3eId = Convert.ToInt32(rsNewFeature.Fields["G3E_ID"].Value);
                                rsNewFeature.Fields["CREATED_BY"].Value   = m_oGTApplication.DataContext.DatabaseUserName;
                                rsNewFeature.Fields["CREATED_DATE"].Value = System.DateTime.Today;
                                rsNewFeature.Fields["SOURCE"].Value       = rsOldFeature.Fields["SOURCE"].Value;
                                rsNewFeature.Fields["STAGE"].Value        = "Accepted";
                            }
                            else
                            {
                                GetComponentValuesOfSameFeature(rsNewFeature, rsOldFeature, m_trgComponent, m_srcComponent, m_iEditIndex);
                            }
                        }
                    }
                }
                return(true);
            }
            catch { throw; }
        }
Ejemplo n.º 22
0
        public Dictionary <IGTKeyObject, IGTComponents> GetFeatureComponentCollection()
        {
            Dictionary <IGTKeyObject, IGTComponents> oReturnCollection = new Dictionary <IGTKeyObject, IGTComponents>();
            IGTJobManagementService oJobManagement = GTClassFactory.Create <IGTJobManagementService>();

            try
            {
                oJobManagement.DataContext = m_oApp.DataContext;
                ADODB.Recordset rs = oJobManagement.FindPendingEdits();

                if (rs != null && rs.RecordCount > 0)
                {
                    foreach (IGTKeyObject item in m_featureKeyObject)
                    {
                        Feature obj = new Feature(item, m_oApp);
                        rs.Filter = "g3e_fid = " + item.FID;

                        if (rs != null && rs.RecordCount > 0)
                        {
                            IGTComponents oFeatureEditedComp = obj.GetEditedCUComponents(item, rs);

                            if (oFeatureEditedComp.Count > 0 && (!oReturnCollection.Contains(new KeyValuePair <IGTKeyObject, IGTComponents>(item, oFeatureEditedComp))))
                            {
                                oReturnCollection.Add(item, oFeatureEditedComp);
                            }
                        }
                        rs.Filter = ADODB.FilterGroupEnum.adFilterNone;
                    }
                }
            }
            catch (Exception ex)
            {
                string exMsg = string.Format("Error occurred in {0} of {1}.{2}{3}", System.Reflection.MethodBase.GetCurrentMethod().Name, this.ToString(), Environment.NewLine, ex.Message);
                throw new Exception(exMsg);
            }

            return(oReturnCollection);
        }
Ejemplo n.º 23
0
 private void GetAllCUComponents(IGTKeyObject feature, ref IGTComponents allCUComponents)
 {
     try
     {
         foreach (IGTComponent component in feature.Components)
         {
             if (component.CNO == 21 || component.CNO == 22)
             {
                 if (component != null)
                 {
                     if (component.Recordset != null && component.Recordset.RecordCount > 0)
                     {
                         allCUComponents.Add(component);
                     }
                 }
             }
         }
     }
     catch
     {
         throw;
     }
 }
Ejemplo n.º 24
0
        /// <summary>
        /// Get Origin point of point feature
        /// </summary>
        /// <param name="m_gtComponents"></param>
        /// <param name="gtRelativeComponent"></param>
        /// <param name="xOffset"></param>
        /// <param name="pointLocation"></param>
        /// <returns></returns>
        private IGTPoint GetOrigin(IGTKeyObject m_KeyObject, IGTComponents m_gtComponents, IGTGraphicComponent m_gtRelativeComponent, double xOffset, string pointLocation)
        {
            try
            {
                IGTPoint    m_gtOriginPoint  = null;
                IGTGeometry m_gtLineGeometry = GTClassFactory.Create <IGTGeometry>();
                m_gtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, currentKeyObject + " Point placement is in Progress......");

                //Get Relative Component
                IGTKeyObject m_gtRelativePoint = m_gtApplication.DataContext.OpenFeature(m_gtRelativeComponent.FNO, m_gtRelativeComponent.FID);

                //get the related Linear features
                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, m_KeyObject.FNO);
                    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)
                {
                    //Get node values
                    m_gtRelativeLines = GetNodeValues(m_gtRelativePoint, m_gtRelativeLines);
                    m_gtLineGeometry  = m_gtRelativeLines[0].Components.GetComponent(primaryCNO).Geometry;

                    //Get Line segment and its angle
                    m_gtLineGeometry = GetSegmentAndAngle(m_gtLineGeometry, m_gtRelativeComponent.Geometry.FirstPoint);

                    if (m_gtLineGeometry != null)
                    {
                        switch (pointLocation)
                        {
                        case "L":
                            //Get Left Origin Point
                            m_gtOriginPoint = GetLeftOriginPoint(m_gtComponents, m_gtRelativePoint, m_gtLineGeometry, m_gtRelativeLines);

                            break;

                        case "R":
                            //Get Right Origin Point
                            m_gtOriginPoint = GetRightOriginPoint(m_gtComponents, m_gtRelativePoint, m_gtLineGeometry);

                            break;

                        case "T":
                            //Get Top Origin Point
                            m_gtOriginPoint = GetTopOriginPoint(m_gtLineGeometry);

                            //establish the connectivity for Relative point with Linear feature
                            EstablishRelationship(m_gtRelativePoint, m_gtRelativeLines);
                            break;

                        default:
                            break;
                        }
                        if (m_gtOriginPoint == null)
                        {
                            m_gtOriginPoint = m_gtRelativeComponent.Geometry.FirstPoint;
                        }
                    }
                    else
                    {
                        if (pointLocation == "R")
                        {
                            MessageBox.Show("Error: Unable to place " + currentKeyObject + " Points as the linear feature is not selected properly", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
                return(m_gtOriginPoint);
            }
            catch
            {
                throw;
            }
        }
Ejemplo n.º 25
0
        public IGTComponents GetEditedCUComponents(IGTKeyObject p_KeyObject, ADODB.Recordset p_RecordSet)
        {
            IGTComponents             oEditedComponentCollection = GTClassFactory.Create <IGTComponents>();
            Dictionary <Int32, Int16> oDic = new Dictionary <Int32, Int16>();
            bool   bPrimaryGeoemtryEdited  = false;
            bool   bCommonComponentEdited  = false;
            string sStrcurure_ID           = string.Empty;
            bool   bAncillaryEdited        = false;
            bool   bPrimaryCUEdited        = false;

            try
            {
                if (p_RecordSet != null)
                {
                    if (p_RecordSet.RecordCount > 0)
                    {
                        p_RecordSet.MoveFirst();
                        while (p_RecordSet.EOF == false)
                        {
                            int   FID = Convert.ToInt32(p_RecordSet.Fields["g3e_fid"].Value);
                            Int16 FNO = Convert.ToInt16(p_RecordSet.Fields["g3e_fno"].Value);
                            int   CNO = Convert.ToInt32(p_RecordSet.Fields["g3e_cno"].Value);

                            if (CNO == 22)
                            {
                                oEditedComponentCollection.Add(p_KeyObject.Components.GetComponent(22));
                                bAncillaryEdited = true;
                            }
                            if (CNO == 21)
                            {
                                oEditedComponentCollection.Add(p_KeyObject.Components.GetComponent(21));
                                bPrimaryCUEdited = true;
                            }
                            if (CNO == 1)
                            {
                                bCommonComponentEdited = true;
                                p_KeyObject.Components.GetComponent(1).Recordset.MoveFirst();
                                sStrcurure_ID = Convert.ToString(p_KeyObject.Components.GetComponent(1).Recordset.Fields["STRUCTURE_ID"].Value);
                            }
                            if (CNO.Equals(IsPrimaryGraphic(FNO)))
                            {
                                bPrimaryGeoemtryEdited = true;
                            }
                            p_RecordSet.MoveNext();
                        }
                        if (bCommonComponentEdited && bPrimaryGeoemtryEdited && IsWPExist(sStrcurure_ID))
                        {
                            if (p_KeyObject.Components.GetComponent(22) != null)
                            {
                                if (!bAncillaryEdited)
                                {
                                    oEditedComponentCollection.Add(p_KeyObject.Components.GetComponent(22));
                                }
                            }
                            if (p_KeyObject.Components.GetComponent(21) != null)
                            {
                                if (!bPrimaryCUEdited)
                                {
                                    oEditedComponentCollection.Add(p_KeyObject.Components.GetComponent(21));
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                string exMsg = string.Format("Error occurred in {0} of {1}.{2}{3}", System.Reflection.MethodBase.GetCurrentMethod().Name, this.ToString(), Environment.NewLine, ex.Message);
                throw new Exception(exMsg);
            }

            return(oEditedComponentCollection);
        }
Ejemplo n.º 26
0
        /// <summary>
        /// Set Attribute value
        /// </summary>
        /// <param name="m_gtComponents"></param>
        /// <param name="m_gtKeyObject"></param>
        /// <param name="m_gtRelativeComponent"></param>
        /// <returns></returns>
        protected void SetAttributeValues(IGTComponents m_gtComponents, IGTKeyObject m_gtKeyObject, IGTGraphicComponent m_gtRelativeComponent)
        {
            try
            {
                foreach (IGTComponent m_gtComponent in m_gtComponents)
                {
                    switch (m_gtComponent.CNO)
                    {
                    case VirtualPointCNO:
                        if (m_gtComponent.Recordset.RecordCount == 0)
                        {
                            m_gtComponent.Recordset.AddNew();
                            m_gtComponent.Recordset.Fields["G3E_FID"].Value = m_gtKeyObject.FID;
                            m_gtComponent.Recordset.Fields["G3E_FNO"].Value = m_gtKeyObject.FNO;
                            m_gtComponent.Recordset.Fields["G3E_CNO"].Value = m_gtComponent.CNO;
                            m_gtComponent.Recordset.Fields["G3E_CID"].Value = 1;
                        }
                        else
                        {
                            m_gtComponent.Recordset.MoveFirst();
                        }
                        break;

                    case ConnectivityCNO:
                        if (m_gtComponent.Recordset.RecordCount == 0)
                        {
                            m_gtComponent.Recordset.AddNew();
                            m_gtComponent.Recordset.Fields["G3E_FID"].Value         = m_gtKeyObject.FID;
                            m_gtComponent.Recordset.Fields["G3E_FNO"].Value         = m_gtKeyObject.FNO;
                            m_gtComponent.Recordset.Fields["G3E_CNO"].Value         = m_gtComponent.CNO;
                            m_gtComponent.Recordset.Fields["G3E_CID"].Value         = 1;
                            m_gtComponent.Recordset.Fields["STATUS_NORMAL_C"].Value = statusNormal;
                        }
                        else
                        {
                            m_gtComponent.Recordset.MoveFirst();
                            m_gtComponent.Recordset.Fields["STATUS_NORMAL_C"].Value = statusNormal;
                        }
                        break;

                    case VirtualAttributeCNO:
                        if (m_gtComponent.Recordset.RecordCount == 0)
                        {
                            m_gtComponent.Recordset.AddNew();
                            m_gtComponent.Recordset.Fields["G3E_FID"].Value        = m_gtKeyObject.FID;
                            m_gtComponent.Recordset.Fields["G3E_FNO"].Value        = m_gtKeyObject.FNO;
                            m_gtComponent.Recordset.Fields["G3E_CNO"].Value        = m_gtComponent.CNO;
                            m_gtComponent.Recordset.Fields["G3E_CID"].Value        = 1;
                            m_gtComponent.Recordset.Fields["ASSOCIATED_FID"].Value = m_gtRelativeComponent.FID;
                            m_gtComponent.Recordset.Fields["PERMANENT_YN"].Value   = "Y";
                        }
                        else
                        {
                            m_gtComponent.Recordset.MoveFirst();
                            m_gtComponent.Recordset.Fields["ASSOCIATED_FID"].Value = m_gtRelativeComponent.FID;
                            m_gtComponent.Recordset.Fields["PERMANENT_YN"].Value   = "Y";
                        }
                        break;

                    default:
                        break;
                    }
                }
            }
            catch
            {
                throw;
            }
        }
Ejemplo n.º 27
0
        /// <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;
            }
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Method to apply offset to removal feature / old feature
        /// </summary>
        /// <param name="sqlString"></param>
        /// <returns></returns>
        private void ApplyOffSetToGraphicComponents(short featureFNO, int featureFID)
        {
            IGTPoint point = null;

            try
            {
                IGTKeyObject  feature       = m_iGtApplication.DataContext.OpenFeature(featureFNO, featureFID);
                IGTComponents allComponents = feature.Components;
                feature.Components.GetComponent(1).Recordset.MoveFirst();
                string sStructureID = Convert.ToString(feature.Components.GetComponent(1).Recordset.Fields["STRUCTURE_ID"].Value);

                foreach (IGTComponent component in allComponents)
                {
                    if (!IsGraphicGeoComp(component.CNO))
                    {
                        continue;
                    }

                    if (component.Geometry == null)
                    {
                        continue;
                    }
                    switch (component.Geometry.Type)
                    {
                    case GTGeometryTypeConstants.gtgtOrientedPointGeometry:
                        IGTOrientedPointGeometry orientedPtGeometry = GTClassFactory.Create <IGTOrientedPointGeometry>();
                        point   = GTClassFactory.Create <IGTPoint>();
                        point.X = component.Geometry.FirstPoint.X + m_offSetX;
                        point.Y = component.Geometry.FirstPoint.Y + m_offSetY;
                        orientedPtGeometry.Origin      = point;
                        orientedPtGeometry.Orientation = ((IGTOrientedPointGeometry)component.Geometry).Orientation;
                        component.Geometry             = orientedPtGeometry;
                        break;

                    case GTGeometryTypeConstants.gtgtTextPointGeometry:
                        IGTTextPointGeometry textPtGeometry = GTClassFactory.Create <IGTTextPointGeometry>();
                        point   = GTClassFactory.Create <IGTPoint>();
                        point.X = component.Geometry.FirstPoint.X + m_offSetX;
                        point.Y = component.Geometry.FirstPoint.Y + m_offSetY;
                        textPtGeometry.Origin = point;
                        textPtGeometry.Normal = ((IGTOrientedPointGeometry)component.Geometry).Orientation;
                        component.Geometry    = textPtGeometry;
                        break;

                    case GTGeometryTypeConstants.gtgtPolylineGeometry:
                        IGTPolylineGeometry newFtPlineGeo = GTClassFactory.Create <IGTPolylineGeometry>();
                        for (int k = 0; k <= component.Geometry.KeypointCount - 1; k++)
                        {
                            point   = GTClassFactory.Create <IGTPoint>();
                            point.X = component.Geometry.GetKeypointPosition(k).X + m_offSetX;
                            point.Y = component.Geometry.GetKeypointPosition(k).Y + m_offSetY;
                            newFtPlineGeo.Points.Add(point);
                        }
                        component.Geometry = newFtPlineGeo;
                        break;

                    case GTGeometryTypeConstants.gtgtCompositePolylineGeometry:
                        IGTCompositePolylineGeometry newFtCpline          = GTClassFactory.Create <IGTCompositePolylineGeometry>();
                        IGTPolylineGeometry          polylineGeometrytemp = GTClassFactory.Create <IGTPolylineGeometry>();
                        foreach (IGTGeometry subgeom in (IGTCompositePolylineGeometry)component.Geometry)
                        {
                            switch (subgeom.Type)
                            {
                            case GTGeometryTypeConstants.gtgtPointGeometry:
                            case GTGeometryTypeConstants.gtgtOrientedPointGeometry:
                                point.X = component.Geometry.FirstPoint.X + m_offSetX;
                                point.Y = component.Geometry.FirstPoint.Y + m_offSetY;
                                polylineGeometrytemp.Points.Add(point);
                                break;

                            case GTGeometryTypeConstants.gtgtLineGeometry:
                                point.X = component.Geometry.FirstPoint.X + m_offSetX;
                                point.Y = component.Geometry.FirstPoint.Y + m_offSetY;
                                polylineGeometrytemp.Points.Add(point);
                                point.X = component.Geometry.LastPoint.X + m_offSetX;
                                point.Y = component.Geometry.LastPoint.Y + m_offSetY;
                                polylineGeometrytemp.Points.Add(point);
                                break;

                            case GTGeometryTypeConstants.gtgtPolylineGeometry:
                                for (int k = 0; k < subgeom.KeypointCount; k++)
                                {
                                    point.X = component.Geometry.FirstPoint.X + m_offSetX;
                                    point.Y = component.Geometry.FirstPoint.Y + m_offSetY;
                                    polylineGeometrytemp.Points.Add(point);
                                }
                                break;
                            }
                        }
                        break;

                    default:
                        break;
                    }
                }

                feature.Components.GetComponent(1).Recordset.Fields["STRUCTURE_ID"].Value = sStructureID; //Reset the Structure ID to original value. The update is needed as Set Structure Locaiton FI changed the original Structure ID
                UpdateAssociatedWorkPointsStructureId(feature.FNO, feature.FID, sStructureID);            //Update all the WP associated with the feature
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 29
0
        /// <summary>
        /// StartPlacement
        /// </summary>
        /// <param name="PTHelper"></param>
        /// <param name="KeyObject"></param>
        /// <param name="KeyObjectCollection"></param>
        /// <returns></returns>
        public override void StartPlacement(IGTPlacementTechniqueHelper PTHelper, IGTKeyObject KeyObject, IGTKeyObjects KeyObjectCollection)
        {
            try
            {
                m_PTHelper = PTHelper;
                IGTKeyObject        m_KeyObject = KeyObject;
                IGTPoint            m_gtOrigin;
                IGTGraphicComponent relativeComponent = GTClassFactory.Create <IGTGraphicComponent>();
                m_KeyObjectCollection = KeyObjectCollection;

                //get current Key object
                currentKeyObject = GetcurrentKeyObject(KeyObject.FNO);

                if (bSilent)
                {
                    m_gtApplication.BeginWaitCursor();

                    // Disable construction aids and status bar prompts for silent placement techinque.
                    m_PTHelper.ConstructionAidsEnabled        = GTConstructionAidsEnabledConstants.gtptConstructionAidsNone;
                    m_PTHelper.ConstructionAidDynamicsEnabled = false;
                    m_PTHelper.StatusBarPromptsEnabled        = true;
                    m_gtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, currentKeyObject + " Point placement is in Progress......");

                    IGTComponents gtComponents = KeyObject.Components;
                    m_PTHelper.StartPlacement(KeyObject, KeyObjectCollection);

                    //Read arguments
                    ReadArgument();

                    //Find the relative component defined in the placement technique arguments.
                    if ((Convert.ToString(m_GComp.Arguments.GetArgument(0)) != "") && (m_GComps.Count > 0) && (m_GComp != null))
                    {
                        relativeComponent = AccessRelativeComponent.RetrieveRelativeComponent(Convert.ToString(m_GComp.Arguments.GetArgument(0)), m_GComps, m_GComp);
                        //get the origin
                        m_gtOrigin = GetOrigin(m_KeyObject, gtComponents, relativeComponent, xOffset, pointLocation);

                        if ((m_gtOrigin != null) && (relativeComponent != null))
                        {
                            //Set Attribute values
                            SetAttributeValues(gtComponents, m_KeyObject, relativeComponent);

                            //Create new point geometry aligned to the linear feature
                            IGTOrientedPointGeometry newPointGeometry = (IGTOrientedPointGeometry)PTHelper.CreateGeometry();
                            //newPointGeometry.Orientation = VectorByAngle(ang);
                            newPointGeometry.Origin = m_gtOrigin;
                            m_PTHelper.SetGeometry(newPointGeometry);
                            m_PTHelper.EndPlacement();
                        }
                        else
                        {
                            AbortPlacement();
                        }
                    }
                    else
                    {
                        if (pointLocation == "R")
                        {
                            MessageBox.Show("Error: Unable to place " + currentKeyObject + " Points", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                        AbortPlacement();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: Unable to place " + currentKeyObject + " Points \n" + ex.Message, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Error);
                AbortPlacement();
            }
            finally
            {
                m_KeyObjectCollection = null;
                m_GComps = null;
                m_GComp  = null;
                if (pointLocation == "R")
                {
                    m_gtApplication.EndWaitCursor();
                    m_gtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Feature Placement Completed");
                    m_gtApplication.ActiveMapWindow.MousePointer = GTMousePointerConstants.gtmwmpNWArrow;
                    m_PTHelper.ConstructionAidsEnabled           = GTConstructionAidsEnabledConstants.gtptConstructionAidsNone;
                    m_PTHelper.ConstructionAidDynamicsEnabled    = false;
                }
                Exitcommand();
            }
        }
Ejemplo n.º 30
0
        //public RestrictedArea(short Fno, int Fid)
        //{
        //    m_fno = Fno;
        //    m_fid = Fid;
        //    m_iGtApplication = GTClassFactory.Create<IGTApplication>();
        //    m_iGtDataContext = m_iGtApplication.DataContext;
        //}

        /// <summary>
        /// Process Restricted Area validation
        /// </summary>
        /// <returns>true if the process is complete without errors, else returns false</returns>
        public bool Process()
        {
            IGTGeometry       featureGeometry          = null;
            IGTSpatialService gTSpatialService         = null;
            IGTComponent      restrictedAreaAttributes = null;

            try
            {
                foreach (IGTKeyObject feature in m_features)
                {
                    m_fno = feature.FNO;
                    m_fid = feature.FID;

                    IGTComponents selectedfeatureComponents = m_iGtDataContext.OpenFeature(m_fno, m_fid).Components;

                    CommonFunctions commonFunctions = new CommonFunctions();
                    short           primaryCno      = commonFunctions.GetPrimaryGraphicCno(m_fno, true);

                    // If the CNO is zero (not defined), then try the detail CNO
                    if (0 == primaryCno)
                    {
                        primaryCno = commonFunctions.GetPrimaryGraphicCno(m_fno, false);
                    }

                    IGTComponent primaryGraphicComponent = selectedfeatureComponents.GetComponent(primaryCno);

                    if (primaryGraphicComponent != null)
                    {
                        Recordset graphicCompRs = primaryGraphicComponent.Recordset;
                        if (graphicCompRs != null && graphicCompRs.RecordCount > 0)
                        {
                            graphicCompRs.MoveFirst();
                            //  Retrieve the geometry of the primary graphic component
                            featureGeometry = primaryGraphicComponent.Geometry;

                            // Find any Restricted Area features whose area component overlaps the retrieved geometry; if none are found, return with a successful status.
                            gTSpatialService                = GTClassFactory.Create <IGTSpatialService>();
                            gTSpatialService.DataContext    = m_iGtDataContext;
                            gTSpatialService.Operator       = GTSpatialOperatorConstants.gtsoEntirelyContainedBy;
                            gTSpatialService.FilterGeometry = featureGeometry;

                            Recordset restrictedAreaFeaturesRs = gTSpatialService.GetResultsByFNO(new short[] { RestrictedAreaFno });

                            if (restrictedAreaFeaturesRs != null && restrictedAreaFeaturesRs.RecordCount > 0)
                            {
                                //Prathyusha
                                //if (restrictedAreaFeaturesRs.RecordCount == 0)
                                //{
                                //    return false;
                                //}
                                restrictedAreaFeaturesRs.MoveFirst();

                                while (!restrictedAreaFeaturesRs.EOF)
                                {
                                    int fid = Convert.ToInt32(restrictedAreaFeaturesRs.Fields["G3E_FID"].Value);
                                    restrictedAreaAttributes = m_iGtDataContext.OpenFeature(RestrictedAreaFno, fid).Components.GetComponent(RestrictedAreaAttributesCno);

                                    if (!ValidateRestrictedAreaFeature(restrictedAreaAttributes))
                                    {
                                        return(false);
                                    }

                                    restrictedAreaFeaturesRs.MoveNext();
                                }
                                return(true);
                            }
                        }
                    }
                }
                return(true);// Prathyusha: return false;
            }
            catch (Exception)
            {
                throw;
            }
        }