예제 #1
0
파일: frmMap.cs 프로젝트: yifeidong/gvms
 protected virtual void OnPointFetched(MapObjects2.Point e)
 {
     if (PointFetchedEvent != null && e != null)
     {
         PointFetchedEvent(null, e);
     }
 }
예제 #2
0
파일: frmMap.cs 프로젝트: yifeidong/gvms
        private void mapControl_MouseDownEvent(object sender, AxMapObjects2._DMapEvents_MouseDownEvent e)
        {
            MapObjects2.Point oMousePosition = mapControl.ToMapPoint(e.x, e.y);
            MapUtil.MapOperation oMapOper = new GPSTrackingMonitor.MapUtil.MapOperation();

            switch (GlobeVariables.CurrentOperation)
            {
                case GPSTrackingMonitor.MapUtil.MapOperationType.ZoomIn:
                    oMapOper.ZoomInMap(mapControl.TrackRectangle(),ref mapControl);
                    break;
                case GPSTrackingMonitor.MapUtil.MapOperationType.ZoomOut:
                    oMapOper.ZoomOutMap(mapControl.TrackRectangle(), ref mapControl);
                    break;
                case GPSTrackingMonitor.MapUtil.MapOperationType.Pan:
                    mapControl.Pan();
                    break;
                case GPSTrackingMonitor.MapUtil.MapOperationType.Measure:
                    this._measureLine = mapControl.TrackLine();
                    this.labMeasure.Text = string.Format("长度 : {0} 米", oMapOper.ComputeDistance(this._measureLine).ToString());
                    break;
                case GPSTrackingMonitor.MapUtil.MapOperationType.Identify:                  
                    MapUtil.FeatureInformations oFeatureInfos = oMapOper.GetIdentifyFeatureInfos(oMousePosition, this.mapControl,GlobeVariables.MapInfosCollection);
                    this._frmIdentify.UpdateFeatureInfos(oFeatureInfos, MousePosition);
                    break;
                case GPSTrackingMonitor.MapUtil.MapOperationType.FetchPoint:
                    this.OnPointFetched(oMousePosition);
                    break;
                default:
                    break;
            }
        }
예제 #3
0
        public FeatureInformations GetIdentifyFeatureInfos(MapObjects2.Point mousePosition, AxMapObjects2.AxMap mapControl, MapProject.MapStruct mapInfosCollection)
        {
            FeatureInformations oFeatureInfos = null;

            foreach (ILayerStruct oLayerInfos in mapInfosCollection.Layers)
            {
                if (oLayerInfos.LayerType != (short)LayerTypeConstants.moMapLayer)
                {
                    continue;
                }

                MapUtil.MapOperation oMapOper  = new MapOperation();
                MapObjects2.MapLayer oMapLayer = oMapOper.GetLayerByName(mapControl, oLayerInfos.AliasName) as MapObjects2.MapLayer;

                if (oMapLayer.Visible == false)
                {
                    continue;
                }

                Recordset oSelectedRecords = oMapLayer.SearchShape(mousePosition, SearchMethodConstants.moAreaIntersect, "");

                if (oSelectedRecords.EOF)
                {
                    continue;
                }

                oSelectedRecords.MoveFirst();

                oFeatureInfos = new FeatureInformations();
                oFeatureInfos.CurrentLayerInfos = oLayerInfos;
                oFeatureInfos.Geometry          = oSelectedRecords.Fields.Item("shape").Value;

                TableDesc oTableDesc = oSelectedRecords.TableDesc;
                oFeatureInfos.FieldsAndValuesCollection = new Dictionary <string, string>();
                int    iFieldsCount = oTableDesc.FieldCount;
                string sFieldName   = "";
                string sValue       = "";

                for (short i = 0; i < iFieldsCount; i++)
                {
                    sFieldName = oTableDesc.get_FieldName(i);
                    sValue     = oSelectedRecords.Fields.Item(sFieldName).ValueAsString;
                    oFeatureInfos.FieldsAndValuesCollection.Add(sFieldName, sValue);
                }

                break;
            }

            return(oFeatureInfos);
        }
예제 #4
0
파일: frmMap.cs 프로젝트: yifeidong/gvms
 private void mapControl_MouseMoveEvent(object sender, AxMapObjects2._DMapEvents_MouseMoveEvent e)
 {
     MapObjects2.Point oMousePosition = mapControl.ToMapPoint(e.x, e.y);
     this.labCoordinates.Text = string.Format("坐标 : X = {0}, Y = {1}", oMousePosition.X.ToString(), oMousePosition.Y.ToString());
 }