]> git.openstreetmap.org Git - rails.git/commitdiff
move preset tags and colours into config files
authorRichard Fairhurst <richard@systemed.net>
Sat, 1 Dec 2007 10:32:35 +0000 (10:32 +0000)
committerRichard Fairhurst <richard@systemed.net>
Sat, 1 Dec 2007 10:32:35 +0000 (10:32 +0000)
app/controllers/amf_controller.rb
config/potlatch/colours.txt [new file with mode: 0644]
config/potlatch/presets.txt
public/potlatch/potlatch.swf

index 6aa64f6a76813952d974d319d1e69b2a247e9750..e39a4ceb2f8ab05c56402ffd94e1a32bdef44975 100644 (file)
@@ -90,121 +90,17 @@ class AmfController < ApplicationController
   #          return presets,presetmenus and presetnames arrays
 
   def getpresets
   #          return presets,presetmenus and presetnames arrays
 
   def getpresets
+    RAILS_DEFAULT_LOGGER.info("  Message: getpresets")
+
+       # Read preset menus
     presets={}
     presetmenus={}; presetmenus['point']=[]; presetmenus['way']=[]; presetmenus['POI']=[]
     presetnames={}; presetnames['point']={}; presetnames['way']={}; presetnames['POI']={}
     presettype=''
     presetcategory=''
 
     presets={}
     presetmenus={}; presetmenus['point']=[]; presetmenus['way']=[]; presetmenus['POI']=[]
     presetnames={}; presetnames['point']={}; presetnames['way']={}; presetnames['POI']={}
     presettype=''
     presetcategory=''
 
-    RAILS_DEFAULT_LOGGER.info("  Message: getpresets")
-
-    #          File.open("config/potlatch/presets.txt") do |file|
-
-    # Temporary patch to get around filepath problem
-    # To remove this patch and make the code nice again:
-    # 1. uncomment above line
-    # 2. fix the path in the above line
-    # 3. delete this here document, and the following line (StringIO....)
-
-    txt=<<-EOF
-way/road
-motorway: highway=motorway,ref=(type road number)
-trunk road: highway=trunk,ref=(type road number),name=(type road name)
-primary road: highway=primary,ref=(type road number),name=(type road name)
-secondary road: highway=secondary,ref=(type road number),name=(type road name)
-tertiary road: highway=tertiary,ref=,name=(type road name)
-residential road: highway=residential,ref=,name=(type road name)
-unclassified road: highway=unclassified,ref=,name=(type road name)
-
-way/footway
-footpath: highway=footway,foot=yes
-bridleway: highway=bridleway,foot=yes
-byway: highway=unsurfaced,foot=yes
-permissive path: highway=footway,foot=permissive
-
-way/cycleway
-cycle lane: highway=cycleway,cycleway=lane,ncn_ref=
-cycle track: highway=cycleway,cycleway=track,ncn_ref=
-cycle lane (NCN): highway=cycleway,cycleway=lane,name=(type name here),ncn_ref=(type route number)
-cycle track (NCN): highway=cycleway,cycleway=track,name=(type name here),ncn_ref=(type route number)
-
-way/waterway
-canal: waterway=canal,name=(type name here)
-navigable river: waterway=river,boat=yes,name=(type name here)
-navigable drain: waterway=drain,boat=yes,name=(type name here)
-derelict canal: waterway=derelict_canal,name=(type name here)
-unnavigable river: waterway=river,boat=no,name=(type name here)
-unnavigable drain: waterway=drain,boat=no,name=(type name here)
-stream: waterway=stream,boat=no,name=(type name here)
-
-way/railway
-railway: railway=rail
-tramway: railway=tram
-light railway: railway=light_rail
-preserved railway: railway=preserved
-disused railway tracks: railway=disused
-course of old railway: railway=abandoned
-
-way/natural
-lake: natural=water,landuse=
-forest: landuse=forest,natural=
-
-point/road
-mini roundabout: highway=mini_roundabout
-traffic lights: highway=traffic_signals
-
-point/footway
-bridge: highway=bridge
-gate: highway=gate
-stile: highway=stile
-cattle grid: highway=cattle_grid
-
-point/cycleway
-gate: highway=gate
-
-point/waterway
-lock gate: waterway=lock_gate
-weir: waterway=weir
-aqueduct: waterway=aqueduct
-winding hole: waterway=turning_point
-mooring: waterway=mooring
-
-point/railway
-station: railway=station
-viaduct: railway=viaduct
-level crossing: railway=crossing
-
-point/natural
-peak: natural=peak
-
-POI/road
-car park: amenity=parking
-petrol station: amenity=fuel
-
-POI/cycleway
-bike park: amenity=bicycle_parking
-
-POI/place
-city: place=city,name=(type name here),is_in=(type region or county)
-town: place=town,name=(type name here),is_in=(type region or county)
-suburb: place=suburb,name=(type name here),is_in=(type region or county)
-village: place=village,name=(type name here),is_in=(type region or county)
-hamlet: place=hamlet,name=(type name here),is_in=(type region or county)
-
-POI/tourism
-attraction: tourism=attraction,amenity=,religion=,denomination=
-church: tourism=,amenity=place_of_worship,name=(type name here),religion=christian,denomination=(type denomination here)
-hotel: tourism=hotel,amenity=,religion=,denomination=
-other religious: tourism=,amenity=place_of_worship,name=(type name here),religion=(type religion),denomination=
-post box: amenity=post_box,tourism=,name=,religion=,denomination=
-post office: amenity=post_office,tourism=,name=,religion=,denomination=
-pub: tourism=,amenity=pub,name=(type name here),religion=,denomination=
-
-POI/natural
-peak: natural=peak
-EOF
-
-    StringIO.open(txt) do |file|
+#      StringIO.open(txt) do |file|
+       File.open("#{RAILS_ROOT}/config/potlatch/presets.txt") do |file|
       file.each_line {|line|
         t=line.chomp
         if (t=~/(\w+)\/(\w+)/) then
       file.each_line {|line|
         t=line.chomp
         if (t=~/(\w+)\/(\w+)/) then
@@ -222,7 +118,21 @@ EOF
         end
       }
     end
         end
       }
     end
