示例#1
0
        public bool Read(ref Array extent, string data, int width, int height, IAgStkGraphicsPluginCustomImageGlobeOverlayContext contextStrat)
        {
            if (width != m_tiler.GetRootTile().Width || height != m_tiler.GetRootTile().Height)
            {
                return(false);
            }

            bool goodRead = false;

            try
            {
                string queryUrl = string.Concat(m_server, "/", data, ".png");

                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(queryUrl);
                request.Method    = "GET";
                request.UserAgent = "Insight/1.0";
                request.Timeout   = 10000;

                using (WebResponse response = request.GetResponse())
                {
                    if (response != null)
                    {
                        using (Bitmap bmp = new Bitmap(response.GetResponseStream()))
                        {
                            IntPtr hBitmap = bmp.GetHbitmap();
                            contextStrat.RasterAsBitmap.SetBitmap(hBitmap);
                            DeleteObject(hBitmap);

                            goodRead = true;
                        }
                    }
                }
            }
            catch (WebException)
            {
            }

            return(goodRead);
        }
示例#2
0
 void IAgStkGraphicsPluginCustomImageGlobeOverlay.OnUninitialize(object pScene, IAgStkGraphicsPluginCustomImageGlobeOverlayContext pContext)
 {
 }
示例#3
0
 void IAgStkGraphicsPluginCustomImageGlobeOverlay.OnInitialize(object pScene, IAgStkGraphicsPluginCustomImageGlobeOverlayContext pContext)
 {
     pContext.Extent     = m_extent;
     pContext.Projection = m_projection;
     pContext.Tiler      = m_tiler;
 }