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; } }
/// <summary> /// 初始化一个“ImageLayer”的新实例 /// </summary> public ImageLayer( string name, World parentWorld, double distanceAboveSurface, string imagePath, double uplat, double uplon, double downlat, double downlon, double leftlat, double leftlon, double rightlat, double rightlon, byte opacity, TerrainAccessor terrainAccessor) : this(name, parentWorld, distanceAboveSurface, imagePath, downlat, uplat, leftlon, rightlon, opacity, terrainAccessor) { UpLat = uplat; UpLon = uplon; DownLat = downlat; DownLon = downlon; LeftLat = leftlat; LeftLon = leftlon; RightLat = rightlat; RightLon = rightlon; UsingUDLRDrawing = true; }
/// <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.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; }
/// <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; }
/// <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; }
/// <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) { }
/// <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; }
/// <summary> /// 初始化一个地球类 /// </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) { //6378137.0 this.m_EquatorialRadius = equatorialRadius; //设置 数字高程 对象 this.m_TerrainAccessor = terrainAccessor; //初始化world的 Renderable对象,名字是"Earth". this.m_RenderableObjects = new RenderableObjectList(this.Name); //在元数据集合里,添加 Cache的路径 this.MetaData.Add("CacheDirectory", cacheDirectory); //大气光环实例 OuterSphere = new AtmosphericScatteringSphere(); AtmosphericScatteringSphere.m_fInnerRadius = (float)equatorialRadius; AtmosphericScatteringSphere.m_fOuterRadius = (float)equatorialRadius * 1.15f; OuterSphere.Init((float)equatorialRadius * 1.15f, 75, 75); }
/// <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(); }
public void UpdateTerrainElevation(TerrainAccessor terrainAccessor) { // Update camera terrain elevation if (terrainAccessor != null) { if (this.Altitude < 300000) { if (DateTime.Now - this.lastElevationUpdate > TimeSpan.FromMilliseconds(500)) { float elevation; // Under camera target elevation = terrainAccessor.GetCachedElevationAt(this.Latitude.Degrees, this.Longitude.Degrees); this.TerrainElevation = float.IsNaN(elevation) ? (short)0 : (short)elevation; // Under the camera itself Vector3 cameraPos = this.Position; Vector3 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); this.TerrainElevationUnderCamera = float.IsNaN(elevation) ? (short)0 : (short)elevation; if (this.TerrainElevationUnderCamera < 0 && !World.Settings.AllowNegativeAltitude) { this.TerrainElevationUnderCamera = 0; } // reset timer this.lastElevationUpdate = DateTime.Now; } } else { this.TerrainElevation = 0; this.TerrainElevationUnderCamera = 0; } } else { this.TerrainElevation = 0; this.TerrainElevationUnderCamera = 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="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 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.terrainMapped = terrainMapped; this.lineColor = lineColor.ToArgb(); this._terrainAccessor = terrainAccessor; 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)); }
private void updateNode(TreeNode tn) { TerrainAccessorInfo taInfo = (TerrainAccessorInfo)tn.Tag; taInfo.LastSpotted = DateTime.Now; if (tn.Checked != taInfo.Accessor.IsOn) { tn.Checked = taInfo.Accessor.IsOn; } TerrainAccessor ta = (TerrainAccessor)taInfo.Accessor; TreeNode correctNode = (TreeNode)m_NodeHash[ta.Name]; if (correctNode == null) { correctNode = new TreeNode(ta.Name); TerrainAccessorInfo currentTai = new TerrainAccessorInfo(); currentTai.Accessor = ta; correctNode.Tag = currentTai; m_NodeHash.Add(ta.Name, correctNode); treeView1.BeginInvoke(new UpdateChildNodeDelegate(this.UpdateChildNodeTree), new object[] { tn, correctNode }); } }
private void m_updateTimerElapsed(object sneder, ElapsedEventArgs e) { try { if (!rootNodeDone) { AddRootNode(); rootNodeDone = true; } DateTime updateStart = DateTime.Now; for (int i = 0; i < m_worldWindow.CurrentWorld.TerrainAccessor.SubsetCount; i++) { TerrainAccessor currentTA = (TerrainAccessor)m_worldWindow. CurrentWorld.TerrainAccessor.HighResSubsets[i]; if (i >= this.treeView1.Nodes.Count) { // More than what is currently in the system, add a node TreeNode correctNode = new TreeNode(currentTA.Name); TerrainAccessorInfo taInfo = new TerrainAccessorInfo(); taInfo.Accessor = currentTA; correctNode.Tag = taInfo; m_NodeHash.Add(correctNode.Text, correctNode); this.treeView1.BeginInvoke(new AddTableTreeDelegate(this.AddTableTree), new object[] { correctNode }); updateNode(correctNode); } else { // Compare and update nodes TreeNode currentTn = this.treeView1.Nodes[i]; TerrainAccessorInfo taInfo = (TerrainAccessorInfo)currentTn.Tag; if (taInfo.Accessor != null && taInfo.Accessor.Name == currentTA.Name) { updateNode(currentTn); continue; } else { if (!m_NodeHash.Contains(currentTA.Name)) { // add it taInfo = new TerrainAccessorInfo(); taInfo.Accessor = currentTA; currentTn = new TreeNode(currentTA.Name); currentTn.Tag = taInfo; m_NodeHash.Add(currentTn.Text, currentTn); this.treeView1.BeginInvoke(new InsertTableTreeDelegate( this.InsertTableTree), new object[] { i, currentTn }); } else { currentTn = (TreeNode)m_NodeHash[currentTA.Name]; try { treeView1.BeginInvoke(new RemoveTableTreeDelegate( this.RemoveTableTree), new object[] { currentTn }); } catch { } treeView1.BeginInvoke(new InsertTableTreeDelegate( this.InsertTableTree), new object[] { i, currentTn }); } } updateNode(currentTn); } } for (int i = m_worldWindow.CurrentWorld.TerrainAccessor.HighResSubsets.Length; i < this.treeView1.Nodes.Count; i++) { this.treeView1.BeginInvoke(new RemoveAtTableTreeDelegate( this.RemoveAtTableTree), new object[] { i }); } ArrayList deletionList = new ArrayList(); foreach (TreeNode tn in m_NodeHash.Values) { TerrainAccessorInfo taInfo = (TerrainAccessorInfo)tn.Tag; if (taInfo == null || taInfo.Accessor == null || taInfo.LastSpotted < updateStart) { deletionList.Add(taInfo.Accessor.Name); } } foreach (string key in deletionList) { m_NodeHash.Remove(key); } // Compare the nodes to the previously selected node // and restore the selection to the same node treeView1.BeginInvoke(new SetPreviousNodeDelegate( this.SetPreviousNode), new object[] { selectedNode }); } catch { } }
public World(string name, Vector3d position, Quaternion4d orientation, System.Windows.Forms.Control control, TerrainAccessor terrainAccessor) { this._name = name; m_worldradius = EarthRadius; this.position = position; this.orientation = orientation; MeterPerDegree = SMath.MeterPerDegree(); this._terrainAccessor = terrainAccessor; this.RenderLayerList = new GeoLayerList(); m_OverlayList = new WidgetRoot(control); }