${ui_action_DrawEventArgs_Title}。

${ui_action_DrawEventArgs_Description}

Inheritance: System.EventArgs
        void action_DrawCompleted(object sender, DrawEventArgs e)
        {
            _elementsLayer.Children.Remove(pushpin);
            //this.boder.Visibility = Visibility.Collapsed;
            Route route = new Route();
            if (_routeLayer.Features.Count > 0)
            {
                Feature f = _routeLayer.Features[0];
                route = f.Geometry as Route;

            }

            pushpin.IsEnabled = false;
            pushpin.Location = e.Geometry.Bounds.Center;
            pushpin.Background = new SolidColorBrush(Colors.Red);
            pushpin.Content = "O";

            _elementsLayer.AddChild(pushpin);

               _queryPoint = (e.Geometry as GeoPoint).Location;

            RouteCalculateMeasureParameters param = new RouteCalculateMeasureParameters();
            param.IsIgnoreGap = true;
            param.Point = _queryPoint;
            param.SourceRoute = route;
            param.Tolerance = 100;
            RouteCalculateMeasureService service = new RouteCalculateMeasureService(_serviceUrl);
            service.ProcessComplated += service_ProcessComplated;
            service.Failed += service_Failed;
            service.ProcessAsync(param);
        }
        //几何对象绘制结束触发事件
        private void DrawCompleted(object sender, DrawEventArgs e)
        {
            //隐藏 FeatureDataGrid 控件
            MyDataGrid.Visibility = Visibility.Collapsed;

            //设置几何查询参数,FilterParameters、Geometry 和 SpatialQueryMode 为必设属性
            QueryByGeometryParameters parameter = new QueryByGeometryParameters
            {
                FilterParameters = new List<FilterParameter>()
                {
                        new FilterParameter()
                       {
                           Name = "Countries@World",
                       }
                },
                Geometry = e.Geometry,
                SpatialQueryMode = SpatialQueryMode.INTERSECT,

                //设置是返回查询结果资源(false)还是返回查询结果记录集(true)
                ReturnContent = notHighlight
            };

            //与服务器交互
            QueryByGeometryService service = new QueryByGeometryService(url);
            service.ProcessAsync(parameter);
            service.ProcessCompleted += new EventHandler<QueryEventArgs>(service_ProcessCompleted);
            service.Failed += new EventHandler<ServiceFailedEventArgs>(service_Failed);

            //当在 FeaturesLayer 上通过鼠标左键点击触发的事件
            flayer.MouseLeftButtonDown += flayer_MouseLeftButtonDown;
        }
        //服务器返回查询结果
        private void DrawCompleted(object sender, DrawEventArgs e)
        {
            QueryLayer querylayer = new QueryLayer();
            querylayer.LayerName = comboBox.SelectionBoxItem.ToString();
            List<QueryLayer> queryLayers = new List<QueryLayer>() { querylayer };

            QueryParam queryParam = new QueryParam()
            {
                ExpectCount = 0,
                QueryLayers = queryLayers,
                StartRecord = 0
            };
            QueryByGeometryParameters parameters = new QueryByGeometryParameters
            {
                Geometry = e.Geometry,
                MapName = "changchun",
                QueryParam = queryParam
            };
            QueryByGeometryService queryByGeometryService = new QueryByGeometryService("http://localhost/IS/AjaxDemo");
            queryByGeometryService.ProcessAsync(parameters);
            queryByGeometryService.Failed += new EventHandler<ServiceFailedEventArgs>(queryByGeometryService_Failed);
            queryByGeometryService.ProcessCompleted += new EventHandler<QueryServiceEventArgs>(queryByGeometryService_ProcessCompleted);

            featuresLayer.MouseLeftButtonDown +=new EventHandler<FeatureMouseButtonEventArgs>(featuresLayer_MouseLeftButtonDown);
        }
        private void node_DrawCompleted(object sender, DrawEventArgs e)
        {
            Pushpin pushpin = new Pushpin();

            //将事件点以图钉样式加到ElementsLayerE上
            if (eventPonit.IsChecked == true)
            {
                //因为事件点只有一个,因此判断是否存在事件点,如果存在就先将以前的事件点删除
                if (flag == true)
                {
                    elementsLayerE.Children.Clear();
                }
                pushpin.Location = e.Geometry.Bounds.Center;
                pushpin.Content = "E";
                pushpin.Background = new SolidColorBrush(Colors.Red);
                elementsLayerE.AddChild(pushpin);
                flag = true;

                //记录事件点坐标
                eventp = pushpin.Location;
            }

            //将设施点以图钉样式加到ElementsLayer上
            if (FacilityPoint.IsChecked == true)
            {
                pushpin.Location = e.Geometry.Bounds.Center;
                pushpin.Content = "F";
                pushpin.Background = new SolidColorBrush(Colors.Purple);
                elementsLayerF.AddChild(pushpin);

                //用 points 数组记录设施点坐标
                points.Add(pushpin.Location);
            }
        }
        private void node_DrawCompleted(object sender, DrawEventArgs e)
        {
            if (this.pathPonit.IsChecked.Value)
            {
                //标记途经结点顺序
                i++;
                //将结点以图钉样式加到ElementsLayer上
                Pushpin pushpin = new Pushpin()
                {
                    Location = e.Geometry.Bounds.Center,
                    Content = i.ToString(System.Globalization.CultureInfo.InvariantCulture),
                };
                elementsLayer.AddChild(pushpin);
                //用points数组记录结点坐标
                points.Add(pushpin.Location);
            }

            if (this.barrierPoint.IsChecked.Value)
            {
                Pushpin pushpin = new Pushpin()
                {
                    Location = e.Geometry.Bounds.Center,
                    Content = "Stop",
                    FontSize = 8,
                    Background = new SolidColorBrush(Colors.Black),
                };
                elementsLayer.AddChild(pushpin);
                //用MyBarrierPoint数组记录结点坐标
                barrierPoints.Add(pushpin.Location);
            }
        }
 void region_DrawCompleted(object sender, DrawEventArgs e)
 {
     Feature feature = new Feature();
     feature.Geometry = e.Geometry;
     restLayer.ClipRegion = e.Geometry as GeoRegion;
     restLayer.Refresh();
     this.MyMap.Action = new Pan(this.MyMap);
 }
        private void selectfeature_DrawCompleted(object sender, DrawEventArgs e)
        {
            EditFeature.IsEnabled = true;
            DeleteFeature.IsEnabled = true;

            //查询当前鼠标点击目标
            queryFeature(e.Geometry);
        }
 //将点添加到任意图层中
 private void node_DrawCompleted(object sender, DrawEventArgs e)
 {
     i++;
     Pushpin pushPin = new Pushpin()
     {
         Location = e.Geometry.Bounds.Center,
         Content = i.ToString()
     };
     elementsLayer.Children.Add(pushPin);
     points.Add(pushPin.Location);
 }
        private void node_DrawCompleted(object sender, DrawEventArgs e)
        {
            //标记途经结点顺序
            i++;

            //将结点以图钉样式加到ElementsLayer上
            Pushpin pushpin = new Pushpin();
            pushpin.Location = e.Geometry.Bounds.Center;
            pushpin.Content = i.ToString(System.Globalization.CultureInfo.InvariantCulture);
            elementsLayer.AddChild(pushpin);

            //用points数组记录结点坐标
            points.Add(pushpin.Location);
        }
 private void point_DrawCompleted(object sender, DrawEventArgs e)
 {
     QueryByCenterParameters parameters = new QueryByCenterParameters
                 {
                     CenterPoint = e.Geometry.Bounds.Center,
                     Tolerance = 5,
                     MapName = "Changchun",
                     QueryParam = new QueryParam { QueryLayerParams = new List<QueryLayerParam>() { qlpVegetable } }
                 };
     QueryByCenterService query = new QueryByCenterService("http://localhost:7080/demo");
     query.ProcessAsync(parameters);
     query.Failed += (s, args) => { MessageBox.Show(args.Error.ToString()); };
     query.ProcessCompleted += new EventHandler<QueryEventArgs>(query_ProcessCompleted);
 }
        //几何对象绘制结束触发事件
        private void drawCompleted(object sender, DrawEventArgs e)
        {
            double tolerance;

            //隐藏 FeatureDataGrid 控件
            MyDataGrid.Visibility = Visibility.Collapsed;

            //如果距离值为空时,默认为1地图单位
            if (!double.TryParse(MyTextBox.Text, out tolerance))
            {
                tolerance = 1;
            }

            //如果查找最近地物,只返回一个期望地物
            if ((bool)FindNearest.IsChecked)
            {
                count = 1;
            }
            else
            {
                count = 100000;
            }

            //设置距离查询参数,FilterParameters和Geometry为必设属性
            QueryByDistanceParameters param = new QueryByDistanceParameters
            {
                Geometry = e.Geometry,
                ExpectCount = count,
                Distance = tolerance,
                IsNearest = (bool)FindNearest.IsChecked,
                FilterParameters = new List<FilterParameter>() 
                { 
                    new FilterParameter(){Name = "Countries@World",}, 
                },

                //设置是返回查询结果资源(false)还是返回查询结果记录集(true)
                ReturnContent = notHighlight
            };

            //与服务器交互
            QueryByDistanceService service = new QueryByDistanceService(url);
            service.ProcessAsync(param);
            service.ProcessCompleted += new EventHandler<QueryEventArgs>(service_ProcessCompleted);
            service.Failed += service_Failed;

            //当在 FeaturesLayer 上通过鼠标左键点击触发的事件
            flayer.MouseLeftButtonDown +=flayer_MouseLeftButtonDown;
        }
        private void polygon_DrawCompleted(object sender, DrawEventArgs e)
        {
            if (e.Geometry == null)
            {
                return;
            }

            //将面标绘在客户端任意图层
            PolygonElement polygon = e.Element as PolygonElement;
            polygon.Opacity = 0.618;
            polygon.StrokeThickness = 1;
            polygon.Fill = new SolidColorBrush(Colors.LightGray);
            this.elementsLayer.Children.Add(polygon);

            Measure(e.Geometry);
        }
 void dp_DrawCompleted(object sender , DrawEventArgs e)
 {
     if (e.Geometry == null)
     {
         return;
     }
     GetFeaturesByBufferParameters param = new GetFeaturesByBufferParameters
     {
         DatasetNames = new List<string> { "World:Countries" } ,
         BufferDistance = 10 ,
         Geometry = e.Geometry ,
     };
     GetFeaturesByBufferService ser = new GetFeaturesByBufferService(url);
     ser.ProcessCompleted += new EventHandler<GetFeaturesEventArgs>(ser_ProcessCompleted);
     ser.ProcessAsync(param);
 }
        private void polygon_DrawCompleted(object sender, DrawEventArgs e)
        {
            //QueryByGeometryParameters param = new QueryByGeometryParameters()
            //{
            //    MapName = "Changchun",
            //    Geometry = e.Geometry,
            //    QueryParam = new QueryParam
            //    {
            //        QueryLayerParams = new List<QueryLayerParam>
            //        {
            //            new QueryLayerParam
            //            {
            //                 Name="Vegetable@changchun"
            //            }
            //        }
            //    }
            //};
            //QueryByGeometryService s = new QueryByGeometryService("http://*****:*****@world",
                              SqlParam=new SqlParam
                              {
                                   WhereClause="SmID=247"
                              }
                        }
                    }
                }
            };

            QueryBySqlService qss = new QueryBySqlService("http://localhost:7080/demo");
            qss.ProcessCompleted += new System.EventHandler<QueryEventArgs>(qss_ProcessCompleted);

            qss.ProcessAsync(param);
        }
        private void line_DrawCompleted(object sender, DrawEventArgs e)
        {
            if (e.Geometry == null)
            {
                return;
            }

            //将线标绘在客户端要素图层
            PredefinedLineStyle lineStyle = new PredefinedLineStyle { Stroke = new SolidColorBrush(Colors.Red), StrokeThickness = 3 };
            Feature feature = new Feature
            {
                Geometry = e.Geometry,
                Style = lineStyle
            };
            featuresLayer.Features.Add(feature);

            Measure(e.Geometry);
        }
        void DrawCompleted(object sender , DrawEventArgs e)
        {
            if (e.Geometry == null)
            {
                return;
            }

            GetFeaturesByGeometryParameters param = new GetFeaturesByGeometryParameters
            {
                DatasetNames = new List<string> { "World:Countries" } ,
                SpatialQueryMode = SuperMap.Web.iServerJava6R.SpatialQueryMode.INTERSECT ,
                Geometry = e.Geometry
            };

            GetFeaturesByGeometryService service = new GetFeaturesByGeometryService(url);
            service.ProcessCompleted += new EventHandler<GetFeaturesEventArgs>(service_ProcessCompleted);
            service.ProcessAsync(param);
        }
        private void node_DrawCompleted(object sender, DrawEventArgs e)
        {
            //标记服务区站点
            i++;

            //将站点以图钉样式加到ElementsLayer上
            Pushpin pushpin = new Pushpin();
            pushpin.Location = e.Geometry.Bounds.Center;
            pushpin.Content = i.ToString();
            pushpin.Background = new SolidColorBrush(Colors.Red);
            elementsLayer.AddChild(pushpin);
            //用points数组记录结点坐标
            points.Add(pushpin.Location);

            //用户输入服务区半径
            InputWindow weightWindow = new InputWindow();
            weightWindow.Show();
            weightWindow.Closed += new EventHandler(weightWindow_Closed);
        }
        //距离量算
        private void line_DrawCompleted(object sender, DrawEventArgs e)
        {
            //将线标绘在客户端要素图层
            PredefinedLineStyle lineStyle = new PredefinedLineStyle { Stroke = new SolidColorBrush(Colors.Red), StrokeThickness = 3 };
            Feature feature = new Feature
            {
                Geometry = e.Geometry,
                Style = lineStyle
            };
            featuresLayer.Features.Add(feature);

            MeasureParameters parameters = new MeasureParameters
            {
                Geometry = e.Geometry,
                MapName = "changchun"
            };
            MeasureService measureDistance = new MeasureService("http://localhost/IS/AjaxDemo");
            measureDistance.ProcessAsync(parameters);
            measureDistance.ProcessCompleted += new EventHandler<MeasureEventArgs>(measureDistance_ProcessCompleted);
            measureDistance.Failed += new EventHandler<ServiceFailedEventArgs>(measure_Failed);
        }
        //面积量算
        private void polygon_DrawCompleted(object sender, DrawEventArgs e)
        {
            //将面标绘在客户端任意图层
            PolygonElement polygon = e.Element as PolygonElement;
            polygon.Opacity = 0.618;
            polygon.StrokeThickness = 1;
            polygon.Fill = new SolidColorBrush(Colors.LightGray);
            this.elementsLayer.Children.Add(polygon);

            MeasureParameters parameters = new MeasureParameters
            {
                Geometry = e.Geometry,
                MapName = "changchun"
            };

            //与服务器交互
            MeasureService measureRegion = new MeasureService("http://localhost/IS/AjaxDemo");
            measureRegion.ProcessAsync(parameters);
            measureRegion.ProcessCompleted += new EventHandler<MeasureEventArgs>(measureRegion_ProcessCompleted);
            measureRegion.Failed += new EventHandler<ServiceFailedEventArgs>(measure_Failed);
        }
