private void CutBuilding(MapViewMouseButtonEventArgs e)
        {
            QueuedTask.Run(() =>
            {
                Dictionary <MapMember, List <long> > selectedItems = GetSelectedItems(e);
                EditOperation editOperation = new EditOperation();
                foreach (KeyValuePair <MapMember, List <long> > item in selectedItems)
                {
                    BasicFeatureLayer layer = item.Key as BasicFeatureLayer;
                    if (layer.ShapeType != ArcGIS.Core.CIM.esriGeometryType.esriGeometryPolygon)
                    {
                        continue;
                    }

                    foreach (long oid in item.Value)
                    {
                        var feature = layer.Inspect(oid);

                        Geometry geometry = feature.Shape.Clone();
                        Polyline polyLine = GetCutPolyLine(geometry);

                        var splitItems = GeometryEngine.Cut(geometry, polyLine);
                        feature.Shape  = splitItems.First();
                        editOperation.Modify(feature);

                        Layer pointLayer = MapView.Active.Map.Layers[0];
                        editOperation.Create(pointLayer, geometry.Extent.Center);
                    }
                    editOperation.Execute();
                }
                MapView.Active.Map.SetSelection(null);
            });
        }
        private void MoveWalls(MapViewMouseButtonEventArgs e)
        {
            QueuedTask.Run(() =>
            {
                Dictionary <MapMember, List <long> > selectedItems = GetSelectedItems(e);

                EditOperation editOperation = new EditOperation();
                foreach (KeyValuePair <MapMember, List <long> > item in selectedItems)
                {
                    BasicFeatureLayer layer = item.Key as BasicFeatureLayer;
                    if (layer.ShapeType != ArcGIS.Core.CIM.esriGeometryType.esriGeometryPolygon)
                    {
                        continue;
                    }

                    foreach (long oid in item.Value)
                    {
                        var feature = layer.Inspect(oid);

                        double hoogte  = double.Parse(feature["PandHoogte"].ToString());
                        int verdieping = int.Parse(feature["Verdieping"].ToString());

                        Geometry geom           = feature.Shape.Clone();
                        Geometry removeGeometry = GeometryEngine.Scale(geom, geom.Extent.Center, 1.2, 1.2);
                        Geometry wallGeometry   = GeometryEngine.Scale(geom, geom.Extent.Center, 1.3, 1.3);
                        editOperation.Scale(selectedItems, feature.Shape.Extent.Center, 0.9, 0.9);
                        editOperation.Create(layer, wallGeometry, new Action <long>(x => OnExtractWalls(x, layer, removeGeometry, hoogte, verdieping)));
                    }
                    editOperation.Execute();
                }

                MapView.Active.Map.SetSelection(null);
            });
        }
        protected void OnNewFloorCreated(long obj, BasicFeatureLayer layer, double verdiepingsHoogte, double buildingZMinValue)
        {
            EditOperation editOperation = new EditOperation();
            var           feature       = layer.Inspect(obj);

            double verdieping = Math.Round(((feature.Shape.Extent.ZMin - buildingZMinValue) / (verdiepingsHoogte * 2)), 0);

            feature["PandHoogte"] = verdiepingsHoogte;
            feature["Verdieping"] = verdieping;
            editOperation.Modify(feature);
            editOperation.Execute();

            MapView.Active.Map.SetSelection(null);
        }
        protected void OnExtractWalls(long oid, BasicFeatureLayer layer, Geometry geometry, double verdiepingsHoogte, int verdieping)
        {
            var feature = layer.Inspect(oid);

            feature["PandHoogte"] = verdiepingsHoogte;
            feature["Verdieping"] = verdieping;
            EditOperation editOperation = new EditOperation();

            QueuedTask.Run(() =>
            {
                editOperation.Clip(layer, oid, geometry, ClipMode.DiscardArea);
                editOperation.Modify(feature);
            });
            editOperation.Execute();
        }
        private void BlowUpBuilding(MapViewMouseButtonEventArgs e)
        {
            int    aantalVerdiepingen;
            double verdiepingsHoogte;

            QueuedTask.Run(() =>
            {
                Dictionary <MapMember, List <long> > selectedItems = GetSelectedItems(e);
                EditOperation editOperation = new EditOperation();
                foreach (KeyValuePair <MapMember, List <long> > item in selectedItems)
                {
                    BasicFeatureLayer layer = item.Key as BasicFeatureLayer;
                    if (layer.ShapeType != ArcGIS.Core.CIM.esriGeometryType.esriGeometryPolygon)
                    {
                        continue;
                    }

                    foreach (long oid in item.Value)
                    {
                        var feature        = layer.Inspect(oid);
                        aantalVerdiepingen = new Random().Next(3, 10);
                        verdiepingsHoogte  = double.Parse(feature["PandHoogte"].ToString()) / aantalVerdiepingen;

                        double buildingZMinValue = feature.Shape.Extent.ZMin;
                        feature["PandHoogte"]    = verdiepingsHoogte;
                        editOperation.Modify(feature);
                        for (int i = 1; i < aantalVerdiepingen; i++)
                        {
                            var newFloorGeometry = GeometryEngine.Move(feature.Shape, 0, 0, (i * (verdiepingsHoogte * 2)));
                            editOperation.Create(layer, newFloorGeometry, new Action <long>(x => OnNewFloorCreated(x, layer, verdiepingsHoogte, buildingZMinValue)));
                        }
                    }
                }
                bool succeded = editOperation.Execute();
            });
        }