ADD map feature: ToyShop
authorSteve Bennett <stevagewp@gmail.com>
Tue, 8 Feb 2011 12:20:58 +0000 (12:20 +0000)
committerSteve Bennett <stevagewp@gmail.com>
Tue, 8 Feb 2011 12:20:58 +0000 (12:20 +0000)
IMPROVE all "shopping" features work for areas as well as points
BONUS comments in Feature.as and remove commented code in WayUI.as

net/systemeD/halcyon/WayUI.as
net/systemeD/potlatch2/mapfeatures/Feature.as
resources/map_features/shopping.xml

index 3da196e..c07d9e9 100644 (file)
@@ -438,7 +438,6 @@ package net.systemeD.halcyon {
                     dx=paint.map.lon2coord(nextNode.lon)-curx;
                                        cury=paint.map.latp2coord(node.latp);
                     dy=paint.map.latp2coord(nextNode.latp)-cury;
-                                       //a=Math.atan2(dy,dx); xc=Math.cos(a); yc=Math.sin(a);
                                        segleft=Math.sqrt(dx*dx+dy*dy);
                                        xc = dx/segleft;
                                        yc = dy/segleft;
index 6089111..c8ae80f 100644 (file)
@@ -26,6 +26,7 @@ package net.systemeD.potlatch2.mapfeatures {
         public var missingIconCls:Class;
 
 
+        /** Create this Feature from an XML subtree. */
         public function Feature(mapFeatures:MapFeatures, _xml:XML) {
             this.mapFeatures = mapFeatures;
             this._xml = _xml;
@@ -99,14 +100,14 @@ package net.systemeD.potlatch2.mapfeatures {
         }
 
         [Bindable(event="nameChanged")]
-        /** The human-readable name of the feature, or null if none. */
+        /** The human-readable name of the feature (@name), or null if none. */
         public function get name():String {
                        if (_xml.attribute('name').length()>0) { return _xml.@name; }
                        return null;
         }
 
         [Bindable(event="imageChanged")]
-        /** An icon for the feature. If none is defined, return default "missing icon". */
+        /** An icon for the feature (from icons[0]/@image). If none is defined, return default "missing icon". */
         public function get image():ByteArray {
             var icon:XMLList = _xml.icon;
             var imageURL:String = null;
@@ -134,6 +135,7 @@ package net.systemeD.potlatch2.mapfeatures {
             return makeHTMLIcon(icon, entity);
         }
 
+        /** Convert the contents of the "icon" tag as an HTML string, with variable substitution. */
         public static function makeHTMLIcon(icon:XMLList, entity:Entity):String {
             if ( icon == null )
                 return "";
@@ -147,6 +149,7 @@ package net.systemeD.potlatch2.mapfeatures {
             return txt;
         }
 
+        /** Basic HTML escaping. */
         public static function htmlEscape(str:String):String {
             var newStr:String = str.replace(/&/g, "&amp;");
             newStr = newStr.replace(/</g, "&lt;");
index 674c1c3..cac5511 100644 (file)
@@ -6,6 +6,7 @@
     </icon>\r
     <help>http://wiki.openstreetmap.org/wiki/Tag:shop%3Dsupermarket</help>\r
     <point/>\r
+    <area/>\r
     <tag k="shop" v="supermarket"/>\r
     <inputSet ref="names"/>\r
     <inputSet ref="web"/>\r
@@ -20,6 +21,7 @@
     </icon>\r
     <help>http://wiki.openstreetmap.org/wiki/Tag:shop%3Dconvenience</help>\r
     <point/>\r
+    <area/>\r
     <tag k="shop" v="convenience"/>\r
     <inputSet ref="names"/>\r
     <inputSet ref="web"/>\r
@@ -30,6 +32,7 @@
   <feature name="Bakery">\r
     <category>shopping</category>\r
     <point/>\r
+    <area/>\r
     <inputSet ref="simpleName"/>\r
     <inputSet ref="web"/>\r
     <inputSet ref="buildingAddress"/>\r
@@ -44,6 +47,7 @@
   <feature name="Alcohol shop">\r
     <category>shopping</category>\r
     <point/>\r
+    <area/>\r
     <inputSet ref="simpleName"/>\r
     <inputSet ref="web"/>\r
     <inputSet ref="buildingAddress"/>\r
@@ -57,6 +61,7 @@
   <feature name="Bike shop">\r
     <category>shopping</category>\r
     <point/>\r
+    <area/>\r
     <inputSet ref="simpleName"/>\r
     <inputSet ref="web"/>\r
     <inputSet ref="buildingAddress"/>\r
@@ -69,6 +74,7 @@
   <feature name="Bookshop">\r
     <category>shopping</category>\r
     <point/>\r
+    <area/>\r
     <inputSet ref="simpleName"/>\r
     <inputSet ref="web"/>\r
     <inputSet ref="buildingAddress"/>\r
@@ -81,6 +87,7 @@
   <feature name="Butcher">\r
     <category>shopping</category>\r
     <point/>\r
+    <area/>\r
     <inputSet ref="simpleName"/>\r
     <inputSet ref="web"/>\r
     <inputSet ref="buildingAddress"/>\r
@@ -92,6 +99,7 @@
   <feature name="Car sales">\r
     <category>shopping</category>\r
     <point/>\r
+    <area/>\r
     <inputSet ref="simpleName"/>\r
     <inputSet ref="web"/>\r
     <inputSet ref="buildingAddress"/>\r
   <feature name="Car repair">\r
     <category>shopping</category>\r
     <point/>\r
+    <area/>\r
     <inputSet ref="simpleName"/>\r
     <inputSet ref="web"/>\r
     <inputSet ref="buildingAddress"/>\r
   <feature name="Clothes shop">\r
     <category>shopping</category>\r
     <point/>\r
+    <area/>\r
     <inputSet ref="simpleName"/>\r
     <inputSet ref="web"/>\r
     <inputSet ref="buildingAddress"/>\r
   <feature name="Confectionery">\r
     <category>shopping</category>\r
     <point/>\r
+    <area/>\r
     <inputSet ref="simpleName"/>\r
     <inputSet ref="web"/>\r
     <inputSet ref="buildingAddress"/>\r
   <feature name="DIY">\r
     <category>shopping</category>\r
     <point/>\r
+    <area/>\r
     <inputSet ref="simpleName"/>\r
     <inputSet ref="web"/>\r
     <inputSet ref="buildingAddress"/>\r
   <feature name="Fishmonger">\r
     <category>shopping</category>\r
     <point/>\r
+    <area/>\r
     <inputSet ref="simpleName"/>\r
     <inputSet ref="web"/>\r
     <inputSet ref="buildingAddress"/>\r
   <feature name="Florist">\r
     <category>shopping</category>\r
     <point/>\r
+    <area/>\r
     <inputSet ref="simpleName"/>\r
     <inputSet ref="web"/>\r
     <inputSet ref="buildingAddress"/>\r
   <feature name="Garden centre">\r
     <category>shopping</category>\r
     <point/>\r
+    <area/>\r
     <inputSet ref="simpleName"/>\r
     <inputSet ref="web"/>\r
     <inputSet ref="buildingAddress"/>\r
   <feature name="Gift shop">\r
     <category>shopping</category>\r
     <point/>\r
+    <area/>\r
     <inputSet ref="simpleName"/>\r
     <inputSet ref="web"/>\r
     <inputSet ref="buildingAddress"/>\r
   <feature name="Greengrocer">\r
     <category>shopping</category>\r
     <point/>\r
+    <area/>\r
     <inputSet ref="simpleName"/>\r
     <inputSet ref="web"/>\r
     <inputSet ref="buildingAddress"/>\r
   <feature name="Hairdresser">\r
     <category>shopping</category>\r
     <point/>\r
+    <area/>\r
     <inputSet ref="simpleName"/>\r
     <inputSet ref="web"/>\r
     <inputSet ref="buildingAddress"/>\r
   <feature name="Hifi shop">\r
     <category>shopping</category>\r
     <point/>\r
+    <area/>\r
     <inputSet ref="simpleName"/>\r
     <inputSet ref="web"/>\r
     <inputSet ref="buildingAddress"/>\r
   <feature name="Jewellery">\r
     <category>shopping</category>\r
     <point/>\r
+    <area/>\r
     <inputSet ref="simpleName"/>\r
     <inputSet ref="web"/>\r
     <inputSet ref="buildingAddress"/>\r
   <feature name="Kiosk">\r
     <category>shopping</category>\r
     <point/>\r
+    <area/>\r
     <inputSet ref="simpleName"/>\r
     <inputSet ref="web"/>\r
     <inputSet ref="buildingAddress"/>\r
   <feature name="Laundrette">\r
     <category>shopping</category>\r
     <point/>\r
+    <area/>\r
     <inputSet ref="simpleName"/>\r
     <inputSet ref="web"/>\r
     <inputSet ref="buildingAddress"/>\r
   <feature name="Motorbike shop">\r
     <category>shopping</category>\r
     <point/>\r
+    <area/>\r
     <inputSet ref="simpleName"/>\r
     <inputSet ref="web"/>\r
     <inputSet ref="buildingAddress"/>\r
   <feature name="Music shop">\r
     <category>shopping</category>\r
     <point/>\r
+    <area/>\r
     <inputSet ref="simpleName"/>\r
     <inputSet ref="web"/>\r
     <inputSet ref="buildingAddress"/>\r
     </icon>\r
     <help>http://wiki.openstreetmap.org/wiki/Pharmacy</help>\r
     <point/>\r
+    <area/>\r
     <tag k="amenity" v="pharmacy"/>\r
     <inputSet ref="names"/>\r
     <inputSet ref="web"/>\r
     <input type="checkbox" category="Amenity" presence="always" description="Does this pharmacy sell prescription drugs?" name="Dispensing" key="dispensing" layout="horizontal"/>\r
     <inputSet ref="common"/>\r
   </feature>\r
+\r
+  <feature name="Toy shop">\r
+    <category>shopping</category>\r
+    <point/>\r
+    <area/>\r
+    <inputSet ref="simpleName"/>\r
+    <inputSet ref="web"/>\r
+    <inputSet ref="buildingAddress"/>\r
+    <tag k="shop" v="toys"/>\r
+    <inputSet ref="common"/>\r
+  </feature>\r
 </featureGroup>\r
 \r
   
\ No newline at end of file