Ejemplo n.º 20
0
        /// <summary>${ui_action_MapAction_event_onMouseUp_D}</summary>
        /// <param name="e">${ui_action_MapAction_event_onMouseUp_param_e}</param>
        public override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
        {
            if (ellipse != null)
            {
                DrawEventArgs args2 = new DrawEventArgs
                {
                    DrawName = Name ,
                    Element = new Pushpin { Location = center } ,
                    Geometry = new GeoPoint(center.X , center.Y)
                };

                Deactivate();
                OnDrawComplete(args2);
            }
            base.OnMouseLeftButtonUp(e);
        }
        //绘制面结束后将所绘制的面转化为矢量要素并加载到矢量要素图层中
        private void polygon_DrawCompleted(object sender, DrawEventArgs e)
        {
            //将绘制面转化为面要素并加载到矢量要素图层中
            Feature feature = new Feature()
            {
                Geometry = e.Geometry as GeoRegion,
                Style = new PredefinedFillStyle
                {
                    Fill = regionColor1
                }
            };

            regionLayer.Features.Add(feature);
            region = e.Geometry as GeoRegion;

            Check();
        }
Ejemplo n.º 22
0
        private void endDraw(bool isDblClick = false, bool isCancel = false)
        {
            if (points != null)
            {
                points.RemoveAt(points.Count - 2);
                if (isDblClick)
                {
                    points.RemoveAt(points.Count - 2);
                }

                PolygonElement pRegion = new PolygonElement()
                {
                    Point2Ds = points.Clone(),//不克隆,在返回后还与下面的GeoRegion指向一个内存地址
                    #region 所有风格的控制
                    Stroke = this.Stroke,
                    StrokeThickness = this.StrokeThickness,
                    StrokeMiterLimit = this.StrokeMiterLimit,
                    StrokeDashOffset = this.StrokeDashOffset,
                    StrokeDashArray = this.StrokeDashArray,
                    StrokeDashCap = this.StrokeDashCap,
                    StrokeEndLineCap = this.StrokeEndLineCap,
                    StrokeLineJoin = this.StrokeLineJoin,
                    StrokeStartLineCap = this.StrokeStartLineCap,
                    Opacity = this.Opacity,
                    Fill = this.Fill,
                    FillRule = this.FillRule
                    #endregion
                };//构造返回Element对象

                GeoRegion geoRegion = new GeoRegion();//构造返回的Geometry
                points.Add(startPoint);//需要添加起始点做为最后一个点
                geoRegion.Parts.Add(points);

                DrawEventArgs args = new DrawEventArgs
                {
                    DrawName = Name,
                    Element = pRegion,    //Element = this.polyline  //直接返回是固定像素的
                    Geometry = geoRegion,
                    Canceled = isCancel
                };

                Deactivate();
                OnDrawCompleted(args);
            }
        }
        public override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
        {
            if (this.points != null)
            {
                GeoRegion geoRegion = new GeoRegion();
                points.Add(a0);
                geoRegion.Parts.Add(points);

                PolygonElement pPen = new PolygonElement()
                {
                    Point2Ds = points,
                    #region 所有风格的控制
                    Stroke = this.Stroke,
                    StrokeThickness = this.StrokeThickness,
                    StrokeMiterLimit = this.StrokeMiterLimit,
                    StrokeDashOffset = this.StrokeDashOffset,
                    StrokeDashArray = this.StrokeDashArray,
                    StrokeDashCap = this.StrokeDashCap,
                    StrokeEndLineCap = this.StrokeEndLineCap,
                    StrokeLineJoin = this.StrokeLineJoin,
                    StrokeStartLineCap = this.StrokeStartLineCap,
                    Opacity = this.Opacity,
                    Fill = this.Fill,
                    FillRule = this.FillRule
                    #endregion
                };

                DrawEventArgs args2 = new DrawEventArgs
                {
                    DrawName = Name,
                    Element = pPen,
                    Geometry = geoRegion
                };

                Deactivate();
                OnDrawComplete(args2);
            }
            e.Handled = true;
            base.OnMouseLeftButtonUp(e);
        }
