Ejemplo n.º 1
0
        private ProjectedVectorTile ComputeChild(DrawArgs drawArgs, double childSouth, double childNorth, double childWest, double childEast, double tileSize)
        {
            ProjectedVectorTile child = new ProjectedVectorTile(
                new GeographicBoundingBox(childNorth, childSouth, childWest, childEast), this.m_parentProjectedLayer);

            return(child);
        }
        public virtual void ComputeChildren(DrawArgs drawArgs)
        {
            float tileSize = (float)(0.5 * (m_geographicBoundingBox.North - m_geographicBoundingBox.South));

            //TODO: Stop children computation at some lower level
            if (tileSize > 0.0001)
            {
                double CenterLat = 0.5f * (m_geographicBoundingBox.North + m_geographicBoundingBox.South);
                double CenterLon = 0.5f * (m_geographicBoundingBox.East + m_geographicBoundingBox.West);

                if (m_NorthWestChild == null && m_NwImageLayer != null && m_Initialized)
                {
                    m_NorthWestChild       = ComputeChild(drawArgs, CenterLat, m_geographicBoundingBox.North, m_geographicBoundingBox.West, CenterLon, tileSize);
                    m_NorthWestChild.Level = Level++;
                    m_NorthWestChild.Row   = 2 * Row + 1;
                    m_NorthWestChild.Col   = 2 * Col;

                    m_NorthWestChild.Initialize(drawArgs);
                }

                if (m_NorthEastChild == null && m_NeImageLayer != null && m_Initialized)
                {
                    m_NorthEastChild       = ComputeChild(drawArgs, CenterLat, m_geographicBoundingBox.North, CenterLon, m_geographicBoundingBox.East, tileSize);
                    m_NorthEastChild.Level = Level++;
                    m_NorthEastChild.Row   = 2 * Row + 1;
                    m_NorthEastChild.Col   = 2 * Col + 1;

                    m_NorthEastChild.Initialize(drawArgs);
                }

                if (m_SouthWestChild == null && m_SwImageLayer != null && m_Initialized)
                {
                    m_SouthWestChild       = ComputeChild(drawArgs, m_geographicBoundingBox.South, CenterLat, m_geographicBoundingBox.West, CenterLon, tileSize);
                    m_SouthWestChild.Level = Level++;
                    m_SouthWestChild.Row   = 2 * Row;
                    m_SouthWestChild.Col   = 2 * Col;

                    m_SouthWestChild.Initialize(drawArgs);
                }

                if (m_SouthEastChild == null && m_SeImageLayer != null && m_Initialized)
                {
                    m_SouthEastChild       = ComputeChild(drawArgs, m_geographicBoundingBox.South, CenterLat, CenterLon, m_geographicBoundingBox.East, tileSize);
                    m_SouthEastChild.Level = Level++;
                    m_SouthEastChild.Row   = 2 * Row;
                    m_SouthEastChild.Col   = 2 * Col + 1;

                    m_SouthEastChild.Initialize(drawArgs);
                }
            }
        }
