• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# WorldWind.DrawArgs类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中WorldWind.DrawArgs的典型用法代码示例。如果您正苦于以下问题:C# DrawArgs类的具体用法?C# DrawArgs怎么用?C# DrawArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DrawArgs类属于WorldWind命名空间,在下文中一共展示了DrawArgs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Render

		public void Render(DrawArgs drawArgs)
		{
			// Render from bottom and up
			const int screenMargin = 10;
			m_renderPosition = new Vector2(drawArgs.screenWidth - HalfWidth - screenMargin, drawArgs.screenHeight - screenMargin);

			ImageAccessor logoAccessor = null;

			// Render download progress and rectangles
			for(int i=0; i < DrawArgs.DownloadQueue.ActiveDownloads.Count; i++)
			{
				DownloadRequest request = (DownloadRequest)DrawArgs.DownloadQueue.ActiveDownloads[i];
				GeoSpatialDownloadRequest geoRequest = request as GeoSpatialDownloadRequest;
				if(geoRequest == null)
					continue;

				RenderProgress(drawArgs, geoRequest);
				RenderRectangle(drawArgs, geoRequest);

				ImageTileRequest imageRequest = geoRequest as ImageTileRequest;
				if(imageRequest == null)
					continue;

				QuadTile qt = imageRequest.QuadTile;
				if(qt.QuadTileArgs.ImageAccessor.ServerLogoPath != null)
					logoAccessor = qt.QuadTileArgs.ImageAccessor;
			}

			if(logoAccessor != null)
				RenderLogo( drawArgs, logoAccessor );
		}
开发者ID:jpespartero,项目名称:WorldWind,代码行数:31,代码来源:DownloadIndicator.cs


示例2: Draw

        /// <summary>
        /// Draws the progress bar
        /// </summary>
        /// <param name="x">Center X position of progress.</param>
        /// <param name="y">Center Y position of progress.</param>
        /// <param name="progress">Progress vale, in the range 0..1</param>
        public void Draw(DrawArgs drawArgs, float x, float y, float progress, int color)
        {
            if(x!=this.x || y!=this.y)
                Initalize(x,y);
            int barlength = (int)(progress * 2 * halfWidth);

            progressBar[0].X = x - halfWidth;
            progressBar[0].Y = y - halfHeight;
            progressBar[0].Color = color;
            progressBar[1].X = x - halfWidth;
            progressBar[1].Y = y + halfHeight;
            progressBar[1].Color = color;
            progressBar[2].X = x - halfWidth + barlength;
            progressBar[2].Y = y - halfHeight;
            progressBar[2].Color = color;
            progressBar[3].Y = y + halfHeight;
            progressBar[3].X = x - halfWidth + barlength;
            progressBar[3].Color = color;

            progressRight[0].X = x - halfWidth +barlength;
            progressRight[0].Y = y - halfHeight;
            progressRight[1].X = x - halfWidth + barlength;
            progressRight[1].Y = y + halfHeight;
            progressRight[2].X = x + halfWidth;
            progressRight[2].Y = y - halfHeight;
            progressRight[3].X = x + halfWidth;
            progressRight[3].Y = y + halfHeight;

            drawArgs.device.VertexFormat = CustomVertex.TransformedColored.Format;
            drawArgs.device.TextureState[0].ColorOperation = TextureOperation.Disable;
            drawArgs.device.DrawUserPrimitives(PrimitiveType.TriangleStrip, 2, progressBar);
            drawArgs.device.DrawUserPrimitives(PrimitiveType.TriangleStrip, 2, progressRight);
            drawArgs.device.DrawUserPrimitives(PrimitiveType.LineStrip, 4, progressBarOutline);
        }
开发者ID:paladin74,项目名称:Dapple,代码行数:40,代码来源:ProgressBar.cs


示例3: Render

		public override void Render(DrawArgs drawArgs)
		{
			if(!this._control.Visible)
			{
				this.SetPushed(false);
			}
		}
开发者ID:jpespartero,项目名称:WorldWind,代码行数:7,代码来源:WindowsControlMenuButton.cs


