Esempio n. 1
0
 private void CustomCommandHelper_MouseMove(object sender, GTMouseEventArgs e)
 {
     if (!string.IsNullOrEmpty(presenter.NotifyPresenterMess))
     {
         GTClassFactory.Create <IGTApplication>().SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, presenter.NotifyPresenterMess);
     }
 }
Esempio n. 2
0
 public ccCompleteFeature()
 {
     if (m_iGtApp == null)
     {
         m_iGtApp = GTClassFactory.Create <IGTApplication>();
     }
 }
Esempio n. 3
0
 public void Activate()
 {
     try
     {
         m_oGTApp = GTClassFactory.Create <IGTApplication>();
         m_oGTApp.Application.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Initializing CorrectionsMode...");
         m_oGTApp.Application.BeginWaitCursor();
         SetJobAttributes();
         if (Validate())
         {
             CorrectionsMode();
         }
         m_oGTApp.Application.EndWaitCursor();
         m_oGTApp.Application.RefreshWindows();
         return;
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error in Corrections Mode command: " + ex.Message, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     finally
     {
     }
 }
Esempio n. 4
0
        /// <summary>
        /// Intialize variables and check selected feature is valid.
        /// </summary>
        /// <param name="CustomCommandHelper"></param>
        public void Activate(Intergraph.GTechnology.API.IGTCustomCommandHelper CustomCommandHelper)
        {
            IGTDDCKeyObjects ddcKeyObjects = GTClassFactory.Create <IGTDDCKeyObjects>();

            gtApp = GTClassFactory.Create <IGTApplication>();
            try
            {
                gtCustomCommandHelper            = CustomCommandHelper;
                gtApp.SelectedObjectsChanged    += GtApp_SelectedObjectsChanged;
                gtCustomCommandHelper.MouseMove += new EventHandler <GTMouseEventArgs>(gtCustomCommandHelper_MouseMove);
                if (gtApp.DataContext.IsRoleGranted("PRIV_MGMT_LAND"))
                {
                    if (gtApp.SelectedObjects.FeatureCount == 1)
                    {
                        g3eFno_trg = gtApp.SelectedObjects.GetObjects()[0].FNO;
                        g3eFid_trg = gtApp.SelectedObjects.GetObjects()[0].FID;
                        if (!ValidateSelectedFeature(g3eFno_trg))
                        {
                            MessageBox.Show(ValidationMsg, msgBoxCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                            CleanUp();
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Command Access Denied.  Please contact System Administrator", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    CleanUp();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error " + ex.Message, msgBoxCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                CleanUp();
            }
        }
Esempio n. 5
0
        public bool Execute(object InputValue)
        {
            Boolean selection         = false;
            string  currentJobStatus  = null;
            string  instanceJobStatus = null;

            try
            {
                if (m_gtFeature.FNO == 191)
                {
                    m_gtApplication = GTClassFactory.Create <IGTApplication>();

                    if (CheckJobStatus(ref currentJobStatus, ref instanceJobStatus))
                    {
                        m_gtOutputValue = GTClassFactory.Create <IGTFieldValue>();
                        QueryVoucherFERCAccount();
                        selection = true;
                    }
                    else
                    {
                        MessageBox.Show(String.Format("Selected Voucher cannot be queried as the specific voucher was created when the job was in '{0}' Status and the job is now in '{1}' Status", instanceJobStatus, currentJobStatus), "G/Technology");
                        selection = false;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("There is an error in \"Voucher FERC Account\" Foreign Key Query Interface \n" + ex.Message, "G/Technology");
            }
            return(selection);
        }
Esempio n. 6
0
        /// <summary>
        /// Method to initiate Update Job Status processing. This method is an asynchronous call and client will get notification of completion of the process through event WriteBackProcessCompleted
        /// </summary>
        /// <param name="p_wrNumber">G3E_JOB.WR_NBR</param>
        /// <param name="p_jobStatus">G3E_JOB.JOB_STATUS</param>
        /// <param name="taskId">Unique task ID that needs to be passed through caller. Example  Guid taskID = Guid.NewGuid();</param>
        public void UpdateJobStatus(string p_wrNumber, string p_jobStatus, object taskId)
        {
            IGTApplication  oApp       = GTClassFactory.Create <IGTApplication>();
            JobStatusUpdate oJobStatus = new JobStatusUpdate(oApp, UpdateJobStatusProcessCompleted);

            oJobStatus.UpdateJobStatus(p_wrNumber, p_jobStatus, taskId);
        }
Esempio n. 7
0
        /// <summary>
        /// Returns the feature name by the FNO value
        /// </summary>
        /// <param name="FNO">G3E_FNO</param>
        /// <returns>G3E_FEATURE.G3E_USERNAME</returns>
        private string FeatureNameByFNO(short FNO)
        {
            try
            {
                string featureName = string.Empty;

                string         sql = "select g3e_username from g3e_features_optlang where g3e_fno=?";
                IGTApplication app = GTClassFactory.Create <IGTApplication>();
                Recordset      rs  = app.DataContext.OpenRecordset(sql, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockReadOnly, (int)CommandTypeEnum.adCmdText, FNO);
                if (null != rs && 1 == rs.RecordCount)
                {
                    if (System.DBNull.Value != rs.Fields["g3e_username"].Value)
                    {
                        featureName = rs.Fields["g3e_username"].Value.ToString();
                    }
                    rs.Close();
                    rs = null;
                }

                return(featureName);
            }
            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);
            }
        }
Esempio n. 8
0
        /// <summary>
        /// The entry point for the custom command.
        /// </summary>
        /// <param name="CustomCommandHelper">Provides notification to the system that the command has finished</param>
        public void Activate(IGTCustomCommandHelper CustomCommandHelper)
        {
            try
            {
                m_CustomCommandHelper = CustomCommandHelper;

                // Get the job information. Used for validating command enabling.
                if (!CommonDT.GetJobInformation())
                {
                    m_CustomCommandHelper.Complete();
                    return;
                }

                IGTDDCKeyObjects oGTDCKeys = GTClassFactory.Create <IGTDDCKeyObjects>();

                // Check if selected feature is a Transformer.
                oGTDCKeys = m_Application.SelectedObjects.GetObjects();
                if (!(oGTDCKeys[0].FNO == ConstantsDT.FNO_OH_XFMR || oGTDCKeys[0].FNO == ConstantsDT.FNO_UG_XFMR))
                {
                    MessageBox.Show(m_Application.ApplicationWindow, ConstantsDT.ERROR_SC_INVALID_FEATURE_SELECTED, ConstantsDT.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    m_CustomCommandHelper.Complete();
                    return;
                }

                frmStreetLightVoltageDrop.m_CustomCommandHelper = CustomCommandHelper;
                frmStreetLightVoltageDrop.m_TransactionManager  = m_TransactionManager;
                frmStreetLightVoltageDrop.StartPosition         = FormStartPosition.CenterScreen;
                frmStreetLightVoltageDrop.Show(m_Application.ApplicationWindow);
            }
            catch (Exception ex)
            {
                MessageBox.Show(m_Application.ApplicationWindow, ex.Message, ConstantsDT.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                CustomCommandHelper.Complete();
            }
        }
        private void GetRuleIDRuleMsg(string p_errDescription, out string p_RuleID, out string p_RuleName)
        {
            p_RuleID   = string.Empty;
            p_RuleName = string.Empty;

            try
            {
                IGTApplication app = GTClassFactory.Create <IGTApplication>();
                string         sql = "select rule_nm, rule_id from wr_validation_rule where rule_msg=?";
                Recordset      rs  = app.DataContext.OpenRecordset(sql, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockReadOnly, (int)CommandTypeEnum.adCmdText, p_errDescription);

                if (rs != null)
                {
                    if (rs.RecordCount > 0)
                    {
                        rs.MoveFirst();
                        p_RuleName = Convert.ToString(rs.Fields["rule_nm"].Value);
                        p_RuleID   = Convert.ToString(rs.Fields["rule_id"].Value);
                    }
                }
            }
            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);
            }
        }
Esempio n. 10
0
        /// <summary>
        /// Add valdiations required to validate the active feature.
        /// </summary>
        /// <param name="noWorkPoint"></param>
        /// <param name="noMatchingWorkPoint"></param>
        /// <param name="strArgument1"></param>
        /// <param name="strArgument2"></param>
        /// <param name="p_lstErrorMessage"></param>
        /// <param name="p_lstErrorPriority"></param>
        /// <param name="errorPriorityNoWorkpoint"></param>
        /// <param name="errorPriorityNoMatchingWorkPoint"></param>
        private void AddValidationsToArray(bool noWorkPoint, bool noMatchingWorkPoint, string strArgument1, string strArgument2, ref List <string> p_lstErrorMessage, ref List <string> p_lstErrorPriority, string errorPriorityNoWorkpoint, string errorPriorityNoMatchingWorkPoint)
        {
            ValidationRuleManager validateMsg = new ValidationRuleManager();

            object[] messArguments;
            try
            {
                if (noWorkPoint)
                {
                    messArguments       = new object[1];
                    messArguments[0]    = strArgument1;
                    validateMsg.Rule_Id = "JM1";
                    validateMsg.BuildRuleMessage((IGTApplication)GTClassFactory.Create <IGTApplication>(), messArguments);

                    p_lstErrorMessage.Add(validateMsg.Rule_MSG);
                    p_lstErrorPriority.Add(errorPriorityNoWorkpoint);
                }

                if (!noMatchingWorkPoint)
                {
                    messArguments       = new object[1];
                    messArguments[0]    = strArgument2;
                    validateMsg.Rule_Id = "JM2";
                    validateMsg.BuildRuleMessage((IGTApplication)GTClassFactory.Create <IGTApplication>(), messArguments);

                    p_lstErrorMessage.Add(validateMsg.Rule_MSG);
                    p_lstErrorPriority.Add(errorPriorityNoMatchingWorkPoint);
                }
            }
            catch
            {
                throw;
            }
        }
Esempio n. 11
0
        //Dictionary<short, short> m_fnoGraphicCnoPair;
        //Dictionary<short, short> m_FnoAttributeCnoPair;

        /// <summary>
        /// Custom Boundary Query
        /// </summary>
        /// <param name="point"></param>
        /// <param name="boundaryFno"></param>
        public customBoundaryQuery(IGTPoint point, short boundaryFno)
        {
            this.m_iGtpoint       = point;
            this.m_boundaryFno    = boundaryFno;
            this.m_iGtApplication = GTClassFactory.Create <IGTApplication>();
            this.m_iGtDataContext = m_iGtApplication.DataContext;
        }
Esempio n. 12
0
        private IGTMatrix RotateZTransform(double theta, char RorD)
        {
            if (RorD == 'D')
            {
                theta = (theta * Math.PI) / 180;
            }

            double cos = Math.Cos(theta);
            double sin = Math.Sin(theta);

            IGTMatrix m = null;

            try
            {
                m = GTClassFactory.Create <IGTMatrix>();
                m.M_Matrix[0, 0] = cos; m.M_Matrix[0, 1] = sin; m.M_Matrix[0, 2] = 0.0; m.M_Matrix[0, 3] = 0.0;
                m.M_Matrix[1, 0] = -sin; m.M_Matrix[1, 1] = cos; m.M_Matrix[1, 2] = 0.0; m.M_Matrix[1, 3] = 0.0;
                m.M_Matrix[2, 0] = 0.0; m.M_Matrix[2, 1] = 0.0; m.M_Matrix[2, 2] = 1.0; m.M_Matrix[2, 3] = 0.0;
                m.M_Matrix[3, 0] = 0.0; m.M_Matrix[3, 1] = 0.0; m.M_Matrix[3, 2] = 0.0; m.M_Matrix[3, 3] = 1.0;
                return(m);
            }
            catch (Exception e)
            {
                throw;
            }
        }
Esempio n. 13
0
        /// <summary>
        ///  Method is called when pad/vault  mounted switch gear placement is started
        /// </summary>
        /// <param name="PTHelper"></param>
        /// <param name="KeyObject"></param>
        /// <param name="KeyObjectCollection"></param>
        public void StartPlacement(IGTPlacementTechniqueHelper PTHelper, IGTKeyObject KeyObject, IGTKeyObjects KeyObjectCollection)
        {
            try
            {
                m_PTHelper            = PTHelper;
                m_KeyObject           = KeyObject;
                m_KeyObjectCollection = KeyObjectCollection;


                m_PTHelper.ConstructionAidsEnabled        = Intergraph.GTechnology.API.GTConstructionAidsEnabledConstants.gtptConstructionAidsNone;
                m_PTHelper.ConstructionAidDynamicsEnabled = false;
                m_PTHelper.StatusBarPromptsEnabled        = false;

                m_PTHelper.StartPlacement(m_KeyObject, m_KeyObjectCollection);

                m_GTApplication   = GTClassFactory.Create <IGTApplication>().Application;
                m_Arguments       = m_ActiveGraphicComponent.Arguments;
                m_ActiveMapWindow = m_GTApplication.ActiveMapWindow;
                string ownerFeatureName = m_ActiveMapWindow.DetailID == 0 ? "Pad" : "Vault";
                m_GTApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Click to select an existing " + ownerFeatureName + " feature to Own the Primary switch gear which is to be placed adjacent to it.");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, Caption);
            }
        }
Esempio n. 14
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;
            }
        }
Esempio n. 15
0
        internal static IGTMatrix RotateZTransform(double theta, char RorD)
        {
            if (RorD == 'D')
            {
                theta = (theta * Math.PI) / 180;
            }

            double cos = Math.Cos(theta);
            double sin = Math.Sin(theta);

            IGTMatrix m = null;

            try
            {
                m = GTClassFactory.Create <IGTMatrix>();
                m.M_Matrix[0, 0] = cos; m.M_Matrix[0, 1] = sin; m.M_Matrix[0, 2] = 0.0; m.M_Matrix[0, 3] = 0.0;
                m.M_Matrix[1, 0] = -sin; m.M_Matrix[1, 1] = cos; m.M_Matrix[1, 2] = 0.0; m.M_Matrix[1, 3] = 0.0;
                m.M_Matrix[2, 0] = 0.0; m.M_Matrix[2, 1] = 0.0; m.M_Matrix[2, 2] = 1.0; m.M_Matrix[2, 3] = 0.0;
                m.M_Matrix[3, 0] = 0.0; m.M_Matrix[3, 1] = 0.0; m.M_Matrix[3, 2] = 0.0; m.M_Matrix[3, 3] = 1.0;
                return(m);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "RotateZTransform", MessageBoxButtons.OK);
                return(null);
            }
        }
        /// <summary>
        /// Returns the Structure ID of a feature based on its FID value
        /// </summary>
        /// <param name="FID">G3E_FID value</param>
        /// <returns>Structure ID</returns>
        private string StructureIDbyFID(int FID)
        {
            try
            {
                string retVal = string.Empty;

                IGTApplication app = GTClassFactory.Create <IGTApplication>();
                string         sql = "select structure_id from common_n where g3e_fid=?";
                Recordset      rs  = app.DataContext.OpenRecordset(sql, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockReadOnly, (int)CommandTypeEnum.adCmdText, FID);
                if (null != rs && 1 == rs.RecordCount)
                {
                    rs.MoveFirst();
                    if (DBNull.Value != rs.Fields[0].Value)
                    {
                        retVal = rs.Fields[0].Value.ToString();
                    }
                }

                if (null != rs)
                {
                    if (rs.State != Convert.ToInt32(ObjectStateEnum.adStateClosed))
                    {
                        rs.Close();
                    }
                    rs = null;
                }

                return(retVal);
            }
            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);
            }
        }
