javascript - Changing the Color of a Cesium Geometry Instance in Dart -


i trying update color of cesium geometry instance. have code working in javascript when convert dart, no longer works. result when try change color black circle if translucent (in perinstancecolorappearance) set false, , nothing if translucent set true. believe has dart conversion unable determine problem is.

this correctly working javascript code:

var primitive;  <script>     document.getelementbyid("test").onclick = function() {myfunction()};      function myfunction() {         var attributes = primitive.getgeometryinstanceattributes('circle');         attributes.color = cesium.colorgeometryinstanceattribute.tovalue(cesium.color.fromrandom({alpha : 1.0}));     } </script>  <script>     var viewer = new cesium.viewer('cesiumcontainer');     var scene = viewer.scene;      var circleinstance = new cesium.geometryinstance({         geometry : new cesium.circlegeometry({             center : cesium.cartesian3.fromdegrees(-95.0, 43.0),             radius : 250000.0,             vertexformat : cesium.perinstancecolorappearance.vertex_format         }),         attributes : {             color : cesium.colorgeometryinstanceattribute.fromcolor(new cesium.color(1.0, 0.0, 0.0, 0.5))         },         id: 'circle'     });      primitive = new cesium.primitive({geometryinstances : circleinstance,                                       releasegeometryinstances : false,                                       appearance : new cesium.perinstancecolorappearance({                                                                  translucent : false,                                                                   closed : true})});     scene.primitives.add(primitive); </script> 

this conversion dart:

var testprimitive; bool mytest = false;  void drawtestcircle() {     if(!mytest) {         var scene = _viewer['scene'];          var color = new jsobject(context['cesium']['color'], [1.0, 0.0, 0.0, 0.5]);         var colorinstance = context['cesium']['colorgeometryinstanceattribute'].callmethod('fromcolor', [color]);          var vertexformat = context['cesium']['perinstancecolorappearance']['vertex_format'];         var center = context['cesium']['cartesian3'].callmethod('fromdegrees', [-95.0, 43.0]);         var geometry = new jsobject(context['cesium']['circlegeometry'],                [new jsobject.jsify({'center' : center,                                     'radius' : 250000.0,                                     'vertexformat' : vertexformat})]);          var circleinstance = new jsobject(context['cesium']['geometryinstance'],                 [new jsobject.jsify({'geometry' : geometry,                                      'attributes' : new jsobject.jsify({'color' : colorinstance}),                                     'id' : 'circle'})]);          var appearance = new jsobject(context['cesium']['perinstancecolorappearance'],                 [new jsobject.jsify({'translucent' : false, 'closed' : true})]);         testprimitive = new jsobject(context['cesium']['primitive'],                 [new jsobject.jsify({'geometryinstances' : circleinstance,                                      'releasegeometryinstances' : true,                                      'appearance' : appearance})]);          scene['primitives'].callmethod('add', [testprimitive]);         mytest = true;     } else {         var attributes = testprimitive.callmethod('getgeometryinstanceattributes', ['circle']);          var color = context['cesium']['color'].callmethod('fromrandom', [new jsobject.jsify({'alpha' : 1.0})]);         attributes['color'] = context['cesium']['colorgeometryinstanceattribute'].callmethod('tovalue', [color]);     } } 

drawtestcircle called on 'test' button click. example code cesium using found here http://cesiumjs.org/2013/11/04/geometry-and-appearances/ under "updating per-instance attributes". thought had trying access testprimitive after had been drawn, believe setting "releasegeometryinstances" should allow me manipulate it. ideas or suggestions appreciated.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -