Skip to content

Commit

Permalink
[UPD]
Browse files Browse the repository at this point in the history
  • Loading branch information
Viglino committed Dec 14, 2023
1 parent 00aaead commit 2ef4bc3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion examples/control/map.switcher.image.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ <h1>ol-ext: Layerswitcher image</h1>

var vector = new ol.layer.Vector({
name: '1914-18',
preview: "http://www.culture.gouv.fr/Wave/image/memoire/2445/sap40_z0004141_v.jpg",
preview: '//wsrv.nl/?url=http://www.culture.gouv.fr/Wave/image/memoire/2445/sap40_z0004141_v.jpg',
source: vectorSource
});

Expand Down
14 changes: 9 additions & 5 deletions examples/storymap/map.control.timeinterval.html
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ <h1>ol-ext: Timeline control</h1>
var cache = {};
function style(select){
return function(f) {
// Is hidden
if (!f.get('visible')) return [];
// Display feature on the map
var style = cache[f.get('img')+'-'+select];
if (!style) {
var img = new ol.style.Photo({
Expand All @@ -126,7 +129,8 @@ <h1>ol-ext: Timeline control</h1>
onload: function() { f.changed(); }
})
style = cache[f.get('img')+'-'+select] = new ol.style.Style({
image: img
image: img,
zIndex: select ? 1 : 0
})
}
return style;
Expand Down Expand Up @@ -189,10 +193,10 @@ <h1>ol-ext: Timeline control</h1>
// Filter features visibility
vectorSource.getFeatures().forEach(function(f) {
var date = new Date(f.get('date'));
if (date<e.dateStart || date>e.dateEnd) {
f.setStyle([]);
if (date < e.dateStart || date > e.dateEnd) {
f.set('visible', false)
} else {
f.setStyle();
f.set('visible', true)
}
});
});
Expand All @@ -207,7 +211,7 @@ <h1>ol-ext: Timeline control</h1>
tline.setDate(f.get('date'));
// Show info
var info = $("#select").html("");
$("<img>").attr('src',f.get("img")).appendTo(info);
$("<img>").attr('src', '//wsrv.nl/?url=' + f.get("img")).appendTo(info);
$("<p>").text(f.get("text")).appendTo(info);
$("<p>").text(f.get("commune")+" ("+f.get("region")+" - "
+ (new Date(f.get("date"))).toLocaleDateString(undefined, {year: 'numeric', month: 'short', day: 'numeric'})
Expand Down

0 comments on commit 2ef4bc3

Please sign in to comment.