Relation selection dialog
[potlatch2.git] / net / systemeD / potlatch2 / TagViewer.mxml
index ab2a04f8df215025fa0a53ef62b8e24b0948c70f..449c05f269b893d4bcd41808aa96dad6a3d99305 100644 (file)
@@ -68,6 +68,7 @@
       import mx.core.*;
       import mx.managers.PopUpManager;
       import flash.geom.Point;
+      import flash.net.*;
       
       private var mapFeatures:MapFeatures;
       private var selectedEntity:Entity;
           var txt:String = feature.htmlDetails(entity);
           iconText.htmlText = txt;
           popupChange.label = feature.name;
+          setLimitTypes(entity);
           tw.setSelectedFeature(feature);
+          helpLabel.visible = feature.hasHelpURL();
+      }
+      
+      private function setLimitTypes(entity:Entity):void {
+          var type:String = null;
+          if ( entity is Node )
+              type = "point";
+          else if ( entity is Way )
+              type = Way(entity).isArea() ? "area" : "line";
+          else if ( entity is Relation )
+              type = "relation";
+          tw.setLimitTypes(type);
       }
 
       private function blankFeatureIcon(entity:Entity):void {
                "<i>Nothing selected</i>" :
                "<b>Not recognised</b><br/>Try looking at the tags under the advanced properties";
           popupChange.label = "unknown";
+          setLimitTypes(entity);
           tw.setSelectedFeature(null);
+          helpLabel.visible = false;
       }
 
       private function initialiseEditors():void {
                   props["id"] = rel.id;
                   var memberIndex:uint = rel.findEntityMemberIndex(entity);
                   props["role"] = rel.getMember(memberIndex).role;
-                  
-                  var desc:String = "";
-                  var relTags:Object = rel.getTagsHash();
-                  if ( relTags["type"] ) {
-                      desc = relTags["type"];
-                      if ( relTags[desc] )
-                          desc += " " + relTags[desc];
-                  }
-                  if ( relTags["ref"] )
-                      desc += " " + relTags["ref"];
-                  if ( relTags["name"] )
-                      desc += " " + relTags["name"];
-                  props["description"] = desc;
+                  props["description"] = rel.getDescription();
                   
                   relations.push(props);
               }
 
       public function openDescription():void {
           trace("open description here");
+          if ( feature != null && feature.hasHelpURL() )
+              navigateToURL(new URLRequest(feature.helpURL), "potlatch_help");
       }
 
       public function addNewTag():void {
       }
       
       public function addToRelation():void {
+          new RelationSelectPanel().init(selectedEntity);        
       }
       
       public function removeFromRelation():void {