void _inputView_drawingGraphicsChangedListener(object sender,
            DrawingGraphicsChangedEventArgs e)
        {
            if (_inputView == null) return;

            if(RB2.IsChecked.Value)
            {
                List<Tuple<IGraphic, string>> polylines =
                getPolylines(_inputView.drawingLayer);
                LineLB.ItemsSource = polylines;
                LineLB.SelectedIndex = LineLB.Items.Count - 1;
            }
        }
예제 #2
0
파일: IS3View.cs 프로젝트: iS3-Project/iS3
        public async Task drawGraphics(DrawShapeType drawShapeType)
        {
            if (Globals.isThreadUnsafe())
            {
                await Globals.application.Dispatcher.Invoke(new Func<Task>(async () =>
                {
                    await drawGraphics(drawShapeType);
                }));
                return;
            }

            // Add a drawing graphics layer
            if (_drawingLayer == null)
            {
                _drawingLayer = new IS3GraphicsLayer();
                _drawingLayer.ID = "0";
                _drawingLayer.DisplayName = "0";
                _map.Layers.Add(_drawingLayer);
            }

            if (_mapView.Editor.IsActive)
                return;

            try
            {
                Geometry geom = await _mapView.Editor.RequestShapeAsync((DrawShape)drawShapeType);
                if (_srEMap != null)
                    geom = GeometryEngine.Project(geom, _srEMap);
                IGeometry iGeom = IS3GeometryEngine.fromGeometry(geom);
                IGraphic g = Runtime.graphicEngine.newGraphic(iGeom);
                GraphicsUtil.AssignDefaultDrawingSymbol(g);

                _drawingLayer.graphics.Add(g);

                // trigger a drawing graphics changed event
                if (drawingGraphicsChangedTrigger != null)
                {
                    DrawingGraphicsChangedEventArgs args =
                        new DrawingGraphicsChangedEventArgs();
                    List<IGraphic> addedItems = new List<IGraphic>();
                    addedItems.Add(g);
                    args.addedItems = addedItems;
                    drawingGraphicsChangedTrigger(this, args);
                }
            }
            catch (TaskCanceledException)
            {
                // Ignore TaskCanceledException - usually happens if the editor gets cancelled or restarted
            }
        }