Пример #1
0
        public void DynamicVisibleValidationMethod_MapPolygonDataWithMapTheme_ReturnsExpectedValuesForRelevantProperties(bool hasMapTheme)
        {
            // Setup
            MapPolygonData mapPolygonData = hasMapTheme
                                                ? new MapPolygonData("Test", new PolygonStyle(), CreateMapTheme())
                                                : new MapPolygonData("Test");

            var properties = new MapPolygonDataProperties(mapPolygonData, Enumerable.Empty <MapDataCollection>());

            // Call
            bool isCategoryThemesVisible = properties.DynamicVisibleValidationMethod(
                nameof(MapPolygonDataProperties.CategoryThemes));
            bool isFillColorVisible = properties.DynamicVisibleValidationMethod(
                nameof(MapPolygonDataProperties.FillColor));
            bool isStrokeColorVisible = properties.DynamicVisibleValidationMethod(
                nameof(MapPolygonDataProperties.StrokeColor));
            bool isStrokeThicknessVisible = properties.DynamicVisibleValidationMethod(
                nameof(MapPolygonDataProperties.StrokeThickness));

            // Assert
            Assert.AreEqual(hasMapTheme, isCategoryThemesVisible);
            Assert.AreNotEqual(hasMapTheme, isFillColorVisible);
            Assert.AreNotEqual(hasMapTheme, isStrokeColorVisible);
            Assert.AreNotEqual(hasMapTheme, isStrokeThicknessVisible);
        }
        public void ChildNodeObjects_Always_ReturnsChildrenWithContextAndDataReversed()
        {
            // Setup
            var mapPointData      = new MapPointData("points");
            var mapLineData       = new MapLineData("lines");
            var nestedCollection  = new MapDataCollection("nested");
            var mapPolygonData    = new MapPolygonData("polygons");
            var mapDataCollection = new MapDataCollection("test data");

            mapDataCollection.Add(mapPointData);
            mapDataCollection.Add(mapLineData);
            mapDataCollection.Add(nestedCollection);
            mapDataCollection.Add(mapPolygonData);

            MapDataCollectionContext parentCollectionContext = GetContext(mapDataCollection);

            // Call
            object[] objects = info.ChildNodeObjects(GetContext(mapDataCollection));

            // Assert
            CollectionAssert.AreEqual(new MapDataContext[]
            {
                new MapPolygonDataContext(mapPolygonData, parentCollectionContext),
                GetContext(nestedCollection, parentCollectionContext),
                new MapLineDataContext(mapLineData, parentCollectionContext),
                new MapPointDataContext(mapPointData, parentCollectionContext)
            }, objects);
        }
Пример #3
0
        public void FromFeatureBasedMapData_WithMapPolygonData_ReturnsNewRemovableDataWithSameProperties()
        {
            // Setup
            const string name         = "test";
            var          mapFeatures  = new MapFeature[0];
            var          polygonStyle = new PolygonStyle
            {
                FillColor       = Color.AliceBlue,
                StrokeColor     = Color.DeepSkyBlue,
                StrokeThickness = 3
            };

            var mapData = new MapPolygonData(name, polygonStyle)
            {
                Features = mapFeatures
            };

            // Call
            var convertedData = RemovableMapDataConverter.FromFeatureBasedMapData(mapData) as RemovableMapPolygonData;

            // Assert
            Assert.NotNull(convertedData);
            Assert.AreEqual(name, convertedData.Name);
            Assert.AreEqual(polygonStyle, convertedData.Style);
            Assert.AreSame(mapFeatures, convertedData.Features);
        }
