Index: Demo/Ringtoets/src/Demo.Ringtoets/Commands/OpenThematicalMapViewCommand.cs =================================================================== diff -u -r2a81f01756e227d5ce93717b21b87e8a5cd5fcbb -rff9884bfe0c85c4cf2fab7f197c2c8b1ce23f650 --- Demo/Ringtoets/src/Demo.Ringtoets/Commands/OpenThematicalMapViewCommand.cs (.../OpenThematicalMapViewCommand.cs) (revision 2a81f01756e227d5ce93717b21b87e8a5cd5fcbb) +++ Demo/Ringtoets/src/Demo.Ringtoets/Commands/OpenThematicalMapViewCommand.cs (.../OpenThematicalMapViewCommand.cs) (revision ff9884bfe0c85c4cf2fab7f197c2c8b1ce23f650) @@ -19,13 +19,13 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. -using System; using System.Collections.Generic; using System.Drawing; -using System.Linq; using Core.Common.Base.Geometry; using Core.Common.Controls.Commands; using Core.Common.Gui.Commands; +using Core.Common.Util; +using Core.Common.Util.Attributes; using Core.Components.Gis.Data; using Core.Components.Gis.Features; using Core.Components.Gis.Geometries; @@ -40,6 +40,24 @@ /// public class OpenThematicalMapViewCommand : ICommand { + private enum ThematicalFeatureTypes + { + [ResourcesDisplayName(typeof(Resources), nameof(Resources.ThematicalFeatureTypes_A))] + A, + + [ResourcesDisplayName(typeof(Resources), nameof(Resources.ThematicalFeatureTypes_B))] + B, + + [ResourcesDisplayName(typeof(Resources), nameof(Resources.ThematicalFeatureTypes_C))] + C, + + [ResourcesDisplayName(typeof(Resources), nameof(Resources.ThematicalFeatureTypes_D))] + D, + + [ResourcesDisplayName(typeof(Resources), nameof(Resources.ThematicalFeatureTypes_E))] + E + } + private const string selectedMetaDataAttributeName = "Waarde"; private readonly IViewCommands viewCommands; @@ -60,7 +78,7 @@ var mapPointDataEqualCriteria = new MapPointData(Resources.OpenThematicalMapViewCommand_Execute_MapPointData_with_EqualValueCriteria) { - Features = CreateMapPointFeaturesWithMetaData(40), + Features = CreateMapPointFeaturesWithMetaData(40, 0), Style = { Size = 10 @@ -72,7 +90,7 @@ var mapPointDataUnequalCriteria = new MapPointData(Resources.OpenThematicalMapViewCommand_Execute_MapPointData_with_UnequalValueCriteria) { - Features = CreateMapPointFeaturesWithMetaData(15), + Features = CreateMapPointFeaturesWithMetaData(15, 5), Style = { Size = 10 @@ -84,31 +102,31 @@ var mapLineDataEqualCriteria = new MapLineData(Resources.OpenThematicalMapViewCommand_Execute_MapLineData_with_EqualValueCriteria) { - Features = CreateMapLineFeaturesWithMetaData(40), + Features = CreateMapLineFeaturesWithMetaData(40, 10), SelectedMetaDataAttribute = selectedMetaDataAttributeName }; SetEqualCriteria(mapLineDataEqualCriteria); mapDataCollection.Add(mapLineDataEqualCriteria); var mapLineDataUnequalCriteria = new MapLineData(Resources.OpenThematicalMapViewCommand_Execute_MapLineData_with_UnequalValueCriteria) { - Features = CreateMapLineFeaturesWithMetaData(10), + Features = CreateMapLineFeaturesWithMetaData(10, 15), SelectedMetaDataAttribute = selectedMetaDataAttributeName }; SetUnequalCriteria(mapLineDataUnequalCriteria); mapDataCollection.Add(mapLineDataUnequalCriteria); var mapPolygonDataEqualCriteria = new MapPolygonData(Resources.OpenThematicalMapViewCommand_Execute_MapPolygonData_with_EqualValueCriteria) { - Features = CreatePolygonFeaturesWithMetaData(40), + Features = CreatePolygonFeaturesWithMetaData(40, 20), SelectedMetaDataAttribute = selectedMetaDataAttributeName }; SetEqualCriteria(mapPolygonDataEqualCriteria); mapDataCollection.Add(mapPolygonDataEqualCriteria); var mapPolygonDataUnequalCriteria = new MapPolygonData(Resources.OpenThematicalMapViewCommand_Execute_MapPolygonData_with_UnequalValueCriteria) { - Features = CreatePolygonFeaturesWithMetaData(10), + Features = CreatePolygonFeaturesWithMetaData(10, 25), SelectedMetaDataAttribute = selectedMetaDataAttributeName }; SetUnequalCriteria(mapPolygonDataUnequalCriteria); @@ -119,32 +137,33 @@ private static void SetEqualCriteria(FeatureBasedMapData mapData) { - var random = new Random(13); - int nrOfFeatures = mapData.Features.Count(); - var theme = new MapTheme("Waarde", new[] + var theme = new MapTheme(selectedMetaDataAttributeName, new[] { - new CategoryTheme(Color.DarkOrange, new ValueCriterion(ValueCriterionOperator.EqualValue, random.Next(0, nrOfFeatures))), - new CategoryTheme(Color.OrangeRed, new ValueCriterion(ValueCriterionOperator.EqualValue, random.Next(0, nrOfFeatures))), - new CategoryTheme(Color.SkyBlue, new ValueCriterion(ValueCriterionOperator.EqualValue, random.Next(0, nrOfFeatures))), - new CategoryTheme(Color.GreenYellow, new ValueCriterion(ValueCriterionOperator.EqualValue, random.Next(0, nrOfFeatures))) + new CategoryTheme(Color.DarkOrange, new ValueCriterion(ValueCriterionOperator.EqualValue, GetDisplayName(ThematicalFeatureTypes.A))), + new CategoryTheme(Color.OrangeRed, new ValueCriterion(ValueCriterionOperator.EqualValue, GetDisplayName(ThematicalFeatureTypes.B))), + new CategoryTheme(Color.SkyBlue, new ValueCriterion(ValueCriterionOperator.EqualValue, GetDisplayName(ThematicalFeatureTypes.C))), + new CategoryTheme(Color.GreenYellow, new ValueCriterion(ValueCriterionOperator.EqualValue, GetDisplayName(ThematicalFeatureTypes.D))) }); mapData.MapTheme = theme; } + private static string GetDisplayName(ThematicalFeatureTypes thematicalFeatureTypes) + { + return new EnumDisplayWrapper(thematicalFeatureTypes).DisplayName; + } + private static void SetUnequalCriteria(FeatureBasedMapData mapData) { - var random = new Random(37); - int nrOfFeatures = mapData.Features.Count(); - var theme = new MapTheme("Waarde", new[] + var theme = new MapTheme(selectedMetaDataAttributeName, new[] { - new CategoryTheme(Color.Purple, new ValueCriterion(ValueCriterionOperator.UnequalValue, random.Next(0, nrOfFeatures))) + new CategoryTheme(Color.Purple, new ValueCriterion(ValueCriterionOperator.UnequalValue, GetDisplayName(ThematicalFeatureTypes.E))) }); mapData.MapTheme = theme; } - private static IEnumerable CreateMapPointFeaturesWithMetaData(int nrOfPoints) + private static IEnumerable CreateMapPointFeaturesWithMetaData(int nrOfPoints, int bottom) { const double offset = 12; double xCoordinate = 0; @@ -155,9 +174,9 @@ { MapFeature feature = GetFeatureWithPoints(new[] { - new Point2D(xCoordinate, 0) + new Point2D(xCoordinate, bottom) }); - feature.MetaData[selectedMetaDataAttributeName] = i; + feature.MetaData[selectedMetaDataAttributeName] = GetThematicalFeatureType(i); features[i] = feature; xCoordinate += offset; @@ -166,7 +185,7 @@ return features; } - private static IEnumerable CreateMapLineFeaturesWithMetaData(int nrOfLines) + private static IEnumerable CreateMapLineFeaturesWithMetaData(int nrOfLines, int bottom) { double xCoordinate = 0; @@ -176,18 +195,23 @@ { MapFeature feature = GetFeatureWithPoints(new[] { - new Point2D(xCoordinate, 0), - new Point2D(xCoordinate++, 10) + new Point2D(xCoordinate, bottom), + new Point2D(xCoordinate++, bottom + 3) }); - feature.MetaData[selectedMetaDataAttributeName] = i; + feature.MetaData[selectedMetaDataAttributeName] = GetThematicalFeatureType(i); features[i] = feature; } return features; } - private static IEnumerable CreatePolygonFeaturesWithMetaData(int nrOfPolygons) + private static string GetThematicalFeatureType(int i) { + return GetDisplayName((ThematicalFeatureTypes) (i % 5)); + } + + private static IEnumerable CreatePolygonFeaturesWithMetaData(int nrOfPolygons, int bottom) + { const double offset = 3; double leftCoordinate = 0; double rightCoordinate = 1; @@ -198,13 +222,13 @@ { MapFeature feature = GetFeatureWithPoints(new[] { - new Point2D(leftCoordinate, 0), - new Point2D(leftCoordinate, 5), - new Point2D(rightCoordinate, 5), - new Point2D(rightCoordinate, 0), - new Point2D(leftCoordinate, 0) + new Point2D(leftCoordinate, bottom), + new Point2D(leftCoordinate, bottom + 3), + new Point2D(rightCoordinate, bottom + 3), + new Point2D(rightCoordinate, bottom), + new Point2D(leftCoordinate, bottom) }); - feature.MetaData[selectedMetaDataAttributeName] = i; + feature.MetaData[selectedMetaDataAttributeName] = GetThematicalFeatureType(i); features[i] = feature; leftCoordinate += offset; Index: Demo/Ringtoets/src/Demo.Ringtoets/Properties/Resources.Designer.cs =================================================================== diff -u -r2a81f01756e227d5ce93717b21b87e8a5cd5fcbb -rff9884bfe0c85c4cf2fab7f197c2c8b1ce23f650 --- Demo/Ringtoets/src/Demo.Ringtoets/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 2a81f01756e227d5ce93717b21b87e8a5cd5fcbb) +++ Demo/Ringtoets/src/Demo.Ringtoets/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision ff9884bfe0c85c4cf2fab7f197c2c8b1ce23f650) @@ -455,5 +455,50 @@ return ResourceManager.GetString("OpenThematicalMapViewCommand_Execute_MapPolygonData_with_UnequalValueCriteria", resourceCulture); } } + + /// + /// Looks up a localized string similar to AA. + /// + public static string ThematicalFeatureTypes_A { + get { + return ResourceManager.GetString("ThematicalFeatureTypes_A", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to BB. + /// + public static string ThematicalFeatureTypes_B { + get { + return ResourceManager.GetString("ThematicalFeatureTypes_B", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to CC. + /// + public static string ThematicalFeatureTypes_C { + get { + return ResourceManager.GetString("ThematicalFeatureTypes_C", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to DD. + /// + public static string ThematicalFeatureTypes_D { + get { + return ResourceManager.GetString("ThematicalFeatureTypes_D", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to EE. + /// + public static string ThematicalFeatureTypes_E { + get { + return ResourceManager.GetString("ThematicalFeatureTypes_E", resourceCulture); + } + } } } Index: Demo/Ringtoets/src/Demo.Ringtoets/Properties/Resources.resx =================================================================== diff -u -r5664f1bdab4e8042daab1d05754d797073d22de2 -rff9884bfe0c85c4cf2fab7f197c2c8b1ce23f650 --- Demo/Ringtoets/src/Demo.Ringtoets/Properties/Resources.resx (.../Resources.resx) (revision 5664f1bdab4e8042daab1d05754d797073d22de2) +++ Demo/Ringtoets/src/Demo.Ringtoets/Properties/Resources.resx (.../Resources.resx) (revision ff9884bfe0c85c4cf2fab7f197c2c8b1ce23f650) @@ -241,4 +241,19 @@ Polygon data met ongelijk criterium + + AA + + + BB + + + CC + + + DD + + + EE + \ No newline at end of file