Fix =no MapCSS check. This must be the longest-standing bug in P2...
[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                 public var layer:Number;                                // optional layer override (usually set by OSM tag)
25                 
26                 override public function get properties():Array {
27                         return [
28                                 'width','color','opacity','dashes','linecap','linejoin','line_style',
29                                 'fill_color','fill_opacity','fill_image',
30                                 'casing_width','casing_color','casing_opacity','casing_dashes','layer'
31                         ];
32                 }
33                 
34                 override public function get drawn():Boolean {
35                         return (fill_image || !isNaN(fill_color) || width || casing_width);
36                 }
37
38                 public function applyStrokeStyle(g:Graphics):void {
39                         g.lineStyle(width,
40                                                 color ? color : 0,
41                                                 opacity ? opacity : 1,
42                                                 false, "normal",
43                                                 linecap  ? linecap : "none",
44                                                 linejoin ? linejoin : "round");
45                 }
46                 
47                 public function applyCasingStyle(g:Graphics):void {
48                         g.lineStyle(width + casing_width,
49                                                 casing_color   ? casing_color : 0,
50                                                 casing_opacity ? casing_opacity : 1,
51                                                 false, "normal",
52                                                 linecap  ? linecap : "none",
53                                                 linejoin ? linejoin : "round");
54                 }
55                 
56                 public function applyFill(g:Graphics):void {
57                         g.beginFill(fill_color,
58                                                 fill_opacity ? fill_opacity : 1);
59                 }
60                 
61         }
62
63 }