Method GetEntitiesFromPolygon
- Namespace
- vdWebLibrary
- Assembly
- JsPropertiesExtractor.dll
GetEntitiesFromPolygon(object, object)
A crossing polygon selection Returns an array of vdraw entities that cross the specified closed polygon. Even if a small part of an entity lies inside the polygon, it is added in the array.
public object GetEntitiesFromPolygon(object pts, object coordSystem)
Parameters
ptsobjectAn array of points
coordSystemobjectThe 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 crossing 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 ents = vdcanvas.GetEntitiesFromPolygon(pts, true);
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
}
}
}