Canvas snippets: Difference between revisions

Jump to navigation Jump to search
m (→‎Adding a MapStructure map to a Canvas: placeholder for questions raised by www2)
Line 268: Line 268:
var target = root.createChild('group');
var target = root.createChild('group');


var offset=50;
var x=0;
var x=0;
var y=height/2;
var y=height/2;


var xoffset=50;
# render 5 instances symbols using the style specified above
for (var i=0;i<5;i+=1) {
for (var i=0;i<5;i+=1) {
# look up the raster image for the symbol
# look up the raster image for the symbol
# render it using the passed style and adjust scaling
# render it using the passed style and adjust scaling
var instanced = myCachedSymbol.render(target, style).setScale(style.scale_factor).setTranslation(x+=offset,y)
var instanced = myCachedSymbol.render(target, style)
  .setScale(style.scale_factor)
  .setTranslation(x+=xoffset,y);
}</syntaxhighlight>
}</syntaxhighlight>
|-
|-

Navigation menu