示例4: Initialize

		public override void Initialize(DrawArgs drawArgs)
		{
			FileInfo boundaryFileInfo = new FileInfo(this._boundaryFilePath);
			if(!boundaryFileInfo.Exists)
			{
				this.isInitialized = true;
				return;
			}

			using( FileStream boundaryFileStream = boundaryFileInfo.OpenRead() )
			using( BinaryReader boundaryFileReader = new BinaryReader(boundaryFileStream, System.Text.Encoding.ASCII) ) {
				int numBoundaries = boundaryFileReader.ReadInt32();
				int count = boundaryFileReader.ReadInt32();
				this.vertices = new CustomVertex.PositionColored[count];

				for(int i = 0; i < count; i++) {
					double lat = boundaryFileReader.ReadDouble();
					double lon = boundaryFileReader.ReadDouble();
					Vector3 v = MathEngine.SphericalToCartesian((float)lat, (float)lon, (float)(this._parentWorld.EquatorialRadius + this._distanceAboveSurface));
					this.vertices[i].X = v.X;
					this.vertices[i].Y = v.Y;
					this.vertices[i].Z = v.Z;
					this.vertices[i].Color = this._color;
				}

			}
			this.isInitialized = true;
		}
开发者ID:jpespartero,项目名称:WorldWind,代码行数:28,代码来源:BoundaryLayer.cs


示例5: Render

 public override void Render(DrawArgs drawArgs)
 {
     if (!m_widget.Visible)
     {
         SetPushed(false);
     }
 }
开发者ID:jpespartero,项目名称:WorldWind,代码行数:7,代码来源:WidgetMenuButton.cs


示例6: Load

		/// <summary>
		/// Plugin entry point 
		/// </summary>
		public override void Load() 
		{
			drawArgs = ParentApplication.WorldWindow.DrawArgs;
			DeviceList dl = Manager.GetDevices(DeviceClass.GameControl, EnumDevicesFlags.AttachedOnly);
			dl.MoveNext();
			if(dl.Current==null)
			{
				throw new ApplicationException("No joystick detected.  Please check your connections and verify your device appears in Control panel -> Game Controllers.");
			}
			DeviceInstance di = (DeviceInstance) dl.Current;
			joystick = new Device( di.InstanceGuid );
			joystick.SetDataFormat(DeviceDataFormat.Joystick);
			joystick.SetCooperativeLevel(ParentApplication,  
				CooperativeLevelFlags.NonExclusive | CooperativeLevelFlags.Background);
			foreach(DeviceObjectInstance d in joystick.Objects) 
			{
				// For axes that are returned, set the DIPROP_RANGE property for the
				// enumerated axis in order to scale min/max values.
				if((d.ObjectId & (int)DeviceObjectTypeFlags.Axis)!=0) 
				{
					// Set the AxisRange for the axis.
					joystick.Properties.SetRange(ParameterHow.ById, d.ObjectId, new InputRange(-AxisRange, AxisRange));
					joystick.Properties.SetDeadZone(ParameterHow.ById, d.ObjectId, 1000); // 10%
				}
			}

			joystick.Acquire();

			// Start a new thread to poll the joystick
			// TODO: The Device supports events, use them
			joyThread = new Thread( new ThreadStart(JoystickLoop) );
			joyThread.IsBackground = true;
			joyThread.Start();
		}
开发者ID:jpespartero,项目名称:WorldWind,代码行数:37,代码来源:Joystick.cs


示例7: Render

		/// <summary>
		/// This is where we do our rendering 
		/// Called from UI thread = UI code safe in this function
		/// </summary>
		public override void Render(DrawArgs drawArgs)
		{
			// Draw the current time using default font in lower right corner
			string text = DateTime.Now.ToString();
			Rectangle bounds = drawArgs.defaultDrawingFont.MeasureString(null, text, DrawTextFormat.None, 0);
			drawArgs.defaultDrawingFont.DrawText(null, text, 
				drawArgs.screenWidth-bounds.Width-distanceFromCorner, drawArgs.screenHeight-bounds.Height-distanceFromCorner,
				color );
		}
开发者ID:jpespartero,项目名称:WorldWind,代码行数:13,代码来源:Clock.cs


示例8: Render

		public void Render(DrawArgs drawArgs)
		{
			// if we aren't active do nothing.
			if ((!m_visible) || (!m_enabled))
				return;

			for(int index = m_ChildWidgets.Count - 1; index >= 0; index--)
			{
				WorldWind.NewWidgets.IWidget currentWidget = m_ChildWidgets[index] as WorldWind.NewWidgets.IWidget;
				if(currentWidget != null)
				{
					if(currentWidget.ParentWidget == null || currentWidget.ParentWidget != this)
						currentWidget.ParentWidget = this;

					currentWidget.Render(drawArgs);
				}
			}
		}
