Table of Contents

Method GetEntitiesInWindowPolygon

Namespace
vdWebLibrary
Assembly
JsPropertiesExtractor.dll

GetEntitiesInWindowPolygon(object, object)

A window polygon selection Returns an array of vdraw entities that lie entirely inside the specified closed polygon.

Even if a small part of an entity lies outside the polygon, the entity is ignored.

public object GetEntitiesInWindowPolygon(object pts, object coordSystem)

Parameters

pts object

An array of points

coordSystem object

The coordinate system of the passed pts

0 -or- false -or- undefined for pts are in pixels.

1 -or- true for pts are in WorldCS.

2 for pts are in current View.

Returns

object

An array of selected entity objects

Examples

Prompt the user to select a polyline and make a window polygon selection from selected polyline boundary

vdcanvas.GetUserPoint(_onActiongetPointEntitySelection);
function _onActiongetPointEntitySelection(action, status) {
var vdcanvas = action.vdrawOwner();
if (status == 'start') {
vdcanvas.Prompt('pick an polyline that defines a close polygon for selection');
} else if (status == 'end') {
vdcanvas.Prompt('');
if (!action.IsCanceled()) {
var pt = vdcanvas.WorldToPixel([action.ResValue[X],action.ResValue[Y],0]);
var entity = vdcanvas.GetEntityFromPoint(pt[X], pt[Y]); //scan for an entity under the pick point
if (!entity || entity._t !== vdConst.vdPolyline_code) return; //check if entity exist and is a polyline type
var pts = vdcanvas.GetEntitySamplePoints(entity);//get the points of selected curve in world coordinate system
var ents = vdcanvas.GetEntitiesInWindowPolygon(pts,true);
for (var i = 0; i  < ents.length; i++)  ents[i].HighLight = true;//highlight the selected figures
setTimeout(vdcanvas.redraw);//post a redraw
}
}
}