better still...
[potlatch2.git] / net / systemeD / halcyon / styleparser / ShapeStyle.as
index e6319cd0ede9ec48f85e321dffe349a60af15e71..fe83ea1e2cd16f36be5016355a5c24ea6319d2bb 100644 (file)
@@ -1,26 +1,60 @@
 package net.systemeD.halcyon.styleparser {
 
-       public class ShapeStyle {
+       import flash.display.Graphics;
+       
+       public class ShapeStyle extends Style {
 
-               public var isStroked:Boolean=true;
-               public var stroke_colour:uint=0x777777;
-               public var stroke_width:Number=1;
-               public var stroke_opacity:uint=100;
-               public var stroke_dashArray:Array=[];
-               public var stroke_linecap:String="none";
-               public var stroke_linejoin:String="round";
-               public var sublayer:uint=0;
+               public var width:Number=0;
+               public var color:Number;
+               public var opacity:Number;
+               public var dashes:Array=[];
+               public var linecap:String;
+               public var linejoin:String;
+               public var line_style:String;
                
-               public var isFilled:Boolean=false;
-               public var fill_colour:uint=0xFFFFFF;
-               public var fill_opacity:Number=100;
-               public var fill_pattern:String;
+               public var fill_color:Number;
+               public var fill_opacity:Number;
+               public var fill_image:String;
                
-               public var isCased:Boolean=false;
-               public var casing_width:Number=1;
-               public var casing_colour:uint=0;
-               public var casing_opacity:Number=100;
-               public var casing_dashArray:Array=[];
+               public var casing_width:Number;
+               public var casing_color:Number;
+               public var casing_opacity:Number;
+               public var casing_dashes:Array=[];
+               
+               override public function get properties():Array {
+                       return [
+                               'width','color','opacity','dashes','linecap','linejoin','line_style',
+                               'fill_color','fill_opacity','fill_image',
+                               'casing_width','casing_color','casing_opacity','casing_dashes'
+                       ];
+               }
+               
+               override public function get drawn():Boolean {
+                       return (fill_image || fill_color || width || casing_width);
+               }
+
+               public function applyStrokeStyle(g:Graphics):void {
+                       g.lineStyle(width,
+                                               color ? color : 0,
+                                               opacity ? opacity : 1,
+                                               false, "normal",
+                                               linecap  ? linecap : "none",
+                                               linejoin ? linejoin : "round");
+               }
+               
+               public function applyCasingStyle(g:Graphics):void {
+                       g.lineStyle(casing_width,
+                                               casing_color   ? casing_color : 0,
+                                               casing_opacity ? casing_opacity : 1,
+                                               false, "normal",
+                                               linecap  ? linecap : "none",
+                                               linejoin ? linejoin : "round");
+               }
+               
+               public function applyFill(g:Graphics):void {
+                       g.beginFill(fill_color,
+                                               fill_opacity ? fill_opacity : 1);
+               }
                
        }