コード例 #1
0
        internal override RenderableObject GetLayer()
        {
            if (m_blnIsChanged)
            {
                string strExt       = ".png";
                string strCachePath = GetCachePath();
                System.IO.Directory.CreateDirectory(strCachePath);

                string imageFormat = "image/png";
                if (m_wmsLayer.ImageFormats != null)
                {
                    foreach (string curFormat in m_wmsLayer.ImageFormats)
                    {
                        if (string.Compare(curFormat, "image/png", true, System.Globalization.CultureInfo.InvariantCulture) == 0)
                        {
                            imageFormat = curFormat;
                            break;
                        }
                        if (string.Compare(curFormat, "image/jpeg", true, System.Globalization.CultureInfo.InvariantCulture) == 0 ||
                            String.Compare(curFormat, "image/jpg", true, System.Globalization.CultureInfo.InvariantCulture) == 0)
                        {
                            imageFormat = curFormat;
                        }
                    }
                }
                if (string.Compare(imageFormat, "image/jpeg", true, System.Globalization.CultureInfo.InvariantCulture) == 0 ||
                    string.Compare(imageFormat, "image/jpg", true, System.Globalization.CultureInfo.InvariantCulture) == 0)
                {
                    strExt = ".jpg";
                }

                WmsImageStoreDapple[] imageStores = new WmsImageStoreDapple[1];
                imageStores[0] = new WmsImageStoreDapple(imageFormat, m_wmsLayer.ParentWMSList.ServerGetMapUrl,
                                                         m_wmsLayer.ParentWMSList.Version, m_wmsLayer.Name, string.Empty, m_wmsLayer.SRS, m_wmsLayer.CRS);
                imageStores[0].DataDirectory            = null;
                imageStores[0].LevelZeroTileSizeDegrees = LevelZeroTileSize;
                imageStores[0].LevelCount        = m_iLevels;
                imageStores[0].ImageExtension    = strExt;
                imageStores[0].CacheDirectory    = strCachePath;
                imageStores[0].TextureSizePixels = TextureSizePixels;

                m_oQuadTileSet = new QuadTileSet(m_szTreeNodeText, m_oWorldWindow.CurrentWorld, distAboveSurface,
                                                 (double)m_wmsLayer.North, (double)m_wmsLayer.South, (double)m_wmsLayer.West, (double)m_wmsLayer.East,
                                                 true, imageStores);
                m_oQuadTileSet.AlwaysRenderBaseTiles = true;
                m_oQuadTileSet.IsOn    = m_IsOn;
                m_oQuadTileSet.Opacity = m_bOpacity;
                m_blnIsChanged         = false;
            }
            return(m_oQuadTileSet);
        }
コード例 #2
0
        internal override RenderableObject GetLayer()
        {
            if (m_blnIsChanged)
             {
            string strExt = ".png";
                string strCachePath = GetCachePath();
            System.IO.Directory.CreateDirectory(strCachePath);

            string imageFormat = "image/png";
            if (m_wmsLayer.ImageFormats != null)
            {
               foreach (string curFormat in m_wmsLayer.ImageFormats)
               {
                  if (string.Compare(curFormat, "image/png", true, System.Globalization.CultureInfo.InvariantCulture) == 0)
                  {
                     imageFormat = curFormat;
                     break;
                  }
                  if (string.Compare(curFormat, "image/jpeg", true, System.Globalization.CultureInfo.InvariantCulture) == 0 ||
                    String.Compare(curFormat, "image/jpg", true, System.Globalization.CultureInfo.InvariantCulture) == 0)
                  {
                     imageFormat = curFormat;
                  }
               }
            }
            if (string.Compare(imageFormat, "image/jpeg", true, System.Globalization.CultureInfo.InvariantCulture) == 0 ||
               string.Compare(imageFormat, "image/jpg", true, System.Globalization.CultureInfo.InvariantCulture) == 0)
               strExt = ".jpg";

            WmsImageStoreDapple[] imageStores = new WmsImageStoreDapple[1];
            imageStores[0] = new WmsImageStoreDapple(imageFormat, m_wmsLayer.ParentWMSList.ServerGetMapUrl,
               m_wmsLayer.ParentWMSList.Version, m_wmsLayer.Name, string.Empty, m_wmsLayer.SRS, m_wmsLayer.CRS);
            imageStores[0].DataDirectory = null;
            imageStores[0].LevelZeroTileSizeDegrees = LevelZeroTileSize;
            imageStores[0].LevelCount = m_iLevels;
            imageStores[0].ImageExtension = strExt;
            imageStores[0].CacheDirectory = strCachePath;
            imageStores[0].TextureSizePixels = TextureSizePixels;

            m_oQuadTileSet = new QuadTileSet(m_szTreeNodeText, m_oWorldWindow.CurrentWorld, distAboveSurface,
               (double)m_wmsLayer.North, (double)m_wmsLayer.South, (double)m_wmsLayer.West, (double)m_wmsLayer.East,
               true, imageStores);
            m_oQuadTileSet.AlwaysRenderBaseTiles = true;
            m_oQuadTileSet.IsOn = m_IsOn;
            m_oQuadTileSet.Opacity = m_bOpacity;
            m_blnIsChanged = false;
             }
             return m_oQuadTileSet;
        }