Beispiel #1
0
        public DownloadableIcon(string name, World parentWorld, float distanceAboveSurface, float west, float south, float east, float north, string imageUrl, string saveTexturePath, Texture iconTexture, int iconSize, string caption, TerrainAccessor terrainAccessor)
            : base(name, parentWorld.Position, parentWorld.Orientation)
        {
            this.imageUrl = imageUrl;
            this.saveTexturePath = saveTexturePath;
            this.iconTexture = iconTexture;
            this.iconSize = iconSize;

            this.north = north;
            this.south = south;
            this.west = west;
            this.east = east;
            this.caption = caption;

            this._terrainAccessor = terrainAccessor;

            this.centerLat = 0.5f * (this.north + this.south);
            this.centerLon = 0.5f * (this.west + this.east);

            this.m_ParentWorld = parentWorld;
            this.layerRadius = (float)parentWorld.EquatorialRadius + distanceAboveSurface;
            this.IsTextureAvailable = File.Exists(saveTexturePath);
            if (this.IsTextureAvailable) {
                this.downloadProgress = 1.0f;
            }
        }
Beispiel #2
0
 /// <summary>
 /// ��ʼ��һ�� <see cref= "T:WorldWind.World"/> ��ʵ��.
 /// </summary>
 /// <param name="name"></param>
 /// <param name="position"></param>
 /// <param name="orientation"></param>
 /// <param name="equatorialRadius"></param>
 /// <param name="cacheDirectory"></param>
 /// <param name="terrainAccessor"></param>
 public World(string name, Vector3 position, Quaternion orientation, double equatorialRadius, string cacheDirectory, TerrainAccessor terrainAccessor)
     : base(name, position, orientation)
 {
     this._equatorialRadius = equatorialRadius;
     this._terrainAccessor = terrainAccessor;
     this._renderableObjects = new RenderableObjectList(this.Name);
     this.MetaData.Add("CacheDirectory", cacheDirectory);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref= "T:WorldWind.Renderable.DownloadableImageFromIconSet"/> class.
 /// </summary>
 /// <param name="name"></param>
 /// <param name="drawArgs"></param>
 /// <param name="terrainAccessor"></param>
 public DownloadableImageFromIconSet(string name, World parentWorld, float distanceAboveSurface, DrawArgs drawArgs, TerrainAccessor terrainAccessor)
     : base(name, parentWorld.Position, parentWorld.Orientation)
 {
     this.m_ParentWorld = parentWorld;
     this.layerRadius = (float) parentWorld.EquatorialRadius + distanceAboveSurface;
     this.IsSelectable = true;
     this.drawArgs = drawArgs;
     this._terrainAccessor = terrainAccessor;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref= "T:WorldWind.Terrain.NltTerrainAccessor"/> class.
 /// </summary>
 /// <param name="name"></param>
 /// <param name="west"></param>
 /// <param name="south"></param>
 /// <param name="east"></param>
 /// <param name="north"></param>
 /// <param name="terrainTileService"></param>
 /// <param name="higherResolutionSubsets"></param>
 public NltTerrainAccessor(string name, double west, double south, double east, double north, TerrainTileService terrainTileService, TerrainAccessor[] higherResolutionSubsets)
 {
     m_name = name;
     m_west = west;
     m_south = south;
     m_east = east;
     m_north = north;
     m_terrainTileService = terrainTileService;
     m_higherResolutionSubsets = higherResolutionSubsets;
 }
Beispiel #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref= "T:WorldWind.Renderable.PathList"/> class.
 /// </summary>
 /// <param name="name"></param>
 /// <param name="parentWorld"></param>
 /// <param name="minDisplayAltitude"></param>
 /// <param name="maxDisplayAltitude"></param>
 /// <param name="pathsDirectoryPath"></param>
 /// <param name="altitude"></param>
 /// <param name="color"></param>
 /// <param name="terrainAccessor"></param>
 public PathList(string name, World parentWorld, double minDisplayAltitude, double maxDisplayAltitude, string pathsDirectoryPath, double altitude, Color color, TerrainAccessor terrainAccessor)
     : base(name)
 {
     this.parentWorld = parentWorld;
     this.minDisplayAltitude = minDisplayAltitude;
     this.maxDisplayAltitude = maxDisplayAltitude;
     this.pathsDirectoryPath = pathsDirectoryPath;
     this.altitude = altitude;
     this.color = Color.FromArgb(150, color);
     this.terrainAccessor = terrainAccessor;
 }
Beispiel #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref= "T:WorldWind.Renderable.TerrainPath"/> class.
 /// </summary>
 /// <param name="name"></param>
 /// <param name="parentWorld"></param>
 /// <param name="minDisplayAltitude"></param>
 /// <param name="maxDisplayAltitude"></param>
 /// <param name="terrainFileName"></param>
 /// <param name="heightAboveSurface"></param>
 /// <param name="lineColor"></param>
 /// <param name="terrainAccessor"></param>
 public TerrainPath(string name, World parentWorld, double minDisplayAltitude, double maxDisplayAltitude, string terrainFileName, float heightAboveSurface, Color lineColor, TerrainAccessor terrainAccessor)
     : base(name, parentWorld.Position, Quaternion.RotationYawPitchRoll(0, 0, 0))
 {
     this._parentWorld = parentWorld;
     this._minDisplayAltitude = minDisplayAltitude;
     this._maxDisplayAltitude = maxDisplayAltitude;
     this.terrainFileName = terrainFileName;
     this.heightAboveSurface = heightAboveSurface;
     //this.terrainMapped = terrainMapped;
     this.lineColor = lineColor.ToArgb();
     this._terrainAccessor = terrainAccessor;
     this.RenderPriority = RenderPriority.LinePaths;
 }
Beispiel #7
0
 /// <summary>
 /// Constructor
 /// </summary>
 public ImageLayer(string name, World parentWorld, double distanceAboveSurface, string imagePath, double minLatitude, double maxLatitude, double minLongitude, double maxLongitude, byte opacity, TerrainAccessor terrainAccessor)
     : base(name, parentWorld.Position, parentWorld.Orientation)
 {
     this.m_ParentWorld = parentWorld;
     this.layerRadius = (float) parentWorld.EquatorialRadius + distanceAboveSurface;
     this._imagePath = imagePath;
     minLat = minLatitude;
     maxLat = maxLatitude;
     minLon = minLongitude;
     maxLon = maxLongitude;
     this.m_opacity = opacity;
     this._terrainAccessor = terrainAccessor;
     this._imagePath = imagePath;
 }
Beispiel #8
0
 /// <summary>
 /// This method appends to the array of higher resolution
 /// subsets for runtime addition of terrain layers
 /// </summary>
 /// <param name="newHighResSubset"></param>
 public void AddHigherResolutionSubset(TerrainAccessor newHighResSubset)
 {
     //need to lock array here
     if (m_higherResolutionSubsets == null)
     {
         m_higherResolutionSubsets = new TerrainAccessor[0];
     }
     lock (m_higherResolutionSubsets)
     {
         TerrainAccessor[] temp_highres = new TerrainAccessor[m_higherResolutionSubsets.Length + 1];
         for (int i = 0; i < m_higherResolutionSubsets.Length; i++)
         {
             temp_highres[i] = m_higherResolutionSubsets[i];
         }
         temp_highres[temp_highres.Length - 1] = newHighResSubset;
         m_higherResolutionSubsets             = temp_highres;
     }
 }
Beispiel #9
0
        /// <summary>
        /// Initializes a new instance of the <see cref= "T:WorldWind.World"/> class.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="position"></param>
        /// <param name="orientation"></param>
        /// <param name="equatorialRadius"></param>
        /// <param name="cacheDirectory"></param>
        /// <param name="terrainAccessor"></param>
        public World(string name, Point3d position, Quaternion4d orientation, double equatorialRadius,
            string cacheDirectory,
            TerrainAccessor terrainAccessor)
            : base(name, position, orientation)
        {
            this.equatorialRadius = equatorialRadius;

            this._terrainAccessor = terrainAccessor;
            this._renderableObjects = new RenderableObjectList(this.Name);
            this.MetaData.Add("CacheDirectory", cacheDirectory);

            //	this.m_WorldSurfaceRenderer = new WorldSurfaceRenderer(32, 0, this);
            this.m_projectedVectorRenderer = new ProjectedVectorRenderer("World Default ProjectedVectorRenderer", this);

            m_outerSphere = new AtmosphericScatteringSphere();
            AtmosphericScatteringSphere.m_fInnerRadius = (float)equatorialRadius;
            AtmosphericScatteringSphere.m_fOuterRadius = (float)equatorialRadius * 1.025f;

            m_outerSphere.Init((float)equatorialRadius * 1.025f);
        }
Beispiel #10
0
 /// <summary>
 /// Method removes the specified high resolution subset from the
 /// array of terrain layers, decreases the array size by 1
 /// </summary>
 /// <param name="highResSubset"></param>
 public void RemoveHigherResolutionSubset(TerrainAccessor highResSubset)
 {
     // lock array here
     if (m_higherResolutionSubsets == null)
     {
         m_higherResolutionSubsets = new TerrainAccessor[0];
     }
     lock (m_higherResolutionSubsets)
     {
         TerrainAccessor[] temp_highres = new TerrainAccessor[m_higherResolutionSubsets.Length + 1];
         for (int i = 0; i < m_higherResolutionSubsets.Length; i++)
         {
             if (m_higherResolutionSubsets[i] != highResSubset)
             {
                 temp_highres[i] = m_higherResolutionSubsets[i];
             }
         }
         m_higherResolutionSubsets = temp_highres;
     }
 }
Beispiel #11
0
		/// <summary>
		/// Constructor
		/// </summary>
		public ImageLayer(
			string name,
			World parentWorld,
			double distanceAboveSurface,
			string imagePath,
			double minLatitude,
			double maxLatitude,
			double minLongitude,
			double maxLongitude,
			double opacityPercent,
			TerrainAccessor terrainAccessor)
			: this(name,parentWorld,distanceAboveSurface,imagePath, 
			minLatitude, maxLatitude, minLongitude, maxLongitude, 
			(byte)(255*opacityPercent), terrainAccessor)
		{
		}
Beispiel #12
0
		/// <summary>
		/// Constructor
		/// </summary>
		public ImageLayer(
			string name,
			World parentWorld,
			double distanceAboveSurface,
			Stream textureStream,
			int transparentColor,
			double minLatitude,
			double maxLatitude,
			double minLongitude,
			double maxLongitude,
			double opacityPercent,
			TerrainAccessor terrainAccessor)
			: this(name,parentWorld,distanceAboveSurface,null, 
			minLatitude, maxLatitude, minLongitude, maxLongitude, 
			(byte)(255*opacityPercent), terrainAccessor)
		{
			m_TextureStream = textureStream;
			m_TransparentColor = transparentColor;
		}
Beispiel #13
0
 internal static void Init(Projection proj, TerrainAccessor terrainAccessor, double layerRadius)
 {
     _proj = proj;
     _terrainAccessor = terrainAccessor;
     _layerRadius = layerRadius;
 }
Beispiel #14
0
 public void UpdateTerrainElevation(TerrainAccessor terrainAccessor)
 {
     // Update camera terrain elevation
      if (terrainAccessor != null)
      {
     if (Altitude < 300000)
     {
        if (System.DateTime.Now - this.lastElevationUpdate > TimeSpan.FromMilliseconds(500))
        {
           float elevation;
           // Under camera target
           elevation = terrainAccessor.GetCachedElevationAt(Latitude.Degrees, Longitude.Degrees);
           TerrainElevation = float.IsNaN(elevation) ? (short)0 : (short)elevation;
           // Under the camera itself
           Point3d cameraPos = Position;
           Point3d cameraCoord = MathEngine.CartesianToSpherical(cameraPos.X, cameraPos.Y, cameraPos.Z);
           double camLat = MathEngine.RadiansToDegrees(cameraCoord.Y);
           double camLon = MathEngine.RadiansToDegrees(cameraCoord.Z);
           elevation = terrainAccessor.GetCachedElevationAt(camLat, camLon);
           TerrainElevationUnderCamera = float.IsNaN(elevation) ? (short)0 : (short)elevation;
           if (TerrainElevationUnderCamera < 0)
              TerrainElevationUnderCamera = 0;
           // reset timer
           this.lastElevationUpdate = System.DateTime.Now;
        }
     }
     else
     {
        TerrainElevation = 0;
        TerrainElevationUnderCamera = 0;
     }
      }
      else
      {
     TerrainElevation = 0;
     TerrainElevationUnderCamera = 0;
      }
 }
 public static void Init(Projection proj, TerrainAccessor terrainAccessor, double layerRadius, VirtualEarthForm veForm)
 {
     _proj = proj;
     _terrainAccessor = terrainAccessor;
     _layerRadius = layerRadius;
     _veForm = veForm;
     _font = new System.Drawing.Font("Verdana", 15, FontStyle.Bold);
     _brush = new SolidBrush(Color.Green);
 }
		/// <summary>
		/// Initializes a new instance of the <see cref= "T:WorldWind.Renderable.TerrainPath"/> class.
		/// </summary>
		/// <param name="name"></param>
		/// <param name="parentWorld"></param>
		/// <param name="minDisplayAltitude"></param>
		/// <param name="maxDisplayAltitude"></param>
		/// <param name="terrainFileName"></param>
		/// <param name="heightAboveSurface"></param>
		/// <param name="lineColor"></param>
		/// <param name="terrainAccessor"></param>
		public JHU_TerrainPath(
			string name, 
			World parentWorld, 
			double minDisplayAltitude, 
			double maxDisplayAltitude, 
			string terrainFileName, 
			float heightAboveSurface, 
			System.Drawing.Color lineColor,
			TerrainAccessor terrainAccessor) 
			: base(name, parentWorld.Position, Quaternion.RotationYawPitchRoll(0,0,0)) 
		{
			this._parentWorld = parentWorld;
			this._minDisplayAltitude = minDisplayAltitude;
			this._maxDisplayAltitude = maxDisplayAltitude;
			this.terrainFileName = terrainFileName;
			this.heightAboveSurface = heightAboveSurface;
			this.lineColor = lineColor.ToArgb();
			this._terrainAccessor = terrainAccessor;
			this.RenderPriority = RenderPriority.LinePaths;
			this.sphericalCoordinates = new ArrayList();
		}
		/// <summary>
		/// Initializes a new instance of the <see cref= "T:WorldWind.Renderable.TerrainPath"/> class.
		/// </summary>
		/// <param name="name"></param>
		/// <param name="parentWorld"></param>
		/// <param name="minDisplayAltitude"></param>
		/// <param name="maxDisplayAltitude"></param>
		/// <param name="dataArchiveReader"></param>
		/// <param name="fileOffset"></param>
		/// <param name="fileSize"></param>
		/// <param name="north"></param>
		/// <param name="south"></param>
		/// <param name="east"></param>
		/// <param name="west"></param>
		/// <param name="heightAboveSurface"></param>
		/// <param name="lineColor"></param>
		/// <param name="terrainAccessor"></param>
		public JHU_TerrainPath(
			string name, 
			World parentWorld, 
			double minDisplayAltitude, 
			double maxDisplayAltitude, 
			BinaryReader dataArchiveReader,
			long fileOffset,
			long fileSize,
			double north,
			double south,
			double east, 
			double west,
			float heightAboveSurface, 
			System.Drawing.Color lineColor,
			TerrainAccessor terrainAccessor) 
			: base(name, parentWorld.Position, Quaternion.RotationYawPitchRoll(0,0,0)) 
		{
			this._parentWorld = parentWorld;
			this._minDisplayAltitude = minDisplayAltitude;
			this._maxDisplayAltitude = maxDisplayAltitude;
			this._dataArchiveReader = dataArchiveReader;
			this._fileOffset = fileOffset;
			this._fileSize = fileSize;
			this.heightAboveSurface = heightAboveSurface;
			this.lineColor = lineColor.ToArgb();
			this._terrainAccessor = terrainAccessor;
			this.sphericalCoordinates = new ArrayList();
			
			this.north = (float)north;
			this.south = (float)south;
			this.west = (float)west;
			this.east = (float)east;

			this.RenderPriority = RenderPriority.LinePaths;

			this.boundingBox = new BoundingBox( this.south, this.north, this.west, this.east, 
				(float)this._parentWorld.EquatorialRadius, 
				(float)(this._parentWorld.EquatorialRadius + this.verticalExaggeration * heightAboveSurface));
		}
Beispiel #18
0
 public static void Init(TerrainAccessor _terrainAccessor, double _layerRadius, GeoportailForm _geoForm)
 {
     terrainAccessor = _terrainAccessor;
     layerRadius = _layerRadius;
     geoForm = _geoForm;
     font = new System.Drawing.Font("Verdana", 15, FontStyle.Bold);
     brush = new SolidBrush(Color.Green);
 }