Пример #4
0
        public void Features_SetValidNewValue_GetsNewValue()
        {
            // Setup
            var data     = new MapPolygonData("test data");
            var features = new[]
            {
                new MapFeature(Enumerable.Empty <MapGeometry>()),
                new MapFeature(new[]
                {
                    new MapGeometry(new[]
                    {
                        CreateTestPoints(),
                        CreateTestPoints()
                    }),
                    new MapGeometry(new[]
                    {
                        CreateTestPoints()
                    })
                })
            };

            // Call
            data.Features = features;

            // Assert
            Assert.AreSame(features, data.Features);
        }
        public void GetFeatureBasedMapDataRecursively_CollectionWithNestedData_ReturnAllFeatureBasedMapData()
        {
            // Setup
            var line             = new MapLineData("line");
            var polygon          = new MapPolygonData("polygon");
            var nestedCollection = new MapDataCollection("nested");

            nestedCollection.Add(line);
            nestedCollection.Add(polygon);

            var collection = new MapDataCollection("test");
            var point      = new MapPointData("point");

            collection.Add(point);
            collection.Add(nestedCollection);

            // Call
            FeatureBasedMapData[] featureBasedMapDatas = collection.GetFeatureBasedMapDataRecursively().ToArray();

            // Assert
            Assert.AreEqual(3, featureBasedMapDatas.Length);
            Assert.IsInstanceOf <MapPointData>(featureBasedMapDatas[0]);
            Assert.IsInstanceOf <MapLineData>(featureBasedMapDatas[1]);
            Assert.IsInstanceOf <MapPolygonData>(featureBasedMapDatas[2]);
        }
Пример #6
0
        public void GivenMapPolygonDataLayer_WhenUpdatedAfterMapPolygonDataFeaturesChanged_MapPolygonDataLayerFeaturesChanged()
        {
            // Given
            var mapPolygonData = new MapPolygonData("Test name")
            {
                Features = new[]
                {
                    CreateTestMapFeature()
                }
            };

            var mapPolygonDataLayer = new MapPolygonDataLayer(mapPolygonData);

            IFeature[] drawnFeatures = mapPolygonDataLayer.DataSet.Features.ToArray();

            // When
            mapPolygonData.Features = new[]
            {
                CreateTestMapFeature()
            };
            mapPolygonDataLayer.Update();

            // Then
            CollectionAssert.AreNotEqual(drawnFeatures, mapPolygonDataLayer.DataSet.Features);
        }
Пример #7
0
        public void DynamicReadOnlyValidator_MapHasMetaData_ReturnsExpectedValuesForRelevantProperties(bool hasMetaData)
        {
            // Setup
            var feature = new MapFeature(Enumerable.Empty <MapGeometry>());

            if (hasMetaData)
            {
                feature.MetaData["key"] = "value";
            }

            var mapData = new MapPolygonData("Test")
            {
                Features = new[]
                {
                    feature
                }
            };

            var properties = new MapPolygonDataProperties(mapData, Enumerable.Empty <MapDataCollection>());

            // Call
            bool isShowLabelReadOnly = properties.DynamicReadonlyValidator(
                nameof(properties.ShowLabels));
            bool isSelectedMetaDataReadOnly = properties.DynamicReadonlyValidator(
                nameof(properties.SelectedMetaDataAttribute));

            // Assert
            Assert.AreNotEqual(hasMetaData, isShowLabelReadOnly);
            Assert.AreNotEqual(hasMetaData, isSelectedMetaDataReadOnly);
        }
Пример #8
0
        public void Constructor_MapPolygonDataWithMapTheme_PropertiesHaveExpectedAttributesValues()
        {
            // Setup
            var mapPolygonData = new MapPolygonData("Test", new PolygonStyle(), CreateMapTheme())
            {
                Features = new[]
                {
                    new MapFeature(Enumerable.Empty <MapGeometry>())
                },
                ShowLabels = true
            };

            // Call
            var properties = new MapPolygonDataProperties(mapPolygonData, Enumerable.Empty <MapDataCollection>());

            // Assert
            PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);

            Assert.AreEqual(7, dynamicProperties.Count);
            const string styleCategory = "Stijl";

            PropertyDescriptor categoryThemesProperty = dynamicProperties[categoryThemesPropertyIndex];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(categoryThemesProperty,
                                                                            styleCategory,
                                                                            "Categorieën",
                                                                            string.Empty,
                                                                            true);
        }
