]> git.openstreetmap.org Git - rails.git/commitdiff
autocomplete (not compiled for now) and start of tile support
authorRichard Fairhurst <richard@systemed.net>
Sun, 23 Dec 2007 12:59:59 +0000 (12:59 +0000)
committerRichard Fairhurst <richard@systemed.net>
Sun, 23 Dec 2007 12:59:59 +0000 (12:59 +0000)
app/controllers/amf_controller.rb
config/potlatch/autocomplete.txt [new file with mode: 0755]

index 9fb9b89405cdfbc8d0e0067a12d735c30a9707d1..c0b642edaeb4faf313b473c53ea8b30230d50f2a 100644 (file)
@@ -98,7 +98,6 @@ class AmfController < ApplicationController
     presetnames={}; presetnames['point']={}; presetnames['way']={}; presetnames['POI']={}
     presettype=''
     presetcategory=''
-
 #      StringIO.open(txt) do |file|
        File.open("#{RAILS_ROOT}/config/potlatch/presets.txt") do |file|
       file.each_line {|line|
@@ -124,7 +123,7 @@ class AmfController < ApplicationController
        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
+               if (t=~/(\w+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)/) then
                  tag=$1
                  if ($2!='-') then colours[tag]=$2.hex end
                  if ($3!='-') then casing[tag]=$3.hex end
@@ -132,7 +131,21 @@ class AmfController < ApplicationController
                end
          }
        end
-    [presets,presetmenus,presetnames,colours,casing,areas]
+       
+       # Read auto-complete
+       autotags={}; autotags['point']={}; autotags['way']={}; autotags['POI']={};
+       File.open("#{RAILS_ROOT}/config/potlatch/autocomplete.txt") do |file|
+               file.each_line {|line|
+                       t=line.chomp
+                       if (t=~/^(\w+)\/(\w+)\s+(.+)$/) then
+                               tag=$1; type=$2; values=$3
+                               if values=='-' then autotags[type][tag]=[]
+                                                          else autotags[type][tag]=values.split(',').sort.reverse end
+                       end
+               }
+       end
+       
+    [presets,presetmenus,presetnames,colours,casing,areas,autotags]
   end
 
   # ----- whichways(left,bottom,right,top)