-    [presets,presetmenus,presetnames]
+    
+    # Read colours/styling
+       colours={}; casing={}; areas={}
+       File.open("#{RAILS_ROOT}/config/potlatch/colours.txt") do |file|
+         file.each_line {|line|
+               t=line.chomp
+               if (t=~/(\w+)\t+([^\t]+)\t+([^\t]+)\t+([^\t]+)/) then
+                 tag=$1
+                 if ($2!='-') then colours[tag]=$2.hex end
+                 if ($3!='-') then casing[tag]=$3.hex end
+                 if ($4!='-') then areas[tag]=$4.hex end
+               end
+         }
+       end
+    [presets,presetmenus,presetnames,colours,casing,areas]
   end
 
   # ----- whichways(left,bottom,right,top)
   end
 
   # ----- whichways(left,bottom,right,top)
diff --git a/config/potlatch/colours.txt b/config/potlatch/colours.txt
new file mode 100644 (file)
index 0000000..c54247c
--- /dev/null
@@ -0,0 +1,31 @@
+# Potlatch colours file
+# each line must be tab-separated: tag, stroke colour, casing?, fill colour
+# ** TODO: act on key=value, not just one or the other
+
+motorway               0x809BC0        1       -
+motorway_link  0x809BC0        1       -
+trunk                  0x7FC97F        1       -
+trunk_link             0x7FC97F        1       -
+primary                        0xE46D71        1       -
+primary_link   0xE46D71        1       -
+secondary              0xFDBF6F        1       -
+tertiary               0xFEFECB        1       -
+unclassified   0xE8E8E8        1       -
+residential            0xE8E8E8        1       -
+footway                        0xFF6644        -       -
+cycleway               0xFF6644        -       -
+bridleway              0xFF6644        -       -
+rail                   0x000001        -       -
+river                  0x8888FF        -       -
+canal                  0x8888FF        -       -
+stream                 0x8888FF        -       -
+leisure                        -                       -       0x8CD6B5
+amenity                        -                       -       0xADCEB5
+shop                   -                       -       0xADCEB5
+tourism                        -                       -       0xF7CECE
+historic               -                       -       0xF7F7DE
+ruins                  -                       -       0xF7F7DE
+landuse                        -                       -       0x444444
+military               -                       -       0xD6D6D6
+natural                        -                       -       0xADD6A5
+sport                  -                       -       0x8CD6B5
index 5d696da43522b0e4a7584fe040b41ecf9bd7876b..369395253aefe2b3b6fd57ccdc16a43c5a745ee9 100644 (file)
@@ -3,13 +3,14 @@ motorway: highway=motorway,ref=(type road number)
 trunk road: highway=trunk,ref=(type road number),name=(type road name)
 primary road: highway=primary,ref=(type road number),name=(type road name)
 secondary road: highway=secondary,ref=(type road number),name=(type road name)
 trunk road: highway=trunk,ref=(type road number),name=(type road name)
 primary road: highway=primary,ref=(type road number),name=(type road name)
 secondary road: highway=secondary,ref=(type road number),name=(type road name)