Пример #9
0
        public void ConvertLayerFeatures_MapPolygonDataWithSingleGeometryFeature_ConvertsFeatureToMapPolygonLayerAsPolygonData()
        {
            // Setup
            var converter       = new MapPolygonDataConverter();
            var mapPolygonLayer = new MapPolygonLayer();
            var mapPolygonData  = new MapPolygonData("test data")
            {
                Features = new[]
                {
                    new MapFeature(new[]
                    {
                        new MapGeometry(new[]
                        {
                            CreateRectangularRing(0.0, 10.0)
                        })
                    })
                }
            };

            // Call
            converter.ConvertLayerFeatures(mapPolygonData, mapPolygonLayer);

            // Assert
            IFeature feature = mapPolygonLayer.DataSet.Features[0];

            Assert.AreEqual(mapPolygonData.Features.Count(), mapPolygonLayer.DataSet.Features.Count);
            Assert.IsInstanceOf <Polygon>(feature.Geometry);

            IEnumerable <Coordinate> expectedCoordinates = mapPolygonData.Features.First().MapGeometries.First().PointCollections.First().Select(p => new Coordinate(p.X, p.Y));

            CollectionAssert.AreEqual(expectedCoordinates, mapPolygonLayer.DataSet.Features[0].Geometry.Coordinates);
        }
Пример #10
0
        public void GivenMapPolygonDataPropertiesWithMapTheme_WhenCategoryThemePropertySet_ThenMapDataNotified()
        {
            // Given
            var random = new Random(21);

            var mocks    = new MockRepository();
            var observer = mocks.StrictMock <IObserver>();

            observer.Expect(o => o.UpdateObserver());
            mocks.ReplayAll();

            var mapPolygonData = new MapPolygonData("Test",
                                                    new PolygonStyle(),
                                                    new MapTheme <PolygonCategoryTheme>("Attribute", new[]
            {
                new PolygonCategoryTheme(ValueCriterionTestFactory.CreateValueCriterion(), new PolygonStyle())
            }));

            mapPolygonData.Attach(observer);

            var properties = new MapPolygonDataProperties(mapPolygonData, Enumerable.Empty <MapDataCollection>());

            // When
            PolygonCategoryThemeProperties categoryThemeProperties = properties.CategoryThemes.First();

            categoryThemeProperties.StrokeThickness = random.Next(1, 48);

            // Then
            mocks.VerifyAll();
        }
Пример #11
0
        public void Constructor_WithMapTheme_ReturnCorrectPropertyValues()
        {
            // Setup
            const string attributeName = "Attribute";
            var          categoryTheme = new PolygonCategoryTheme(ValueCriterionTestFactory.CreateValueCriterion(),
                                                                  new PolygonStyle());
            var mapPolygonData = new MapPolygonData("Test",
                                                    new PolygonStyle(),
                                                    new MapTheme <PolygonCategoryTheme>(attributeName, new[]
            {
                categoryTheme
            }));

            // Call
            var properties = new MapPolygonDataProperties(mapPolygonData, Enumerable.Empty <MapDataCollection>());

            // Assert
            Assert.AreEqual("Categorie", properties.StyleType);

            Assert.AreEqual(mapPolygonData.ShowLabels, properties.ShowLabels);
            Assert.IsEmpty(properties.SelectedMetaDataAttribute.MetaDataAttribute);
            Assert.AreEqual(mapPolygonData.MetaData, properties.GetAvailableMetaDataAttributes());

            Assert.AreEqual(1, properties.CategoryThemes.Length);
            PolygonCategoryThemeProperties pointCategoryThemeProperties = properties.CategoryThemes.First();

            Assert.AreSame(categoryTheme, pointCategoryThemeProperties.Data);
            ValueCriterionTestHelper.AssertValueCriterionFormatExpression(attributeName,
                                                                          categoryTheme.Criterion,
                                                                          pointCategoryThemeProperties.Criterion);
        }