开发者ID:jpespartero,项目名称:WorldWind,代码行数:18,代码来源:RootWidget.cs


示例9: RenderLogo

		/// <summary>
		/// Renders the server logo
		/// </summary>
		/// <param name="logoAccessor"></param>
		protected void RenderLogo( DrawArgs drawArgs, ImageAccessor logoAccessor )
		{
			if(logoAccessor.ServerLogoPath == null)
				return;

			if(logoAccessor.ServerLogo == null)
			{
				if(!File.Exists(logoAccessor.ServerLogoPath))
					return;

				logoAccessor.ServerLogo = ImageHelper.LoadTexture(drawArgs.device, logoAccessor.ServerLogoPath);

				using(Surface s = logoAccessor.ServerLogo.GetSurfaceLevel(0))
				{
					SurfaceDescription desc = s.Description;
					logoAccessor.ServerLogoSize = new Rectangle(0, 0, desc.Width, desc.Height);
				}
			}

			if(m_sprite == null)
				m_sprite = new Sprite(drawArgs.device);

			float xScale = 2f * HalfWidth / logoAccessor.ServerLogoSize.Width;
			float yScale = 2f * HalfWidth / logoAccessor.ServerLogoSize.Height;

			m_renderPosition.Y -= HalfWidth;
			m_sprite.Begin(SpriteFlags.AlphaBlend);

			m_sprite.Transform = Matrix.Scaling(xScale,yScale,0);
			m_sprite.Transform *= Matrix.Translation(m_renderPosition.X, m_renderPosition.Y, 0);
			m_sprite.Draw( logoAccessor.ServerLogo,
				new Vector3(logoAccessor.ServerLogoSize.Width>>1, logoAccessor.ServerLogoSize.Height>>1, 0),
				Vector3.Empty,
				World.Settings.downloadLogoColor );

			m_sprite.End();
		}
开发者ID:jpespartero,项目名称:WorldWind,代码行数:41,代码来源:DownloadIndicator.cs


示例10: Update

 /// <summary>
 /// RenderableObject abstract member (needed)
 /// OBS: Worker thread (don't update UI directly from this thread)
 /// </summary>
 public override void Update(DrawArgs drawArgs)
 {
         if(!isInitialized)
                 Initialize(drawArgs);
 }
开发者ID:jpespartero,项目名称:WorldWind,代码行数:9,代码来源:SkyGradient.cs


示例11: Recenter

 // Recenter world projection in WW 1.4
 public void Recenter(DrawArgs drawArgs) {
         drawArgs.device.Transform.World *= Matrix.Translation(
                 (float)-drawArgs.WorldCamera.ReferenceCenter.X,
                 (float)-drawArgs.WorldCamera.ReferenceCenter.Y,
                 (float)-drawArgs.WorldCamera.ReferenceCenter.Z
                 );
 }
开发者ID:jpespartero,项目名称:WorldWind,代码行数:8,代码来源:SkyGradient.cs


示例12: file

               public string presetFileName;           // preset file (will overide defaults)

               /// <summary>
               /// Constructor
               /// </summary>
               public SkyGradientLayer(string LayerName, string pluginPath, WorldWindow worldWindow) : base(LayerName)
               {
                       this.pluginPath = pluginPath;
                       this.pluginName = LayerName;
                       this.world = worldWindow.CurrentWorld;
                       this.settingsFileName = this.world.Name + ".ini";
                       this.drawArgs = worldWindow.DrawArgs;
                       //this.RenderPriority = RenderPriority.AtmosphericImages;
                       this.RenderPriority = RenderPriority.SurfaceImages;
                       ReadSettings();
               }
开发者ID:jpespartero,项目名称:WorldWind,代码行数:16,代码来源:SkyGradient.cs


