public void Constructor_WithStyleAndMapTheme_ExpectedValues() { // Setup const string name = "test data"; Color color = Color.Aqua; var style = new PointStyle { Color = color, Size = 3, Symbol = PointSymbol.Circle, StrokeColor = color, StrokeThickness = 1 }; var mapTheme = new MapTheme <PointCategoryTheme>("attribute", new[] { new PointCategoryTheme(ValueCriterionTestFactory.CreateValueCriterion(), new PointStyle()) }); // Call var data = new MapPointData(name, style, mapTheme); // Assert Assert.AreEqual(name, data.Name); CollectionAssert.IsEmpty(data.Features); Assert.AreSame(style, data.Style); Assert.AreSame(mapTheme, data.Theme); }
/// <summary> /// Creates the map data. /// </summary> protected virtual void CreateMapData() { hydraulicBoundaryLocationsMapLayer = new HydraulicBoundaryLocationsMapLayer(AssessmentSection); MapDataCollection = new MapDataCollection(PipingDataResources.PipingFailureMechanism_DisplayName); referenceLineMapData = RiskeerMapDataFactory.CreateReferenceLineMapData(); stochasticSoilModelsMapData = RiskeerMapDataFactory.CreateStochasticSoilModelsMapData(); surfaceLinesMapData = RiskeerMapDataFactory.CreateSurfaceLinesMapData(); semiProbabilisticCalculationsMapData = PipingMapDataFactory.CreateSemiProbabilisticCalculationsMapData(); probabilisticCalculationsMapData = PipingMapDataFactory.CreateProbabilisticCalculationsMapData(); MapDataCollection sectionsMapDataCollection = RiskeerMapDataFactory.CreateSectionsMapDataCollection(); sectionsMapData = RiskeerMapDataFactory.CreateFailureMechanismSectionsMapData(); sectionsStartPointMapData = RiskeerMapDataFactory.CreateFailureMechanismSectionsStartPointMapData(); sectionsEndPointMapData = RiskeerMapDataFactory.CreateFailureMechanismSectionsEndPointMapData(); MapDataCollection.Add(referenceLineMapData); MapDataCollection.Add(stochasticSoilModelsMapData); MapDataCollection.Add(surfaceLinesMapData); sectionsMapDataCollection.Add(sectionsMapData); sectionsMapDataCollection.Add(sectionsStartPointMapData); sectionsMapDataCollection.Add(sectionsEndPointMapData); MapDataCollection.Add(sectionsMapDataCollection); MapDataCollection.Add(hydraulicBoundaryLocationsMapLayer.MapData); MapDataCollection.Add(probabilisticCalculationsMapData); MapDataCollection.Add(semiProbabilisticCalculationsMapData); }
public void DynamicReadOnlyValidator_MapHasMetaData_ReturnsExpectedValuesForRelevantProperties(bool hasMetaData) { // Setup var feature = new MapFeature(Enumerable.Empty <MapGeometry>()); if (hasMetaData) { feature.MetaData["key"] = "value"; } var mapData = new MapPointData("Test") { Features = new[] { feature } }; var properties = new MapPointDataProperties(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); }
public void Constructor_WithMapTheme_ReturnCorrectPropertyValues() { // Setup const string attributeName = "Attribute"; var categoryTheme = new PointCategoryTheme(ValueCriterionTestFactory.CreateValueCriterion(), new PointStyle()); var mapPointData = new MapPointData("Test", new PointStyle(), new MapTheme <PointCategoryTheme>(attributeName, new[] { categoryTheme })); // Call var properties = new MapPointDataProperties(mapPointData, Enumerable.Empty <MapDataCollection>()); // Assert Assert.AreEqual("Categorie", properties.StyleType); Assert.AreEqual(mapPointData.ShowLabels, properties.ShowLabels); Assert.IsEmpty(properties.SelectedMetaDataAttribute.MetaDataAttribute); Assert.AreEqual(mapPointData.MetaData, properties.GetAvailableMetaDataAttributes()); Assert.AreEqual(1, properties.CategoryThemes.Length); PointCategoryThemeProperties pointCategoryThemeProperties = properties.CategoryThemes.First(); Assert.AreSame(categoryTheme, pointCategoryThemeProperties.Data); ValueCriterionTestHelper.AssertValueCriterionFormatExpression(attributeName, categoryTheme.Criterion, pointCategoryThemeProperties.Criterion); }
public void GivenMapPointDataPropertiesWithMapTheme_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 mapPointData = new MapPointData("Test", new PointStyle(), new MapTheme <PointCategoryTheme>("Attribute", new[] { new PointCategoryTheme(ValueCriterionTestFactory.CreateValueCriterion(), new PointStyle()) })); mapPointData.Attach(observer); var properties = new MapPointDataProperties(mapPointData, Enumerable.Empty <MapDataCollection>()); // When PointCategoryThemeProperties categoryThemeProperties = properties.CategoryThemes.First(); categoryThemeProperties.Size = random.Next(1, 48); // Then mocks.VerifyAll(); }
public void Constructor_WithoutMapTheme_ReturnCorrectPropertyValues() { // Setup Color color = Color.Aqua; const int size = 4; const PointSymbol symbol = PointSymbol.Circle; var mapPointData = new MapPointData("Test", new PointStyle { Color = color, Size = size, Symbol = symbol, StrokeColor = color, StrokeThickness = 1 }); // Call var properties = new MapPointDataProperties(mapPointData, Enumerable.Empty <MapDataCollection>()); // Assert Assert.AreEqual("Enkel symbool", properties.StyleType); Assert.AreEqual(mapPointData.ShowLabels, properties.ShowLabels); Assert.IsEmpty(properties.SelectedMetaDataAttribute.MetaDataAttribute); Assert.AreEqual(mapPointData.MetaData, properties.GetAvailableMetaDataAttributes()); Assert.AreEqual(color, properties.Color); Assert.AreEqual(color, properties.StrokeColor); Assert.AreEqual(1, properties.StrokeThickness); Assert.AreEqual(size, properties.Size); Assert.AreEqual(symbol, properties.Symbol); CollectionAssert.IsEmpty(properties.CategoryThemes); }
public void Constructor_MapPointDataWithMapTheme_PropertiesHaveExpectedAttributesValues() { // Setup var mapPointData = new MapPointData("Test", new PointStyle(), CreateMapTheme()) { Features = new[] { new MapFeature(Enumerable.Empty <MapGeometry>()) }, ShowLabels = true }; // Call var properties = new MapPointDataProperties(mapPointData, 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); }
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); }
public void DynamicVisibleValidationMethod_MapPointDataWithMapTheme_ReturnsExpectedValuesForRelevantProperties(bool hasMapTheme) { // Setup MapPointData mapPointData = hasMapTheme ? new MapPointData("Test", new PointStyle(), CreateMapTheme()) : new MapPointData("Test"); var properties = new MapPointDataProperties(mapPointData, Enumerable.Empty <MapDataCollection>()); // Call bool isCategoryThemesVisible = properties.DynamicVisibleValidationMethod( nameof(MapLineDataProperties.CategoryThemes)); bool isColorVisible = properties.DynamicVisibleValidationMethod( nameof(MapPointDataProperties.Color)); bool isStrokeColorVisible = properties.DynamicVisibleValidationMethod( nameof(MapPointDataProperties.StrokeColor)); bool isStrokeThicknessVisible = properties.DynamicVisibleValidationMethod( nameof(MapPointDataProperties.StrokeThickness)); bool isSizeVisible = properties.DynamicVisibleValidationMethod( nameof(MapPointDataProperties.Size)); bool isSymbolVisible = properties.DynamicVisibleValidationMethod( nameof(MapPointDataProperties.Symbol)); // Assert Assert.AreEqual(hasMapTheme, isCategoryThemesVisible); Assert.AreNotEqual(hasMapTheme, isColorVisible); Assert.AreNotEqual(hasMapTheme, isStrokeColorVisible); Assert.AreNotEqual(hasMapTheme, isStrokeThicknessVisible); Assert.AreNotEqual(hasMapTheme, isSizeVisible); Assert.AreNotEqual(hasMapTheme, isSymbolVisible); }
public void Features_SetValidNewValue_GetsNewValue() { // Setup var data = new MapPointData("test data"); var features = new[] { new MapFeature(Enumerable.Empty <MapGeometry>()), new MapFeature(new[] { new MapGeometry(new[] { Enumerable.Empty <Point2D>() }), new MapGeometry(new[] { CreateTestPoints() }) }) }; // Call data.Features = features; // Assert Assert.AreSame(features, data.Features); }
private void CreateMapData() { mapDataCollection = new MapDataCollection(FailureMechanism.Name); referenceLineMapData = RiskeerMapDataFactory.CreateReferenceLineMapData(); hydraulicBoundaryLocationsMapLayer = new HydraulicBoundaryLocationsMapLayer(AssessmentSection); MapDataCollection sectionsMapDataCollection = RiskeerMapDataFactory.CreateSectionsMapDataCollection(); sectionsMapData = RiskeerMapDataFactory.CreateFailureMechanismSectionsMapData(); sectionsStartPointMapData = RiskeerMapDataFactory.CreateFailureMechanismSectionsStartPointMapData(); sectionsEndPointMapData = RiskeerMapDataFactory.CreateFailureMechanismSectionsEndPointMapData(); assemblyResultMapLayer = new NonCalculatableFailureMechanismSectionResultsMapLayer <TSectionResult>( FailureMechanism, performAssemblyFunc); mapDataCollection.Add(referenceLineMapData); sectionsMapDataCollection.Add(sectionsMapData); sectionsMapDataCollection.Add(sectionsStartPointMapData); sectionsMapDataCollection.Add(sectionsEndPointMapData); mapDataCollection.Add(sectionsMapDataCollection); mapDataCollection.Add(assemblyResultMapLayer.MapData); mapDataCollection.Add(hydraulicBoundaryLocationsMapLayer.MapData); }
public void FromFeatureBasedMapData_WithMapPointData_ReturnsNewRemovableDataWithSameProperties() { // Setup const string name = "test"; var mapFeatures = new MapFeature[0]; Color color = Color.AliceBlue; var pointStyle = new PointStyle { Color = color, Size = 3, Symbol = PointSymbol.Diamond, StrokeColor = color, StrokeThickness = 1 }; var mapData = new MapPointData(name, pointStyle) { Features = mapFeatures }; // Call var convertedData = RemovableMapDataConverter.FromFeatureBasedMapData(mapData) as RemovableMapPointData; // Assert Assert.NotNull(convertedData); Assert.AreEqual(name, convertedData.Name); Assert.AreEqual(pointStyle, convertedData.Style); Assert.AreSame(mapFeatures, convertedData.Features); }
public void CopyToFeature_FeatureContainsMultipleGeometries_ThrowsArgumentException() { // Setup var feature = new MapFeature(new[] { new MapGeometry(new[] { Enumerable.Empty <Point2D>() }), new MapGeometry(new[] { Enumerable.Empty <Point2D>() }) }); var mapData = new MapPointData("test") { Features = new[] { feature } }; using (var writer = new PointShapeFileWriter()) { // Call TestDelegate call = () => writer.CopyToFeature(mapData); // Assert TestHelper.AssertThrowsArgumentExceptionAndTestMessage <ArgumentException>(call, "Een feature mag maar één geometrie bevatten."); } }
public void Update_MapPointDataWithTestProperties_MapPointDataLayerUpdatedAccordingly() { // Setup Color color = Color.AliceBlue; var mapPointData = new MapPointData("Test name", new PointStyle { Color = color, Size = 4, Symbol = PointSymbol.Circle, StrokeColor = color, StrokeThickness = 1 }); var mapPointDataLayer = new MapPointDataLayer(mapPointData); SetMapPointDataTestProperties(mapPointData); // Precondition AssertMapPointDataLayerDefaultProperties(mapPointDataLayer); // Call mapPointDataLayer.Update(); // Assert AssertMapPointDataLayerTestProperties(mapPointDataLayer); }
public void CopyToFeature_InconsistentMetaDataBetweenMapPointDatas_ThrowArgumentException() { // Setup MapFeature[] features1 = CreateFeatures(0.0); var mapPointData1 = new MapPointData("test data 1") { Features = features1 }; mapPointData1.Features.First().MetaData["firstKey"] = 123; mapPointData1.Features.First().MetaData["secondKey"] = "aValue"; MapFeature[] features2 = CreateFeatures(10.0); var mapPointData2 = new MapPointData("test data 2") { Features = features2 }; mapPointData2.Features.First().MetaData["firstKey"] = 123; mapPointData2.Features.First().MetaData["anotherKey"] = "anotherValue"; using (var writer = new PointShapeFileWriter()) { writer.CopyToFeature(mapPointData1); // Call TestDelegate call = () => writer.CopyToFeature(mapPointData2); // Assert const string message = "Column 'anotherKey' does not belong to table ."; TestHelper.AssertThrowsArgumentExceptionAndTestMessage <ArgumentException>(call, message); } }
public void Features_SetInvalidValue_ThrowsArgumentException(int numberOfPointCollections) { // Setup var data = new MapPointData("test data"); var invalidPointsCollections = new IEnumerable <Point2D> [numberOfPointCollections]; for (var i = 0; i < numberOfPointCollections; i++) { invalidPointsCollections[i] = CreateTestPoints(); } var features = new[] { new MapFeature(new[] { new MapGeometry(invalidPointsCollections) }) }; // Call TestDelegate test = () => data.Features = features; // Assert const string expectedMessage = "MapPointData only accepts MapFeature instances whose MapGeometries contain a single point-collection."; TestHelper.AssertThrowsArgumentExceptionAndTestMessage <ArgumentException>(test, expectedMessage); }
public void GivenMapPointDataLayer_WhenUpdatedAfterMapPointDataFeaturesChanged_MapPointDataLayerFeaturesChanged() { // Given var mapPointData = new MapPointData("Test name") { Features = new[] { CreateTestMapFeature() } }; var mapPointDataLayer = new MapPointDataLayer(mapPointData); IFeature[] drawnFeatures = mapPointDataLayer.DataSet.Features.ToArray(); // When mapPointData.Features = new[] { CreateTestMapFeature() }; mapPointDataLayer.Update(); // Then CollectionAssert.AreNotEqual(drawnFeatures, mapPointDataLayer.DataSet.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]); }
public void GivenMapLegendView_WhenSelectedNodeChanged_SelectionChangedFired() { // Given var mapData = new MapPointData("test"); var mapDataCollection = new MapDataCollection("collection"); mapDataCollection.Add(mapData); using (var view = new MapLegendView(contextMenuBuilderProvider) { Data = mapDataCollection }) { var treeViewControl = TypeUtils.GetField <TreeViewControl>(view, "treeViewControl"); WindowsFormsTestHelper.Show(treeViewControl); var selectionChangedCount = 0; view.SelectionChanged += (sender, args) => selectionChangedCount++; // When var context = new MapPointDataContext(mapData, new MapDataCollectionContext(mapDataCollection, null)); treeViewControl.TrySelectNodeForData(context); // Then Assert.AreEqual(1, selectionChangedCount); } WindowsFormsTestHelper.CloseAll(); }
public void ConvertLayerProperties_MapPointDataWithStyle_ConvertsStyleToMapPointLayer( [Values(KnownColor.AliceBlue, KnownColor.Azure)] KnownColor color, [Values(1, 5)] int width, [Values(PointSymbol.Circle, PointSymbol.Square)] PointSymbol pointStyle) { // Setup var converter = new MapPointDataConverter(); var mapPointLayer = new MapPointLayer(); Color expectedColor = Color.FromKnownColor(color); var mapPointData = new MapPointData("test", new PointStyle { Color = expectedColor, Size = width, Symbol = pointStyle, StrokeColor = expectedColor, StrokeThickness = 1 }); // Call converter.ConvertLayerProperties(mapPointData, mapPointLayer); // Assert PointShape expectedPointShape = pointStyle == PointSymbol.Circle ? PointShape.Ellipse : PointShape.Rectangle; var expectedSymbolizer = new PointSymbolizer(expectedColor, expectedPointShape, width); expectedSymbolizer.SetOutline(expectedColor, 1); AssertAreEqual(expectedSymbolizer, mapPointLayer.Symbolizer); }
public void SaveAs_ValidMapPointData_WritesShapeFile() { // Setup string directoryPath = TestHelper.GetScratchPadPath(nameof(SaveAs_ValidMapPointData_WritesShapeFile)); string filePath = Path.Combine(directoryPath, "test.shp"); const string baseName = "test"; MapFeature[] features = CreateFeatures(0.0); var mapPointData = new MapPointData("test data") { Features = features }; mapPointData.Features.First().MetaData["<some key>"] = 123; using (new DirectoryDisposeHelper(TestHelper.GetScratchPadPath(), nameof(SaveAs_ValidMapPointData_WritesShapeFile))) using (var writer = new PointShapeFileWriter()) { writer.CopyToFeature(mapPointData); // Call writer.SaveAs(filePath); // Assert string pathName = Path.Combine(directoryPath, baseName); Assert.IsTrue(File.Exists(pathName + ".shp")); Assert.IsTrue(File.Exists(pathName + ".shx")); Assert.IsTrue(File.Exists(pathName + ".dbf")); } }
public void ConvertLayerFeatures_MapPointDataWithMultipleFeatures_ConvertsEachGeometryToMapPointLayerAsSingleFeature() { // Setup var converter = new MapPointDataConverter(); var mapPointLayer = new MapPointLayer(); var mapPointData = new MapPointData("test") { Features = new[] { new MapFeature(new[] { new MapGeometry(new[] { new[] { new Point2D(1, 2) } }) }), new MapFeature(Enumerable.Empty <MapGeometry>()), new MapFeature(new[] { new MapGeometry(new[] { new[] { new Point2D(2, 3) } }) }), new MapFeature(Enumerable.Empty <MapGeometry>()), new MapFeature(new[] { new MapGeometry(new[] { new[] { new Point2D(3, 4) } }), new MapGeometry(new[] { new[] { new Point2D(5, 6) } }) }) } }; // Call converter.ConvertLayerFeatures(mapPointData, mapPointLayer); // Assert Assert.AreEqual(4, mapPointLayer.DataSet.Features.Count); }
public void Constructor_MapPointDataWithoutMapTheme_PropertiesHaveExpectedAttributesValues() { // Setup var mapPointData = new MapPointData("Test") { Features = new[] { new MapFeature(Enumerable.Empty <MapGeometry>()) }, ShowLabels = true }; // Call var properties = new MapPointDataProperties(mapPointData, Enumerable.Empty <MapDataCollection>()); // Assert PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); Assert.AreEqual(11, dynamicProperties.Count); const string styleCategory = "Stijl"; PropertyDescriptor colorProperty = dynamicProperties[colorPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(colorProperty, styleCategory, "Kleur", "De kleur van de symbolen waarmee deze kaartlaag wordt weergegeven."); PropertyDescriptor strokeColorProperty = dynamicProperties[strokeColorPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(strokeColorProperty, styleCategory, "Lijnkleur", "De kleur van de lijn van de symbolen waarmee deze kaartlaag wordt weergegeven."); PropertyDescriptor strokeThicknessProperty = dynamicProperties[strokeThicknessPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(strokeThicknessProperty, styleCategory, "Lijndikte", "De dikte van de lijn van de symbolen waarmee deze kaartlaag wordt weergegeven."); PropertyDescriptor sizeProperty = dynamicProperties[sizePropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(sizeProperty, styleCategory, "Grootte", "De grootte van de symbolen waarmee deze kaartlaag wordt weergegeven."); PropertyDescriptor symbolProperty = dynamicProperties[symbolPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(symbolProperty, styleCategory, "Symbool", "Het symbool waarmee deze kaartlaag wordt weergegeven."); }
public void CreateFailureMechanismSectionsEndPointMapData_ReturnsEmptyMapPointDataWithExpectedStyling() { // Call MapPointData data = RiskeerMapDataFactory.CreateFailureMechanismSectionsEndPointMapData(); // Assert CollectionAssert.IsEmpty(data.Features); Assert.AreEqual("Vakindeling (eindpunten)", data.Name); RiskeerMapDataFactoryTestHelper.AssertEqualStyle(data.Style, Color.DarkKhaki, 15, PointSymbol.Triangle); }
private static void SetMapPointDataTestProperties(MapPointData mapPointData) { mapPointData.Name = "Another test name"; mapPointData.IsVisible = false; mapPointData.ShowLabels = true; mapPointData.SelectedMetaDataAttribute = "Name"; mapPointData.Features = new[] { CreateTestMapFeature() }; }
public void CreateStructuresMapData_ReturnsEmptyMapPointDataWithExpectedStyling() { // Call MapPointData data = RiskeerMapDataFactory.CreateStructuresMapData(); // Assert CollectionAssert.IsEmpty(data.Features); Assert.AreEqual("Kunstwerken", data.Name); RiskeerMapDataFactoryTestHelper.AssertEqualStyle(data.Style, Color.DarkSeaGreen, 15, PointSymbol.Square); Assert.AreEqual("Naam", data.SelectedMetaDataAttribute); }
public void Constructor_Always_CreatesNewInstanceOfDefaultStyle() { // Setup var dataA = new MapPointData("test data"); // Call var dataB = new MapPointData("test data"); // Assert Assert.AreNotSame(dataA.Style, dataB.Style); }
/// <summary> /// Creates a new instance of <see cref="MapPointDataLayer"/>. /// </summary> /// <param name="mapPointData">The <see cref="MapPointData"/> which the map point data layer is based upon.</param> /// <exception cref="ArgumentNullException">Thrown when <paramref name="mapPointData"/> is <c>null</c>.</exception> public MapPointDataLayer(MapPointData mapPointData) { if (mapPointData == null) { throw new ArgumentNullException(nameof(mapPointData)); } this.mapPointData = mapPointData; Projection = MapDataConstants.FeatureBasedMapDataCoordinateSystem; Update(); }
public void CreateHydraulicBoundaryLocationsMapData_ReturnsEmptyMapPointDataWithExpectedStyling() { // Call MapPointData data = RiskeerMapDataFactory.CreateHydraulicBoundaryLocationsMapData(); // Assert CollectionAssert.IsEmpty(data.Features); Assert.AreEqual("Hydraulische belastingen", data.Name); Assert.IsTrue(data.ShowLabels); RiskeerMapDataFactoryTestHelper.AssertEqualStyle(data.Style, Color.DarkBlue, 6, PointSymbol.Circle); Assert.AreEqual("Naam", data.SelectedMetaDataAttribute); }
public void ConvertLayerProperties_MapPointDataWithThemeAndMetaDataNameNotInFeatures_OnlyAddsDefaultCategory() { // Setup const string metadataAttribute = "Meta"; var random = new Random(21); var theme = new MapTheme <PointCategoryTheme>("Other Meta", new[] { new PointCategoryTheme(ValueCriterionTestFactory.CreateValueCriterion(), new PointStyle { Color = Color.FromKnownColor(random.NextEnum <KnownColor>()), Size = random.Next(1, 48), Symbol = random.NextEnum <PointSymbol>(), StrokeColor = Color.FromKnownColor(random.NextEnum <KnownColor>()), StrokeThickness = random.Next(1, 48) }) }); var pointStyle = new PointStyle { Color = Color.FromKnownColor(random.NextEnum <KnownColor>()), Size = random.Next(1, 48), Symbol = random.NextEnum <PointSymbol>(), StrokeColor = Color.FromKnownColor(random.NextEnum <KnownColor>()), StrokeThickness = random.Next(1, 48) }; var mapPointData = new MapPointData("test", pointStyle, theme) { Features = new[] { CreateMapFeatureWithMetaData(metadataAttribute) } }; var mapPointLayer = new MapPointLayer(); var converter = new MapPointDataConverter(); // Call converter.ConvertLayerProperties(mapPointData, mapPointLayer); // Assert PointSymbolizer expectedSymbolizer = CreateExpectedSymbolizer(pointStyle); IPointScheme appliedScheme = mapPointLayer.Symbology; Assert.AreEqual(1, appliedScheme.Categories.Count); IPointCategory baseCategory = appliedScheme.Categories[0]; AssertAreEqual(expectedSymbolizer, baseCategory.Symbolizer); Assert.IsNull(baseCategory.FilterExpression); }