Ejemplo n.º 3
0
        private void UpdateRootTiles()
        {
            int numberRows = (int)(180.0f / this.m_lzts);

            System.Collections.ArrayList tileList = new System.Collections.ArrayList();

            int istart = 0;
            int iend   = numberRows;
            int jstart = 0;
            int jend   = numberRows * 2;

            for (int i = istart; i < iend; i++)
            {
                for (int j = jstart; j < jend; j++)
                {
                    double north = (i + 1) * this.m_lzts - 90.0f;
                    double south = i * this.m_lzts - 90.0f;
                    double west  = j * this.m_lzts - 180.0f;
                    double east  = (j + 1) * this.m_lzts - 180.0f;

                    ProjectedVectorTile newTile = new ProjectedVectorTile(
                        new GeographicBoundingBox(
                            north,
                            south,
                            west,
                            east),
                        this);

                    newTile.Level = 0;
                    newTile.Row   = i;
                    newTile.Col   = j;
                    tileList.Add(newTile);
                }
            }

            this.m_rootTiles = (ProjectedVectorTile[])tileList.ToArray(typeof(ProjectedVectorTile));
        }
		private void UpdateRootTiles()
		{
			int numberRows = (int)(180.0f/m_lzts);
			
			System.Collections.ArrayList tileList = new System.Collections.ArrayList();

			int istart = 0;
			int iend = numberRows;
			int jstart = 0;
			int jend = numberRows * 2;

			for(int i = istart; i < iend; i++)
			{
				for(int j = jstart; j < jend; j++)
				{
					double north = (i + 1) * m_lzts - 90.0f;
					double south = i  * m_lzts - 90.0f;
					double west = j * m_lzts - 180.0f;
					double east = (j + 1) * m_lzts - 180.0f;
					
					ProjectedVectorTile newTile = new ProjectedVectorTile(
						new GeographicBoundingBox(
						north,
						south,
						west,
						east),
						this);

					newTile.Level = 0;
					newTile.Row = i;
					newTile.Col = j;
					tileList.Add(newTile);
				}
			}

			m_rootTiles = (ProjectedVectorTile[])tileList.ToArray(typeof(ProjectedVectorTile));
		}
Ejemplo n.º 5
0
        internal virtual void ComputeChildren(DrawArgs drawArgs)
        {
            float tileSize = (float)(0.5*(m_geographicBoundingBox.North - m_geographicBoundingBox.South));
            //TODO: Stop children computation at some lower level
            if(tileSize>0.0001)
            {

                double CenterLat = 0.5f*(m_geographicBoundingBox.North + m_geographicBoundingBox.South);
                double CenterLon = 0.5f*(m_geographicBoundingBox.East + m_geographicBoundingBox.West);

                if(m_NorthWestChild == null && m_NwImageLayer != null && m_Initialized)
                {
                    m_NorthWestChild = ComputeChild(CenterLat, m_geographicBoundingBox.North, m_geographicBoundingBox.West, CenterLon);
                    m_NorthWestChild.Level = Level++;
                    m_NorthWestChild.Row = 2 * Row + 1;
                    m_NorthWestChild.Col = 2 * Col;

                    m_NorthWestChild.Initialize(drawArgs);
                }

                if(m_NorthEastChild == null && m_NeImageLayer != null && m_Initialized)
                {
                    m_NorthEastChild = ComputeChild(CenterLat, m_geographicBoundingBox.North, CenterLon, m_geographicBoundingBox.East);
                    m_NorthEastChild.Level = Level++;
                    m_NorthEastChild.Row = 2 * Row + 1;
                    m_NorthEastChild.Col = 2 * Col + 1;

                    m_NorthEastChild.Initialize(drawArgs);
                }

                if(m_SouthWestChild == null && m_SwImageLayer != null && m_Initialized)
                {
                    m_SouthWestChild = ComputeChild(m_geographicBoundingBox.South, CenterLat, m_geographicBoundingBox.West, CenterLon);
                    m_SouthWestChild.Level = Level++;
                    m_SouthWestChild.Row = 2 * Row;
                    m_SouthWestChild.Col = 2 * Col;

                    m_SouthWestChild.Initialize(drawArgs);
                }

                if(m_SouthEastChild == null && m_SeImageLayer != null && m_Initialized)
                {
                    m_SouthEastChild = ComputeChild(m_geographicBoundingBox.South, CenterLat, CenterLon, m_geographicBoundingBox.East);
                    m_SouthEastChild.Level = Level++;
                    m_SouthEastChild.Row = 2 * Row;
                    m_SouthEastChild.Col = 2 * Col + 1;

                    m_SouthEastChild.Initialize(drawArgs);
                }
            }
        }