Пример #12
0
        public void Constructor_WithoutMapTheme_ReturnCorrectPropertyValues()
        {
            // Setup
            Color     fillColor       = Color.Aqua;
            Color     strokeColor     = Color.Bisque;
            const int strokeThickness = 4;

            var mapPolygonData = new MapPolygonData("Test", new PolygonStyle
            {
                FillColor       = fillColor,
                StrokeColor     = strokeColor,
                StrokeThickness = strokeThickness
            });

            // Call
            var properties = new MapPolygonDataProperties(mapPolygonData, Enumerable.Empty <MapDataCollection>());

            // Assert
            Assert.AreEqual("Enkel symbool", properties.StyleType);

            Assert.AreEqual(mapPolygonData.ShowLabels, properties.ShowLabels);
            Assert.IsEmpty(properties.SelectedMetaDataAttribute.MetaDataAttribute);
            Assert.AreEqual(mapPolygonData.MetaData, properties.GetAvailableMetaDataAttributes());

            Assert.AreEqual(fillColor, properties.FillColor);
            Assert.AreEqual(strokeColor, properties.StrokeColor);
            Assert.AreEqual(strokeThickness, properties.StrokeThickness);

            CollectionAssert.IsEmpty(properties.CategoryThemes);
        }
Пример #13
0
        public void Constructor_WithStyleAndMapTheme_ExpectedValues()
        {
            // Setup
            const string name  = "test data";
            var          style = new PolygonStyle
            {
                FillColor       = Color.Aqua,
                StrokeColor     = Color.DarkGoldenrod,
                StrokeThickness = 3
            };

            var mapTheme = new MapTheme <PolygonCategoryTheme>("attribute", new[]
            {
                new PolygonCategoryTheme(ValueCriterionTestFactory.CreateValueCriterion(),
                                         new PolygonStyle())
            });

            // Call
            var data = new MapPolygonData(name, style, mapTheme);

            // Assert
            Assert.AreEqual(name, data.Name);
            CollectionAssert.IsEmpty(data.Features);
            Assert.AreSame(style, data.Style);
            Assert.AreSame(mapTheme, data.Theme);
        }
Пример #14
0
        public void ConvertLayerProperties_MapPolygonDataWithStyle_ConvertsStyleToMapPolygonLayer(
            [Values(KnownColor.AliceBlue, KnownColor.Azure)]
            KnownColor fillColor,
            [Values(KnownColor.AppWorkspace, KnownColor.BlueViolet)]
            KnownColor outlineFillColor,
            [Values(1, 5)] int width)
        {
            // Setup
            var   converter                = new MapPolygonDataConverter();
            var   mapPolygonLayer          = new MapPolygonLayer();
            Color expectedFillColor        = Color.FromKnownColor(fillColor);
            Color expectedOutlineFillColor = Color.FromKnownColor(outlineFillColor);
            var   mapPolygonData           = new MapPolygonData("test", new PolygonStyle
            {
                FillColor       = expectedFillColor,
                StrokeColor     = expectedOutlineFillColor,
                StrokeThickness = width
            });

            // Call
            converter.ConvertLayerProperties(mapPolygonData, mapPolygonLayer);

            // Assert
            AssertAreEqual(new PolygonSymbolizer(expectedFillColor, expectedOutlineFillColor, width), mapPolygonLayer.Symbolizer);
        }
Пример #15
0
 private static void SetMapPolygonDataTestProperties(MapPolygonData mapPolygonData)
 {
     mapPolygonData.Name       = "Another test name";
     mapPolygonData.IsVisible  = false;
     mapPolygonData.ShowLabels = true;
     mapPolygonData.SelectedMetaDataAttribute = "Name";
     mapPolygonData.Features = new[]
     {
         CreateTestMapFeature()
     };
 }
Пример #16
0
        public void Constructor_Always_CreatesNewInstanceOfDefaultStyle()
        {
            // Setup
            var dataA = new MapPolygonData("test data");

            // Call
            var dataB = new MapPolygonData("test data");

            // Assert
            Assert.AreNotSame(dataA.Style, dataB.Style);
        }
Пример #17
0
        /// <summary>
        /// Creates a new instance of <see cref="MapPolygonDataLayer"/>.
        /// </summary>
        /// <param name="mapPolygonData">The <see cref="MapPolygonData"/> which the map polygon data layer is based upon.</param>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="mapPolygonData"/> is <c>null</c>.</exception>
        public MapPolygonDataLayer(MapPolygonData mapPolygonData)
        {
            if (mapPolygonData == null)
            {
                throw new ArgumentNullException(nameof(mapPolygonData));
            }

            this.mapPolygonData = mapPolygonData;
            Projection          = MapDataConstants.FeatureBasedMapDataCoordinateSystem;

            Update();
        }
