Skip to content

Commit

Permalink
merge master
Browse files Browse the repository at this point in the history
  • Loading branch information
atlefren committed Nov 12, 2015
2 parents f1d4e55 + 0db40e9 commit 8fdfdc6
Show file tree
Hide file tree
Showing 21 changed files with 321 additions and 42 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kulturraadet-demonstratorer",
"version": "0.0.17",
"version": "0.0.18",
"authors": [
"Atle Frenvik Sveen <[email protected]>"
],
Expand Down
3 changes: 3 additions & 0 deletions common/js/datasets.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ KR.Config = KR.Config || {};
'ark_hist': {
grouped: true,
name: 'Arkeologi og historie',
minZoom: 14,
datasets: [
{
name: 'MUSIT',
Expand Down Expand Up @@ -156,6 +157,7 @@ KR.Config = KR.Config || {};
'arkeologi': {
grouped: true,
name: 'Arkeologi',
minZoom: 14,
style: {
fillcolor: '#436978',
circle: false,
Expand Down Expand Up @@ -196,6 +198,7 @@ KR.Config = KR.Config || {};
'historie': {
grouped: true,
name: 'Historie',
minZoom: 14,
style: {
fillcolor: '#D252B9',
circle: false,
Expand Down
33 changes: 24 additions & 9 deletions common/js/setupMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,36 @@ var KR = this.KR || {};

function _getFilter(buffer) {
return function (featureCollection) {

if (!featureCollection || !featureCollection.features.length) {
return featureCollection;
}
if (featureCollection.features[0].geometry.type.indexOf('Polygon') === -1) {
return turf.within(featureCollection, buffer);

var type = featureCollection.features[0].geometry.type;

if (type.indexOf('Polygon') > -1) {
var intersects = _.filter(featureCollection.features, function (feature) {
var bbox = turf.extent(feature);
var bboxPolygon = turf.bboxPolygon(bbox);
return !!turf.intersect(bboxPolygon, buffer.features[0]);
});
return KR.Util.createFeatureCollection(intersects);
}
var intersects = _.filter(featureCollection.features, function (feature) {
var bbox = turf.extent(feature);
var bboxPolygon = turf.bboxPolygon(bbox);
return !!turf.intersect(bboxPolygon, buffer.features[0]);
});
return KR.Util.createFeatureCollection(intersects);

if (type.indexOf('MultiLineString') > -1) {
var intersects = _.filter(featureCollection.features, function (feature) {
var bbox = turf.extent(feature);
var bboxPolygon = turf.bboxPolygon(bbox);
return !!turf.intersect(bboxPolygon, buffer.features[0]);
});
return KR.Util.createFeatureCollection(intersects);
}

return turf.within(featureCollection, buffer);

};
}


function _loadDatasets(api, datasets, fromUrl, komm, fylke) {
if (fromUrl) {
datasets = KR.Config.getDatasets(datasets, api, komm, fylke);
Expand Down Expand Up @@ -69,6 +83,7 @@ var KR = this.KR || {};
var layer = L.geoJson(geoJson);

var filter = _getFilter(geoJson);

callback(layer.getBounds(), datasets, filter, null, initPos);
});
} else {
Expand Down
37 changes: 27 additions & 10 deletions dist/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -3274,7 +3274,6 @@ KR.Config = KR.Config || {};
fillOpacity: 0.4
});
if (_loadEnkeltminner) {
console.log("loadEnkeltminner")
_loadEnkeltminner(e.layer.feature);
}
}
Expand Down Expand Up @@ -3492,6 +3491,7 @@ KR.Config = KR.Config || {};
'ark_hist': {
grouped: true,
name: 'Arkeologi og historie',
minZoom: 14,
datasets: [
{
name: 'MUSIT',
Expand Down Expand Up @@ -3554,6 +3554,7 @@ KR.Config = KR.Config || {};
'arkeologi': {
grouped: true,
name: 'Arkeologi',
minZoom: 14,
style: {
fillcolor: '#436978',
circle: false,
Expand Down Expand Up @@ -3594,6 +3595,7 @@ KR.Config = KR.Config || {};
'historie': {
grouped: true,
name: 'Historie',
minZoom: 14,
style: {
fillcolor: '#D252B9',
circle: false,
Expand Down Expand Up @@ -4216,22 +4218,36 @@ var KR = this.KR || {};

function _getFilter(buffer) {
return function (featureCollection) {

if (!featureCollection || !featureCollection.features.length) {
return featureCollection;
}
if (featureCollection.features[0].geometry.type.indexOf('Polygon') === -1) {
return turf.within(featureCollection, buffer);

var type = featureCollection.features[0].geometry.type;

if (type.indexOf('Polygon') > -1) {
var intersects = _.filter(featureCollection.features, function (feature) {
var bbox = turf.extent(feature);
var bboxPolygon = turf.bboxPolygon(bbox);
return !!turf.intersect(bboxPolygon, buffer.features[0]);
});
return KR.Util.createFeatureCollection(intersects);
}
var intersects = _.filter(featureCollection.features, function (feature) {
var bbox = turf.extent(feature);
var bboxPolygon = turf.bboxPolygon(bbox);
return !!turf.intersect(bboxPolygon, buffer.features[0]);
});
return KR.Util.createFeatureCollection(intersects);

if (type.indexOf('MultiLineString') > -1) {
var intersects = _.filter(featureCollection.features, function (feature) {
var bbox = turf.extent(feature);
var bboxPolygon = turf.bboxPolygon(bbox);
return !!turf.intersect(bboxPolygon, buffer.features[0]);
});
return KR.Util.createFeatureCollection(intersects);
}

return turf.within(featureCollection, buffer);

};
}


function _loadDatasets(api, datasets, fromUrl, komm, fylke) {
if (fromUrl) {
datasets = KR.Config.getDatasets(datasets, api, komm, fylke);
Expand Down Expand Up @@ -4267,6 +4283,7 @@ var KR = this.KR || {};
var layer = L.geoJson(geoJson);

var filter = _getFilter(geoJson);

callback(layer.getBounds(), datasets, filter, null, initPos);
});
} else {
Expand Down
2 changes: 1 addition & 1 deletion dist/scripts.min.js

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion dist/scripts3d.js
Original file line number Diff line number Diff line change
Expand Up @@ -2606,7 +2606,6 @@ KR.Config = KR.Config || {};
fillOpacity: 0.4
});
if (_loadEnkeltminner) {
console.log("loadEnkeltminner")
_loadEnkeltminner(e.layer.feature);
}
}
Expand Down Expand Up @@ -2824,6 +2823,7 @@ KR.Config = KR.Config || {};
'ark_hist': {
grouped: true,
name: 'Arkeologi og historie',
minZoom: 14,
datasets: [
{
name: 'MUSIT',
Expand Down Expand Up @@ -2886,6 +2886,7 @@ KR.Config = KR.Config || {};
'arkeologi': {
grouped: true,
name: 'Arkeologi',
minZoom: 14,
style: {
fillcolor: '#436978',
circle: false,
Expand Down Expand Up @@ -2926,6 +2927,7 @@ KR.Config = KR.Config || {};
'historie': {
grouped: true,
name: 'Historie',
minZoom: 14,
style: {
fillcolor: '#D252B9',
circle: false,
Expand Down
4 changes: 2 additions & 2 deletions dist/scripts3d.min.js

Large diffs are not rendered by default.

24 changes: 23 additions & 1 deletion experiments/api_example.html
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ <h3><%= name %></h3>
</tr>
</table>

<a class="sidebar-link" href="<%= url %>" target="_blank">
<a class="sidebar-link" href="<%= link %>" target="_blank">
<i class="fa fa-external-link-square"></i> Vis hos Kulturminnesøk
</a>

Expand Down Expand Up @@ -490,11 +490,33 @@ <h3><%= title %></h3>

<% if(!_.isUndefined(arguments[0].extra)) { %>
<img class="fullwidth img-thumbnail" src="<%= extra.UrlTilBilde %>" />
<<<<<<< HEAD
<table class="sidebar-table">
<tr>
<td>Tittel</td>
<td><%= extra.Tittel %></td>
</tr>
<tr>
<td>Registrert Av</td>
<td><%= extra.RegistrertAv %></td>
</tr>
<tr>
<td>Fotograf</td>
<td><%= extra.OpphavspersonFotograf %></td>
</tr>
<tr>
<td>Copyright</td>
<td><%= extra.Copyright %></td>
</tr>
</table>

=======
<p class="small sidebar-image-text grey">
<b><%= extra.Tittel %></b> - Foto: <%= extra.OpphavspersonFotograf %><br>
<%= extra.Copyright %>
</p>

>>>>>>> master
<% } %>


Expand Down
24 changes: 23 additions & 1 deletion experiments/cesium_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ <h3><%= name %></h3>
</tr>
</table>

<a class="sidebar-link" href="<%= url %>" target="_blank">
<a class="sidebar-link" href="<%= link %>" target="_blank">
<i class="fa fa-external-link-square"></i> Vis hos Kulturminnesøk
</a>

Expand Down Expand Up @@ -498,11 +498,33 @@ <h3><%= title %></h3>

<% if(!_.isUndefined(arguments[0].extra)) { %>
<img class="fullwidth img-thumbnail" src="<%= extra.UrlTilBilde %>" />
<<<<<<< HEAD
<table class="sidebar-table">
<tr>
<td>Tittel</td>
<td><%= extra.Tittel %></td>
</tr>
<tr>
<td>Registrert Av</td>
<td><%= extra.RegistrertAv %></td>
</tr>
<tr>
<td>Fotograf</td>
<td><%= extra.OpphavspersonFotograf %></td>
</tr>
<tr>
<td>Copyright</td>
<td><%= extra.Copyright %></td>
</tr>
</table>

=======
<p class="small sidebar-image-text grey">
<b><%= extra.Tittel %></b> - Foto: <%= extra.OpphavspersonFotograf %><br>
<%= extra.Copyright %>
</p>

>>>>>>> master
<% } %>


Expand Down
24 changes: 23 additions & 1 deletion experiments/cesium_folgefonna.html
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ <h3><%= name %></h3>
</tr>
</table>

<a class="sidebar-link" href="<%= url %>" target="_blank">
<a class="sidebar-link" href="<%= link %>" target="_blank">
<i class="fa fa-external-link-square"></i> Vis hos Kulturminnesøk
</a>

Expand Down Expand Up @@ -595,11 +595,33 @@ <h3><%= title %></h3>

<% if(!_.isUndefined(arguments[0].extra)) { %>
<img class="fullwidth img-thumbnail" src="<%= extra.UrlTilBilde %>" />
<<<<<<< HEAD
<table class="sidebar-table">
<tr>
<td>Tittel</td>
<td><%= extra.Tittel %></td>
</tr>
<tr>
<td>Registrert Av</td>
<td><%= extra.RegistrertAv %></td>
</tr>
<tr>
<td>Fotograf</td>
<td><%= extra.OpphavspersonFotograf %></td>
</tr>
<tr>
<td>Copyright</td>
<td><%= extra.Copyright %></td>
</tr>
</table>

=======
<p class="small sidebar-image-text grey">
<b><%= extra.Tittel %></b> - Foto: <%= extra.OpphavspersonFotograf %><br>
<%= extra.Copyright %>
</p>

>>>>>>> master
<% } %>


Expand Down
24 changes: 23 additions & 1 deletion experiments/cesium_terrain.html
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ <h3><%= name %></h3>
</tr>
</table>

<a class="sidebar-link" href="<%= url %>" target="_blank">
<a class="sidebar-link" href="<%= link %>" target="_blank">
<i class="fa fa-external-link-square"></i> Vis hos Kulturminnesøk
</a>

Expand Down Expand Up @@ -569,11 +569,33 @@ <h3><%= title %></h3>

<% if(!_.isUndefined(arguments[0].extra)) { %>
<img class="fullwidth img-thumbnail" src="<%= extra.UrlTilBilde %>" />
<<<<<<< HEAD
<table class="sidebar-table">
<tr>
<td>Tittel</td>
<td><%= extra.Tittel %></td>
</tr>
<tr>
<td>Registrert Av</td>
<td><%= extra.RegistrertAv %></td>
</tr>
<tr>
<td>Fotograf</td>
<td><%= extra.OpphavspersonFotograf %></td>
</tr>
<tr>
<td>Copyright</td>
<td><%= extra.Copyright %></td>
</tr>
</table>

=======
<p class="small sidebar-image-text grey">
<b><%= extra.Tittel %></b> - Foto: <%= extra.OpphavspersonFotograf %><br>
<%= extra.Copyright %>
</p>

>>>>>>> master
<% } %>


Expand Down
Loading

0 comments on commit 8fdfdc6

Please sign in to comment.