Ejemplo n.º 6
0
        private ProjectedVectorTile ComputeChild(double childSouth, double childNorth, double childWest, double childEast)
        {
            ProjectedVectorTile child = new ProjectedVectorTile(
                new GeographicBoundingBox(childNorth, childSouth, childWest, childEast),
                m_parentProjectedLayer);

            return child;
        }
Ejemplo n.º 7
0
        internal void Update(DrawArgs drawArgs)
        {
            try
            {
                double centerLatitude = 0.5 * (m_geographicBoundingBox.North + m_geographicBoundingBox.South);
                double centerLongitude = 0.5 * (m_geographicBoundingBox.West + m_geographicBoundingBox.East);
                double tileSize = m_geographicBoundingBox.North - m_geographicBoundingBox.South;

                if(!m_Initialized)
                {
                    if(drawArgs.WorldCamera.ViewRange * 0.5f < Angle.FromDegrees(TileDrawDistance * tileSize)
                        && MathEngine.SphericalDistance(Angle.FromDegrees(centerLatitude), Angle.FromDegrees(centerLongitude),
                        drawArgs.WorldCamera.Latitude, drawArgs.WorldCamera.Longitude) < Angle.FromDegrees( TileSpreadFactor * tileSize * 1.25f )
                        && drawArgs.WorldCamera.ViewFrustum.Intersects(BoundingBox)
                        )
                    {
                        Initialize(drawArgs);
                    }
                }

                if(m_Initialized)
                {
                    if(m_LastUpdate < m_parentProjectedLayer.LastUpdate)
                        UpdateImageLayers(drawArgs);

                    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(TileDrawDistance*tileSize) &&
                        MathEngine.SphericalDistance( Angle.FromDegrees(centerLatitude), Angle.FromDegrees(centerLongitude),
                        drawArgs.WorldCamera.Latitude, drawArgs.WorldCamera.Longitude) < Angle.FromDegrees( 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( TileDrawDistance*tileSize*1.5f )
                        || MathEngine.SphericalDistance(Angle.FromDegrees(centerLatitude), Angle.FromDegrees(centerLongitude), drawArgs.WorldCamera.Latitude, drawArgs.WorldCamera.Longitude) > Angle.FromDegrees( TileSpreadFactor*tileSize*1.5f ))
                    {
                        if(this.Level != 0)
                        //{
                        Dispose();
                        //}
                    }
                }
            }
            catch(Exception ex)
            {
                Log.Write(ex);
            }
        }
Ejemplo n.º 8
0
        private void CreateRootTiles()
        {
            int numberRows = (int)(180.0f / m_lzts);

            int istart = 0;
            int iend = numberRows;
            int jstart = 0;
            int jend = numberRows * 2;

            for (int i = istart; i < iend; i++)
            {
                for (int j = jstart; j < jend; j++)
                {
                    double north = (i + 1) * m_lzts - 90.0f;
                    double south = i * m_lzts - 90.0f;
                    double west = j * m_lzts - 180.0f;
                    double east = (j + 1) * m_lzts - 180.0f;

                    ProjectedVectorTile newTile = new ProjectedVectorTile(
                        new GeographicBoundingBox(
                        north,
                        south,
                        west,
                        east),
                        this);

                    newTile.Level = 0;
                    newTile.Row = i;
                    newTile.Col = j;
                    m_rootTiles.Add(newTile);
                }
            }
        }
        public void Update(DrawArgs drawArgs)
        {
            try
            {
                double centerLatitude  = 0.5 * (m_geographicBoundingBox.North + m_geographicBoundingBox.South);
                double centerLongitude = 0.5 * (m_geographicBoundingBox.West + m_geographicBoundingBox.East);
                double tileSize        = m_geographicBoundingBox.North - m_geographicBoundingBox.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_LastUpdate < m_parentProjectedLayer.LastUpdate)
                    {
                        UpdateImageLayers(drawArgs);
                    }

                    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)
            {
                Log.Write(ex);
            }
        }