Пример #18
0
        public void Features_SetNullValue_ThrowsArgumentNullException()
        {
            // Setup
            var data = new MapPolygonData("test data");

            // Call
            TestDelegate test = () => data.Features = null;

            // Assert
            const string expectedMessage = "The array of features cannot be null or contain null.";

            TestHelper.AssertThrowsArgumentExceptionAndTestMessage <ArgumentNullException>(test, expectedMessage);
        }
        public void CreateInstance_WithValidArguments_NewPropertiesWithMapPolygonDataAsData()
        {
            // Setup
            var mapData = new MapPolygonData("Test");
            var context = new MapPolygonDataContext(mapData, new MapDataCollectionContext(new MapDataCollection("test"), null));

            // Call
            IObjectProperties objectProperties = info.CreateInstance(context);

            // Assert
            Assert.IsInstanceOf <MapPolygonDataProperties>(objectProperties);
            Assert.AreSame(mapData, objectProperties.Data);
        }
Пример #20
0
        public void Constructor_ExpectedValues()
        {
            // Setup
            var data   = new MapPolygonData("test");
            var parent = new MapDataCollectionContext(new MapDataCollection("parent"), null);

            // Call
            var context = new MapPolygonDataContext(data, parent);

            // Assert
            Assert.IsInstanceOf <FeatureBasedMapDataContext>(context);
            Assert.AreSame(data, context.WrappedData);
            Assert.AreSame(parent, context.ParentMapData);
        }
Пример #21
0
        public void ConvertLayerProperties_MapPolygonDataWithThemeAndMetaDataNameNotInFeatures_OnlyAddsDefaultCategory()
        {
            // Setup
            const string metadataAttribute = "Meta";
            var          random            = new Random(21);
            var          theme             = new MapTheme <PolygonCategoryTheme>("Other Meta", new[]
            {
                new PolygonCategoryTheme(ValueCriterionTestFactory.CreateValueCriterion(),
                                         new PolygonStyle
                {
                    FillColor       = Color.FromKnownColor(random.NextEnum <KnownColor>()),
                    StrokeColor     = Color.FromKnownColor(random.NextEnum <KnownColor>()),
                    StrokeThickness = random.Next(1, 48)
                })
            });

            var polygonStyle = new PolygonStyle
            {
                FillColor       = Color.FromKnownColor(random.NextEnum <KnownColor>()),
                StrokeColor     = Color.FromKnownColor(random.NextEnum <KnownColor>()),
                StrokeThickness = random.Next(1, 48)
            };
            var mapPolygonData = new MapPolygonData("test", polygonStyle, theme)
            {
                Features = new[]
                {
                    CreateMapFeatureWithMetaData(metadataAttribute)
                }
            };

            var mapPolygonLayer = new MapPolygonLayer();

            var converter = new MapPolygonDataConverter();

            // Call
            converter.ConvertLayerProperties(mapPolygonData, mapPolygonLayer);

            // Assert
            IPolygonSymbolizer expectedSymbolizer = CreateExpectedSymbolizer(polygonStyle);

            IPolygonScheme appliedScheme = mapPolygonLayer.Symbology;

            Assert.AreEqual(1, appliedScheme.Categories.Count);

            IPolygonCategory baseCategory = appliedScheme.Categories[0];

            AssertAreEqual(expectedSymbolizer, baseCategory.Symbolizer);
            Assert.IsNull(baseCategory.FilterExpression);
        }
Пример #22
0
        public void DynamicVisibleValidationMethod_ShowLabels_ReturnsExpectedValuesForRelevantProperties(bool showLabels)
        {
            // Setup
            var mapPolygonData = new MapPolygonData("Test")
            {
                ShowLabels = showLabels
            };

            var properties = new MapPolygonDataProperties(mapPolygonData, Enumerable.Empty <MapDataCollection>());

            // Call
            bool isSelectedMetaDataAttributeVisible = properties.DynamicVisibleValidationMethod(
                nameof(MapPolygonDataProperties.SelectedMetaDataAttribute));

            // Assert
            Assert.AreEqual(showLabels, isSelectedMetaDataAttributeVisible);
        }
