i draw water pipeline with my own polygons data。the water pipeline is Simulated with 16 polygons. I can not use PlylineVolumeGeometry, because the water pipeline is preprocessed , and the data comes from server with ajax。
the picture is a simplified version with 8 polygons。Actually, it has 16.
this is the data:
{
"geometry": [
{
"p1": [
31.804247343787384,
119.99082370184908,
24.21246689396021
],
"p2": [
31.804247352755727,
119.99082373405653,
24.241554082666756
],
"p3": [
31.802317524880625,
119.99153830893675,
24.462406476131683
],
"p4": [
31.80231751591243,
119.99153827672993,
24.433319287425142
]
},
{
"p1": [
31.804247352755727,
119.99082373405653,
24.241554082666756
],
"p2": [
31.804247330785184,
119.99082365173076,
24.26965470756847
],
"p3": [
31.802317502910523,
119.99153822661258,
24.4905071010334
],
"p4": [
31.802317524880625,
119.99153830893675,
24.462406476131683
]
},
{
"p1": [
31.804247330785184,
119.99082365173076,
24.26965470756847
],
"p2": [
31.804247281220565,
119.99082346740518,
24.29249070321276
],
"p3": [
31.80231745334692,
119.99153804229043,
24.513343096677687
],
"p4": [
31.802317502910523,
119.99153822661258,
24.4905071010334
]
},
{
"p1": [
31.804247281220565,
119.99082346740518,
24.29249070321276
],
"p2": [
31.804247211607628,
119.99082320914167,
24.30658549623574
],
"p3": [
31.802317383735417,
119.99153778403173,
24.527437889700668
],
"p4": [
31.80231745334692,
119.99153804229043,
24.513343096677687
]
},
{
"p1": [
31.804247211607628,
119.99082320914167,
24.30658549623574
],
"p2": [
31.80424713254431,
119.99082291625852,
24.30979328214715
],
"p3": [
31.80231730467372,
119.99153749115409,
24.530645675612078
],
"p4": [
31.802317383735417,
119.99153778403173,
24.527437889700668
]
},
{
"p1": [
31.80424713254431,
119.99082291625852,
24.30979328214715
],
"p2": [
31.80424705606728,
119.99082263334454,
24.301625704615596
],
"p3": [
31.802317228198255,
119.99153720824538,
24.522478098080523
],
"p4": [
31.80231730467372,
119.99153749115409,
24.530645675612078
]
},
{
"p1": [
31.80424705606728,
119.99082263334454,
24.301625704615596
],
"p2": [
31.804246993819483,
119.99082240347076,
24.283326203293804
],
"p3": [
31.802317165951735,
119.99153697837588,
24.50417859675873
],
"p4": [
31.802317228198255,
119.99153720824538,
24.522478098080523
]
},
{
"p1": [
31.804246993819483,
119.99082240347076,
24.283326203293804
],
"p2": [
31.804246955277588,
119.99082226163347,
24.257680711401353
],
"p3": [
31.80231712741061,
119.99153683654124,
24.47853310486628
],
"p4": [
31.802317165951735,
119.99153697837588,
24.50417859675873
]
},
{
"p1": [
31.804246955277588,
119.99082226163347,
24.257680711401353
],
"p2": [
31.80424694630924,
119.99082222942602,
24.22859352264217
],
"p3": [
31.80231711844244,
119.99153680433442,
24.4494459161071
],
"p4": [
31.80231712741061,
119.99153683654124,
24.47853310486628
]
},
{
"p1": [
31.80424694630924,
119.99082222942602,
24.22859352264217
],
"p2": [
31.80424696827978,
119.99082231175178,
24.200492897874483
],
"p3": [
31.802317140412534,
119.99153688665864,
24.421345291339414
],
"p4": [
31.80231711844244,
119.99153680433442,
24.4494459161071
]
},
{
"p1": [
31.80424696827978,
119.99082231175178,
24.200492897874483
],
"p2": [
31.80424701784441,
119.99082249607739,
24.177656902530494
],
"p3": [
31.80231718997613,
119.99153707098078,
24.398509295995424
],
"p4": [
31.802317140412534,
119.99153688665864,
24.421345291339414
]
},
{
"p1": [
31.80424701784441,
119.99082249607739,
24.177656902530494
],
"p2": [
31.804247087457348,
119.99082275434087,
24.163562109928364
],
"p3": [
31.802317259587653,
119.99153732923943,
24.38441450339329
],
"p4": [
31.80231718997613,
119.99153707098078,
24.398509295995424
]
},
{
"p1": [
31.804247087457348,
119.99082275434087,
24.163562109928364
],
"p2": [
31.80424716652066,
119.99082304722405,
24.16035432449428
],
"p3": [
31.80231733864935,
119.99153762211712,
24.38120671795921
],
"p4": [
31.802317259587653,
119.99153732923943,
24.38441450339329
]
},
{
"p1": [
31.80424716652066,
119.99082304722405,
24.16035432449428
],
"p2": [
31.804247242997693,
119.99082333013803,
24.168521902486972
],
"p3": [
31.802317415124804,
119.99153790502582,
24.3893742959519
],
"p4": [
31.80231733864935,
119.99153762211712,
24.38120671795921
]
},
{
"p1": [
31.804247242997693,
119.99082333013803,
24.168521902486972
],
"p2": [
31.80424730524548,
119.99082356001179,
24.186821404183508
],
"p3": [
31.802317477371325,
119.99153813489528,
24.407673797648435
],
"p4": [
31.802317415124804,
119.99153790502582,
24.3893742959519
]
},
{
"p1": [
31.80424730524548,
119.99082356001179,
24.186821404183508
],
"p2": [
31.804247343787384,
119.99082370184908,
24.21246689396021
],
"p3": [
31.80231751591243,
119.99153827672993,
24.433319287425142
],
"p4": [
31.802317477371325,
119.99153813489528,
24.407673797648435
]
}
]
}
And this is the code:
$.ajax({
type:"POST",
url:"data.json",
dataType: "json",
success: function(data){
var geoms = data.geometry;
var greenPolygon = null;
var entity = null;
var instances = [];
for(var i=0; i<geoms.length; i++) {
var positions = Cesium.Cartesian3.fromDegreesArrayHeights([
geoms[i]["p1"][1], geoms[i]["p1"][0], geoms[i]["p1"][2],
geoms[i]["p2"][1], geoms[i]["p2"][0], geoms[i]["p2"][2],
geoms[i]["p3"][1], geoms[i]["p3"][0], geoms[i]["p3"][2],
geoms[i]["p4"][1], geoms[i]["p4"][0], geoms[i]["p4"][2]
]);
var polygonInstance = new Cesium.GeometryInstance({
geometry: Cesium.PolygonGeometry.fromPositions({
positions: positions,
vertexFormat: Cesium.PerInstanceColorAppearance.VERTEX_FORMAT
}),
attributes : {
color : Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.RED)
}
});
instances.push(polygonInstance);
}
viewer.scene.primitives.add(new Cesium.Primitive({
geometryInstances : instances,
appearance : new Cesium.PerInstanceColorAppearance()
}));
// 定位到可视范围
viewer.scene.camera.flyTo({
destination : Cesium.Cartesian3.fromDegrees(
119.99082249607739,
31.80424701784441,
24.177656902530494)
});
}
});
the result is:
it looks like a slice or a polygon, but not like column。
the data is correct。because my friends use it in WorldWind。
But i donot know what is the error
df w