更改s3m 标签服务设置字体颜色??

0 投票
使用产品: iserver 9D

在webgl中,把标签专题图,发布为s3m 服务,如何设置 字体的颜色???使用下面的代码 为啥 没效果??还有可以动态设置字体大小不??

//获取图层风格
 var style = layer.style3D;
 //设置图层风格
//var style3D = new Cesium.Style3D();
var color = new Cesium.Color(1,1,0);
 style.fillForeColor = color;
 layer.style3D = style;
  //设置后需刷新图层
   layer.refresh();
5月 18, 2018 分类:  381次浏览 | 用户: 匿名

1个回答

0 投票

您好,用最新包试试呢http://support.supermap.com.cn:8090/webgl/download.html

您也可以在线测试http://support.supermap.com.cn:8090/webgl/examples/editor.html#S3MTiles_vector该范例,把源代码修改成下面这样即可:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
    <title>矢量</title>
    <link href="../Build/Cesium/Widgets/widgets.css" rel="stylesheet">
    <link href="./css/pretty.css" rel="stylesheet">
    <script src="./js/jquery.min.js"></script>
    <script src="./js/config.js"></script>
	<script type="text/javascript" src="./js/require.min.js" data-main="js/main"></script>

    <style>
        html, body, #cesiumContainer {
            width: 100%; height: 100%; margin: 0; padding: 0; overflow: hidden;background-color: #000000;
        }
    </style>
</head>
<body>
<div id="cesiumContainer"></div>
<div id='loadingbar' class="spinner">
    <div class="spinner-container container1">
        <div class="circle1"></div>
        <div class="circle2"></div>
        <div class="circle3"></div>
        <div class="circle4"></div>
    </div>
    <div class="spinner-container container2">
        <div class="circle1"></div>
        <div class="circle2"></div>
        <div class="circle3"></div>
        <div class="circle4"></div>
    </div>
    <div class="spinner-container container3">
        <div class="circle1"></div>
        <div class="circle2"></div>
        <div class="circle3"></div>
        <div class="circle4"></div>
    </div>
</div>
<script type="text/javascript">
    var host = document.location.toString().match(/file:\/\//)?"http://localhost:8090":'http://' + document.location.host;
    function onload(Cesium) {
        //初始化viewer部件
        var viewer = new Cesium.Viewer('cesiumContainer',{
            imageryProvider :  new Cesium.BingMapsImageryProvider({
                key : "AjQhMyw76oicHqFz7cUc3qTEy3M2fC2YIbcHjqgyMPuQprNVBr3SsvVdOfmlVc0v",//可至官网(https://www.bingmapsportal.com/)申请key
                url : URL_CONFIG.BINGMAP
            })
        });
        var scene = viewer.scene;
        var widget = viewer.cesiumWidget;
        $('#loadingbar').remove();
        try{
            //打开所发布三维服务下的所有图层
            var promise = scene.open('http://www.supermapol.com/realspace/services/3D-GuangZhou/rest/realspace');
            Cesium.when.all(promise,function(layers){
               var layer=scene.layers.findByIndex(0);
		        var color = new Cesium.Color(1.0, 0.0, 0.0);
		        layer.style3D.fillForeColor = color;
		        //设置后需刷新图层
		        layer.refresh();
                //设置图层的阴影模式
                scene.camera.setView({
                    //将经度、纬度、高度的坐标转换为笛卡尔坐标
                    destination : new Cesium.Cartesian3(-2323607.7945701713,5386182.530303348,2505814.811681112),
                    orientation : {
                        heading : 4.844795866469065,
                        pitch : -0.58125995096984,
                        roll :1.2504663970958063e-11
                    }
                });
            },function(e){
                if (widget._showRenderLoopErrors) {
                    var title = '加载SCP失败,请检查网络连接状态或者url地址是否正确?';
                    widget.showErrorPanel(title, undefined, e);
                }
            });
        }
        catch(e){
            if (widget._showRenderLoopErrors) {
                var title = '渲染时发生错误,已停止渲染。';
                widget.showErrorPanel(title, undefined, e);
            }
        }
    }
    </script>
</body>
</html>

5月 18, 2018 用户: 胡林 登峰造极 (5,972 分)

对普通的模型 有作用,但是对 文字 没作用(标签专题服务没作用)

 

...