Make bounds a Box3d.
This commit is contained in:
parent
c706e16db1
commit
34720970ff
@ -6,4 +6,8 @@
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Dashboard\Dashboard.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
|
||||
@ -64,8 +65,11 @@ namespace Dashboard.Drawing
|
||||
|
||||
public static void Point(this DrawQueue queue, Vector3 position, float size, IBrush brush)
|
||||
{
|
||||
Vector3 radius = new Vector3(size / 2f);
|
||||
Box3d bounds = new Box3d(position - radius, position + radius);
|
||||
|
||||
var controller = queue.GetController(DbBaseCommands.Instance);
|
||||
controller.EnsureSize(position);
|
||||
controller.EnsureBounds(bounds);
|
||||
controller.Write(DbBaseCommands.Instance.DrawPoint, new PointCommandArgs(position, size, brush));
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Numerics;
|
||||
|
||||
namespace Dashboard.Drawing
|
||||
{
|
||||
@ -15,9 +15,9 @@ namespace Dashboard.Drawing
|
||||
private readonly MemoryStream _commandStream = new MemoryStream();
|
||||
|
||||
/// <summary>
|
||||
/// Size of the image in points.
|
||||
/// The absolute boundary of all graphics objects.
|
||||
/// </summary>
|
||||
public Vector3 Size { get; private set; } = Vector3.Zero;
|
||||
public Box3d Bounds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The extensions required to draw the image.
|
||||
@ -163,19 +163,9 @@ namespace Dashboard.Drawing
|
||||
|
||||
private class DrawController(DrawQueue Queue) : IDrawController
|
||||
{
|
||||
public void EnsureSize(Vector3 size)
|
||||
public void EnsureBounds(Box3d bounds)
|
||||
{
|
||||
Queue.Size = Vector3.Max(Queue.Size, size);
|
||||
}
|
||||
|
||||
public int Require(IDrawExtension extension)
|
||||
{
|
||||
return Queue.RequireExtension(extension);
|
||||
}
|
||||
|
||||
public int GetResourceIndex(IDrawResource resource)
|
||||
{
|
||||
return Queue._resources.Intern(resource);
|
||||
Queue.Bounds = Box3d.Union(Queue.Bounds, bounds);
|
||||
}
|
||||
|
||||
public void Write(IDrawCommand command)
|
||||
@ -237,8 +227,8 @@ namespace Dashboard.Drawing
|
||||
/// <summary>
|
||||
/// Ensures that the canvas is at least a certain size.
|
||||
/// </summary>
|
||||
/// <param name="size">The minimum size.</param>
|
||||
void EnsureSize(Vector3 size);
|
||||
/// <param name="bounds">The bounding box.</param>
|
||||
void EnsureBounds(Box3d bounds);
|
||||
|
||||
/// <summary>
|
||||
/// Write into the command stream.
|
||||
|
Loading…
Reference in New Issue
Block a user