one-way arrows
[potlatch2.git] / net / systemeD / halcyon / styleparser / ShapeStyle.as
1 package net.systemeD.halcyon.styleparser {
2
3         import flash.display.Graphics;
4         
5         public class ShapeStyle extends Style {
6
7                 public var width:Number=0;
8                 public var color:Number;
9                 public var opacity:Number;
10                 public var dashes:Array=[];
11                 public var linecap:String;
12                 public var linejoin:String;
13                 public var line_style:String;
14                 
15                 public var fill_color:Number;
16                 public var fill_opacity:Number;
17                 public var fill_image:String;
18                 
19                 public var casing_width:Number;
20                 public var casing_color:Number;
21                 public var casing_opacity:Number;
22                 public var casing_dashes:Array=[];
23                 
24                 override public function get properties():Array {
25                         return [
26                                 'width','color','opacity','dashes','linecap','linejoin','line_style',
27                                 'fill_color','fill_opacity','fill_image',
28                                 'casing_width','casing_color','casing_opacity','casing_dashes'
29                         ];
30                 }
31                 
32                 override public function get drawn():Boolean {
33                         return (fill_image || fill_color || width || casing_width);
34                 }
35
36                 public function applyStrokeStyle(g:Graphics):void {
37                         g.lineStyle(width,
38                                                 color ? color : 0,
39                                                 opacity ? opacity : 1,
40                                                 false, "normal",
41                                                 linecap  ? linecap : "none",
42                                                 linejoin ? linejoin : "round");
43                 }
44                 
45                 public function applyCasingStyle(g:Graphics):void {
46                         g.lineStyle(casing_width,
47                                                 casing_color   ? casing_color : 0,
48                                                 casing_opacity ? casing_opacity : 1,
49                                                 false, "normal",
50                                                 linecap  ? linecap : "none",
51                                                 linejoin ? linejoin : "round");
52                 }
53                 
54                 public function applyFill(g:Graphics):void {
55                         g.beginFill(fill_color,
56                                                 fill_opacity ? fill_opacity : 1);
57                 }
58                 
59         }
60
61 }