Skip to content

Commit

Permalink
Move photo overlays to their own section in the map data pane (close #…
Browse files Browse the repository at this point in the history
  • Loading branch information
quincylvania committed Mar 14, 2019
1 parent d96a3e4 commit bb9e8d6
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 19 deletions.
7 changes: 7 additions & 0 deletions css/80_app.css
Original file line number Diff line number Diff line change
Expand Up @@ -3127,6 +3127,13 @@ div.full-screen > button:hover {
cursor: pointer;
}

[dir='ltr'] .layer-list .indented label {
padding-left: 24px;
}
[dir='rtl'] .layer-list .indented label {
padding-right: 24px;
}

.layer-list label > span {
display: block;
overflow: hidden;
Expand Down
14 changes: 8 additions & 6 deletions data/core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -527,8 +527,11 @@ en:
tooltip: "Drag and drop a data file onto the page, or click the button to setup"
title: Custom Map Data
zoom: Zoom to data
photo_overlays: Photo Overlays
fill_area: Fill Areas
map_features: Map Features
traffic_signs:
title: Traffic Signs
autohidden: "These features have been automatically hidden because too many would be shown on the screen. You can zoom in to edit them."
osmhidden: "These features have been automatically hidden because the OpenStreetMap layer is hidden."
feature:
Expand Down Expand Up @@ -946,22 +949,21 @@ en:
description: '{var1} may have an outdated URL: {var2} did not contain keywords "{var3}".'
streetside:
tooltip: "Streetside photos from Microsoft"
title: "Photo Overlay (Bing Streetside)"
title: "Bing Streetside"
report: Report a privacy concern with this image
view_on_bing: "View on Bing Maps"
hires: "High resolution"
mapillary_images:
tooltip: "Street-level photos from Mapillary"
title: "Photo Overlay (Mapillary)"
mapillary_signs:
tooltip: "Traffic signs from Mapillary (must enable Photo Overlay)"
title: "Traffic Sign Overlay (Mapillary)"
mapillary:
title: Mapillary
signs:
tooltip: "Traffic signs from Mapillary"
view_on_mapillary: "View this image on Mapillary"
openstreetcam_images:
tooltip: "Street-level photos from OpenStreetCam"
title: "Photo Overlay (OpenStreetCam)"
openstreetcam:
title: OpenStreetCam
view_on_openstreetcam: "View this image on OpenStreetCam"
note:
note: Note
Expand Down
21 changes: 12 additions & 9 deletions dist/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -644,8 +644,12 @@
"zoom": "Zoom to data"
}
},
"photo_overlays": "Photo Overlays",
"fill_area": "Fill Areas",
"map_features": "Map Features",
"traffic_signs": {
"title": "Traffic Signs"
},
"autohidden": "These features have been automatically hidden because too many would be shown on the screen. You can zoom in to edit them.",
"osmhidden": "These features have been automatically hidden because the OpenStreetMap layer is hidden."
},
Expand Down Expand Up @@ -1174,27 +1178,26 @@
},
"streetside": {
"tooltip": "Streetside photos from Microsoft",
"title": "Photo Overlay (Bing Streetside)",
"title": "Bing Streetside",
"report": "Report a privacy concern with this image",
"view_on_bing": "View on Bing Maps",
"hires": "High resolution"
},
"mapillary_images": {
"tooltip": "Street-level photos from Mapillary",
"title": "Photo Overlay (Mapillary)"
},
"mapillary_signs": {
"tooltip": "Traffic signs from Mapillary (must enable Photo Overlay)",
"title": "Traffic Sign Overlay (Mapillary)"
"tooltip": "Street-level photos from Mapillary"
},
"mapillary": {
"title": "Mapillary",
"signs": {
"tooltip": "Traffic signs from Mapillary"
},
"view_on_mapillary": "View this image on Mapillary"
},
"openstreetcam_images": {
"tooltip": "Street-level photos from OpenStreetCam",
"title": "Photo Overlay (OpenStreetCam)"
"tooltip": "Street-level photos from OpenStreetCam"
},
"openstreetcam": {
"title": "OpenStreetCam",
"view_on_openstreetcam": "View this image on OpenStreetCam"
},
"note": {
Expand Down
53 changes: 49 additions & 4 deletions modules/ui/map_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export function uiMapData(context) {
var _fillSelected = context.storage('area-fill') || 'partial';
var _shown = false;
var _dataLayerContainer = d3_select(null);
var _photoOverlayContainer = d3_select(null);
var _fillList = d3_select(null);
var _featureList = d3_select(null);
var _QAList = d3_select(null);
Expand Down Expand Up @@ -144,14 +145,24 @@ export function uiMapData(context) {

var liEnter = li.enter()
.append('li')
.attr('class', function(d) { return 'list-item-photos list-item-' + d.id; });
.attr('class', function(d) {
var classes = 'list-item-photos list-item-' + d.id;
if (d.id === 'mapillary-signs') {
classes += ' indented';
}
return classes;
});

var labelEnter = liEnter
.append('label')
.each(function(d) {
var titleID = d.id.replace('-', '_') + '.tooltip';
if (d.id === 'mapillary-signs') {
titleID = 'mapillary.signs.tooltip';
}
d3_select(this)
.call(tooltip()
.title(t(d.id.replace('-', '_') + '.tooltip'))
.title(t(titleID))
.placement('top')
);
});
Expand All @@ -163,7 +174,13 @@ export function uiMapData(context) {

labelEnter
.append('span')
.text(function(d) { return t(d.id.replace('-', '_') + '.title'); });
.text(function(d) {
var id = d.id;
if (id === 'mapillary-images') id = 'mapillary';
if (id === 'openstreetcam-images') id = 'openstreetcam';
if (id === 'mapillary-signs') id = 'map_data.traffic_signs';
return t(id.replace('-', '_') + '.title');
});


// Update
Expand Down Expand Up @@ -548,6 +565,18 @@ export function uiMapData(context) {
updateDataLayers();
}

function renderPhotoOverlays(selection) {
var container = selection.selectAll('.photo-overlay-container')
.data([0]);

_photoOverlayContainer = container.enter()
.append('div')
.attr('class', 'photo-overlay-container')
.merge(container);

updatePhotoOverlays();
}


function renderFillList(selection) {
var container = selection.selectAll('.layer-fill-list')
Expand All @@ -574,11 +603,15 @@ export function uiMapData(context) {
updateFeatureList();
}

function updatePhotoOverlays() {
_photoOverlayContainer
.call(drawPhotoItems);
}

function updateDataLayers() {
_dataLayerContainer
.call(drawOsmItems)
.call(drawQAItems)
.call(drawPhotoItems)
.call(drawCustomDataItems)
.call(drawVectorItems); // Beta - Detroit mapping challenge
}
Expand All @@ -598,6 +631,9 @@ export function uiMapData(context) {
if (!_pane.select('.disclosure-wrap-data_layers').classed('hide')) {
updateDataLayers();
}
if (!_pane.select('.disclosure-wrap-photo_overlays').classed('hide')) {
updatePhotoOverlays();
}
if (!_pane.select('.disclosure-wrap-fill_area').classed('hide')) {
updateFillList();
}
Expand Down Expand Up @@ -718,6 +754,15 @@ export function uiMapData(context) {
.content(renderDataLayers)
);

// photo overlays
content
.append('div')
.attr('class', 'map-data-photo-overlays')
.call(uiDisclosure(context, 'photo_overlays', false)
.title(t('map_data.photo_overlays'))
.content(renderPhotoOverlays)
);

// area fills
content
.append('div')
Expand Down

0 comments on commit bb9e8d6

Please sign in to comment.