Esempio n. 17
0
        /// <summary>
        /// Get boundaries touching Street Light
        /// </summary>
        /// <param name="fnoArray"></param>
        /// <returns></returns>
        private IDictionary <int, short> GetBoundaryTouchStreetLight(short[] fnoArray)
        {
            IDictionary <int, short> boundaryFids     = new Dictionary <int, short>();
            IGTSpatialService        gtspatialService = GTClassFactory.Create <IGTSpatialService>();

            gtspatialService.DataContext = _gtDataContext;

            //gtspatialService.FilterGeometry = _gtDataContext.GetDDCKeyObjects(_gtFeature.FNO, _gtFeature.FID, GTComponentGeometryConstants.gtddcgPrimaryGeographic)[0].Geometry;
            if (null != Feature.Components["STREETLIGHT_S"].Geometry)
            {
                gtspatialService.FilterGeometry = Feature.Components["STREETLIGHT_S"].Geometry;
            }
            else
            {
                throw new Exception("A Street Light's symbol geometry must exist before an ESI Location can be assigned to it.");
            }

            gtspatialService.Operator = GTSpatialOperatorConstants.gtsoTouches;
            Recordset rs = gtspatialService.GetResultsByFNO(fnoArray);

            if (rs != null && rs.RecordCount > 0)
            {
                rs.MoveFirst();
                while (!rs.EOF)
                {
                    boundaryFids.Add(Convert.ToInt32(rs.Fields["G3E_FID"].Value), Convert.ToInt16(rs.Fields["G3E_FNO"].Value));
                    rs.MoveNext();
                }
            }
            return(boundaryFids);
        }
        void IGTCustomCommandModal.Activate()
        {
            gtApp = GTClassFactory.Create <IGTApplication>();
            try
            {
                if (gtApp.DataContext.IsRoleGranted("PRIV_MGMT_LAND"))
                {
                    PurgeLandbase();
                    MessageBox.Show("Sucessfully purge expired archived landbase", msgBoxCaption, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Command Access Denied.  Please contact System Administrator", "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                var errMsg = ex.Message;
                if (ex.Message.Contains("ORA-20001"))
                {
                    errMsg = "Parameter ArchivedLandbaseExpireDays missing in SYS_GENERALPARAMETER TABLE";
                }

                MessageBox.Show("Error " + errMsg, msgBoxCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 19
0
        /// <summary>
        /// True if conflicts exist; else, false
        /// </summary>
        public bool ConflictsExist()
        {
            try
            {
                bool retVal = false;

                IGTApplication          app        = GTClassFactory.Create <IGTApplication>();
                IGTJobManagementService jobService = GTClassFactory.Create <IGTJobManagementService>();
                jobService.DataContext = app.DataContext;

                Recordset rs = jobService.FindConflicts();
                if (null != rs && 0 < rs.RecordCount)
                {
                    MessageBox.Show("Some edits conflict with other posted jobs; please run Conflict Detection to resolve before marking for closure.", "G /Technology", MessageBoxButtons.OK);
                    retVal = true;
                }

                return(retVal);
            }
            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);
            }
        }
Esempio n. 20
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;
            }
        }
Esempio n. 21
0
        /// <summary>
        /// Attaches the construction prints, passed in as the prints parameter, to the active job.
        /// </summary>
        /// <param name="prints">File path/name of generated construction prints.</param>
        /// <returns>true if successful; else, false</returns>
        private bool AttachConstructionPrints(string prints)
        {
            bool retVal = false;

            try
            {
                IGTApplication   app = GTClassFactory.Create <IGTApplication>();
                AttachWRDocument attachWRDocument = new AttachWRDocument();
                TransactionManager.Begin("Attach Archival Prints");

                if (attachWRDocument.AttachDocument(app.DataContext.ActiveJob, prints, "Work Prints Design"))
                {
                    TransactionManager.Commit();
                    retVal = true;
                }
                else
                {
                    TransactionManager.Rollback();
                }
            }
            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);
                MessageBox.Show(exMsg, "G/Technology", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }

            return(retVal);
        }
