Harmony
Scripting Interface Documentation
Line2dDisplayWidget Class Reference

The Line2dDisplayWidget JavaScript class. A 2 dimensional line linking 2 points. More...

Additional Inherited Members

- Public Slots inherited from WidgetBase
Attributedata (int index=0)
 
- Signals inherited from WidgetBase
void dragStarted (QScriptValue dragContext)
 signal called on mouse down when picking this widget with the Transform tool More...
 
void drag (QScriptValue dragContext)
 signal called when this widget is dragged with the Transform tool More...
 
void dragEnded ()
 signal called on mouse up after having manipulated this widget with the Transform tool More...
 

Detailed Description

The Line2dDisplayWidget JavaScript class. A 2 dimensional line linking 2 points.

A simple 2 dimensional line display script widget. This widget offers a 2D visual line in the Camera view. It is intended to show the relation between 2 distinct points. The line 2D widget cannot be instantiated without providing it with an array of 2 2D point attributes.

The following properties are supported by the widget:

Property Type Default Value Description
data Attribute array An array of existing 2D point attribute.
size float 0.01 The thickness of the line.
color ColorRGBA 255, 0, 0 The colour of the sphere manipulator.

The following components constitute the widget:

Component Type -----—
attribute 2 x POSITION_2D
drag_manipulator -
painter LINE_2D
picker -
local_transformation -

Set the data properties of this widget to an array of 2 2d point attributes at the widget creation.

{
var myPointWidgetA = new Point2dWidget();
var myPointWidgetB = new Point2dWidget();
var myLine2dDisplayWidget = new Line2dDisplayWidget(
{
data : [myPointWidgetA.data(), myPointWidgetB.data()],
size : 0.05,
color : ColorRGBA(20, 20, 20)
} );
myLine2dDisplayWidget.data(0).setValue(new Point2d(2,2));
myLine2dDisplayWidget.data(1).setValue(new Point2d(-2,-2));
Controller.controls.push(myPointWidgetA);
Controller.controls.push(myPointWidgetB);
Controller.controls.push(myLine2dDisplayWidget);