示例13: DrawTrack

		private void DrawTrack(DrawArgs drawArgs)
		{
			UpdateTrackPositions(drawArgs);

			drawArgs.device.Transform.World = Matrix.Translation(
				(float)-drawArgs.WorldCamera.ReferenceCenter.X,
				(float)-drawArgs.WorldCamera.ReferenceCenter.Y,
				(float)-drawArgs.WorldCamera.ReferenceCenter.Z
				);

			drawArgs.device.RenderState.ZBufferEnable = false;
			drawArgs.device.TextureState[0].ColorOperation = TextureOperation.Disable;
			drawArgs.device.VertexFormat = CustomVertex.PositionColored.Format;
			drawArgs.device.DrawUserPrimitives(PrimitiveType.LineStrip, track.Length-1, track);
			drawArgs.device.RenderState.ZBufferEnable = true;

			drawArgs.device.Transform.World = drawArgs.WorldCamera.WorldMatrix;
		}
开发者ID:jpespartero,项目名称:WorldWind,代码行数:18,代码来源:SatelliteTrackerPlugin.cs


示例14: LoadMesh

		private bool LoadMesh(DrawArgs drawArgs)
		{
			string LayerMeshFile =Path.Combine( meshFilePath,this.Name +".x");
			//Get the mesh, if exists, else load default file
			if(System.IO.File.Exists(LayerMeshFile))
			{//There is a mesh file for the satellite, load it.
				GraphicsStream adj;
				try
				{
					mesh = Mesh.FromFile(LayerMeshFile, MeshFlags.Managed, drawArgs.device, out adj, out materials );
				}
				catch(Exception caught)
				{
					Utility.Log.Write( caught );
					string msg = "Failed to read mesh from " + meshFilePath;
					System.Windows.Forms.MessageBox.Show( msg, this.name +" failed to load.", MessageBoxButtons.OK, MessageBoxIcon.Error);
					this.ParentList.IsOn = false;
					return false;
				}
				string textureFilePath = "";
				try
				{
					// Extract the material properties and texture names.
					meshTextures  = new Texture[materials.Length];
					meshMaterials = new Material[materials.Length];
					string xFilePath = Path.GetDirectoryName(LayerMeshFile);
					for(int i = 0; i < materials.Length; i++)
					{
						meshMaterials[i] = materials[i].Material3D;
						// Set the ambient color for the material (D3DX does not do this)
						meshMaterials[i].Ambient = meshMaterials[i].Diffuse;

						// Create the texture.
						if(materials[i].TextureFilename!=null)
						{
							textureFilePath = Path.Combine(xFilePath, materials[i].TextureFilename);
							meshTextures[i] = TextureLoader.FromFile(drawArgs.device, textureFilePath);
						}
					}

					isInitialized = true;
					isFirstRun = true;
					// Compute bounding box for a mesh.
					GraphicsStream vertexData;
					VertexBufferDescription description =
						mesh.VertexBuffer.Description;
					vertexData = mesh.VertexBuffer.Lock
						(0, 0, LockFlags.ReadOnly);
					Geometry.ComputeBoundingBox(vertexData,
						mesh.NumberVertices,description.VertexFormat,
						out meshBoundingBoxMinValue,
						out meshBoundingBoxMaxValue);
					mesh.VertexBuffer.Unlock();
					//Compute Path
					localmeshloaded = true;
				}
				catch(Exception caught)
				{
					Utility.Log.Write( caught );
					string msg = "Failed to read Texture from " + textureFilePath;
					System.Windows.Forms.MessageBox.Show( msg, this.name +" failed to load.", MessageBoxButtons.OK, MessageBoxIcon.Error);
					return false;
				}
			}
			else
			{
				//There is not a mesh file for the satellite, use the layer's mesh file
				this.meshBoundingBoxMinValue = ((SatelliteTrackerOverlay)this.ParentList).meshBoundingBoxMinValue;
				this.meshBoundingBoxMaxValue  = ((SatelliteTrackerOverlay)this.ParentList).meshBoundingBoxMaxValue;
				this.meshTextures = ((SatelliteTrackerOverlay)this.ParentList).meshTextures;
				this.meshMaterials = ((SatelliteTrackerOverlay)this.ParentList).meshMaterials;
				this.mesh = ((SatelliteTrackerOverlay)this.ParentList).mesh;
				localmeshloaded = false;
			}
			return true;
		}
开发者ID:jpespartero,项目名称:WorldWind,代码行数:76,代码来源:SatelliteTrackerPlugin.cs


