Пример #1
0
        private void DoOffset()
        {
            if (selectedParcelGraphic != null)
            {
                offsetGraphicsLayer.Graphics.Clear();
                try
                {
                    var offsetGeom = GeometryEngine.Offset(
                        selectedParcelGraphic.Geometry,
                        OffsetDistanceSlider.Value,
                        (OffsetType)OffsetTypeComboBox.SelectedItem,
                        OffsetBevelRatioSlider.Value,
                        OffsetFlattenErrorSlider.Value
                        );

                    if (offsetGeom != null)
                    {
                        offsetGraphicsLayer.Graphics.Add(new Graphic {
                            Geometry = offsetGeom
                        });
                    }
                }
                catch (Exception ex)
                {
                    var dlg = new Windows.UI.Popups.MessageDialog(ex.Message);
                    var _   = dlg.ShowAsync();
                }
            }
        }
        private void DoOffset()
        {
            if (_selectedParcelGraphic != null)
            {
                _offsetOverlay.Graphics.Clear();
                try
                {
                    var offsetGeom = GeometryEngine.Offset(
                        _selectedParcelGraphic.Geometry,
                        OffsetDistanceSlider.Value,
                        (OffsetType)OffsetTypeComboBox.SelectedItem,
                        OffsetBevelRatioSlider.Value,
                        OffsetFlattenErrorSlider.Value);

                    if (offsetGeom != null)
                    {
                        _offsetOverlay.Graphics.Add(new Graphic {
                            Geometry = offsetGeom
                        });
                    }
                }
                catch (Exception ex)
                {
                    var _x = new MessageDialog(ex.Message).ShowAsync();
                }
            }
        }
        // Accept user click point, find a target parcel, and create an offset polygon graphic
        private async Task SelectTargetGeometryAsync()
        {
            Graphic graphic = null;

            while (graphic == null)
            {
                var point = await mapView.Editor.RequestPointAsync();

                graphic = await parcelLayer.HitTestAsync(mapView, mapView.LocationToScreen(point));

                if (graphic == null)
                {
                    continue;
                }

                double distance = (double)(int?)comboSize.SelectedItem;
                if ((bool)checkDirection.IsChecked)
                {
                    distance *= -1;
                }

                OffsetType offsetType = (OffsetType)comboOffsetType.SelectedValue;

                var offset = GeometryEngine.Offset(graphic.Geometry, distance, offsetType, 1.15, 0.0);

                offsetLayer.Graphics.Clear();
                offsetLayer.Graphics.Add(new Graphic(offset));
            }
        }
Пример #4
0
        private void DoOffset()
        {
            if (selectedParcelGraphic != null)
            {
                offsetGraphicsLayer.Graphics.Clear();

                try
                {
                    var offsetGeom = GeometryEngine.Offset(selectedParcelGraphic.Geometry,
                                                           OffsetDistanceSlider.Value, (OffsetType)OffsetTypeComboBox.SelectedItem,
                                                           OffsetBevelRatioSlider.Value, OffsetFlattenErrorSlider.Value);
                    if (offsetGeom != null)
                    {
                        offsetGraphicsLayer.Graphics.Add(new Graphic {
                            Geometry = offsetGeom
                        });
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Sample Error");
                }
            }
        }