如何在铯中获得与模型的鼠标相交的位置

时间:2019-06-12 11:39:55

标签: cesium

我正在尝试使用Cesium中的模型获取鼠标的相交位置

我也想对铯实体使用PoTree测量。我已经使用了Potree Cesium示例。

但是在那个例子中,我看到铯和Potree在两个不同的画布层上。

var pointcloudPoint = scope.getMousePointCloudIntersection();
var modelPoint = viewer.getMouseModelIntersection(scope.mouse);
var nearestPoint = viewer.getModelPointcloudNearestPoint(pointcloudPoint, modelPoint);
var measurmentPoint = getHoveredElement();

if (nearestPoint == null) {
    if (
        measurmentPoint != false
        && viewer.measuringTool.activeMeasurement != null
    ) {
        var point = measurmentPoint.object;
    }
} else {

    var point = nearestPoint;
}

这是我如何获得不同的鼠标交点位置

if (scope.state == scope.STATE.INSERT && scope.activeMeasurement) {
    var pointcloudPoint = scope.getMousePointCloudIntersection();
    var modelPoint = viewer.getMouseModelIntersection(scope.mouse);
    var nearestPoint = viewer.getModelPointcloudNearestPoint(pointcloudPoint, modelPoint);
    var measurmentPoint = getHoveredElement();

    if (nearestPoint == null) {
        if (
            measurmentPoint != false
            && viewer.measuringTool.activeMeasurement != null
        ) {
            var point = measurmentPoint.object;
        }
    } else {
        var point = nearestPoint;
    }

    if (point) {
        var position = point.position;
        var lastIndex = scope.activeMeasurement.points.length - 1;
        scope.activeMeasurement.setMarker(lastIndex, point);
    }
}

0 个答案:

没有答案