Ejemplo n.º 1
0
        private int GetTotalDistance(GTActiveStreetLight objSL)
        {
            int iTotalDistance = 0;

            try
            {
                int icounter = 0;
                for (int i = 0; i < objSL.GeometrySource.Count; i++)
                {
                    if (icounter == objSL.GeometrySource.Count - 1)
                    {
                        break;
                    }

                    CommandUtilities.LogDistanceCalculationPoints(icounter, objSL, oDiag);
                    iTotalDistance = iTotalDistance + CommandUtilities.GetDistance(objSL.GeometrySource[i].OGG_X1, objSL.GeometrySource[i].OGG_Y1, objSL.GeometrySource[i].OGG_Z1,
                                                                                   objSL.GeometrySource[i + 1].OGG_X1, objSL.GeometrySource[i + 1].OGG_Y1, objSL.GeometrySource[i + 1].OGG_Z1, oDiag);

                    icounter += 1;
                }
            }
            catch (Exception ex)
            {
                CommandUtilities.LogException(oDiag, "GetTotalDistance", ex);
                throw ex;
            }

            return(iTotalDistance);
        }
Ejemplo n.º 2
0
        private void ProcessActiveStreetLightDDC(IGTDDCKeyObjects ddcStreetLightList)
        {
            try
            {
                foreach (IGTDDCKeyObject ddcobj in ddcStreetLightList)
                {
                    if ((ddcobj.Geometry.Type == GTGeometryTypeConstants.gtgtOrientedPointGeometry) || (ddcobj.Geometry.Type == GTGeometryTypeConstants.gtgtPointGeometry))
                    {
                        IGTKeyObject koStreetLight = oDC.OpenFeature(ddcobj.FNO, ddcobj.FID);

                        oRelationService.ActiveFeature = koStreetLight;

                        IGTKeyObjects koOwnedByList = oRelationService.GetRelatedFeatures(3);                         // Owned By

                        if (koOwnedByList == null)
                        {
                            continue;
                        }

                        if (koOwnedByList.Count == 0)
                        {
                            continue;
                        }

                        //Should only be one IGTKeyObject that owns a streetlight
                        //Need Common_N data on both the structure and the streetlight
                        IGTKeyObject koStructure = koOwnedByList[0];

                        GTActiveStreetLight objStreetLight = CommandUtilities.GetCommonNActiveFeature(koStreetLight, koStructure, oDiag);

                        if (objStreetLight == null)
                        {
                            continue;
                        }

                        objStreetLight.G3E_FID       = ddcobj.FID;
                        objStreetLight.G3E_FNO       = ddcobj.FNO;
                        objStreetLight.Structure_FID = koStructure.FID;
                        objStreetLight.StructureFNO  = koStructure.FNO;

                        this.oActiveList.Add(objStreetLight);
                    }
                }
            }
            catch (Exception ex)
            {
                CommandUtilities.LogException(oDiag, "ProcessActiveStreetLightDDC", ex);
                throw ex;
            }
        }
Ejemplo n.º 3
0
        public static void LogDistanceCalculationPoints(int _counter, GTActiveStreetLight _sl, GTDiagnostics _odiag)
        {
            try
            {
                if (_counter == 0)
                {
                    LogMessage(_odiag, "LogDistanceCalculationPoints", "TEST", "Starting distance calculation for fid = " + _sl.G3E_FID.ToString());
                }

                LogMessage(_odiag, "LogDistanceCalculationPoints", "TEST", "Counter = " + _counter.ToString() + " OGGX = " + _sl.GeometrySource[_counter].OGG_X1.ToString());
                LogMessage(_odiag, "LogDistanceCalculationPoints", "TEST", "Counter = " + _counter.ToString() + " OGGY = " + _sl.GeometrySource[_counter].OGG_Y1.ToString());
                LogMessage(_odiag, "LogDistanceCalculationPoints", "TEST", "Counter = " + _counter + 1.ToString() + " OGGX+1 = " + _sl.GeometrySource[_counter + 1].OGG_X1.ToString());
                LogMessage(_odiag, "LogDistanceCalculationPoints", "TEST", "Counter = " + _counter + 1.ToString() + " OGGY+1 = " + _sl.GeometrySource[_counter + 1].OGG_Y1.ToString());
            }
            catch (Exception ex)
            {
                LogException(_odiag, "LogDistanceCalculationPoints", ex);
                throw ex;
            }
        }
Ejemplo n.º 4
0
        public static GTActiveStreetLight GetCommonNActiveFeature(IGTKeyObject _koStreetLight, IGTKeyObject _koStructure, GTDiagnostics _odiag)
        {
            GTActiveStreetLight _oSL = null;

            try
            {
                _oSL = GetCommonNStreetLight(_koStreetLight, _odiag);
                if (_oSL == null)
                {
                    return(null);
                }

                GetCommonNStructure(_koStructure, ref _oSL, _odiag);
            }
            catch (Exception ex)
            {
                LogException(_odiag, "GetCommonN", ex);
                throw ex;
            }

            return(_oSL);
        }
