Exemple #1
0
        private void DoActiveMapWindowByStructure()
        {
            try
            {
                short[] fnoToLocate = new short[3];
                fnoToLocate[0] = 107;                 //Streetlight Standard
                fnoToLocate[1] = 110;                 //pole
                fnoToLocate[2] = 114;                 //Misc Structure


                if (this.oLocate == null)
                {
                    throw new Exception("IGTLocateService object is null.");
                }

                if (this.oLocationCriteria == null)
                {
                    throw new Exception("The map extents for the active map window is null.");
                }

                if (this.oRelationService == null)
                {
                    throw new Exception("IGTRelationshipService is null.");
                }

                this.oLocate.FenceMode = GTFenceMode.gtfmInside;
                IGTDDCKeyObjects activeStructureDDCList = this.oLocate.Locate(this.oLocationCriteria, 0, -1, GTSelectionTypeConstants.gtmwstSelectAll, fnoToLocate);

                if (activeStructureDDCList == null)
                {
                    CommandUtilities.LogMessage(this.oDiag, "DoActiveMapWindowByStructure", "IGTLocateService", "There are no structures or street lights in the active map window.");
                    return;
                }


                if (activeStructureDDCList.Count == 0)
                {
                    CommandUtilities.LogMessage(this.oDiag, "LoadActiveDDCObjects", "IGTLocateService", "There are no street lights in the active map window.");
                    //throw new Exception("No features were located in the active map window");
                    return;
                }

                ProcessActiveStructureDDC(activeStructureDDCList);
            }
            catch (Exception ex)
            {
                CommandUtilities.LogException(oDiag, "DoActiveMapWindow", ex);
                throw ex;
            }
        }
Exemple #2
0
        private void DoActiveMapWindowByStreetlight()
        {
            try
            {
                if (this.oLocate == null)
                {
                    throw new Exception("IGTLocateService object is null.");
                }

                if (this.oLocationCriteria == null)
                {
                    throw new Exception("The map extents for the active map window is null.");
                }

                if (this.oRelationService == null)
                {
                    throw new Exception("IGTRelationshipService is null.");
                }

                this.oLocate.FenceMode = GTFenceMode.gtfmInside;
                IGTDDCKeyObjects activeSLightDDCList = this.oLocate.Locate(this.oLocationCriteria, 0, -1, GTSelectionTypeConstants.gtmwstSelectAll, new short[] { 56 });                 // 56=Street Light

                if (activeSLightDDCList == null)
                {
                    CommandUtilities.LogMessage(this.oDiag, "LoadActiveDDCObjects", "IGTLocateService", "There are no street lights in the active map window.");
                    //throw new Exception("No features were located in the active map window");
                    return;
                }


                if (activeSLightDDCList.Count == 0)
                {
                    CommandUtilities.LogMessage(this.oDiag, "LoadActiveDDCObjects", "IGTLocateService", "There are no street lights in the active map window.");
                    //throw new Exception("No features were located in the active map window");
                    return;
                }

                ProcessActiveStreetLightDDC(activeSLightDDCList);
            }
            catch (Exception ex)
            {
                CommandUtilities.LogException(oDiag, "DoActiveMapWindow", ex);
                throw ex;
            }
        }
Exemple #3
0
        private void InitializeAppResources()
        {
            try
            {
                this.oApp = GTClassFactory.Create <IGTApplication>();

                if (this.oApp == null)
                {
                    CommandUtilities.LogMessage(oDiag, "GTAssetTracker.InitializeResources", "IGTApplicationError", "Cannot initialize IGTApplication.");
                    DoExit();
                }

                SetStatusBarText("Initializing...");

                this.oMap = oApp.ActiveMapWindow;
                if (this.oMap == null)
                {
                    CommandUtilities.LogMessage(oDiag, "GTAssetTracker.InitializeResources", "MapWindowError", "There is no active map window.");
                    throw new Exception("IGTMapWindow");
                }

                oDisplay = oMap.DisplayService;
                if (oDisplay == null)
                {
                    CommandUtilities.LogMessage(oDiag, "GTAssetTracker.InitializeResources", "DisplayService", "No display service for the active map window.");
                    throw new Exception("IGTDisplayService");
                }

                this.oDC = oApp.DataContext;
                if (this.oDC == null)
                {
                    CommandUtilities.LogMessage(oDiag, "GTAssetTracker.InitializeResources", "DataContextError", "No data context was obtained from IGTApplication.");
                    throw new Exception("IGTDataContext");
                }

                this.oLocate = this.oMap.LocateService;
                if (this.oLocate == null)
                {
                    CommandUtilities.LogMessage(oDiag, "GTAssetTracker.InitializeResources", "IGTLocateService", "No IGTLocateService was obtained from IGTMapWindow.");
                    throw new Exception("IGTLocateService");
                }

                this.oRelationService             = GTClassFactory.Create <IGTRelationshipService>();
                this.oRelationService.DataContext = this.oDC;

                this.oGenParams = new GTSysGenParam();
                if (!CommandUtilities.GetSysGeneralParameters(this.oDC, this.oDiag, ref this.oGenParams))
                {
                    throw new Exception("No General Parameters have been defined.");
                }

                this.oActiveList          = new List <GTActiveStreetLight>();
                this.oActiveStructureList = new List <GTActiveStructure>();

                SetStatusBarText("Initialized.");
            }
            catch (Exception ex)
            {
                CommandUtilities.LogException(oDiag, "GTAssetTracker.InitializeResources", ex);
                throw ex;
            }
        }
