Class: oContour

$. oContour

The $.oContour class models the strokes that make up the shapes visible on the Drawings.
$.oContour is a subclass of $.oSroke and shares its properties, but represents a stroke with a fill.

new $.oContour(index, contourObject, oShapeObject)

openHarmony/openHarmony_drawing.js, line 1864
The constructor for the $.oContour class. These types of objects are not supported for harmony versions < 16
Name Type Description
index int The index of the contour in the shape.
contourObject object The stroke object descriptor that contains the info for the stroke
oShapeObject oShape The parent oShape
Properties:
Name Type Description
index int the index of the stroke in the parent shape
shape $.oShape the shape that contains this stroke
artLayer $.oArtLayer the art layer that contains this stroke

Extends

Members

readonlybounds$.oBox

The bounding box of the contour.

closedbool

wether the stroke is a closed shape.
The information about the fill of this contour

indexint

The index of the stroke in the shape

readonlypathArray.<$.oVertex>

The $.oVertex (including bezier handles) making up the complete path of the stroke.

readonlypointsArray.<$.oVertex>

The oVertex that are on the stroke (Bezier handles exluded.) The first is repeated at the last position when the stroke is closed.

readonlysegmentsArray.<Array.<$.oVertex>>

The segments making up the stroke. Each segment is a slice of the path, starting and stopping with oVertex present on the curve, and includes the bezier handles oVertex.
The style of the stroke. null if the stroke is invisible

Methods

inherited addPoints(pointsToAdd){Array.<$.oVertex>}

openHarmony/openHarmony_drawing.js, line 1699
Adds points on the stroke without moving them, at the distance specified (0=start vertice, 1=end vertice)
Name Type Description
pointsToAdd Array.<float> an array of float value between 0 and the number of current points on the curve
Returns:
Type Description
Array.<$.oVertex> the points that were created (if points already existed, they will be returned)
Example
// get the selected stroke and create points where it intersects with the other two strokes
var sel = $.scn.activeDrawing.selectedStrokes[0];

var intersections = sel.getIntersections();

// get the two intersections
var intersection1 = intersections[0];
var intersection2 = intersections[1];

// add the points at the intersections on the intersecting strokes
intersection1.stroke.addPoints([intersection1.strokePoint]);
intersection2.stroke.addPoints([intersection2.strokePoint]);

// add the points on the stroke
sel.addPoints([intersection1.ownPoint, intersection2.ownPoint]);

inherited getClosestPoint(point){$.oPoint}

openHarmony/openHarmony_drawing.js, line 1797
projects a point onto a stroke and returns the closest point belonging to the stroke. Only works until a distance of 600 drawing vector units.
Name Type Description
point $.oPoint
Returns:
Type Description
$.oPoint

inherited getIntersections(stroke){Array.<Object>}

openHarmony/openHarmony_drawing.js, line 1646
The intersections on this stroke. Each intersection is an object with stroke ($.oStroke), point($.oPoint), strokePoint(float) and ownPoint(float) One of these objects describes an intersection by giving the stroke it intersects with, the coordinates of the intersection and two values which represent the place on the stroke at which the point is placed, with a value between 0 (start) and 1(end)
Name Type Description
stroke $.oStroke optional Specify a stroke to find intersections specific to it. If no stroke is specified,
Returns:
Type Description
Array.<Object>
Example
// get the selected strokes on the active drawing
var sel = $.scn.activeDrawing.selectedStrokes;

for (var i in sel){
  // get intersections with all other elements of the drawing
	var intersections = sel[i].getIntersections();

  for (var j in intersections){
    log("intersection : " + j);
    log("point : " + intersections[j].point);                    // the point coordinates
    log("strokes index : " + intersections[j].stroke.index);     // the index of the intersecting strokes in their own shape
    log("own point : " + intersections[j].ownPoint);             // how far the intersection is on the stroke itself
    log("stroke point : " + intersections[j].strokePoint);       // how far the intersection is on the intersecting stroke
  }
}

inherited getPointCoordinates(position){$.oPoint}

openHarmony/openHarmony_drawing.js, line 1780
Get the coordinates of the point on the stroke from its strokePosition (@see $.oVertex#strokePosition). Only works until a distance of 600 drawing vector units.
Name Type Description
position float
Returns:
Type Description
$.oPoint an oPoint object containing the coordinates.

inherited getPointDistance(point){float}

openHarmony/openHarmony_drawing.js, line 1817
projects a point onto a stroke and returns the distance between the point and the stroke. Only works until a distance of 600 drawing vector units.
Name Type Description
point $.oPoint
Returns:
Type Description
float

inherited getPointPosition(point){float}

openHarmony/openHarmony_drawing.js, line 1762
Gets the closest position of the point on the stroke (float value) from a point with x and y coordinates.
Name Type Description
point oPoint
Returns:
Type Description
float the strokePosition of the point on the stroke (@see $.oVertex#strokePosition)

inherited updateDefinition(){object}

openHarmony/openHarmony_drawing.js, line 1745
fetch the stroke information again to update it after modifications.
Returns:
Type Description
object the data definition of the stroke, for internal use.