zhanmingkan
2022-05-14 0fc43fe898d14895c97427801293edfb3a0c5bf1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
function drawPoint() {
    var options = {
        'viewer': viewer, //全局Cesium对象
        'pointcolor': Cesium.Color.RED, //点的颜色
        // 'printId':textid,  //用来存放返回坐标的文本框的id
        'text': '新',   //要印在PIN标签上的文字
        'size': 36    //PIN标签的大小(以像素为单位)
    };
    CesiumDraw.drawPoint(options);
}
function drawPolyline() {
    var options = {
        'viewer': viewer, //全局Cesium对象
        'polylinecolor': new Cesium.Color.fromBytes(255,124,0,255), //线的颜色)
        'pointcolor': Cesium.Color.WHITE, //画线时次点的颜色
        // 'printId':textid,    //用来存放返回坐标的文本框的id
        'text': "线"      //次点时生成的PIN标签上的文字
    };
    CesiumDraw.drawPolyline(options);
}
function drawPolygon(type) {
    var options = {
        'viewer': viewer,  //全局Cesium对象
        'polygoncolor': Cesium.Color.SALMON.withAlpha(0.5), //面的颜色(可设置透明度)
        'pointcolor': Cesium.Color.RED,  //画面时圈点的颜色
        // 'printId':textid,  //用来存放返回坐标的文本框的id
        'type': type 
    };
    CesiumDraw.drawPolygon(options);
}
function drawLabel(text) {
    var options = {
        'viewer': viewer,
        'label': {
            'text': text,
            'font': '30px SimSun',
            'fillColor': Cesium.Color.RED,
            'outlineColor': Cesium.Color.BLACK,
            'outlineWidth': 2,
            'style': Cesium.LabelStyle.FILL_AND_OUTLINE,
            'scaleByDistance': new Cesium.NearFarScalar(100, 1.0, 200, 0.4)
        },
    }
    CesiumDraw.drawLabel(options);
}
 
function clearDraw() {
    var options = {
        'viewer': viewer, //全局Cesium对象
    };
    CesiumDraw.clearDraw(options);
}