首页 / 浏览问题 / 三维GIS / 问题详情
在webgl中,可以插入polyline volume数目有限制?
16EXP 2020年01月13日

现在的问题是,使用同样的程序在cesium原生的js库上运行,就没有错误。而在经过superMap打包的cesium js库上运行就会出:

image


这样的错误,而且只和要插入的polyline volume的数目有关。不能超过6个,超过,就会出错。

是不是supermap 故意做了数量的限制?

2 个回答

您好,没有限制,我这边添加了9个没出现错误,webgl添加方式:

function computeCircle(radius) {
    var positions = [];
    for (var i = 0; i < 360; i++) {
        var radians = Cesium.Math.toRadians(i);
        positions.push(new Cesium.Cartesian2(radius * Math.cos(radians), radius * Math.sin(radians)));
    }
    return positions;
}
var redTube = viewer.entities.add({
    name : 'Red tube with rounded corners',
    polylineVolume : {
        positions : Cesium.Cartesian3.fromDegreesArrayHeights([
            102.61773481610077, 31.071257883937033, 5000,
            102.71883646240747, 31.121299541997338, 5000,
            102.91726036147866, 31.08704848398098, 5000,
            102.81562112186255, 31.010046039747248, 5000
        ]),
        shape : computeCircle(100.0),
        material: Cesium.Color.WHITE,
    }
});
867EXP 2020年01月13日
不好意思,是12个,我这里只要超过12个就会出现那个黑屏。我的源代码是:

function parsePolyLineVolumePipes(jsonText, pipeType)
{
    var color = Cesium.Color.GREEN;
   

    var polylines = JSON.parse(jsonText);
    g_allPipes[pipeType] = polylines;
    for(var index=0; index<polylines.pvs.length;index++)
    {
        console.log("polyline number is :" + index);

        let pv = polylines.pvs[index];
        let radius = parseFloat(pv.sequence[0].gj)/100./2;
        let points = [];
        for(let pIndex=0; pIndex<pv.sequence.length; pIndex++)
        {
            let pp = pv.sequence[pIndex];
            let x = parseFloat(pp.longitude);
            let y = parseFloat(pp.latitude);
            let z = pp.dmgc - pp.ms + radius;
            if(isNaN(x) || isNaN(y) ||  isNaN(z))
            {
                console.info("error in xyz coordinate.");
            }
            else
            {
                console.info("x: " + x + ", y: " + y + ", z: " + z);
            }
            let point = Cesium.Cartesian3.fromDegrees(x, y, z);
            points.push(point);
        }
     
        var p2 =
        {
            //id : line.qddh + '-' + line.zddh,
            polylineVolume : {
               positions: points,
               shape : computeCircle(radius),
               cornerType : Cesium.CornerType.BEVELED,
               material : color,
               outline : false
            }
        }

        if(index !=14 && index < 10)
        {
            var pipe = viewer.entities.add(p2);
        }
 
      console.log("come here.");
     } //
}
16EXP 2020年01月13日
...