Commit d508c5ff authored by Adrien Pavie's avatar Adrien Pavie
Browse files

Configuration now given directly in JS, default config embedded in Main controller

parent 8355e0d5
......@@ -70,8 +70,7 @@ coreprepare:
mkdir -p $(DIST_FOLDER)
# Copy HTML/Conf files
cp $(SRC_FOLDER)/*.html $(DIST_FOLDER)/
cp -r $(SRC_FOLDER)/conf $(DIST_FOLDER)/
mkdir $(DIST_FOLDER)/styles/
mkdir -p $(DIST_FOLDER)/styles/
./mapcss.import.sh
# Prepare images
mkdir -p $(DIST_FOLDER)/img
......
......@@ -12,7 +12,7 @@
},
"repository": {
"type": "git",
"url": "https://git.framasoft.org/PanierAvide/OpenLevelUp.git"
"url": "git@framagit.org:OpenLevelUp/OpenLevelUp.git"
},
"keywords": [
"openlevelup",
......
......@@ -47,7 +47,7 @@
<!-- Init code -->
<script>
var myOlu = OLU.init("openlevelup", "conf", "advanced");
var myOlu = OLU.init("openlevelup", "advanced");
</script>
</body>
</html>
{
"_comment": "OpenLevelUp configuration file (JSON)",
"view": {
"icons": {
"folder": "img",
"size": 24
},
"map": {
"cluster_min_zoom": 11,
"data_min_zoom": 18,
"max_zoom": 24,
"tiles_data_opacity": 0.2,
"coordinates": {
"lat": 46.973,
"lon": 1.934,
"zoom": 6
}
},
"images": {
"spherical": {
"width": 600,
"height": 350
}
}
},
"osm": {
"oapi": "http://api.openstreetmap.fr/oapi/interpreter/?data=",
"oapi_alt": "http://www.overpass-api.de/api/interpreter?data=",
"api": "http://api.openstreetmap.org/api/0.6/",
"api_dev": "http://api06.dev.openstreetmap.org/api/0.6/",
"attribution": "Map data © <a href=\"http://openstreetmap.org\">OpenStreetMap</a> contributors",
"nominatim": "http://nominatim.openstreetmap.org/"
},
"images": {
"flickr": {
"api": "https://api.flickr.com/services/rest/?",
"key": "d06fb1ebb3ede5813b89c79320e11ab8"
},
"mapillary": {
"api": "https://a.mapillary.com/v2/",
"clientId": "eDhQTTdnRmZJNXdYZWUwRDQxc1NwdzpmYjE3YWE3MWM5ZjcyMTdm"
}
},
"tiles": [
{
"name": "OpenStreetMap",
"URL": "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
"attribution": "Tiles <a href=\"http://openstreetmap.org/\">OSM</a>",
"minZoom": 1,
"maxZoom": 19
},
{
"name": "OpenStreetMap FR",
"URL": "http://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png",
"attribution": "Tiles <a href=\"http://tile.openstreetmap.fr/\">OSMFR</a>",
"minZoom": 1,
"maxZoom": 20
},
{
"name": "Stamen Toner",
"URL": "http://{s}.tile.stamen.com/toner/{z}/{x}/{y}.png",
"attribution": "Tiles <a href=\"http://maps.stamen.com/\">Stamen Toner</a>",
"minZoom": 1,
"maxZoom": 20
},
{
"name": "Cadastre FR",
"URL": "http://tms.cadastre.openstreetmap.fr/*/tout/{z}/{x}/{y}.png",
"attribution": "Cadastre (DGFiP)",
"minZoom": 1,
"maxZoom": 20
},
{
"name": "ÖPNV",
"URL": "http://tileserver.memomaps.de/tilegen/{z}/{x}/{y}.png",
"attribution": "Tiles <a href=\"http://www.öpnvkarte.de/\">ÖPNV</a>",
"minZoom": 1,
"maxZoom": 18
},
{
"name": "OpenStreetMap DE",
"URL": "http://b.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png",
"attribution": "Tiles <a href=\"http://openstreetmap.de/karte.html\">OSMDE</a>",
"minZoom": 1,
"maxZoom": 18,
"subdomains": "abcd"
}
],
"feature": {
"details": {
"major": {
"opening_hours": {
"type": "hours",
"img": "clock",
"name": "Opening hours"
},
"contact:website": {
"type": "link",
"img": "web",
"name": "Website"
},
"website": {
"type": "link",
"img": "web",
"name": "Website"
},
"contact:email": {
"type": "email",
"img": "email",
"name": "E-mail"
},
"email": {
"type": "email",
"img": "email",
"name": "E-mail"
},
"contact:phone": {
"type": "text",
"img": "phone",
"name": "Phone"
},
"phone": {
"type": "text",
"img": "phone",
"name": "Phone"
},
"wheelchair": {
"type": "text_bind",
"img": "wheelchair",
"text_bind": { "yes": "Fully accessible", "limited": "Limited access", "no": "Not accessible" }
}
},
"minor": {
"cuisine": {
"type": "text",
"img": "cuisine",
"name": "Cuisine"
},
"description": {
"type": "text",
"img": "info",
"name": "More details"
}
}
}
},
"routing": {
"foot": {
"name": "By foot",
"speed": 1.39
},
"wheelchair": {
"name": "In wheelchair",
"speed": 0.7,
"avoid": [ "stairs", "escalator" ]
},
"sport": {
"name": "By foot (sportive)",
"speed": 1.39,
"avoid": [ "elevator", "escalator" ]
}
},
"edit": {
"id_url": "http://projets.pavie.info/id-indoor/"
},
"polygonFeatures": {
"building": true,
"highway": {
"included_values": {
"services": true,
"rest_area": true,
"escape": true,
"elevator": true
}
},
"natural": {
"excluded_values": {
"coastline": true,
"cliff": true,
"ridge": true,
"arete": true,
"tree_row": true
}
},
"landuse": true,
"waterway": {
"included_values": {
"riverbank": true,
"dock": true,
"boatyard": true,
"dam": true
}
},
"amenity": true,
"leisure": true,
"barrier": {
"included_values": {
"city_wall": true,
"ditch": true,
"retaining_wall": true,
"spikes": true,
"self_checkout": true,
"checkout": true,
"shelf": true
}
},
"railway": {
"included_values": {
"station": true,
"turntable": true,
"roundhouse": true,
"platform": true
}
},
"area": true,
"boundary": true,
"man_made": {
"excluded_values": {
"cutline": true,
"embankment": true,
"pipeline": true
}
},
"power": {
"included_values": {
"plant": true,
"substation": true,
"generator": true,
"transformer": true
}
},
"place": true,
"shop": true,
"aeroway": {
"excluded_values": {
"taxiway": true
}
},
"tourism": true,
"historic": true,
"public_transport": true,
"office": true,
"building:part": true,
"military": true,
"ruins": true,
"area:highway": true,
"craft": true,
"golf": true,
"indoor": {
"excluded_values": {
"yes": true,
"wall": true
}
},
"buildingpart": {
"excluded_values": {
"yes": true,
"wall": true
}
},
"room": true,
"department": true
},
"mapcss": {
"folder": "styles",
"default": "basic.mapcss"
}
}
This diff is collapsed.
{
"olddetails": {
"access": {
"name": "Access",
"values": "icons",
"icons": "access_${v}.png",
"iconsAlias": { "private": "no" }
},
"architect": {
"name": "Architect",
"values": "text"
},
"artist": {
"name": "Artist",
"values": "text"
},
"artist_name": {
"name": "Artist",
"values": "text"
},
"bicycle": {
"img": "icon_bicycle.svg",
"values": "icons",
"icons": "icon_status_${v}.png",
"iconsAlias": { "private": "no", "designated": "yes" }
},
"capacity": {
"name": "Capacity",
"values": "text"
},
"direction": {
"img": "icon_compass.svg",
"values": "direction"
},
"display": {
"name": "Display",
"values": "icons",
"icons": "display_${v}.png",
"iconsAlias": { }
},
"fee": {
"img": "access_customers.png",
"values": "text"
},
"female": {
"img": "icon_female.svg",
"values": "icons",
"icons": "icon_status_${v}.png"
},
"foot": {
"img": "icon_walk.svg",
"values": "icons",
"icons": "icon_status_${v}.png",
"iconsAlias": { "private": "no", "designated": "yes" }
},
"height": {
"img": "icon_height.svg",
"values": "measure",
"unit": "m"
},
"length": {
"img": "icon_length.svg",
"values": "measure",
"unit": "m"
},
"male": {
"img": "icon_male.svg",
"values": "icons",
"icons": "icon_status_${v}.png"
},
"material": {
"name": "Material",
"values": "icons",
"icons": "material_${v}.png",
"iconsAlias": { "steel": "metal", "reinforced_concrete": "concrete" }
},
"operator": {
"name": "Operator",
"values": "text"
},
"seats": {
"img": "icon_seats.svg",
"values": "text"
},
"stairs:orientation": {
"img": "icon_compass.svg",
"values": "text"
},
"support": {
"name": "Support",
"values": "icons",
"icons": "support_${v}.png",
"iconsAlias": { }
},
"vendor": {
"name": "With vendor",
"values": "icons",
"icons": "icon_status_${v}.png"
},
"width": {
"img": "icon_width.svg",
"values": "measure",
"unit": "m"
}
}
}
......@@ -47,7 +47,7 @@
<!-- Init code -->
<script>
var myOlu = OLU.init("openlevelup", "conf", "basic");
var myOlu = OLU.init("openlevelup", "basic");
</script>
</body>
</html>
......@@ -33,15 +33,271 @@ var ProviderPictureFlickr = require("./provider/picture/Flickr");
* It coordinates all services/providers of OpenLevelUp.
* It also links them to view classes.
*/
var Main = function(divId, configFolder, mode) {
var Main = function(divId, mode, config) {
//DEFAULT CONFIGURATION
this.config = {
"map": {
"iconSize": 24,
"iconFolder": "img",
"clusterMinZoom": 11,
"dataMinZoom": 18,
"maxZoom": 24,
"tilesMinOpacity": 0.2,
"center": {
"lat": 46.973,
"lon": 1.934,
"zoom": 6
},
"defaultStyle": "basic.mapcss",
"styleFolder": "styles"
},
"api": {
"overpass": "http://api.openstreetmap.fr/oapi/interpreter/?data=",
"overpass_alt": "http://www.overpass-api.de/api/interpreter?data=",
"osm": "http://api.openstreetmap.org/api/0.6/",
"osm_dev": "http://api06.dev.openstreetmap.org/api/0.6/",
"nominatim": "http://nominatim.openstreetmap.org/",
"flickr": {
"url": "https://api.flickr.com/services/rest/?",
"key": "d06fb1ebb3ede5813b89c79320e11ab8"
},
"mapillary": {
"clientId": "eDhQTTdnRmZJNXdYZWUwRDQxc1NwdzpmYjE3YWE3MWM5ZjcyMTdm"
}
},
"tiles": [
{
"name": "OpenStreetMap",
"URL": "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
"attribution": "Tiles <a href=\"http://openstreetmap.org/\">OSM</a>",
"minZoom": 1,
"maxZoom": 19
},
{
"name": "OpenStreetMap FR",
"URL": "http://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png",
"attribution": "Tiles <a href=\"http://tile.openstreetmap.fr/\">OSMFR</a>",
"minZoom": 1,
"maxZoom": 20
},
{
"name": "Stamen Toner",
"URL": "http://{s}.tile.stamen.com/toner/{z}/{x}/{y}.png",
"attribution": "Tiles <a href=\"http://maps.stamen.com/\">Stamen Toner</a>",
"minZoom": 1,
"maxZoom": 20
},
{
"name": "Cadastre FR",
"URL": "http://tms.cadastre.openstreetmap.fr/*/tout/{z}/{x}/{y}.png",
"attribution": "Cadastre (DGFiP)",
"minZoom": 1,
"maxZoom": 20
},
{
"name": "ÖPNV",
"URL": "http://tileserver.memomaps.de/tilegen/{z}/{x}/{y}.png",
"attribution": "Tiles <a href=\"http://www.öpnvkarte.de/\">ÖPNV</a>",
"minZoom": 1,
"maxZoom": 18
},
{
"name": "OpenStreetMap DE",
"URL": "http://b.tile.openstreetmap.de/tiles/osmde/{z}/{x}/{y}.png",
"attribution": "Tiles <a href=\"http://openstreetmap.de/karte.html\">OSMDE</a>",
"minZoom": 1,
"maxZoom": 18,
"subdomains": "abcd"
}
],
"feature": {
"details": {
"major": {
"opening_hours": {
"type": "hours",
"img": "clock",
"name": "Opening hours"
},
"contact:website": {
"type": "link",
"img": "web",
"name": "Website"
},
"website": {
"type": "link",
"img": "web",
"name": "Website"
},
"contact:email": {
"type": "email",
"img": "email",
"name": "E-mail"
},
"email": {
"type": "email",
"img": "email",
"name": "E-mail"
},
"contact:phone": {
"type": "text",
"img": "phone",
"name": "Phone"
},
"phone": {
"type": "text",
"img": "phone",
"name": "Phone"
},
"wheelchair": {
"type": "text_bind",
"img": "wheelchair",
"text_bind": { "yes": "Fully accessible", "limited": "Limited access", "no": "Not accessible" }
}
},
"minor": {
"cuisine": {
"type": "text",
"img": "cuisine",
"name": "Cuisine"
},
"description": {
"type": "text",
"img": "info",
"name": "More details"
}
}
}
},
"routing": {
"foot": {
"name": "By foot",
"speed": 1.39
},
"wheelchair": {
"name": "In wheelchair",
"speed": 0.7,
"avoid": [ "stairs", "escalator" ]
},
"sport": {
"name": "By foot (sportive)",
"speed": 1.39,
"avoid": [ "elevator", "escalator" ]
}
},
"polygonFeatures": {
"building": true,
"highway": {
"included_values": {
"services": true,
"rest_area": true,
"escape": true,
"elevator": true
}
},
"natural": {
"excluded_values": {
"coastline": true,
"cliff": true,
"ridge": true,
"arete": true,
"tree_row": true
}
},
"landuse": true,
"waterway": {
"included_values": {