Ejemplo n.º 5
0
        private static void GetCommonNStructure(IGTKeyObject _ko, ref GTActiveStreetLight _obj, GTDiagnostics _odiag)
        {
            GTActiveStreetLight oCommonN = null;

            try
            {
                IGTComponent commonN = _ko.Components["COMMON_N"];
                if (commonN == null)
                {
                    return;
                }

                ADODB.Recordset oRS = commonN.Recordset;

                if (oRS == null)
                {
                    return;
                }

                if (oRS.RecordCount == 0)
                {
                    return;
                }

                oRS.MoveFirst();

                oCommonN = new GTActiveStreetLight();

                if ((!oRS.EOF) && (!oRS.BOF))
                {
                    string sid = oRS.Fields["STRUCTURE_ID"].Value.ToString().Trim();
                    if (!string.IsNullOrEmpty(sid))
                    {
                        oCommonN.StructureID = sid;
                        _obj.StructureID     = sid;
                    }
                    else
                    {
                        oCommonN = null;
                        LogMessage(_odiag, "GetCommonN", "COMMON_N", "FID = " + _ko.FID.ToString() + " has no structure_id.");
                        return;
                    }


                    string sx = oRS.Fields["OGGX_H"].Value.ToString().Trim();
                    if (!string.IsNullOrEmpty(sx))
                    {
                        oCommonN.StructureOGG_X1 = Convert.ToDouble(sx);
                        _obj.StructureOGG_X1     = Convert.ToDouble(sx);
                    }

                    string sy = oRS.Fields["OGGY_H"].Value.ToString().Trim();
                    if (!string.IsNullOrEmpty(sy))
                    {
                        _obj.StructureOGG_Y1 = Convert.ToDouble(sy);
                    }

                    string sz = oRS.Fields["OGGZ_H"].Value.ToString().Trim();
                    if (!string.IsNullOrEmpty(sz))
                    {
                        oCommonN.StructureOGG_Z1 = Convert.ToDouble(sz);
                        _obj.StructureOGG_Z1     = Convert.ToDouble(sx);
                    }
                }
            }
            catch (Exception ex)
            {
                LogException(_odiag, "GetCommonN", ex);
                throw ex;
            }
        }
Ejemplo n.º 6
0
        private static GTActiveStreetLight GetCommonNStreetLight(IGTKeyObject _ko, GTDiagnostics _odiag)
        {
            GTActiveStreetLight oCommonN = null;

            try
            {
                IGTComponent commonN = _ko.Components["COMMON_N"];
                if (commonN == null)
                {
                    return(null);
                }

                ADODB.Recordset oRS = commonN.Recordset;

                if (oRS == null)
                {
                    return(null);
                }

                if (oRS.RecordCount == 0)
                {
                    return(null);
                }

                oRS.MoveFirst();

                oCommonN = new GTActiveStreetLight();

                if ((!oRS.EOF) && (!oRS.BOF))
                {
                    string sid = oRS.Fields["STRUCTURE_ID"].Value.ToString().Trim();
                    if (!string.IsNullOrEmpty(sid))
                    {
                        //Picking up structure id from structure common_n
                    }
                    else
                    {
                        oCommonN = null;
                        LogMessage(_odiag, "GetCommonN", "COMMON_N", "FID = " + _ko.FID.ToString() + " has no structure_id.");
                        return(null);
                    }


                    string sx = oRS.Fields["OGGX_H"].Value.ToString().Trim();
                    if (!string.IsNullOrEmpty(sx))
                    {
                        oCommonN.OGG_X1 = Convert.ToDouble(sx);
                    }

                    string sy = oRS.Fields["OGGY_H"].Value.ToString().Trim();
                    if (!string.IsNullOrEmpty(sy))
                    {
                        oCommonN.OGG_Y1 = Convert.ToDouble(sy);
                    }

                    string sz = oRS.Fields["OGGZ_H"].Value.ToString().Trim();
                    if (!string.IsNullOrEmpty(sz))
                    {
                        oCommonN.OGG_Z1 = Convert.ToDouble(sz);
                    }

                    string sRepFID = oRS.Fields["REPLACED_FID"].Value.ToString().Trim();
                    if (!string.IsNullOrEmpty(sRepFID))
                    {
                        oCommonN.REPLACED_FID = Convert.ToInt32(oRS.Fields["REPLACED_FID"].Value.ToString().Trim());
                    }
                }
            }
            catch (Exception ex)
            {
                LogException(_odiag, "GetCommonN", ex);
                throw ex;
            }

            return(oCommonN);
        }