Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

Commit

Permalink
terrain: convertig credits to attribution
Browse files Browse the repository at this point in the history
  • Loading branch information
vaclavblazek committed Mar 14, 2019
1 parent c2b7a2e commit f0ff550
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion externals/vts-libs
4 changes: 4 additions & 0 deletions mapproxy/src/mapproxy/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ file_to_cpp(mapproxy_CESIUM_SOURCES
cesium::cesium_js
cesium/cesium.js)

file_to_cpp(mapproxy_CESIUM_SOURCES
cesium::melowntech_png
cesium/melown-technologies-logo-transparent-28.png)

add_executable(mapproxy
${mapproxy_SOURCES}
${mapproxy_BROWSER_SOURCES}
Expand Down
8 changes: 8 additions & 0 deletions mapproxy/src/mapproxy/cesium.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

#include "cesium/cesium.html.hpp"
#include "cesium/cesium.js.hpp"
#include "cesium/melown-technologies-logo-transparent-28.png.hpp"

namespace cesium {

Expand All @@ -47,6 +48,13 @@ const vtslibs::storage::SupportFile::Files supportFiles =
, cesium_js_attr_lastModified
, "application/javascript; charset=utf-8"
}
}, { "melowntech.png"
, {
melowntech_png
, sizeof(melowntech_png)
, melowntech_png_attr_lastModified
, "image/png"
}
}
};

Expand Down
7 changes: 7 additions & 0 deletions mapproxy/src/mapproxy/cesium/cesium.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,16 @@ function launchCesium(imageryProvider) {
, scene3DOnly: true
, navigationInstructionsInitiallyVisible: false
, selectionIndicator: false
, requestRenderMode : true
, imageryProvider: imageryProvider
, terrainProvider: terrainProvider
});

var melownCredit = new Cesium.Credit
('<a href="https://www.melown.com/">'
+ '<img src="melowntech.png" title="Melown Technologies SE" />'
+ '</a>');
viewer.scene.frameState.creditDisplay.addDefaultCredit(melownCredit);
}

function resolveUrl(url, base) {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions mapproxy/src/mapproxy/generator/surface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <boost/filesystem.hpp>
#include <boost/format.hpp>
#include <boost/utility/in_place_factory.hpp>
#include <boost/lexical_cast.hpp>

#include <opencv2/highgui/highgui.hpp>

Expand All @@ -39,6 +40,7 @@
#include "imgproc/rastermask/cvmat.hpp"
#include "imgproc/png.hpp"

#include "vts-libs/registry/io.hpp"
#include "vts-libs/storage/fstreams.hpp"
#include "vts-libs/vts/io.hpp"
#include "vts-libs/vts/nodeinfo.hpp"
Expand Down Expand Up @@ -641,6 +643,12 @@ void SurfaceBase::layerJson(Sink &sink, const SurfaceFileInfo &fi) const
}
}

if (!r.credits.empty()) {
layer.attribution
= boost::lexical_cast<std::string>
(utility::join(html(asInlineCredits(r)), "<br/>"));
}

std::ostringstream os;
save(layer, os);
sink.content(os.str(), fi.sinkFileInfo());
Expand Down
1 change: 1 addition & 0 deletions mapproxy/src/mapproxy/support/tilejson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ void build(Json::Value &content, const LayerJson &layer)
build(content["available"], layer.available);
content["minzoom"] = layer.zoom.min;
content["maxzoom"] = layer.zoom.max;
build(content, "attribution", layer.attribution);
}

} // namespace
Expand Down
1 change: 1 addition & 0 deletions mapproxy/src/mapproxy/support/tilejson.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ struct LayerJson {
vts::LodRange zoom;
Available available;
std::vector<std::string> tiles;
OString attribution;

LayerJson()
: tilejson(2, 0, 0), version(1, 0, 0), scheme(Scheme::xyz)
Expand Down

0 comments on commit f0ff550

Please sign in to comment.