Hi.WinForm and Hi.WpfPlus are being retired, and Hi.Sample.Wpf existed only to demonstrate Hi.WpfPlus -- but ten of its fourteen files never touched WPF at all. Those move here rather than leaving with it: - The three displayees upgrading-to-3.2/breaking-changes.md tells callers to copy -- MachiningProjectDisplayee, IsoCoordinateEntryDisplayee, HeidenhainCoordinateEntryDisplayee. They compose only public API over LocalProjectService, which is the point of shipping them as a starting sample; that doc now points at Hi.Sample/Disp/. - Seven display demos -- Cylindroid, DiscreteRgb, Drawing, Pick1, Pick2, Pickable, Satellite. Their only WPF coupling was the closing DemoUtil.RunApplication call. DemoUtil is rewritten for a project with no canvas. HiAPI ships none any more, so a sample cannot end by opening a window; Present() initializes the app, reports the displayee's type and bounding box, and shuts down, which makes the samples runnable and checkable headlessly and puts the handover where it actually is -- the application assigns the composed IDisplayee to its own canvas' DispEngine. The four files that genuinely need WPF (DemoStl, the old DemoUtil, and the two Machining demos) stay behind and retire with Hi.Sample.Wpf. Each moved file's own [!code-csharp] doc-comment path was repointed from ~/../Hi.Sample.Wpf/Disp/ to ~/../Hi.Sample/Disp/. Builds clean at x64: 0 warnings, 0 errors. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
59 lines
1.5 KiB
C#
59 lines
1.5 KiB
C#
using Hi.Disp;
|
|
using Hi.Geom;
|
|
using System;
|
|
|
|
namespace Sample.Disp;
|
|
|
|
/// <summary>
|
|
/// Demonstrates creation of pickable 3D geometry at the primitive level.
|
|
/// Shows how to assign picking IDs directly to geometry vertices and create interactive triangles.
|
|
/// Uses a lower-level approach than the Pickable base class for more precise control.
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// ### Source Code
|
|
/// [!code-csharp[SampleCode](~/../Hi.Sample/Disp/DemoPickable.cs)]
|
|
/// </remarks>
|
|
public class DemoPickable : IDisplayee
|
|
{
|
|
private readonly Drawing draw;
|
|
private readonly ShowEventPickable pickable;
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of DemoPickable.
|
|
/// Creates a pickable triangle with a specific picking ID for user interaction.
|
|
/// </summary>
|
|
public DemoPickable()
|
|
{
|
|
pickable = new ShowEventPickable();
|
|
double pid = pickable.PickingID;
|
|
double[] vs = new double[] {
|
|
//pickID, x,y,z
|
|
pid, 0,0.1,0.1,
|
|
pid, 0.1,0,0,
|
|
pid, 0.1,0,0.1
|
|
};
|
|
draw = new Drawing(vs, Stamp.PV, GL.GL_TRIANGLES);
|
|
}
|
|
/// <inheritdoc/>
|
|
public void Display(Bind bind)
|
|
{
|
|
draw.Display(bind);
|
|
}
|
|
/// <inheritdoc/>
|
|
public void ExpandToBox3d(Box3d dst)
|
|
{
|
|
draw.ExpandToBox3d(dst);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Entry point for the DemoPickable example.
|
|
/// Creates and displays a pickable triangle that can respond to mouse events.
|
|
/// Demonstrates integration of picking functionality with geometric primitives.
|
|
/// </summary>
|
|
[STAThread]
|
|
public static void Main()
|
|
{
|
|
DemoUtil.Present("DemoPickable", new DemoPickable());
|
|
}
|
|
}
|