use of ij3d.shapes.BoundingBox in project GDSC-SMLM by aherbert.
the class CustomContentInstant method display.
@Override
public void display(final ContentNode node) {
// Remove everything if possible
for (final Enumeration<Node> e = ordered.getAllChildren(); e.hasMoreElements(); ) {
final Switch s = (Switch) e.nextElement();
s.removeAllChildren();
}
// Remove custom switch objects
while (ordered.numChildren() > 5) {
ordered.removeChild(ordered.numChildren() - 1);
}
customBefore = 0;
if (switchMap != null) {
switchMap.clear();
}
// Create content node and add it to the switch
contentNode = node;
((Switch) ordered.getChild(CO)).addChild(contentNode);
// Create the bounding box and add it to the switch
final Point3d min = new Point3d();
contentNode.getMin(min);
final Point3d max = new Point3d();
contentNode.getMax(max);
BoundingBox bb = new BoundingBox(min, max);
bb.setPickable(false);
((Switch) ordered.getChild(BS)).addChild(bb);
bb = new BoundingBox(min, max, new Color3f(0, 1, 0));
bb.setPickable(false);
((Switch) ordered.getChild(BB)).addChild(bb);
// Create coordinate system and add it to the switch
final float cl = (float) Math.abs(max.x - min.x) / 5f;
final CoordinateSystem cs = new CoordinateSystem(cl, new Color3f(0, 1, 0));
cs.setPickable(false);
((Switch) ordered.getChild(CS)).addChild(cs);
// Create point list and add it to the switch
((Switch) ordered.getChild(PL)).addChild(plShape);
// Adjust the landmark point size properly
plShape.setRadius((float) min.distance(max) / 100f);
// Initialize child mask of the switch
setSwitchValue(BS, selected);
setSwitchValue(CS, coordVisible);
setSwitchValue(CO, visible);
setSwitchValue(PL, showPl);
// Update type
this.type = CUSTOM;
}
Aggregations