示例#1
0
        void mi_Prop_Click(object sender, EventArgs e)
        {
            #region Apply movement or not

            //m_SelectedFeature = null;

            if (m_IsMoveMode)
            {
                if (ApplyMovement(false) == DialogResult.Cancel)
                {
                    return;
                }
            }

            #endregion

            var userLayer = UserDbLayersManager.GetUserLayer(m_TargetLayerGuid);
            var lyr       = (EidssUserBufZoneLayer)userLayer;
            var zone      = lyr.FeatureRowToStruct(m_SelectedFeature);
            if (zone.Radius > 0)
            {
                var frm = new CircleBufZone();
                frm.ZoneName    = zone.Name;
                frm.Description = zone.Description;
                frm.Radius      = zone.Radius;
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    zone.Name        = frm.ZoneName;
                    zone.Description = frm.Description;
                    zone.Radius      = frm.Radius;

                    var projectedCenter = zone.Center;// GeometryTransform.TransformGeometry(zone.Center, CoordinateSystems.WGS84,
                    //                                     CoordinateSystems.SphericalMercatorCS);
                    var projectedBufGeom = GIS_V4.Utils.GeometryUtils.CreateBuffer(projectedCenter, zone.Radius);
                    var geom             = projectedBufGeom;//GeometryTransform.TransformGeometry(projectedBufGeom, CoordinateSystems.SphericalMercatorCS,
                    //                                    CoordinateSystems.WGS84);

                    zone.Geometry = geom;

                    lyr.UpdateZone(zone);

                    m_SelectedFeature = null;
                }
            }
            else
            {
                var frm = new PolygonBufZone();
                frm.ZoneName    = zone.Name;
                frm.Description = zone.Description;
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    zone.Name        = frm.ZoneName;
                    zone.Description = frm.Description;
                    lyr.UpdateZone(zone);

                    m_SelectedFeature = null;
                }
            }
            m_MapImage.Refresh();
        }
示例#2
0
        void MapImage_MouseDown(Point worldPos, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                var circleBufZone = new CircleBufZone();
                if (circleBufZone.ShowDialog() == DialogResult.OK)
                {
                    if (m_TargetLayerGuid == Guid.Empty)
                    {
                        return;
                    }

                    var projectedCenter  = worldPos;
                    var projectedBufGeom = GIS_V4.Utils.GeometryUtils.CreateBuffer(projectedCenter, circleBufZone.Radius);
                    //var geom = GeometryTransform.TransformGeometry(projectedBufGeom, CoordinateSystems.SphericalMercatorCS,
                    //                                               CoordinateSystems.WGS84);
                    //var center = GeometryTransform.TransformGeometry(projectedCenter, CoordinateSystems.SphericalMercatorCS,
                    //                                               CoordinateSystems.WGS84);
                    if (m_TargetLayerGuid == Guid.Empty)
                    {
                        return;
                    }

                    var eidssUserBufZoneLayer = (EidssUserBufZoneLayer)UserDbLayersManager.GetUserLayer(m_TargetLayerGuid);

                    if (eidssUserBufZoneLayer == null)
                    {
                        return;
                    }

                    var userBufZone = new EidssUserBufZoneLayer.UserBufZone
                    {
                        Geometry    = projectedBufGeom, //geom,
                        Description = circleBufZone.Description,
                        Name        = circleBufZone.ZoneName,
                        Center      = projectedCenter, //center,
                        Radius      = circleBufZone.Radius
                    };

                    eidssUserBufZoneLayer.AddNewZone(userBufZone);

                    MapImage.Refresh();
                }
                circleBufZone.Dispose();
            }
        }
示例#3
0
        void MapImage_MouseDown(Point worldPos, MouseEventArgs e)
        {
            switch (PivotalType)
            {
            case PivotLayerType.Settlements:
                m_PivotalProvider = new EidssSqlServer2008(SystemLayerNames.Settlements);
                break;

            case PivotLayerType.AvrPoints:
                if (Content.AVRLayer != null)
                {
                    m_PivotalProvider = Content.AVRLayer.DataSource;
                }
                break;

            default:
                m_PivotalProvider = null;
                break;
            }

            string strName;
            var    nearestPoint = GetNearestPoint(worldPos, out strName);

            if (nearestPoint == null)
            {
                return;
            }
            //show form
            var frm = new CircleBufZone {
                ZoneName = strName
            };

            if (frm.ShowDialog() == DialogResult.OK)
            {
                if (m_PivotalProvider == null)
                {
                    return;
                }

                var projectedCenter = nearestPoint;
                //var projectedCenter = GeometryTransform.TransformGeometry(nearestPoint, CoordinateSystems.WGS84,
                //                                                          CoordinateSystems.SphericalMercatorCS);
                var projectedBufGeom = GIS_V4.Utils.GeometryUtils.CreateBuffer(projectedCenter, frm.Radius);
                //var geom = GeometryTransform.TransformGeometry(projectedBufGeom, CoordinateSystems.SphericalMercatorCS,
                //                                               CoordinateSystems.WGS84);
                //var center = GeometryTransform.TransformGeometry(projectedCenter, CoordinateSystems.SphericalMercatorCS,
                //                                               CoordinateSystems.WGS84);
                if (m_TargetLayerGuid == Guid.Empty)
                {
                    return;
                }

                var eidssUserBufZoneLayer = (EidssUserBufZoneLayer)UserDbLayersManager.GetUserLayer(m_TargetLayerGuid);

                if (eidssUserBufZoneLayer == null)
                {
                    return;
                }

                var userBufZone = new EidssUserBufZoneLayer.UserBufZone
                {
                    Geometry    = projectedBufGeom, //geom,
                    Description = frm.Description,
                    Name        = frm.ZoneName,
                    Center      = projectedCenter, //center,
                    Radius      = frm.Radius
                };

                eidssUserBufZoneLayer.AddNewZone(userBufZone);

                MapImage.Refresh();
            }
        }