Table of Contents

Method GetUserLine

Namespace
vdWebLibrary
Assembly
JsPropertiesExtractor.dll

GetUserLine(onStateChangedDelegate)

Initiates an action (check BaseActionObj) where the user will create a new line in the component's drawing area. The function is running asynchronously, so you need to implement statechangeDelegate event/delegate to manage the method results The action has the actionType == ACTION_LINE_WORLD

public void GetUserLine(onStateChangedDelegate statechangeDelegate)

Parameters

statechangeDelegate onStateChangedDelegate

A function created using the onStateChangedDelegate as model.

Examples

function CmdGetDistance(canvasId) {
   var vdcanvas = vdmanager.vdrawObject(canvasId);
   vdcanvas.GetUserLine(_onActionGetDistanceStateChanged);
}

function _onActionGetDistanceStateChanged(action, status) {
    var vdcanvas = action.vdrawOwner();

    if (status == 'start') {
        vdcanvas.Prompt('pick first point');
    } else if (status == 'count') {
        vdcanvas.Prompt('pick second point');
    } else if (status == 'end') {
        vdcanvas.Prompt(':');
        if (!action.IsCanceled()) {
           var distance = vdgeo.Distance2D(action.ResValue[0], action.ResValue[1]);
           vdcanvas.Prompt('Distance = ' + distance.toString());
       }
    }
}