Example #1
0
        private void AddTiledLayer(WMS_Tile_ServiceTiledPatternsTiledGroup tileGroup)
        {
            string tilePatern = GetPattern(tileGroup.TilePattern[0].Value);

            double degrees = GetLngDegrees(tilePatern);

            foreach (WMS_Tile_ServiceTiledPatternsTiledGroupTilePattern pat in tileGroup.TilePattern)
            {
                double deg = GetLngDegrees(pat.Value);

                if (deg < degrees)
                {
                    degrees = deg;
                }
            }



            double baseTileDegrees = degrees;
            int    totalLevels     = -1;

            while (baseTileDegrees < 180)
            {
                totalLevels++;
                baseTileDegrees *= 2;
            }


            string url       = serviceUrl + FillBoundingBoxUrl(tilePatern.Replace("&time=${time}", ""));
            int    baseLevel = 3;

            //if (tileGroup.TilePattern.Length > totalLevels)
            {
                //     baseLevel = (totalLevels +8) - tileGroup.TilePattern.Length;
            }


            string imageType  = ".png";
            double meanRadius = 300000000; //todo

            string referenceFrame = LayerManager.CurrentMap;

            string thumbUrl = "http://www.worldwidetelescope.org/wwtweb/thumbnail.aspx?name=" + referenceFrame;

            ImageSetHelper ish = new ImageSetHelper(tileGroup.Title, url, ImageSetType.Planet, BandPass.Visible, ProjectionType.Equirectangular, (int)(uint)url.GetHashCode32(), baseLevel, totalLevels, 512, baseTileDegrees, imageType, true, "", 0, 0, 0, false, thumbUrl, false, false, 1, 0, 0, tileGroup.Abstract, "", "", "", meanRadius, referenceFrame);

            if (AddAsLayer.Checked == false)
            {
                Earth3d.MainWindow.CurrentImageSet = ish;
            }
            else
            {
                ImageSetLayer layer = new ImageSetLayer(ish);
                layer.Enabled        = true;
                layer.Name           = tileGroup.Title;
                layer.ReferenceFrame = LayerManager.CurrentMap;

                LayerManager.Add(layer, true);
            }
        }
