split potlatch2 into entirely different namespace
[potlatch2.git] / net / systemeD / potlatch2 / mapfeatures / Category.as
1 package net.systemeD.potlatch2.mapfeatures {
2
3     import flash.events.EventDispatcher;
4     import flash.events.Event;
5
6         public class Category extends EventDispatcher {
7         private var mapFeatures:MapFeatures;
8         private var _name:String;
9         private var _id:String;
10         private var _features:Array;
11         private var _index:uint;
12
13         public function Category(mapFeatures:MapFeatures, name:String, id:String, globalIndex:uint) {
14             this.mapFeatures = mapFeatures;
15             this._name = name;
16             this._id = id;
17             this._index = globalIndex;
18             
19             _features = new Array();
20             for each( var feature:Feature in mapFeatures.features ) {
21                 if ( feature.isInCategory(id) )
22                     _features.push(feature);
23             }
24         }
25
26         public function get id():String {
27             return _id;
28         }
29         
30         public function get index():uint {
31             return _index;
32         }
33
34         [Bindable(event="categoryChange")]
35         public function get name():String {
36             return _name;
37         }
38         
39         [Bindable(event="featuresChanged")]
40         public function get features():Array {
41             return _features;
42         }
43     }
44 }
45
46