Index: Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Core.Plugins.SharpMapGis.Gui.csproj
===================================================================
diff -u -re5cd358fe021d2c9d042e226cc00db06578619e3 -r5e8f24c2eade934e5e8ff0f4f510eb5fbd40ac67
--- Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Core.Plugins.SharpMapGis.Gui.csproj (.../Core.Plugins.SharpMapGis.Gui.csproj) (revision e5cd358fe021d2c9d042e226cc00db06578619e3)
+++ Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Core.Plugins.SharpMapGis.Gui.csproj (.../Core.Plugins.SharpMapGis.Gui.csproj) (revision 5e8f24c2eade934e5e8ff0f4f510eb5fbd40ac67)
@@ -84,12 +84,6 @@
-
- Form
-
-
- InputTextDialog.cs
-
@@ -141,9 +135,6 @@
-
- InputTextDialog.cs
-
MapLegendView.cs
Designer
Fisheye: Tag 5e8f24c2eade934e5e8ff0f4f510eb5fbd40ac67 refers to a dead (removed) revision in file `Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/InputTextDialog.Designer.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 5e8f24c2eade934e5e8ff0f4f510eb5fbd40ac67 refers to a dead (removed) revision in file `Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/InputTextDialog.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 5e8f24c2eade934e5e8ff0f4f510eb5fbd40ac67 refers to a dead (removed) revision in file `Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/InputTextDialog.resx'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/MapLegendView/MapLegendView.cs
===================================================================
diff -u -re5cd358fe021d2c9d042e226cc00db06578619e3 -r5e8f24c2eade934e5e8ff0f4f510eb5fbd40ac67
--- Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/MapLegendView/MapLegendView.cs (.../MapLegendView.cs) (revision e5cd358fe021d2c9d042e226cc00db06578619e3)
+++ Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/MapLegendView/MapLegendView.cs (.../MapLegendView.cs) (revision 5e8f24c2eade934e5e8ff0f4f510eb5fbd40ac67)
@@ -244,7 +244,7 @@
private void AddLayer()
{
- var addLayerCommand = new MapAddLayerCommand();
+ var addLayerCommand = new MapAddLayerCommand { Gui = gui };
addLayerCommand.Execute();
UpdateButtonsVisibility();
}
Index: Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/VectorLayerAttributeTableView.cs
===================================================================
diff -u -r9f917802e4ebd3c4c6681e7f42198d6e758cafed -r5e8f24c2eade934e5e8ff0f4f510eb5fbd40ac67
--- Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/VectorLayerAttributeTableView.cs (.../VectorLayerAttributeTableView.cs) (revision 9f917802e4ebd3c4c6681e7f42198d6e758cafed)
+++ Core/Plugins/src/Core.Plugins.SharpMapGis.Gui/Forms/VectorLayerAttributeTableView.cs (.../VectorLayerAttributeTableView.cs) (revision 5e8f24c2eade934e5e8ff0f4f510eb5fbd40ac67)
@@ -30,14 +30,11 @@
private Func createFeatureRowObject;
private Type featureRowType;
private Func dynamicAttributeVisible;
- private bool canAddDeleteAttributes;
public VectorLayerAttributeTableView()
{
InitializeComponent();
- canAddDeleteAttributes = true;
-
InitializeDynamicAttributeContextMenu();
// TODO: extend UpdateTableDataSource() to support add/delete new rows, via layer.FeatureEditor?
@@ -69,22 +66,6 @@
}
}
- public bool CanAddDeleteAttributes
- {
- get
- {
- return canAddDeleteAttributes;
- }
- set
- {
- if (canAddDeleteAttributes != value)
- {
- canAddDeleteAttributes = value;
- InitializeDynamicAttributeContextMenu();
- }
- }
- }
-
public object Data
{
get
@@ -370,39 +351,11 @@
private void InitializeDynamicAttributeContextMenu()
{
- const string addAttributeItemName = "btnAddAttribute";
const string zoomItemName = "btnzoomToMenuItem";
const string openViewItemName = "btnOpenViewMenuItem";
- string addAttributeCaption = Resources.VectorLayerAttributeTableView_InitializeDynamicAttributeContextMenu_Add_Attribute;
- string deleteAttributeCaption = Resources.VectorLayerAttributeTableView_InitializeDynamicAttributeContextMenu_Delete_Attribute;
string zoomToItemCaption = Resources.VectorLayerAttributeTableView_InitializeDynamicAttributeContextMenu_Zoom_to_item;
string openViewCaption = Resources.VectorLayerAttributeTableView_InitializeDynamicAttributeContextMenu_Open_view;
- if (CanAddDeleteAttributes)
- {
- if (TableView.RowContextMenu.Items.OfType().All(mi => mi.Name != addAttributeItemName))
- {
- var btnAddAttribute = new ToolStripMenuItem
- {
- Name = addAttributeItemName,
- Text = addAttributeCaption,
- Image = Resources.TableAdd
- };
- btnAddAttribute.Click += AddAttributeItemClick;
- btnAddAttribute.Tag = TableView;
- TableView.RowContextMenu.Items.Add(btnAddAttribute);
- }
- }
- else
- {
- if (TableView.RowContextMenu.Items.OfType()
- .Any(mi => mi.Name == addAttributeItemName))
- {
- var menuItem = TableView.RowContextMenu.Items.OfType()
- .First(mi => mi.Name == addAttributeItemName);
- TableView.RowContextMenu.Items.Remove(menuItem);
- }
- }
if (TableView.RowContextMenu.Items.OfType().All(mi => mi.Name != zoomItemName))
{
var btnzoomToMenuItem = new ToolStripMenuItem
@@ -430,34 +383,6 @@
}
TableView.UnboundColumnData = TableViewUnboundColumnDataUpdating;
- if (CanAddDeleteAttributes)
- {
- if (TableView.ColumnMenuItems.All(mi => mi.Caption != addAttributeCaption))
- {
- var addAttributeItem = new TableViewColumnMenuItem(addAttributeCaption)
- {
- Image = Resources.TableAdd
- };
- addAttributeItem.Click += AddAttributeItemClick;
- TableView.ColumnMenuItems.Add(addAttributeItem);
- }
- if (TableView.ColumnMenuItems.All(mi => mi.Caption != deleteAttributeCaption))
- {
- var deleteAttributeItem = new TableViewColumnMenuItem(deleteAttributeCaption)
- {
- Image = Resources.TableDelete
- };
- deleteAttributeItem.Showing += DeleteAttributeItemShowing;
- deleteAttributeItem.Click += DeleteAttributeItemClick;
- TableView.ColumnMenuItems.Add(deleteAttributeItem);
- }
- }
- else
- {
- TableView.ColumnMenuItems.RemoveAllWhere(
- mi => mi.Caption == addAttributeCaption || mi.Caption == deleteAttributeCaption);
- }
-
if (TableView.ColumnMenuItems.All(mi => mi.Caption != zoomToItemCaption))
{
var zoomToMenuItem = new TableViewColumnMenuItem(zoomToItemCaption)
@@ -469,47 +394,6 @@
}
}
- private void DeleteAttributeItemShowing(object sender, CancelEventArgs e)
- {
- var attributes = layer.DataSource.Features.Cast().Where(f => f.Attributes != null).SelectMany(f => f.Attributes.Keys);
-
- var column = sender as TableViewColumn;
-
- //only show delete option if its a custom attribute
- if (column != null && attributes.Any(a => a == column.Name))
- {
- e.Cancel = false;
- return;
- }
- e.Cancel = true;
- }
-
- private void DeleteAttributeItemClick(object sender, EventArgs e)
- {
- var column = sender as TableViewColumn;
-
- if (column == null)
- {
- return;
- }
-
- column.Visible = false;
- TableView.Remove(column);
-
- var attributeName = column.Name;
-
- foreach (var feature in layer.DataSource.Features.Cast().ToList())
- {
- if (feature.Attributes != null && feature.Attributes.ContainsKey(attributeName))
- {
- feature.Attributes.Remove(attributeName);
- }
- }
-
- TableView.RefreshData();
- TableView.ResetBindings();
- }
-
private void BtnZoomToClick(object sender, EventArgs e)
{
var selectedFeature = SelectedFeatures.FirstOrDefault();
@@ -528,44 +412,6 @@
}
}
- private void AddAttributeItemClick(object sender, EventArgs e)
- {
- if (TableView.FocusedRowIndex < 0)
- {
- return;
- }
-
- var dialog = new InputTextDialog
- {
- Text = "Please give an attribute name"
- };
- if (dialog.ShowDialog() == DialogResult.OK)
- {
- var attributeName = dialog.EnteredText;
-
- if (String.IsNullOrEmpty(attributeName) || layer.DataSource.Features.Cast().ToList().Any(f => f.Attributes != null && f.Attributes.ContainsKey(attributeName)))
- {
- MessageBox.Show("Invalid attribute name: already exists");
- return;
- }
-
- foreach (var feature in layer.DataSource.Features.Cast().ToList())
- {
- if (feature.Attributes == null)
- {
- feature.Attributes = new DictionaryFeatureAttributeCollection();
- }
-
- if (!feature.Attributes.ContainsKey(attributeName))
- {
- feature.Attributes.Add(new KeyValuePair(dialog.EnteredText, ""));
- }
- }
- ConfigureDynamicAttributeColumns();
- TableView.RefreshData();
- }
- }
-
private object TableViewUnboundColumnDataUpdating(int column, int dataSourceIndex, bool isGetData, bool isSetData, object value)
{
var featureIndex = dataSourceIndex;