示例15: Initialize

		public override void Initialize(DrawArgs drawArgs)
		{
			if (isInitialized)
				return;
			try
			{
				orbit = new Orbit(this.TwoLineElement);
				timer = new System.Timers.Timer(10000);
				UpdateTrackPositions(drawArgs);
				timer.Elapsed+=new System.Timers.ElapsedEventHandler(timer_Elapsed);
				timer.Start();

			}
			catch(Exception caught)
			{
				Utility.Log.Write( caught );
				string msg = "Failed to read TLE from " + this.TwoLineElement.Name;
				throw new Exception( msg);
			}
			this.IsOn = LoadMesh(drawArgs);
			isInitialized = true;
		}
开发者ID:jpespartero,项目名称:WorldWind,代码行数:22,代码来源:SatelliteTrackerPlugin.cs


示例16: Render

		/// <summary>
		/// This is where we do our rendering
		/// Called from UI thread = UI code safe in this function
		/// </summary>
		public override void Render(DrawArgs drawArgs)
		{
			if(!IsOn)
				return;
			if(!isInitialized)
				return;
			base.Render(drawArgs);
		}
开发者ID:jpespartero,项目名称:WorldWind,代码行数:12,代码来源:SatelliteTrackerPlugin.cs


示例17: Update

		public override void Update(DrawArgs drawArgs)
		{
			try
			{
				if(!this.IsOn)
					return;

				if(!this.isInitialized)
					this.Initialize(drawArgs);


				foreach(RenderableObject ro in this.m_children)
				{
					if(ro.IsOn)
					{
						ro.Update(drawArgs);
					}
				}
			}
			catch(Exception ex)
			{
				System.Windows.Forms.MessageBox.Show(ex.Message);
				//Critical error, turn off layer
				this.IsOn=false;
				throw ex;
			}
			base.Update (drawArgs);
		}
开发者ID:jpespartero,项目名称:WorldWind,代码行数:28,代码来源:SatelliteTrackerPlugin.cs


示例18: Initialize

		public void Initialize(DrawArgs drawArgs)
		{
			if (m_autoSize)
				ComputeAutoSize (drawArgs);
			m_isInitialized = true;
		}
开发者ID:jpespartero,项目名称:WorldWind,代码行数:6,代码来源:LabelWidget.cs


示例19: Render

		public void Render(DrawArgs drawArgs)
		{
			// if we aren't active do nothing.
			if ((!m_visible) || (!m_enabled))
				return;			

			if (!m_isInitialized)
				Initialize(drawArgs);

			drawArgs.defaultDrawingFont.DrawText(
				null,
				m_Text,
				new System.Drawing.Rectangle(AbsoluteLocation.X, AbsoluteLocation.Y, m_size.Width, m_size.Height),
				m_Format,
				m_ForeColor);

			if (m_clearOnRender)
			{
				m_Text = "";
				m_isInitialized = false;
			}
		}
开发者ID:jpespartero,项目名称:WorldWind,代码行数:22,代码来源:LabelWidget.cs


示例20: UpdateTrackPositions

		/// <summary>
		/// Updates the array track with the future positions of the satellite.  Called initially and then when the timer fires.
		/// </summary>
		/// <param name="drawArgs"></param>
		private void UpdateTrackPositions(DrawArgs drawArgs)
		{
			//Do not update the track every render, very CPU intensive.  Update after the timer sets UpdateTrack
			//to true.
			if(UpdateTrack)
			{
				periodMin = (int) orbit.Period()/60;
				track = new CustomVertex.PositionColored[periodMin*m_trackorbits];
				for(int i=0;i<track.Length;i++)
				{
					try
					{
						Eci e = orbit.getPosition(i+m_elapsedMinutes);
						CoordGeo cg = e.toGeo();
						Vector3 s = MathEngine.SphericalToCartesian(Angle.FromRadians(cg.Latitude ), Angle.FromRadians(cg.Longitude ),
							drawArgs.WorldCamera.WorldRadius + cg.Altitude *1000 );
						track[i].X = s.X;
						track[i].Y = s.Y;
						track[i].Z = s.Z;
						track[i].Color = m_orbitColor;
					}
					catch(Exception ex)
					{
						//Do not throw decayed orbit erroes.
						if(!ex.Message.Equals("Satellite orbit may have decayed"))
							throw ex;
					}
				}
				UpdateTrack = false;
			}
		}
开发者ID:jpespartero,项目名称:WorldWind,代码行数:35,代码来源:SatelliteTrackerPlugin.cs



注:本文中的WorldWind.DrawArgs类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Misc.Guid类代码示例发布时间:2022-05-26
下一篇:
C# player.Player类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap