Пример #1
0
        /// <summary>
        /// Update MiscellaneousStructure components.
        /// </summary>
        /// <param name="p_GpsX">GPS X</param>
        /// <param name="p_GpsY">GPS Y</param>
        /// <param name="gtMiscellaneousStructureKO">MiscellaneousStructure Keyobject</param>
        /// <param name="p_ISNonLoc">Is MiscellaneousStructure locatable or not</param>
        private void UpdateMiscellaneousStructureComponents(double p_GpsX, double p_GpsY,
                                                            IGTKeyObject gtMiscellaneousStructureKO, bool p_ISNonLoc)
        {
            Recordset tempRs = null;

            try
            {
                foreach (IGTComponent gtCompo in gtMiscellaneousStructureKO.Components)
                {
                    if (gtCompo.CNO == 10702)
                    {
                        tempRs = gtCompo.Recordset;
                        if (tempRs != null)
                        {
                            if (tempRs.RecordCount > 0)
                            {
                                if (p_ISNonLoc)
                                {
                                    IGTGeometry bndryGeom = m_oGTDataContext.GetDDCKeyObjects(m_dataAccess.m_boundaryFNO,
                                                                                              m_dataAccess.m_boundaryFID, GTComponentGeometryConstants.gtddcgPrimaryGeographic)[0].Geometry;
                                    IGTPoint gtOrigin = CalculateCentroid(bndryGeom);
                                    IGTOrientedPointGeometry gtPointGeom = GTClassFactory.Create <IGTOrientedPointGeometry>();
                                    gtPointGeom.Origin = gtOrigin;

                                    gtCompo.Geometry = gtPointGeom;
                                    gtCompo.Recordset.Update();
                                }
                                else
                                {
                                    IGTPoint gTPoint = GTClassFactory.Create <IGTPoint>();
                                    gTPoint.X = p_GpsX;
                                    gTPoint.Y = p_GpsY;

                                    IGTPointGeometry gtPointGeom = GTClassFactory.Create <IGTOrientedPointGeometry>();
                                    gtPointGeom.Origin = gTPoint;

                                    gtCompo.Geometry = gtPointGeom;
                                    gtCompo.Recordset.Update();
                                }
                            }
                        }
                    }
                    else if (gtCompo.CNO == 10701)
                    {
                        if (p_ISNonLoc)
                        {
                            gtCompo.Recordset.Fields["TYPE_C"].Value = "SPNL";
                        }
                        else
                        {
                            gtCompo.Recordset.Fields["TYPE_C"].Value = "SP";
                        }
                        gtCompo.Recordset.Fields["g3e_fno"].Value = 107;
                        gtCompo.Recordset.Fields["g3e_fid"].Value = gtMiscellaneousStructureKO.FID;
                        gtCompo.Recordset.Fields["g3e_cno"].Value = gtCompo.CNO;
                        gtCompo.Recordset.Update();
                    }
                    else if (gtCompo.CNO == 1)
                    {
                        tempRs = gtCompo.Recordset;
                        if (tempRs != null)
                        {
                            if (tempRs.RecordCount > 0)
                            {
                                tempRs.MoveFirst();
                                if (!p_ISNonLoc)
                                {
                                    tempRs.Fields["FEATURE_STATE_C"].Value = "CLS";
                                }
                                tempRs.Fields["OWNED_TYPE_C"].Value = "CUSTOMER";
                                tempRs.Fields["G3E_CNO"].Value      = gtCompo.CNO;
                                tempRs.Update();
                                gtCompo.Recordset.Update();
                            }
                        }
                    }
                }
            }
            catch
            {
                throw;
            }
        }