-residential road: highway=residential,name=(type road name)
-unclassified road: highway=unclassified,name=(type road name)
+tertiary road: highway=tertiary,ref=,name=(type road name)
+residential road: highway=residential,ref=,name=(type road name)
+unclassified road: highway=unclassified,ref=,name=(type road name)
 
 way/footway
 footpath: highway=footway,foot=yes
 
 way/footway
 footpath: highway=footway,foot=yes
-bridleway: highway=bridleway,foot=yes,horse=yes,bicycle=yes
-byway: highway=byway,foot=yes,horse=yes,bicycle=yes,motorcar=yes
+bridleway: highway=bridleway,foot=yes
+byway: highway=unsurfaced,foot=yes
 permissive path: highway=footway,foot=permissive
 
 way/cycleway
 permissive path: highway=footway,foot=permissive
 
 way/cycleway
@@ -25,6 +26,7 @@ navigable drain: waterway=drain,boat=yes,name=(type name here)
 derelict canal: waterway=derelict_canal,name=(type name here)
 unnavigable river: waterway=river,boat=no,name=(type name here)
 unnavigable drain: waterway=drain,boat=no,name=(type name here)
 derelict canal: waterway=derelict_canal,name=(type name here)
 unnavigable river: waterway=river,boat=no,name=(type name here)
 unnavigable drain: waterway=drain,boat=no,name=(type name here)
+stream: waterway=stream,boat=no,name=(type name here)
 
 way/railway
 railway: railway=rail
 
 way/railway
 railway: railway=rail
@@ -34,6 +36,10 @@ preserved railway: railway=preserved
 disused railway tracks: railway=disused
 course of old railway: railway=abandoned
 
 disused railway tracks: railway=disused
 course of old railway: railway=abandoned
 
+way/natural
+lake: natural=water,landuse=
+forest: landuse=forest,natural=
+
 point/road
 mini roundabout: highway=mini_roundabout
 traffic lights: highway=traffic_signals
 point/road
 mini roundabout: highway=mini_roundabout
 traffic lights: highway=traffic_signals
@@ -58,3 +64,32 @@ point/railway
 station: railway=station
 viaduct: railway=viaduct
 level crossing: railway=crossing
 station: railway=station
 viaduct: railway=viaduct
 level crossing: railway=crossing
+
+point/natural
+peak: natural=peak
+
+POI/road
+car park: amenity=parking
+petrol station: amenity=fuel
+
+POI/cycleway
+bike park: amenity=bicycle_parking
+
+POI/place
+city: place=city,name=(type name here),is_in=(type region or county)
+town: place=town,name=(type name here),is_in=(type region or county)
+suburb: place=suburb,name=(type name here),is_in=(type region or county)
+village: place=village,name=(type name here),is_in=(type region or county)
+hamlet: place=hamlet,name=(type name here),is_in=(type region or county)
+
+POI/tourism
+attraction: tourism=attraction,amenity=,religion=,denomination=
+church: tourism=,amenity=place_of_worship,name=(type name here),religion=christian,denomination=(type denomination here)
+hotel: tourism=hotel,amenity=,religion=,denomination=
+other religious: tourism=,amenity=place_of_worship,name=(type name here),religion=(type religion),denomination=
+post box: amenity=post_box,tourism=,name=,religion=,denomination=
+post office: amenity=post_office,tourism=,name=,religion=,denomination=
+pub: tourism=,amenity=pub,name=(type name here),religion=,denomination=
+
+POI/natural
+peak: natural=peak
index bfbdc2c1de909a1e317bba98e41321870fc48ffa..9bde5d42961aaaa7f54fff5a698609f97c58bdc9 100755 (executable)
Binary files a/public/potlatch/potlatch.swf and b/public/potlatch/potlatch.swf differ