-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Gaël UTARD
committed
Nov 23, 2018
1 parent
4a31d8d
commit 8ef1a18
Showing
18 changed files
with
191 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// | ||
// Signage | ||
// | ||
|
||
$(window).on('entity:map', function (e, data) { | ||
var map = data.map; | ||
|
||
// Show signage layer in application maps | ||
var layer = new L.ObjectsLayer(null, { | ||
modelname: 'signage', | ||
style: L.Util.extend(window.SETTINGS.map.styles['signage'] || {}, { clickable:false }), | ||
pointToLayer: function (feature, latlng) { | ||
return L.marker(latlng).bindLabel(feature.properties.name, { noHide: true }); | ||
} | ||
}); | ||
var url = window.SETTINGS.urls['signage_layer']; | ||
layer.load(url); | ||
map.layerscontrol.addOverlay(layer, tr('Signage'), tr('Infrastructure')); | ||
}); | ||
|
||
|
||
// | ||
// Infrastructure | ||
// | ||
|
||
$(window).on('entity:map', function (e, data) { | ||
var map = data.map; | ||
|
||
// Show infrastructure layer in application maps | ||
var layer = new L.ObjectsLayer(null, { | ||
modelname: 'infrastructure', | ||
style: L.Util.extend(window.SETTINGS.map.styles['infrastructure'] || {}, { clickable:false }), | ||
pointToLayer: function (feature, latlng) { | ||
var infrastructureIcon = L.icon({ | ||
iconUrl: feature.properties.type.pictogram, | ||
iconSize: [18, 18], | ||
iconAnchor: [9, 9], | ||
}); | ||
return L.marker(latlng, {icon: infrastructureIcon}); | ||
} | ||
}); | ||
var url = window.SETTINGS.urls['infrastructure_layer']; | ||
layer.load(url); | ||
map.layerscontrol.addOverlay(layer, tr('Infrastructure'), tr('Infrastructure')); | ||
}); |
6 changes: 6 additions & 0 deletions
6
geotrek/infrastructure/templates/infrastructure/infrastructure_extrabody_fragment.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{% load i18n %} | ||
|
||
<script type="text/javascript"> | ||
MapEntity.i18n['Signages'] = "{% trans "Signages" %}"; | ||
MapEntity.i18n['Infrastructures'] = "{% trans "Infrastructures" %}"; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
var InfrastructuresLayer = L.GeoJSON.extend({ | ||
|
||
initialize: function (infrastructuresData, options) { | ||
options = options || {}; | ||
options.pointToLayer = this.infrastructuresMarker.bind(this); | ||
L.GeoJSON.prototype.initialize.call(this, infrastructuresData, options); | ||
}, | ||
|
||
infrastructuresMarker: function(featureData, latlng) { | ||
// Label | ||
var category = featureData.properties.type.label, | ||
name = featureData.properties.name, | ||
infrastructureLabel = category + ' : ' + name; | ||
if (name.indexOf(category) === 0) { // startswith | ||
infrastructureLabel = name; | ||
} | ||
|
||
var img = L.Util.template('<img src="{SRC}" title="{TITLE}">', { | ||
SRC: featureData.properties.type.pictogram || '/static/trekking/infrastructure.png', | ||
TITLE: infrastructureLabel | ||
}); | ||
|
||
var infrastructureicon = new L.DivIcon({className: 'infrastructure-marker-icon', | ||
iconSize: [this.options.iconSize, this.options.iconSize], | ||
html: img}), | ||
marker = L.marker(latlng, {icon: infrastructureicon}); | ||
marker.properties = featureData.properties; | ||
|
||
return marker; | ||
} | ||
}); |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
var SignagesLayer = L.GeoJSON.extend({ | ||
|
||
initialize: function (signagesData, options) { | ||
options = options || {}; | ||
options.pointToLayer = this.signagesMarker.bind(this); | ||
L.GeoJSON.prototype.initialize.call(this, signagesData, options); | ||
}, | ||
|
||
signagesMarker: function(featureData, latlng) { | ||
// Label | ||
var category = featureData.properties.type.label, | ||
name = featureData.properties.name, | ||
serviceLabel = category + ' : ' + name; | ||
if (name.indexOf(category) === 0) { // startswith | ||
serviceLabel = name; | ||
} | ||
|
||
var img = L.Util.template('<img src="{SRC}" title="{TITLE}">', { | ||
SRC: featureData.properties.type.pictogram || '/static/trekking/signage.png', | ||
TITLE: serviceLabel | ||
}); | ||
|
||
var serviceicon = new L.DivIcon({className: 'infrastructure-marker-icon', | ||
iconSize: [this.options.iconSize, this.options.iconSize], | ||
html: img}); | ||
|
||
return L.marker(latlng, {icon: serviceicon}).bindLabel(featureData.properties.name, {noHide: true}); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
geotrek/trekking/templates/trekking/trekking_extrabody_fragment.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{% load i18n %} | ||
|
||
<script type="text/javascript"> | ||
MapEntity.i18n['Services'] = "{% trans "Services" %}"; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters