Class DemoPickable
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.
public class DemoPickable : IDisplayee, IExpandToBox3d
- Inheritance
-
DemoPickable
- Implements
- Inherited Members
Remarks
Source Code
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.Wpf/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.RunApplication("DemoPickable", new DemoPickable());
}
}
}
Constructors
DemoPickable()
Initializes a new instance of DemoPickable. Creates a pickable triangle with a specific picking ID for user interaction.
public DemoPickable()
Methods
Display(Bind)
Display function called in DispEngine rendering loop.
public void Display(Bind bind)
Parameters
bindBindBind with DispEngine. See Bind.
ExpandToBox3d(Box3d)
Expands the destination box. This function is usually used to compute the bounding box of elements.
public void ExpandToBox3d(Box3d dst)
Parameters
dstBox3dDestination box
Main()
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.
[STAThread]
public static void Main()