diff --git a/config/potlatch/autocomplete.txt b/config/potlatch/autocomplete.txt
new file mode 100755 (executable)
index 0000000..3480355
--- /dev/null
@@ -0,0 +1,92 @@
+# Potlatch autocomplete values
+# each line should be: key / way|point|POI (tab) list_of_values
+# '-' indicates no autocomplete for values
+highway/way            motorway,motorway_link,trunk,trunk_link,primary,primary_link,secondary,tertiary,unclassified,residential,service,bridleway,cycleway,footway,pedestrian,steps
+highway/point  mini_roundabout,traffic_signals,crossing,gate,stile,cattle_grid,toll_booth,incline,viaduct,motorway_junction,services,ford,bus_stop
+junction/way   roundabout
+cycleway/way   lane,track,opposite_lane,opposite_track,opposite
+waterway/way   river,canal,stream,drain,dock
+waterway/point lock_gate,lock,turning_point,aqueduct,boatyard,water_point,waste_disposal,mooring,weir
+waterway/POI   boatyard,water_point,waste_disposal,mooring
+railway/way            rail,tram,light_rail,subway,preserved,disused,abandoned,narrow_gauge,monorail
+railway/point  station,halt,viaduct,crossing,level_crossing,subway_entrance
+railway/POI            subway_entrance
+aeroway/way            runway,taxiway,apron
+aeroway/POI            aerodrome,terminal,helipad
+aerialway/way  cable_car,chair_lift,drag_lift
+power/POI              tower
+power/way              line
+man_made/point works,beacon,survey_point,power_wind,power_hydro,power_fossil,power_nuclear,tower,water_tower,gasometer,reservoir_covered,lighthouse,windmill
+man_made/way   reservoir_covered,pier
+leisure/POI            sports_centre,golf_course,stadium,marina,track,pitch,water_park,fishing,nature_reserve,park,playground,garden,common,slipway
+leisure/way            sports_centre,golf_course,stadium,marina,track,pitch,water_park,fishing,nature_reserve,park,playground,garden,common
+amenity/POI            pub,biergarten,cafe,nightclub,restaurant,fast_food,parking,bicycle_parking,bicycle_rental,car_rental,car_shasring,fuel,telephone,toilets,recycling,public_building,place_of_worship,grave_yard,post_office,post_box,school,university,college,pharmacy,hospital,library,police,fire_station,bus_station,theatre,cinema,arts_centre,courthouse,prison,bank,bureau_de_change,atm,town_hall
+amenity/way            parking,bicycle_parking,car_rental,car_sharing,public_building,grave_yard,school,university,college,hospital,town_hall
+shop/POI               supermarket,convenience,bicycle,outdoor
+shop/way               supermarket
+tourism/POI            information,camp_site,caravan_site,caravan_site,picnic_site,viewpoint,theme_park,hotel,motel,guest_house,hostel,attraction,zoo
+tourism/way            camp_site,caravan_site,picnic_site,theme_parkattraction,zoo
+historic/POI   castle,monument,memorial,museum,archaeological_site,icon,ruins
+historic/way   archaeological_site,ruins
+landuse/POI            farm,quarry,landfill,basin,reservoir,forest,allotments,residential,retail,commercial,industrial,brownfield,greenfield,cemetery,village_green,recreation_ground
+landuse/way            farm,quarry,landfill,basin,reservoir,forest,allotments,residential,retail,commercial,industrial,brownfield,greenfield,cemetery,village_green,recreation_ground
+military/POI   airfield,bunker,barracks,danger_area,range
+military/way   airfield,barracks,danger_area,range
+natural/POI            spring,peak,cliff,scree,scrub,fell,heath,wood,marsh,water,coastline,mud,beach,bay,land,glacier
+natural/way            peak,cliff,scree,scrub,fell,heath,wood,marsh,water,coastline,mud,beach,bay,land,glacier
+route/way              bus,ferry,flight,ncn,subsea,ski,tour,pub_crawl
+boundary/way   administrative,civil,political,national_park
+sport/POI              10pin,athletics,baseball,basketball,bowls,climbing,cricket,cricket_nets,croquet,cycling,dog_racing,equestrian,football,golf,gymnastics,hockey,horse_racing,motor,multi,pelota,racquet,rugby,skating,skateboard,soccer,swimming,skiing,table_tennis,tennis
+sport/way              10pin,athletics,baseball,basketball,bowls,climbing,cricket,cricket_nets,croquet,cycling,dog_racing,equestrian,football,golf,gymnastics,hockey,horse_racing,motor,multi,pelota,racquet,rugby,skating,skateboard,soccer,swimming,skiing,table_tennis,tennis
+abutters/way   residential,retail,industrial,commercial,mixed
+area/way               yes,no
+bridge/way             yes,no
+tunnel/way             yes,no
+cutting/way            yes,no
+embankment/way yes,no
+lanes/way              -
+layer/way              -
+surface/way            paved,unpaved
+width/way              -
+depth/way              -
+operator/way   -
+operator/point -
+operator/POI   -
+access/way             yes,private,permissive,unknown,no
+bicycle/way            yes,private,permissive,unknown,no
+foot/way               yes,private,permissive,unknown,no
+goods/way              yes,private,permissive,unknown,no
+hgv/way                        yes,private,permissive,unknown,no
+horse/way              yes,private,permissive,unknown,no
+motorcycle/way yes,private,permissive,unknown,no
+motorcar/way   yes,private,permissive,unknown,no
+psv/way                        yes,private,permissive,unknown,no
+motorboat/way  yes,private,permissive,unknown,no
+boat/way               yes,private,permissive,unknown,no
+oneway/way             yes,no
+maxspeed/way   -
+name/way               -
+name/point             -
+name/POI               -
+ref/way                        -
+ref/point              -
+ref/POI                        -
+ncn_ref/way            -
+rcn_ref/way            -
+lcn_ref/way            -
+place/POI              state,region,county,city,town,village,hamlet,suburb,island
+place/way              state,region,county,city,town,village,hamlet,suburb,island
+is_in/POI              -
+is_in/way              -
+note/point             -
+note/POI               -
+note/way               -
+source/point   -
+source/POI             -
+source/way             -
+postal_code/point      -
+postal_code/POI                -
+postal_code/way                -
+description/point      -
+description/POI                -
+description/way                -