Example #2
0
        private void AddTiledLayer(WMS.Layer wmsLayer, WMS.Style style)
        {
            double baseTileDegrees = 180;
            int    totalLevels     = 12;

            string styles = style != null ? style.Name : "";

            string url = FillBoundingBoxUrl(MakeWmsGetMapUrl(wmsLayer.Name, styles, 0, 0, 0, 0, 256, 256, "", ""));

            int baseLevel = 1;


            string imageType  = ".png";
            double meanRadius = 300000000; //todo

            string referenceFrame = LayerManager.CurrentMap;

            string thumbUrl = "http://www.worldwidetelescope.org/wwtweb/thumbnail.aspx?name=" + referenceFrame;

            ImageSetHelper ish = new ImageSetHelper(wmsLayer.Title, url, ImageSetType.Planet, BandPass.Visible, ProjectionType.Equirectangular, (int)(uint)url.GetHashCode32(), baseLevel, totalLevels, 512, baseTileDegrees, imageType, true, "", 0, 0, 0, false, thumbUrl, false, false, 1, 0, 0, wmsLayer.Abstract, "", "", "", meanRadius, referenceFrame);

            if (AddAsLayer.Checked == false)
            {
                Earth3d.MainWindow.CurrentImageSet = ish;
            }
            else
            {
                ImageSetLayer layer = new ImageSetLayer(ish);
                layer.Enabled        = true;
                layer.Name           = wmsLayer.Title;
                layer.ReferenceFrame = LayerManager.CurrentMap;

                LayerManager.Add(layer, true);
            }
        }
        private void AddTiledLayer(WMS.Layer wmsLayer, Style style)
        {
            double baseTileDegrees = 180;
            var totalLevels = 12;

            var styles = style != null ? style.Name : "";

            var url = FillBoundingBoxUrl(MakeWmsGetMapUrl(wmsLayer.Name, styles, 0, 0, 0, 0, 256, 256, "", ""));

            var baseLevel = 1;

            var imageType = ".png";
            double meanRadius = 300000000; //todo

            var referenceFrame = LayerManager.CurrentMap;

            var thumbUrl = "http://www.worldwidetelescope.org/wwtweb/thumbnail.aspx?name=" + referenceFrame;

            var ish = new ImageSetHelper(wmsLayer.Title, url, ImageSetType.Planet, BandPass.Visible, ProjectionType.Equirectangular, (int)(uint)url.GetHashCode32(), baseLevel, totalLevels, 512, baseTileDegrees, imageType, true, "", 0, 0, 0, false, thumbUrl, false, false, 1, 0, 0, wmsLayer.Abstract, "", "", "", meanRadius, referenceFrame);

            if (AddAsLayer.Checked == false)
            {
                Earth3d.MainWindow.CurrentImageSet = ish;
            }
            else
            {
                var layer = new ImageSetLayer(ish);
                layer.Enabled = true;
                layer.Name = wmsLayer.Title;
                layer.ReferenceFrame = LayerManager.CurrentMap;

                LayerManager.Add(layer, true);
            }
        }
        private void AddTiledLayer(WMS_Tile_ServiceTiledPatternsTiledGroup tileGroup)
        {
            var tilePatern = GetPattern(tileGroup.TilePattern[0].Value);

            var degrees = GetLngDegrees(tilePatern);

            foreach(var pat in tileGroup.TilePattern)
            {
                var deg = GetLngDegrees(pat.Value);

                if (deg < degrees)
                {
                    degrees = deg;
                }
            }

            var baseTileDegrees = degrees;
            var totalLevels = -1;

            while (baseTileDegrees < 180)
            {
                totalLevels++;
                baseTileDegrees *= 2;
            }

            var url = serviceUrl + FillBoundingBoxUrl(tilePatern.Replace("&time=${time}",""));
            var baseLevel = 3;

            //if (tileGroup.TilePattern.Length > totalLevels)
            {
               //     baseLevel = (totalLevels +8) - tileGroup.TilePattern.Length;
            }

            var imageType = ".png";
            double meanRadius = 300000000; //todo

            var referenceFrame = LayerManager.CurrentMap;

            var thumbUrl = "http://www.worldwidetelescope.org/wwtweb/thumbnail.aspx?name=" + referenceFrame;

            var ish = new ImageSetHelper(tileGroup.Title, url, ImageSetType.Planet, BandPass.Visible, ProjectionType.Equirectangular, (int)(uint)url.GetHashCode32(), baseLevel, totalLevels, 512, baseTileDegrees, imageType, true,"", 0, 0, 0, false, thumbUrl, false, false, 1, 0, 0, tileGroup.Abstract, "", "", "", meanRadius, referenceFrame);

            if (AddAsLayer.Checked == false)
            {
                Earth3d.MainWindow.CurrentImageSet = ish;
            }
            else
            {
                var layer = new ImageSetLayer(ish);
                layer.Enabled = true;
                layer.Name = tileGroup.Title;
                layer.ReferenceFrame = LayerManager.CurrentMap;

                LayerManager.Add(layer, true);
            }
        }
 internal static Layer AddImagesetLayer(IImageSet imageSet)
 {
     if (!string.IsNullOrEmpty(CurrentMap))
     {
         ImageSetLayer layer = new ImageSetLayer(imageSet);
         layer.Name = imageSet.Name;
         LayerList.Add(layer.ID, layer);
         layer.ReferenceFrame = CurrentMap;
         AllMaps[CurrentMap].Layers.Add(layer);
         AllMaps[CurrentMap].Open = true;
         LoadTree();
         version++;
         return layer;
     }
     return null;
 }