Пример #23
0
        public void Constructor_ValidName_NameAndDefaultValuesSet()
        {
            // Setup
            const string name = "test data";

            // Call
            var data = new MapPolygonData(name);

            // Assert
            Assert.AreEqual(name, data.Name);
            CollectionAssert.IsEmpty(data.Features);
            Assert.IsInstanceOf <FeatureBasedMapData <PolygonCategoryTheme> >(data);
            Assert.AreEqual(Color.DarkGray, data.Style.FillColor);
            Assert.AreEqual(Color.Black, data.Style.StrokeColor);
            Assert.AreEqual(2, data.Style.StrokeThickness);
            Assert.IsNull(data.Theme);
        }
Пример #24
0
        public void ConvertLayerProperties_MapPolygonDataWithStrokeThicknessZero_MapPolygonLayerOutlineColorTransparent()
        {
            // Setup
            var   converter         = new MapPolygonDataConverter();
            var   mapPolygonLayer   = new MapPolygonLayer();
            Color expectedFillColor = Color.FromKnownColor(new Random(21).NextEnum <KnownColor>());
            var   mapPolygonData    = new MapPolygonData("test", new PolygonStyle
            {
                FillColor       = expectedFillColor,
                StrokeColor     = Color.ForestGreen,
                StrokeThickness = 0
            });

            // Call
            converter.ConvertLayerProperties(mapPolygonData, mapPolygonLayer);

            // Assert
            AssertAreEqual(new PolygonSymbolizer(expectedFillColor, Color.Transparent, 0), mapPolygonLayer.Symbolizer);
        }
Пример #25
0
        public void ConvertLayerFeatures_MapPolygonDataWithRingFeatureAndHoles_ConvertsFeatureToMapPolygonLayerAsPolygonData()
        {
            // Setup
            var converter       = new MapPolygonDataConverter();
            var mapPolygonLayer = new MapPolygonLayer();

            Point2D[]    outerRingPoints  = CreateRectangularRing(0.0, 10.0);
            Point2D[]    innerRing1Points = CreateRectangularRing(2.0, 3.0);
            Point2D[]    innerRing2Points = CreateRectangularRing(8.0, 5.0);
            MapFeature[] mapFeatures      =
            {
                new MapFeature(new[]
                {
                    new MapGeometry(new[]
                    {
                        outerRingPoints,
                        innerRing1Points,
                        innerRing2Points
                    })
                })
            };
            var mapPolygonData = new MapPolygonData("test data")
            {
                Features = mapFeatures
            };

            // Call
            converter.ConvertLayerFeatures(mapPolygonData, mapPolygonLayer);

            // Assert
            IFeature feature = mapPolygonLayer.DataSet.Features[0];

            Assert.AreEqual(mapPolygonData.Features.Count(), mapPolygonLayer.DataSet.Features.Count);
            Assert.IsInstanceOf <Polygon>(feature.Geometry);

            var polygonGeometry = (Polygon)mapPolygonLayer.FeatureSet.Features[0].Geometry;

            Assert.AreEqual(1, polygonGeometry.NumGeometries);
            CollectionAssert.AreEqual(outerRingPoints, polygonGeometry.Shell.Coordinates.Select(c => new Point2D(c.X, c.Y)));
            Assert.AreEqual(2, polygonGeometry.Holes.Length);
            CollectionAssert.AreEqual(innerRing1Points, polygonGeometry.Holes.ElementAt(0).Coordinates.Select(c => new Point2D(c.X, c.Y)));
            CollectionAssert.AreEqual(innerRing2Points, polygonGeometry.Holes.ElementAt(1).Coordinates.Select(c => new Point2D(c.X, c.Y)));
        }
