Class SoPolygonScreenDrawer

  • All Implemented Interfaces:
    SafeDisposable

    public class SoPolygonScreenDrawer
    extends SoPolyLineScreenDrawer
    Interactively draws a polygon in normalized screen space. This class can be used to interactively draw a polygon on screen.

    When the polygon is finished, an event is raised to notify the application (see SoPolyLineScreenDrawer.onFinish ). Points are returned as normalized coordinates in the range -1..1, which is conveniently the default view volume for an SoOrthographicCamera node.

    The line color and simplification threshold are specified by fields in the parent class SoPolyLineScreenDrawer.

    Please see SoPolyLineScreenDrawer for additional notes and code example.

    Polygon specific notes:

    • The simplificationThreshold field does apply to this node.
    • If the user finishes a polygon and the application does not call the clear() method, then the next click will add another point to the existing polygon.
    • SbEventHandlers:
      • OnStart : Triggered on initial LeftMouseDown input event.
      • OnMove : Triggered on MouseMove input events (after Start)
        and also on LeftMouseDown and LeftMouseUp input events (after Start).
      • OnFinish : Triggered on LeftMouseDoubleClick input event
        or KeyPress input event with <Enter> or <ESC> keys.

    USAGE

    • Left click to add a point.
    • Double-click to add a point and finish the polygon.
    • Press Enter to finish the polygon (with the points added so far).
    • Press Escape to cancel creation of the polygon.

    File format/default:

    PolygonScreenDrawer {

      point []
      color 1 0 0
      simplificationThreshold 5
      isClosed true
    }

    See Also:
    SoEllipseScreenDrawer, SoLassoScreenDrawer, SoPolyLineScreenDrawer, SoRectangleScreenDrawer
    • Constructor Detail

      • SoPolygonScreenDrawer

        public SoPolygonScreenDrawer()
        Constructor.