add a feature selector to the simple view
[potlatch2.git] / net / systemeD / halcyon / mapfeatures / Category.as
1 package net.systemeD.halcyon.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
12         public function Category(mapFeatures:MapFeatures, name:String, id:String) {
13             this.mapFeatures = mapFeatures;
14             this._name = name;
15             this._id = id;
16             
17             _features = new Array();
18             for each( var feature:Feature in mapFeatures.features ) {
19                 if ( feature.isInCategory(id) )
20                     _features.push(feature);
21             }
22         }
23
24         public function get id():String {
25             return _id;
26         }
27
28         [Bindable(event="categoryChange")]
29         public function get name():String {
30             return _name;
31         }
32         
33         [Bindable(event="featuresChanged")]
34         public function get features():Array {
35             return _features;
36         }
37     }
38 }
39
40