Esempio n. 22
0
        /// <summary>
        /// Activates the specified job
        /// </summary>
        /// <param name="JobName">Job to activate.</param>
        public void ActivateJob(string JobName)
        {
            IGTJobManagementService jms = GTClassFactory.Create <IGTJobManagementService>();

            jms.DataContext = app.DataContext;
            jms.EditJob(JobName);
        }
 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;
 }
        /// <summary>
        /// Support method for Geocode locate. May be removed at a later date.
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        internal static void geoLocate(double x, double y)
        {
            gtGeoEditService.TargetMapWindow = gtApp.ActiveMapWindow;
            gtGeoEditService.RemoveAllGeometries();
            gtApp.ActiveMapWindow.DisplayScale = 250;
            IGTPoint      locationPoint = gCoordinateConvert(x, y, 0);
            IGTWorldRange gtWorldRange  = gtApp.ActiveMapWindow.GetRange();
            double        xOffset       = (gtWorldRange.TopRight.X - gtWorldRange.BottomLeft.X) / 2;
            double        yOffset       = (gtWorldRange.TopRight.Y - gtWorldRange.BottomLeft.Y) / 2;

            IGTPoint tempPt = GTClassFactory.Create <IGTPoint>();

            tempPt.X = 0;
            tempPt.Y = 0;
            tempPt.X = locationPoint.X + xOffset;
            tempPt.Y = locationPoint.Y + yOffset;
            gtWorldRange.TopRight = tempPt;

            tempPt.X = 0;
            tempPt.Y = 0;
            tempPt.X = locationPoint.X - xOffset;
            tempPt.Y = locationPoint.Y - yOffset;
            gtWorldRange.BottomLeft = tempPt;

            gtGeoEditService.TargetMapWindow = gtApp.ActiveMapWindow;
            IGTPointGeometry newSymbol = GTClassFactory.Create <IGTPointGeometry>();

            newSymbol.Origin = locationPoint;
            gtGeoEditService.AddGeometry(newSymbol, Convert.ToInt16(GTStyleIDConstants.gtstyleHandleSquareX));
            gtApp.ActiveMapWindow.DisplayScale = 250;

            gtApp.ActiveMapWindow.ZoomArea(gtWorldRange);
            gtApp.RefreshWindows();
        }
