basic multipolygon rendering
[potlatch2.git] / net / systemeD / halcyon / connection / Entity.as
index 949efc9e70eb76a50f6eb4e6a490825ba5b5d593..3d6a7ac7605548dfe8eaa2bc5f7bcae9bef2e25f 100644 (file)
@@ -52,6 +52,11 @@ package net.systemeD.halcyon.connection {
         public function getTag(key:String):String {
             return tags[key];
         }
+
+               public function tagIs(key:String,value:String):Boolean {
+                       if (!tags[key]) { return false; }
+                       return tags[key]==value;
+               }
         
         public function setTag(key:String, value:String, performAction:Function):void {
             performAction(new SetTagAction(this, key, value));
@@ -183,6 +188,20 @@ package net.systemeD.halcyon.connection {
                        return a;
                }
                
+               public function findParentRelationsOfType(type:String, role:String=""):Array {
+                       var a:Array=[];
+                       for (var o:Object in parents) {
+                               if (o is Relation && Relation(o).tagIs('type',type)) { 
+                                       for (var i:uint=0; i<o.length; i++) {
+                                               if (o.getMember(i).entity==this && o.getMember(i).role==role) {
+                                                       a.push(o);
+                                               }
+                                       }
+                               }
+                       }
+                       return a;
+               }
+               
                public function get parentObjects():Array {
                        var a:Array=[];
                        for (var o:Object in parents) { a.push(o); }