public void Update(DrawArgs drawArgs) { try { double centerLatitude = 0.5 * (m_GeoBB.North + m_GeoBB.South); double centerLongitude = 0.5 * (m_GeoBB.West + m_GeoBB.East); double tileSize = m_GeoBB.North - m_GeoBB.South; if (!m_Initialized) { if (drawArgs.WorldCamera.ViewRange * 0.5f < Angle.FromDegrees(ShapeTileArgs.TileDrawDistance * tileSize) && MathEngine.SphericalDistance(Angle.FromDegrees(centerLatitude), Angle.FromDegrees(centerLongitude), drawArgs.WorldCamera.Latitude, drawArgs.WorldCamera.Longitude) < Angle.FromDegrees(ShapeTileArgs.TileSpreadFactor * tileSize * 1.25f) && drawArgs.WorldCamera.ViewFrustum.Intersects(BoundingBox) ) { Initialize(drawArgs); } } if (m_Initialized) { if (m_NwImageLayer != null) { m_NwImageLayer.Update(drawArgs); } if (m_NeImageLayer != null) { m_NeImageLayer.Update(drawArgs); } if (m_SwImageLayer != null) { m_SwImageLayer.Update(drawArgs); } if (m_SeImageLayer != null) { m_SeImageLayer.Update(drawArgs); } if ( drawArgs.WorldCamera.ViewRange < Angle.FromDegrees(ShapeTileArgs.TileDrawDistance * tileSize) && MathEngine.SphericalDistance(Angle.FromDegrees(centerLatitude), Angle.FromDegrees(centerLongitude), drawArgs.WorldCamera.Latitude, drawArgs.WorldCamera.Longitude) < Angle.FromDegrees(ShapeTileArgs.TileSpreadFactor * tileSize) && drawArgs.WorldCamera.ViewFrustum.Intersects(BoundingBox) ) { if (m_NorthEastChild == null && m_NorthWestChild == null && m_SouthEastChild == null && m_SouthWestChild == null) { ComputeChildren(drawArgs); } else { if (m_NorthEastChild != null) { m_NorthEastChild.Update(drawArgs); } if (m_NorthWestChild != null) { m_NorthWestChild.Update(drawArgs); } if (m_SouthEastChild != null) { m_SouthEastChild.Update(drawArgs); } if (m_SouthWestChild != null) { m_SouthWestChild.Update(drawArgs); } } } else { if (m_NorthWestChild != null) { m_NorthWestChild.Dispose(); m_NorthWestChild = null; } if (m_NorthEastChild != null) { m_NorthEastChild.Dispose(); m_NorthEastChild = null; } if (m_SouthEastChild != null) { m_SouthEastChild.Dispose(); m_SouthEastChild = null; } if (m_SouthWestChild != null) { m_SouthWestChild.Dispose(); m_SouthWestChild = null; } } } if (m_Initialized) { if (drawArgs.WorldCamera.ViewRange > Angle.FromDegrees(ShapeTileArgs.TileDrawDistance * tileSize * 1.5f) || MathEngine.SphericalDistance(Angle.FromDegrees(centerLatitude), Angle.FromDegrees(centerLongitude), drawArgs.WorldCamera.Latitude, drawArgs.WorldCamera.Longitude) > Angle.FromDegrees(ShapeTileArgs.TileSpreadFactor * tileSize * 1.5f)) { //if(this.level != 0) //{ Dispose(); //} } } } catch (Exception ex) { Utility.Log.Write(ex); } }
public void Update(DrawArgs drawArgs) { try { double centerLatitude = 0.5 * (this.m_geographicBoundingBox.North + this.m_geographicBoundingBox.South); double centerLongitude = 0.5 * (this.m_geographicBoundingBox.West + this.m_geographicBoundingBox.East); double tileSize = this.m_geographicBoundingBox.North - this.m_geographicBoundingBox.South; if (!this.m_Initialized) { if (drawArgs.WorldCamera.ViewRange * 0.5f < Angle.FromDegrees(ShapeTileArgs.TileDrawDistance * tileSize) && MathEngine.SphericalDistance(Angle.FromDegrees(centerLatitude), Angle.FromDegrees(centerLongitude), drawArgs.WorldCamera.Latitude, drawArgs.WorldCamera.Longitude) < Angle.FromDegrees(ShapeTileArgs.TileSpreadFactor * tileSize * 1.25f) && drawArgs.WorldCamera.ViewFrustum.Intersects(this.BoundingBox) ) { this.Initialize(drawArgs); } } if (this.m_Initialized) { if (this.m_LastUpdate < this.m_parentProjectedLayer.LastUpdate) { this.UpdateImageLayers(drawArgs); } if (this.m_NwImageLayer != null) { this.m_NwImageLayer.Update(drawArgs); } if (this.m_NeImageLayer != null) { this.m_NeImageLayer.Update(drawArgs); } if (this.m_SwImageLayer != null) { this.m_SwImageLayer.Update(drawArgs); } if (this.m_SeImageLayer != null) { this.m_SeImageLayer.Update(drawArgs); } if ( drawArgs.WorldCamera.ViewRange < Angle.FromDegrees(ShapeTileArgs.TileDrawDistance * tileSize) && MathEngine.SphericalDistance(Angle.FromDegrees(centerLatitude), Angle.FromDegrees(centerLongitude), drawArgs.WorldCamera.Latitude, drawArgs.WorldCamera.Longitude) < Angle.FromDegrees(ShapeTileArgs.TileSpreadFactor * tileSize) && drawArgs.WorldCamera.ViewFrustum.Intersects(this.BoundingBox) ) { if (this.m_NorthEastChild == null && this.m_NorthWestChild == null && this.m_SouthEastChild == null && this.m_SouthWestChild == null) { this.ComputeChildren(drawArgs); } else { if (this.m_NorthEastChild != null) { this.m_NorthEastChild.Update(drawArgs); } if (this.m_NorthWestChild != null) { this.m_NorthWestChild.Update(drawArgs); } if (this.m_SouthEastChild != null) { this.m_SouthEastChild.Update(drawArgs); } if (this.m_SouthWestChild != null) { this.m_SouthWestChild.Update(drawArgs); } } } else { if (this.m_NorthWestChild != null) { this.m_NorthWestChild.Dispose(); this.m_NorthWestChild = null; } if (this.m_NorthEastChild != null) { this.m_NorthEastChild.Dispose(); this.m_NorthEastChild = null; } if (this.m_SouthEastChild != null) { this.m_SouthEastChild.Dispose(); this.m_SouthEastChild = null; } if (this.m_SouthWestChild != null) { this.m_SouthWestChild.Dispose(); this.m_SouthWestChild = null; } } } if (this.m_Initialized) { if (drawArgs.WorldCamera.ViewRange > Angle.FromDegrees(ShapeTileArgs.TileDrawDistance * tileSize * 1.5f) || MathEngine.SphericalDistance(Angle.FromDegrees(centerLatitude), Angle.FromDegrees(centerLongitude), drawArgs.WorldCamera.Latitude, drawArgs.WorldCamera.Longitude) > Angle.FromDegrees(ShapeTileArgs.TileSpreadFactor * tileSize * 1.5f)) { if (this.Level != 0) { //{ this.Dispose(); } //} } } } catch (Exception ex) { Log.Write(ex); } }