Esempio n. 25
0
        /// <summary>
        /// Calculate Centroid for given boundayr Geometry
        /// </summary>
        /// <param name="gtGeometry"></param>
        /// <returns></returns>
        public IGTPoint CalculateCentroid(IGTGeometry gtGeometry)
        {
            IGTPoint gtCenterPt = GTClassFactory.Create <IGTPoint>();

            gtCenterPt.X = 0;
            gtCenterPt.Y = 0;
            gtCenterPt.Z = 0;
            if (gtGeometry.KeypointCount > 1)
            {
                for (int indx = 0; indx < gtGeometry.KeypointCount - 1; indx++)
                {
                    gtCenterPt.X += gtGeometry.GetKeypointPosition(indx).X;
                    gtCenterPt.Y += gtGeometry.GetKeypointPosition(indx).Y;
                    gtCenterPt.Z += gtGeometry.GetKeypointPosition(indx).Z;
                }
                gtCenterPt.X /= gtGeometry.KeypointCount - 1;
                gtCenterPt.Y /= gtGeometry.KeypointCount - 1;
                gtCenterPt.Z /= gtGeometry.KeypointCount - 1;
            }
            else
            {
                gtCenterPt = gtGeometry.FirstPoint;
            }
            return(gtCenterPt);
        }