Ejemplo n.º 24
0
 private void endDraw(double radius, bool isCancel = false)
 {
     if (this.ellipse != null)
     {
         //Point2D item = Map.ScreenToMap(e.GetPosition(Map));
         Rectangle2D b = ElementsLayer.GetBBox(ellipse);
         DrawEventArgs args2 = new DrawEventArgs
         {
             DrawName = Name,
             Element = ellipse, //可以由它的bbox得到半径
             Geometry = new GeoCircle(new Point2D(startPt.X, startPt.Y), radius), //返回圆的中心点
             Canceled = isCancel
         };
         Deactivate();
         OnDrawComplete(args2);
     }
 }
Ejemplo n.º 25
0
        private void endDraw(bool isDblClick = false, bool isCancel = false)
        {
            if (points != null)
            {
                if (isDblClick)
                {
                    points.RemoveAt(points.Count - 1);
                }
                PolylineElement pLine = new PolylineElement()
                {
                    Point2Ds = this.points.Clone(),
                    #region 所有风格的控制
                    Stroke = this.Stroke,
                    StrokeThickness = this.StrokeThickness,
                    StrokeMiterLimit = this.StrokeMiterLimit,
                    StrokeDashOffset = this.StrokeDashOffset,
                    StrokeDashArray = this.StrokeDashArray,
                    StrokeDashCap = this.StrokeDashCap,
                    StrokeEndLineCap = this.StrokeEndLineCap,
                    StrokeLineJoin = this.StrokeLineJoin,
                    StrokeStartLineCap = this.StrokeStartLineCap,
                    Opacity = this.Opacity,
                    Fill = this.Fill,
                    FillRule = this.FillRule
                    #endregion
                };
                GeoLine geoLine = new GeoLine();//构造返回的Geometry
                geoLine.Parts.Add(points);
                DrawEventArgs args = new DrawEventArgs
                {
                    DrawName = Name,
                    Element = pLine,    //Element = this.polyline  //直接返回是固定像素的
                    Geometry = geoLine,
                    Canceled = isCancel
                };

                Deactivate();
                OnDrawCompleted(args);
            }
        }
        private void ModifyEntity_DrawCompleted(object sender, DrawEventArgs e)
        {
            //清除前一次选中地物
            drawLayer.Features.Clear();

            //查询当次鼠标点击地物
            queryEntity(e.Geometry);
        }
 private void star_DrawCompleted(object sender, DrawEventArgs e)
 {
     elementslayer.AddChild(e.Element);
 }
        //将地物添加到图层中
        private void polygon_DrawCompleted(object sender, DrawEventArgs e)
        {
            //将绘制的地物显示在FeaturesLayer中
            GeoRegion region = e.Geometry as GeoRegion;
            Feature f = new Feature();
            f.Geometry = region;
            f.Style = new PredefinedFillStyle() { Fill = new SolidColorBrush(Colors.Green) };
            drawLayer.Features.Add(f);

            //记录所绘制地物的点坐标
            Point2DCollection ps = new Point2DCollection();
            for (int i = 0; i < region.Parts.Count; i++)
            {
                for (int j = 0; j < region.Parts[i].Count; j++)
                {
                    ps.Add(new Point2D(region.Parts[i][j].X, region.Parts[i][j].Y));
                }
            }

            //将客户端地物转换成服务端几何类型
            ServerGeometry Addshape = new ServerGeometry
               {
               Feature = ServerFeatureType.Polygon,
               Point2Ds = ps
               };

            Entity entity = new Entity
            {
                Shape = Addshape
            };

            AddEntityParameters parameters = new AddEntityParameters
            {
                MapName = "Changchun",
                LayerName = "Vegetable@Changchun",
                Entity = entity
            };

            //与服务器交互
            AddEntityService editService = new AddEntityService("http://localhost:7080/demo");
            editService.ProcessAsync(parameters);
            editService.Failed += new EventHandler<ServiceFailedEventArgs>(Service_Failed);
            editService.ProcessCompleted += new EventHandler<EditEventArgs>(Service_ProcessCompleted);
        }
Ejemplo n.º 29
0
 private void OnDrawComplete(DrawEventArgs args)
 {
     if (DrawCompleted != null)
     {
         DrawCompleted(this, args);
     }
 }
        private void selectEntity_DrawCompleted(object sender, DrawEventArgs e)
        {
            //如果存在编辑过的地物,则不显示编辑过的地物
            if (Editflag == true)
            {
                drawLayer.ClearFeatures();
                dgVegetable.Visibility = Visibility.Collapsed;
                Editflag = false;
            }

            //查询鼠标点击处地物
            QueryByCenterParameters parameters = new QueryByCenterParameters
            {
                CenterPoint = e.Geometry.Bounds.Center,
                Tolerance = 5,
                MapName = "Changchun",
                IsNearest = true,
                QueryParam = new QueryParam { QueryLayerParams = new List<QueryLayerParam>() { qureyLayerParam } }
            };
            QueryByCenterService selectQuery = new QueryByCenterService("http://localhost:7080/demo");
            selectQuery.ProcessAsync(parameters);
            selectQuery.Failed += (s, args) => { MessageBox.Show(args.Error.ToString()); };
            selectQuery.ProcessCompleted += new EventHandler<QueryEventArgs>(selectQuery_ProcessCompleted);
        }