private void MapControl_Loaded(object sender, RoutedEventArgs e)
        {
            mapControl.MapUnit = GeoUnit.Meter;

            baseOverlay = new LayerOverlay();
            CssDocument doc = CssDocument.Load(@"SampleData/Default.sgcss");

            baseOverlay.LoadStyledLayers("SampleData", doc);
            mapControl.Overlays.Add(baseOverlay);

            buildingOverlay   = new LayerOverlay();
            altitudeFillStyle = new AltitudeFillStyle(GeoColor.FromHtml("#E6E1DF"), GeoColor.FromHtml("#80D3CDCA"), 1);
            altitudeFillStyle.AltitudeUnit = LengthUnit.Meter;

            ShapefileLayer buildingsLayer = new ShapefileLayer(@"SampleData/Buildings.shp");

            buildingsLayer.Styles.Add(altitudeFillStyle);
            buildingOverlay.Layers.Add(buildingsLayer);

            ShapefileLayer stadiumLayer = new ShapefileLayer(@"SampleData/Stadium.shp");

            stadiumLayer.Styles.Add(altitudeFillStyle);
            buildingOverlay.Layers.Add(stadiumLayer);

            mapControl.Overlays.Add(buildingOverlay);
            mapControl.CurrentBound = new GeoBound(11586390.5663, 3584893.2152, 11586849.1885, 3585104.8502);
            mapControl.Refresh();

            directionComboBox.SelectedIndex = 2;
            altitudeComboBox.SelectedIndex  = 0;
        }
Beispiel #2
0
        CssDocument Validate(string source)
        {
            CssDocument doc = CssDocument.Load(source);

            if (doc != null && doc.Rules != null && doc.Rules.Count > 0)
            {
                Validate(doc.Rules);
            }
            return(doc);
        }
Beispiel #3
0
        public ActionResult Index()
        {
            var fileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "content\\easyui-icon.css");
            var doc      = new CssDocument();

            doc.Load(fileName);
            var names = doc.Elements.Select(s => new { Name = s.Name.Substring(1) }).ToArray();

            ViewBag.Icons = new JsonSerializer().Serialize(names);
            return(View());
        }
Beispiel #4
0
 void Reset()
 {
     cssDocument = new CssDocument();
     _currentAtMedia = new CssAtMedia();
     cssDocument.Add(_currentAtMedia);
     _mediaStack.Clear();
     this._currentSelectorAttr = null;
     this._currentSelectorExpr = null;
     this._currentProperty = null;
     this._latestPropertyValue = null;
 }
Beispiel #5
0
        public IActionResult Get(string theme, int z, int x, int y)
        {
            string      themeFilename = char.ToUpper(theme[0]) + theme.Substring(1);
            CssDocument cssDoc        = CssDocument.Load($@"Themes\{themeFilename}Theme.sgcss");
            LayerGroup  layerGroup    = new LayerGroup();

            layerGroup.LoadStyledLayers("AppData", cssDoc);

            MapModel tempMapModel = new MapModel(GeoUnit.Meter);

            tempMapModel.Layers.AddRange(layerGroup.Layers);
            return(new XyzTileResult(tempMapModel, x, y, z));
        }
        private void LoadFromCss(LayerOverlay overlay, string css)
        {
            CssDocument doc = CssDocument.Parse(css);

            overlay.LoadStyledLayers("AppData", doc);

            GeoSolidBrush background = doc.Styles.First().FillBrush as GeoSolidBrush;

            if (background != null)
            {
                Map1.Background = new SolidColorBrush(Color.FromArgb(background.Color.Alpha, background.Color.Red, background.Color.Green, background.Color.Blue));
            }
        }
        public string Process(string html)
        {
            var htmlDocument = new LinqIt.Parsing.Html.HtmlDocument(html);
            var css = ExtractCss(htmlDocument);
            _cssDocument = new CssDocument(css);

            BackupStyles(htmlDocument);

            var bodyTag = ExtractBodyTag(htmlDocument);
            Process(bodyTag);

            OverwriteWithBackupStyles();

            return htmlDocument.ToString();
        }
Beispiel #8
0
 public CssDocument Process(CssDocument document)
 {
     document.Elements = MergeElements(document.Elements).ToList();
     return document;
 }