Example #1
0
 private void Configure()
 {
     _categories = new LineCategoryCollection();
     InitializeCategories();
 }
Example #2
0
 /// <summary>
 /// Handle the event un-wiring and scheme update for the old categories
 /// </summary>
 /// <param name="categories">The category collection to update.</param>
 protected virtual void OnExcludeCategories(LineCategoryCollection categories)
 {
     if (categories == null) return;
     categories.Scheme = null;
     categories.ItemChanged -= CategoriesItemChanged;
     categories.SelectFeatures -= OnSelectFeatures;
 }
Example #3
0
 /// <summary>
 /// Handle the event wiring and scheme update for the new categories.
 /// </summary>
 /// <param name="categories">The category collection to update</param>
 protected virtual void OnIncludeCategories(LineCategoryCollection categories)
 {
     if (categories == null) return;
     categories.Scheme = this;
     categories.ItemChanged += CategoriesItemChanged;
     categories.SelectFeatures += OnSelectFeatures;
 }
Example #4
0
        public void GivenMapLayerWithScheme_WhenConvertingLayerFeatures_ThenClearsAppliedSchemeAndAppliesDefaultCategory()
        {
            // Given
            var mocks       = new MockRepository();
            var categoryOne = mocks.Stub <ILineCategory>();
            var categoryTwo = mocks.Stub <ILineCategory>();

            mocks.ReplayAll();

            var mapLineLayer = new MapLineLayer
            {
                Symbology = new LineScheme
                {
                    Categories =
                    {
                        categoryOne,
                        categoryTwo
                    }
                }
            };

            var converter = new MapLineDataConverter();

            var random    = new Random(21);
            var lineStyle = new LineStyle
            {
                Color     = Color.FromKnownColor(random.NextEnum <KnownColor>()),
                Width     = random.Next(1, 48),
                DashStyle = random.NextEnum <LineDashStyle>()
            };
            var theme = new MapTheme <LineCategoryTheme>("Meta", new[]
            {
                new LineCategoryTheme(ValueCriterionTestFactory.CreateValueCriterion(),
                                      new LineStyle
                {
                    Color     = Color.FromKnownColor(random.NextEnum <KnownColor>()),
                    Width     = random.Next(1, 48),
                    DashStyle = random.NextEnum <LineDashStyle>()
                })
            });

            var mapLineData = new MapLineData("test", lineStyle, theme)
            {
                Features = new[]
                {
                    CreateMapFeatureWithMetaData("Meta")
                }
            };

            // When
            converter.ConvertLayerFeatures(mapLineData, mapLineLayer);

            // Then
            LineCategoryCollection categoryCollection = mapLineLayer.Symbology.Categories;

            Assert.AreEqual(1, categoryCollection.Count);

            ILineSymbolizer expectedSymbolizer = CreateExpectedSymbolizer(lineStyle);

            AssertAreEqual(expectedSymbolizer, categoryCollection.Single().Symbolizer);

            mocks.VerifyAll();
        }