900913 tile support, not complete or working yet
[potlatch2.git] / net / systemeD / halcyon / WayBitmapFiller.as
1 package net.systemeD.halcyon {
2
3         import net.systemeD.halcyon.styleparser.*;
4     import net.systemeD.halcyon.connection.*;
5         import flash.display.*;
6         import flash.events.*;
7
8         public class WayBitmapFiller {
9                 private var wayui:WayUI;
10                 private var style:ShapeStyle;
11                 private var graphics:Graphics;
12                 private var loader:Loader = new Loader();
13
14                 public function WayBitmapFiller(wayui:WayUI,graphics:Graphics,style:ShapeStyle) {
15                         this.wayui=wayui;
16                         this.graphics=graphics;
17                         this.style=style;
18                         
19                         if (wayui.map.ruleset.images[style.fill_image]) {
20                                 loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadedFill);
21                                 loader.loadBytes(wayui.map.ruleset.images[style.fill_image]);
22                         }
23                 }
24                 
25                 private function loadedFill(event:Event):void {
26                         var image:BitmapData = new BitmapData(loader.width, loader.height, false);
27                         image.draw(loader);
28                         graphics.beginBitmapFill(image);
29                         wayui.solidLine(graphics);
30                         graphics.endFill();
31                 }
32         }
33 }