/// <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();
        }
Example #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void CustomCommandHelper_Click(object sender, GTMouseEventArgs e)
 {
     if (isPlacementEnabled)
     {
         var btnclk = e.Button;
         IGTPointGeometry gtPointGeom = GTClassFactory.Create <IGTPointGeometry>();
         gtPointGeom.Origin = e.WorldPoint;
         _gtKeyObj.Components.GetComponent(CommonUtil.MiscStructGeoCno).Geometry = gtPointGeom;
     }
 }
Example #3
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;
            }
        }