Esempio n. 26
0
        /// <summary>
        /// ProcessIsolationScenario
        /// </summary>
        /// <param name="ErrorMessage">Error Message to be displayed</param>
        /// <param name="ErrorPriority">Error Priority</param>
        public void ProcessIsolationScenario(out string ErrorMessage, out string ErrorPriority)
        {
            try
            {
                if (!CheckIsoDual(m_oNode1IsolationFeatures, m_oNode2IsolationFeatures))
                {
                    validateMsg.Rule_Id = "ISO01";
                    validateMsg.BuildRuleMessage(GTClassFactory.Create <IGTApplication>(), null);

                    ErrorMessage  = validateMsg.Rule_MSG;
                    ErrorPriority = m_errorPriority;
                }
                else
                {
                    ErrorMessage  = null;
                    ErrorPriority = null;
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                validateMsg = null;
                m_oNode1IsolationFeatures = null;
                m_oNode2IsolationFeatures = null;
            }
        }
        /// <summary>
        /// Intialize variables and check selected feature is valid.
        /// </summary>
        /// <param name="CustomCommandHelper"></param>
        public void Activate(Intergraph.GTechnology.API.IGTCustomCommandHelper CustomCommandHelper)
        {
            gtApp = GTClassFactory.Create <IGTApplication>();
            List <KeyValuePair <int, string> > featureTypes = null;

            try
            {
                gtCustomCommandHelper            = CustomCommandHelper;
                gtCustomCommandHelper.MouseMove += gtCustomCommandHelper_MouseMove;
                featureTypes = GetFeatureClass();
                detectOverlappingAnalysis = new DetectOverlappingAnalysis(featureTypes);

                if (detectOverlappingAnalysis.ShowDialog() == DialogResult.OK)
                {
                    //    RunProcess(detectOverlappingAnalysis.SelectedFeatureType, detectOverlappingAnalysis.IsSelfOverlap);
                    DetectOverlapping(detectOverlappingAnalysis.SelectedFeatureType, detectOverlappingAnalysis.IsSelfOverlap);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error " + ex.Message, msgBoxCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                CleanUp();
            }
        }
Esempio n. 28
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;
            }
        }
