// ***************** Edit ******************** // ******************************************* public static ILegendCommand CreateEditDrawingItemLayer(MapPresenter map, DrawingItemLayer layer) { var result = new LegendCommand() { PathMarkup = IRI.Jab.Common.Assets.ShapeStrings.Appbar.appbarEdit, Layer = layer, ToolTip = _editToolTip, }; result.Command = new RelayCommand(async param => { var editResult = await map.EditAsync(layer.Geometry, map.MapSettings.EditingOptions); if (!(editResult.IsCanceled == true)) { map.ClearLayer(layer); } if (editResult.HasNotNullResult()) { layer.Geometry = editResult.Result; //shapeItem.AssociatedLayer = new VectorLayer(shapeItem.Title, new List<SqlGeometry>() { editResult.Result.AsSqlGeometry() }, VisualParameters.GetRandomVisualParameters(), LayerType.Drawing, RenderingApproach.Default, RasterizationApproach.DrawingVisual); map.ClearLayer(layer); map.AddLayer(layer); //map.SetLayer(layer); // 1400.03.08- remove highlighted geometry layer.IsSelectedInToc = false; //map.ClearLayer(layer.HighlightGeometryKey.ToString(), true, true); //map.Refresh(); if (layer.OriginalSource != null) { layer.OriginalSource.Update(new SqlFeature(editResult.Result.AsSqlGeometry()) { Id = layer.Id }); } } }); return(result); }
public static void GetDefaultShowSymbologyView(Window ownerWindow, ILayer layer, MapPresenter mapPresenter) { var view = new IRI.Jab.Controls.View.Symbology.SymbologyView(); var presenter = new IRI.Jab.Common.Presenters.Symbology.SymbologyPresenter(); //if (layer is DrawingItemLayer) //{ // presenter.Symbology = (layer as DrawingItemLayer).OriginalSymbology.Clone(); //} //else //{ presenter.Symbology = layer.VisualParameters.Clone(); //} presenter.RequestCloseAction = () => { view.Close(); }; presenter.RequestApplyAction = p => { //if (layer is DrawingItemLayer) //{ // (layer as DrawingItemLayer).OriginalSymbology.Fill = p.Symbology.Fill; // (layer as DrawingItemLayer).OriginalSymbology.Stroke = p.Symbology.Stroke; // (layer as DrawingItemLayer).OriginalSymbology.StrokeThickness = p.Symbology.StrokeThickness; // //update symbology // if (!layer.IsSelectedInToc) // (layer as DrawingItemLayer).RequestHighlightGeometry?.Invoke(layer as DrawingItemLayer); //} //else //{ // layer.VisualParameters.Fill = p.Symbology.Fill; // layer.VisualParameters.Stroke = p.Symbology.Stroke; // layer.VisualParameters.StrokeThickness = p.Symbology.StrokeThickness; //} layer.VisualParameters.Fill = p.Symbology.Fill; layer.VisualParameters.Stroke = p.Symbology.Stroke; layer.VisualParameters.StrokeThickness = p.Symbology.StrokeThickness; if (layer is DrawingItemLayer) { //update symbology if (layer.IsSelectedInToc) { (layer as DrawingItemLayer).RequestHighlightGeometry?.Invoke(layer as DrawingItemLayer); } } view.Close(); //in order to update the symbology for the layer on the map after dialog was closed mapPresenter.ClearLayer(layer, true, true); mapPresenter.AddLayer(layer); }; //var gotoPresenter = IRI.Jab.Controls.Presenter.GoToPresenter.Create(mapPresenter); view.DataContext = presenter; view.Owner = ownerWindow; view.WindowStartupLocation = WindowStartupLocation.CenterOwner; view.Show(); //gotoPresenter.SelectDefaultMenu(); }