拿到一组数据在mars3d上渲染报错排查思路
前景提要:
1.拿到一组数据,不知道怎么在mars3d上渲染
positions: [[117.13736237725986, 46.36744915831693],[117.11316348752415, 46.37920796263987],[117.11150051793469, 46.37579082835441],[117.11934329709531, 46.37197672713472],[117.11996556958685, 46.37325882304401],[117.11828114232527, 46.37407421458465],[117.11853863439075, 46.37460529196966],[117.13658453664544, 46.36583983290777]],
2.翻了api文档,用了PolygonPrimitive方法,正常渲染了
const graphic = new mars3d.graphic.PolygonPrimitive({positions: [[117.13736237725986, 46.36744915831693],[117.11316348752415, 46.37920796263987],[117.11150051793469, 46.37579082835441],[117.11934329709531, 46.37197672713472],[117.11996556958685, 46.37325882304401],[117.11828114232527, 46.37407421458465],[117.11853863439075, 46.37460529196966],[117.13658453664544, 46.36583983290777]],style: {color: "#00ffff",opacity: 0.4},attr: { remark: "示例1" },flyTo: true})graphicLayer.addGraphic(graphic)
3.加上材质之后报错了
style: {height: 50,diffHeight: 300,materialType: mars3d.MaterialType.PolyGradient,materialOptions: {color: "#3388cc",alphaPower: 1.5},vertexFormat: Cesium.MaterialAppearance.MaterialSupport.TEXTURED.vertexFormat,textureCoordinates: {positions: [new Cesium.Cartesian2(0, 1),new Cesium.Cartesian2(0, 0),new Cesium.Cartesian2(0.5, 0),new Cesium.Cartesian2(1, 0),new Cesium.Cartesian2(1, 1)]},label: {text: "Mars3D平台",font_family: "楷体",color: "#ffff00",font_size: 18,setHeight: 400}},
4.注释部分材质代码,发现又能够渲染了
const graphic = new mars3d.graphic.PolygonPrimitive({positions: [[117.13736237725986, 46.36744915831693],[117.11316348752415, 46.37920796263987],[117.11150051793469, 46.37579082835441],[117.11934329709531, 46.37197672713472],[117.11996556958685, 46.37325882304401],[117.11828114232527, 46.37407421458465],[117.11853863439075, 46.37460529196966],[117.13658453664544, 46.36583983290777]],style: {height: 50,diffHeight: 300,materialType: mars3d.MaterialType.PolyGradient,materialOptions: {color: "#3388cc",alphaPower: 1.5},label: {text: "Mars3D平台",font_family: "楷体",color: "#ffff00",font_size: 18,setHeight: 400}},attr: { remark: "示例9" },flyTo: true})graphicLayer.addGraphic(graphic)
问题:
1.但是没有示例的效果,渐变材质的中心点无法在边界点的内部
解决方案:
1.暂无,只能先注释解决报错