Ejemplo n.º 1
0
        public int CompareTo(object obj)
        {
            if (!(obj is SurfaceImage))
            {
                return(1);
            }

            SurfaceImage robj = obj as SurfaceImage;

            string parentRenderableZOrderString = this.getZOrderStringFromIRenderable(this.m_ParentRenderable);
            string objectRenderableZOrderString = this.getZOrderStringFromIRenderable(robj.ParentRenderable);

            if (parentRenderableZOrderString == objectRenderableZOrderString)
            {
                double parentSourceRange = this.m_North - this.m_South;
                parentSourceRange = 1.0 / parentSourceRange;
                double objectSourceRange = robj.North - robj.South;
                objectSourceRange = 1.0 / objectSourceRange;

                return(parentSourceRange.CompareTo(objectSourceRange));
            }
            else
            {
                return(parentRenderableZOrderString.CompareTo(objectRenderableZOrderString));
            }
        }
        public void RemoveSurfaceImage(string imageResource)
        {
            try
            {
                lock (m_SurfaceImages.SyncRoot)
                {
                    for (int i = 0; i < m_SurfaceImages.Count; i++)
                    {
                        SurfaceImage current = m_SurfaceImages[i] as SurfaceImage;
                        if (current != null && current.ImageFilePath == imageResource)
                        {
                            m_SurfaceImages.RemoveAt(i);
                            break;
                        }
                    }

                    m_SurfaceImages.Sort();
                }
                LastChange = System.DateTime.Now;
            }
            catch (System.Threading.ThreadAbortException)
            {
            }
            catch (Exception ex)
            {
                Log.DebugWrite(ex);
            }
        }
Ejemplo n.º 3
0
        public void AddSurfaceImage(SurfaceImage surfaceImage)
        {
            if (surfaceImage.ImageTexture != null)
            {
                lock (m_SurfaceImages.SyncRoot) {
                    m_SurfaceImages.Add(surfaceImage);
                    m_SurfaceImages.Sort();
                }

                LastChange = DateTime.Now;
            }
            else
            {
                lock (m_TextureLoadQueue.SyncRoot) {
                    m_TextureLoadQueue.Enqueue(surfaceImage);
                }
            }
        }
        public void RenderSurfaceImages(DrawArgs drawArgs)
        {
            if (this.m_Rts == null)
            {
                drawArgs.device.DeviceReset += new EventHandler(OnDeviceReset);
                OnDeviceReset(drawArgs.device, null);
            }
            if (!m_Initialized)
            {
                return;
            }

            if (m_TextureLoadQueue.Count > 0)
            {
                SurfaceImage si = m_TextureLoadQueue.Dequeue() as SurfaceImage;
                if (si != null)
                {
                    si.ImageTexture = ImageHelper.LoadTexture(si.ImageFilePath);

                    lock (this.m_SurfaceImages.SyncRoot)
                    {
                        m_SurfaceImages.Add(si);
                        m_SurfaceImages.Sort();
                    }
                }
                drawArgs.TexturesLoadedThisFrame++;
            }

            NumberTilesUpdated = 0;
            foreach (SurfaceTile tile in m_RootSurfaceTiles)
            {
                if (tile != null)
                {
                    tile.Render(drawArgs);
                }
            }
        }
Ejemplo n.º 5
0
		/// <summary>
		/// Cleanup when layer is disabled
		/// </summary>
		public override void Dispose()
		{
			this.isInitialized = false;

			if(this.downloadThread != null)
			{
				if(this.downloadThread.IsAlive)
				{
                    this.downloadThread.Abort();
				}

                this.downloadThread = null;
			}

			if(this.m_SurfaceImage != null)
			{
                this.m_ParentWorld.WorldSurfaceRenderer.RemoveSurfaceImage(this.m_SurfaceImage.ImageFilePath);
                this.m_SurfaceImage = null;
			}
			if (this.texture!=null)
			{
				this.texture.Dispose();
				this.texture = null;
			}

			if(this.legendControl != null)
			{
                this.legendControl.Dispose();
                this.legendControl = null;
			}

			if(this.refreshTimer != null && this.refreshTimer.Enabled)
			{
                this.refreshTimer.Stop();
                this.refreshTimer = null;
			}
		}
Ejemplo n.º 6
0
        public void AddSurfaceImage(SurfaceImage surfaceImage)
        {
            if (surfaceImage.ImageTexture != null) {
                lock (m_SurfaceImages.SyncRoot) {
                    m_SurfaceImages.Add(surfaceImage);
                    m_SurfaceImages.Sort();
                }

                LastChange = DateTime.Now;
            }
            else {
                lock (m_TextureLoadQueue.SyncRoot) {
                    m_TextureLoadQueue.Enqueue(surfaceImage);
                }
            }
        }
Ejemplo n.º 7
0
        private Vector2 GetTextureCoordinate(SurfaceImage surfaceImage, double latitude, double longitude)
        {
            double deltaLat = surfaceImage.North - latitude;
            double deltaLon = longitude - surfaceImage.West;

            double latRange = surfaceImage.North - surfaceImage.South;
            double lonRange = surfaceImage.East - surfaceImage.West;

            Vector2 v = new Vector2((float) (deltaLat/latRange), (float) (deltaLon/lonRange));

            return v;
        }