Esempio n. 29
0
        private bool IsSelectedSethaveStreetLight()
        {
            bool found = false;

            try
            {
                gTKeyObjects = GTClassFactory.Create <IGTKeyObjects>();
                if (gTDDCKeyObjects != null && gTDDCKeyObjects.Count > 0)
                {
                    IList <int> SelectedFeatureIDList = new List <int>();
                    foreach (IGTDDCKeyObject ddcKey in gTDDCKeyObjects)
                    {
                        if (ddcKey.FNO == 56)
                        {
                            found = true;
                        }
                        if (!SelectedFeatureIDList.Contains(ddcKey.FID))
                        {
                            SelectedFeatureIDList.Add(ddcKey.FID);
                            gTKeyObjects.Add(gTDataContext.OpenFeature(ddcKey.FNO, ddcKey.FID));
                        }
                    }
                }
            }
            catch
            {
                throw;
            }
            return(found);
        }
Esempio n. 30
0
        /// <summary>
        /// Method to check whether the active feature has Bypass Points on both nodes, plus a third Bypass Point encompassing feature and the other two Bypass Points.
        /// </summary>
        /// <param name="p_byPassFeatures">Bypass Points features connected to active feature</param>
        /// <returns></returns>
        private bool CheckByPass(List <IGTKeyObject> p_node1ByPassFeatures, List <IGTKeyObject> p_node2ByPassFeatures)
        {
            bool      byPass = false;
            Recordset connRs = null;
            int       node1  = 0;
            int       node2  = 0;

            try
            {
                if (p_node1ByPassFeatures.Count() == 1 && p_node2ByPassFeatures.Count() == 1)
                {
                    p_node1ByPassFeatures[0].Components.GetComponent(11).Recordset.MoveFirst();
                    node1 = Convert.ToInt32(p_node1ByPassFeatures[0].Components.GetComponent(11).Recordset.Fields["NODE_1_ID"].Value);

                    p_node2ByPassFeatures[0].Components.GetComponent(11).Recordset.MoveFirst();
                    node2 = Convert.ToInt32(p_node2ByPassFeatures[0].Components.GetComponent(11).Recordset.Fields["NODE_2_ID"].Value);

                    connRs = GTClassFactory.Create <IGTApplication>().DataContext.OpenRecordset(String.Format("Select * from connectivity_n where g3e_fno=40 and NODE_1_ID={0} and NODE_2_ID={1}", node1, node2), CursorTypeEnum.adOpenStatic,
                                                                                                LockTypeEnum.adLockReadOnly, (int)CommandTypeEnum.adCmdText);

                    if (connRs != null && connRs.RecordCount >= 1)
                    {
                        byPass = true;
                    }
                }
            }
            catch
            {
                throw;
            }
            return(byPass);
        }