Пример #26
0
        public void Constructor_MapPolygonDataWithoutMapTheme_PropertiesHaveExpectedAttributesValues()
        {
            // Setup
            var mapPolygonData = new MapPolygonData("Test")
            {
                Features = new[]
                {
                    new MapFeature(Enumerable.Empty <MapGeometry>())
                },
                ShowLabels = true
            };

            // Call
            var properties = new MapPolygonDataProperties(mapPolygonData, Enumerable.Empty <MapDataCollection>());

            // Assert
            PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);

            Assert.AreEqual(9, dynamicProperties.Count);
            const string styleCategory = "Stijl";

            PropertyDescriptor colorProperty = dynamicProperties[fillColorPropertyIndex];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(colorProperty,
                                                                            styleCategory,
                                                                            "Kleur",
                                                                            "De kleur van de vlakken waarmee deze kaartlaag wordt weergegeven.");

            PropertyDescriptor strokeColorProperty = dynamicProperties[strokeColorPropertyIndex];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(strokeColorProperty,
                                                                            styleCategory,
                                                                            "Lijnkleur",
                                                                            "De kleur van de lijn van de vlakken waarmee deze kaartlaag wordt weergegeven.");

            PropertyDescriptor styleProperty = dynamicProperties[strokeThicknessPropertyIndex];

            PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(styleProperty,
                                                                            styleCategory,
                                                                            "Lijndikte",
                                                                            "De dikte van de lijn van de vlakken waarmee deze kaartlaag wordt weergegeven.");
        }
Пример #27
0
        public void Constructor_WithStyle_ExpectedValues()
        {
            // Setup
            const string name  = "test data";
            var          style = new PolygonStyle
            {
                FillColor       = Color.Aqua,
                StrokeColor     = Color.DarkGoldenrod,
                StrokeThickness = 3
            };

            // Call
            var data = new MapPolygonData(name, style);

            // Assert
            Assert.AreEqual(name, data.Name);
            CollectionAssert.IsEmpty(data.Features);
            Assert.AreSame(style, data.Style);
            Assert.IsNull(data.Theme);
        }
Пример #28
0
        public void DynamicVisibleValidationMethod_AnyOtherProperty_ReturnsTrue()
        {
            // Setup
            var mapPolygonData = new MapPolygonData("Test", new PolygonStyle(), CreateMapTheme())
            {
                Features = new[]
                {
                    new MapFeature(Enumerable.Empty <MapGeometry>())
                },
                ShowLabels = true
            };

            var properties = new MapPolygonDataProperties(mapPolygonData, Enumerable.Empty <MapDataCollection>());

            // Call
            bool isOtherPropertyVisible = properties.DynamicVisibleValidationMethod(string.Empty);

            // Assert
            Assert.IsFalse(isOtherPropertyVisible);
        }
Пример #29
0
        public void Features_SetInvalidValue_ThrowsArgumentException()
        {
            // Setup
            var data     = new MapPolygonData("test data");
            var features = new[]
            {
                new MapFeature(new[]
                {
                    new MapGeometry(Enumerable.Empty <IEnumerable <Point2D> >())
                })
            };

            // Call
            TestDelegate test = () => data.Features = features;

            // Assert
            const string expectedMessage = "MapPolygonData only accepts MapFeature instances whose MapGeometries contain at least one single point-collection.";

            TestHelper.AssertThrowsArgumentExceptionAndTestMessage <ArgumentException>(test, expectedMessage);
        }
Пример #30
0
        public void ConvertLayerFeatures_MapPolygonDataWithMultipleFeatures_ConvertsAllFeaturesToMapPolygonLayer()
        {
            // Setup
            var converter       = new MapPolygonDataConverter();
            var mapPolygonLayer = new MapPolygonLayer();
            var mapPolygonData  = new MapPolygonData("test")
            {
                Features = new[]
                {
                    new MapFeature(Enumerable.Empty <MapGeometry>()),
                    new MapFeature(Enumerable.Empty <MapGeometry>()),
                    new MapFeature(Enumerable.Empty <MapGeometry>())
                }
            };

            // Call
            converter.ConvertLayerFeatures(mapPolygonData, mapPolygonLayer);

            // Assert
            Assert.AreEqual(mapPolygonData.Features.Count(), mapPolygonLayer.DataSet.Features.Count);
        }