Exemple #4
0
        public static bool GetSysGeneralParameters(IGTDataContext _odc, GTDiagnostics _odiag, ref GTSysGenParam _gp)
        {
            bool bSuccess = false;

            try
            {
                string    sSqlSysGP      = "SELECT ID, SUBSYSTEM_NAME, SUBSYSTEM_COMPONENT, PARAM_NAME, PARAM_VALUE, PARAM_DESC FROM SYS_GENERALPARAMETER WHERE SUBSYSTEM_NAME = 'ASSET_HISTORY_TRACKING'";
                Recordset rsGeneralParam = CommandUtilities.ExecuteQuery(_odc, sSqlSysGP, _odiag);

                if (rsGeneralParam == null)
                {
                    CommandUtilities.LogMessage(_odiag, "GetGeneralParameters", "GeneralParameter", "Nothing returned from SYS_GENERALPARAMETER."); return(bSuccess);
                }

                string sThreshold          = CommandUtilities.Get_Recordset_Value(rsGeneralParam, "PARAM_VALUE", "PARAM_NAME", "StreetLightMovementThreshold", _odiag);
                string sHistoricalSymbol   = CommandUtilities.Get_Recordset_Value(rsGeneralParam, "PARAM_VALUE", "PARAM_NAME", "StreetLightHistoricalSymbol", _odiag);
                string sHistoricalLine     = CommandUtilities.Get_Recordset_Value(rsGeneralParam, "PARAM_VALUE", "PARAM_NAME", "StreetLightHistoricalLine", _odiag);
                string sHistoricalStacking = CommandUtilities.Get_Recordset_Value(rsGeneralParam, "PARAM_VALUE", "PARAM_NAME", "StreetLightHistoricalStacking", _odiag);
                string sANOx = Get_Recordset_Value(rsGeneralParam, "PARAM_VALUE", "PARAM_NAME", "ANO_OGGX", _odiag);
                string sANOy = Get_Recordset_Value(rsGeneralParam, "PARAM_VALUE", "PARAM_NAME", "ANO_OGGY", _odiag);
                string sANOz = Get_Recordset_Value(rsGeneralParam, "PARAM_VALUE", "PARAM_NAME", "ANO_OGGZ", _odiag);

                if (!string.IsNullOrEmpty(sThreshold))
                {
                    _gp.MovementThreshold = Convert.ToInt32(sThreshold);
                }
                if (!string.IsNullOrEmpty(sHistoricalSymbol))
                {
                    _gp.HistoricalSymbol = Convert.ToInt32(sHistoricalSymbol);
                }
                if (!string.IsNullOrEmpty(sHistoricalSymbol))
                {
                    _gp.HistoricalLine = Convert.ToInt32(sHistoricalLine);
                }
                if (!string.IsNullOrEmpty(sHistoricalStacking))
                {
                    _gp.HistoricalStacking = Convert.ToInt32(sHistoricalStacking);
                }
                if (!string.IsNullOrEmpty(sANOx))
                {
                    _gp.ANO_X = Convert.ToInt32(sANOx);
                }
                else
                {
                    _gp.ANO_X = 108;
                }

                if (!string.IsNullOrEmpty(sANOy))
                {
                    _gp.ANO_Y = Convert.ToInt32(sANOy);
                }
                else
                {
                    _gp.ANO_Y = 109;
                }

                if (!string.IsNullOrEmpty(sANOz))
                {
                    _gp.ANO_Z = Convert.ToInt32(sANOz);
                }
                else
                {
                    _gp.ANO_Z = 110;
                }

                rsGeneralParam.Close();
                rsGeneralParam = null;
                bSuccess       = true;
            }
            catch (Exception ex)
            {
                CommandUtilities.LogException(_odiag, "GTAssetTracker.GetSysGeneralParameters", ex);
                throw ex;
            }

            return(bSuccess);
        }