本文整理汇总了C#中WorldWind.DrawArgs类的典型用法代码示例。如果您正苦于以下问题:C# DrawArgs类的具体用法?C# DrawArgs怎么用?C# DrawArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DrawArgs类属于WorldWind命名空间,在下文中一共展示了DrawArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 );
}
示例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);
}
示例3: Render
public override void Render(DrawArgs drawArgs)
{
if(!this._control.Visible)
{
this.SetPushed(false);
}
}
示例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;
}
示例5: Render
public override void Render(DrawArgs drawArgs)
{
if (!m_widget.Visible)
{
SetPushed(false);
}
}
示例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();
}
示例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 );
}
示例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);
}
}
}
示例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();
}
示例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);
}
示例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
);
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}