Exemple #1
0
        private bool insertGeoserverStyle(GeoserverClient client, string username, ColorMap colorMap)
        {
            StylesBuilder stylesBuilder =
                new StylesBuilder(username + '_' + colorMap.Name, colorMap.Name);

            foreach (var intervalRule in colorMap.GetRules())
            {
                stylesBuilder.AddRule(intervalRule);
            }

            return(client.Post(new ModulesFactory().CreateStylesModule(stylesBuilder)));
        }
Exemple #2
0
        public void ColorMapStyle()
        {
            ColorMap colorMap = new ColorMap()
            {
                Name      = "checking",
                Intervals = new List <Interval>()
                {
                    new Interval()
                    {
                        Color = "#FF0000",
                        Left  = -100,
                        Right = 0
                    },
                    new Interval()
                    {
                        Color = "#00FF00",
                        Left  = 0,
                        Right = 100
                    }
                }
            };


            StylesBuilder builder = new StylesBuilder("colormap51", "colormap51");

            foreach (var rule in colorMap.GetRules())
            {
                builder.AddRule(rule);
            }

            ModulesFactory modulesFactory = new ModulesFactory();


            GeoserverClient geoserverClient = new GeoserverClient("http://localhost:8080", "admin", "geoserver");


            var result = geoserverClient.Post(modulesFactory.CreateStylesModule(builder));

            Assert.IsTrue(result);
        }