1. AxisFrame

1.1. new AxisFrame(geomap, options)

坐标轴

Param Type Default Description
geomap Geomap -

地图对象

options Object -

属性选项

options.target Cesium3DTileset | Model| Point -

目标对象,支持通过ModelLayer.add方法添加的三维模型对象(Model、Cesium3DTileset)和点实体对象(Entity)

[options.xColor] String '#ff0000'

x轴颜色

[options.yColor] String '#00ff00'

y轴颜色

[options.zColor] String '#0000ff'

z轴颜色

[options.xyColor] String '#0000ff85'

xy轴面颜色

[options.yzColor] String '#ff000085'

yz轴面颜色

[options.xzColor] String '#00ff0085'

xz轴面颜色

[options.radius] Number

坐标轴长度,若不指定长度,则长度根据当前目标对象大小而定。

[options.hasAxisPlane] Number true

是否需要轴面

[options.hasDepth] Number false

是否允许坐标轴在一定深度也显示,若为true,坐标轴总是置于被拖拽目标的前方。

[options.width] Number 20

坐标轴宽度

[options.planeScale] Number 0.3

轴面比例

[options.minimumScale] Number 0.3

坐标轴最小比例

[options.maximumScale] Number 5

坐标轴最大比例

[options.consistent] Boolean false

坐标轴方向是否与模型整体局部坐标系保持一致,false表示与世界坐标系平行,true表示与模型整体局部坐标系一致

Example

let geomap = new BOSGeo.GeoMap('container');
let layerManager = map.layerManager;
let modelLayer = layerManager.createLayer(BOSGeo.LayerType.MODEL, "模型");
let myModel = modelLayer.add({
    name: '模型名称',
    url: 'https://lab.earthsdk.com/model/3610c2b0d08411ea/tileset.json'
});
geomap.enableMoveFeature(new BOSGeo.AxisFrame(geomap, {target: myModel}));

//或者点击模型方式
geomap.on(BOSGeo.MapEventType.LEFT_CLICK, (e) => {
    if (e.feature) {  //拾取到模型时
        const f = BOSGeo.GeoUtil.getPickTargetFeature(e.feature).target;
        BOSGeo.GeoUtil.selectFeature(f);
        console.log(f);
        const axis = new BOSGeo.AxisFrame(geomap, {target: f, hasDepth: true});//对拾取模型创建坐标轴
        geomap.enableMoveFeature(axis, (e) => console.log(e));  //拾取模型与坐标轴可移动
    }
}, [BOSGeo.MapPickType.FEATURE]);
document.addEventListener('keydown', function (event) {
    if (event.keyCode === 'I'.charCodeAt(0)) {
        geomap.disableMoveFeature(); //关闭要素移动事件功能
    }
});

1.2. 属性

属性名 Type Default Description
show Boolean true

坐标轴是否可见

highlightAxisOrPlane EditorAxisType -

高亮

target Cesium3DTileset | Model | Point -

目标

1.3. 方法

1.3.1. axisFrame.updateByTarget()

更新

Example

let axis = new BOSGeo.AxisFrame({target: myModel});

axis.updateByTarget() //模型被调整位置后执行更新

1.3.2. axisFrame.contains(primitive) ⇒ Boolean

Param Type Description
primitive Primitive

坐标系中是否包含该元素

1.3.3. axisFrame.destroy()

销毁

Example

let axis = new BOSGeo.AxisFrame({target: myModel});
axis.destroy()
版权所有@盈嘉互联(北京)科技有限公司 京ICP备15051988号-9 Copyright © 2022 all right reserved,powered by Gitbook该文件修订时间: 2022-02-22 17:53:53

results matching ""

    No results matching ""