From f0ff5506c7e45aa18bdcb82bc1aa3b13f1a10196 Mon Sep 17 00:00:00 2001 From: Vaclav Blazek Date: Thu, 14 Mar 2019 16:06:35 +0100 Subject: [PATCH] terrain: convertig credits to attribution --- externals/vts-libs | 2 +- mapproxy/src/mapproxy/CMakeLists.txt | 4 ++++ mapproxy/src/mapproxy/cesium.cpp | 8 ++++++++ mapproxy/src/mapproxy/cesium/cesium.js | 7 +++++++ .../melown-technologies-logo-transparent-28.png | Bin 0 -> 4255 bytes mapproxy/src/mapproxy/generator/surface.cpp | 8 ++++++++ mapproxy/src/mapproxy/support/tilejson.cpp | 1 + mapproxy/src/mapproxy/support/tilejson.hpp | 1 + 8 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 mapproxy/src/mapproxy/cesium/melown-technologies-logo-transparent-28.png diff --git a/externals/vts-libs b/externals/vts-libs index 4a45bd5..4f4bd72 160000 --- a/externals/vts-libs +++ b/externals/vts-libs @@ -1 +1 @@ -Subproject commit 4a45bd5ad240065a2c8ddaf052d4f9b2051216f4 +Subproject commit 4f4bd72d402bab5c009a2a998fdc2d5b0e2c8076 diff --git a/mapproxy/src/mapproxy/CMakeLists.txt b/mapproxy/src/mapproxy/CMakeLists.txt index 1c901c9..b6b57dc 100644 --- a/mapproxy/src/mapproxy/CMakeLists.txt +++ b/mapproxy/src/mapproxy/CMakeLists.txt @@ -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} diff --git a/mapproxy/src/mapproxy/cesium.cpp b/mapproxy/src/mapproxy/cesium.cpp index 58ad78f..d336eff 100644 --- a/mapproxy/src/mapproxy/cesium.cpp +++ b/mapproxy/src/mapproxy/cesium.cpp @@ -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 { @@ -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" + } } }; diff --git a/mapproxy/src/mapproxy/cesium/cesium.js b/mapproxy/src/mapproxy/cesium/cesium.js index 4089b09..ceb3263 100644 --- a/mapproxy/src/mapproxy/cesium/cesium.js +++ b/mapproxy/src/mapproxy/cesium/cesium.js @@ -33,9 +33,16 @@ function launchCesium(imageryProvider) { , scene3DOnly: true , navigationInstructionsInitiallyVisible: false , selectionIndicator: false + , requestRenderMode : true , imageryProvider: imageryProvider , terrainProvider: terrainProvider }); + + var melownCredit = new Cesium.Credit + ('' + + '' + + ''); + viewer.scene.frameState.creditDisplay.addDefaultCredit(melownCredit); } function resolveUrl(url, base) { diff --git a/mapproxy/src/mapproxy/cesium/melown-technologies-logo-transparent-28.png b/mapproxy/src/mapproxy/cesium/melown-technologies-logo-transparent-28.png new file mode 100644 index 0000000000000000000000000000000000000000..a2edb7995e64d825e94ae8e9167c7f5ed879a436 GIT binary patch literal 4255 zcmZ`-WmFW}+8$IwLPSylL3&UahLoX0(or0`yJLVEoS_xr&>-ESfD$7egMf5PBOOB> zDPbrXBrl%hckcb}T6eFt>)Fryys_8XKX$m*6ICkmJLCWWfJ$9W8Fo3lTy_>RlFKnz z*@*ITx@NBcRR93WV<}E8i7)r;)@m>)0N}#|0K5nW0FE!A7i$23mk6<9$8=e{1}`eU@7*M#XXE3ut|hr=mrP}s9{Vw~Pc#!4o$B%R>+5<( zgZ8*OwcMXpg*@iV1`)9%cJVxp=~}5HTDSXEXrNz6Bhqu0tZh@~e2@JCR|B`taP_FE zIU1-Pq%ZJd^+Ku%htI_ApALL_h;0+kPE0X7_~dzUkrn%n#LwwtP&WSC(Wpzv=-J!Y zMGfpp{PV|yCM$|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H$Do-sns$G_0!NZv4D4V0xXPb@33D=v z>OH+>tomBy3T=hzz&5{<5B14}M>E6AJuYYe4lPpmVP?ZXG~Bfl;U6Y6W0Iz^4kK2_ zT;!cyko4cxjtuxT4l13BC|Bbjo9DVT$8&)!t`@EKbME5A%i;`8^SX5#PHcwmw+0er3GaU> U&^}TA^$no@=!tTPqD9cZ0R4a)KmY&$ literal 0 HcmV?d00001 diff --git a/mapproxy/src/mapproxy/generator/surface.cpp b/mapproxy/src/mapproxy/generator/surface.cpp index 74d229a..46b97b5 100644 --- a/mapproxy/src/mapproxy/generator/surface.cpp +++ b/mapproxy/src/mapproxy/generator/surface.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include @@ -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" @@ -641,6 +643,12 @@ void SurfaceBase::layerJson(Sink &sink, const SurfaceFileInfo &fi) const } } + if (!r.credits.empty()) { + layer.attribution + = boost::lexical_cast + (utility::join(html(asInlineCredits(r)), "
")); + } + std::ostringstream os; save(layer, os); sink.content(os.str(), fi.sinkFileInfo()); diff --git a/mapproxy/src/mapproxy/support/tilejson.cpp b/mapproxy/src/mapproxy/support/tilejson.cpp index 35b0e42..7bea187 100644 --- a/mapproxy/src/mapproxy/support/tilejson.cpp +++ b/mapproxy/src/mapproxy/support/tilejson.cpp @@ -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 diff --git a/mapproxy/src/mapproxy/support/tilejson.hpp b/mapproxy/src/mapproxy/support/tilejson.hpp index 326310e..e922837 100644 --- a/mapproxy/src/mapproxy/support/tilejson.hpp +++ b/mapproxy/src/mapproxy/support/tilejson.hpp @@ -65,6 +65,7 @@ struct LayerJson { vts::LodRange zoom; Available available; std::vector tiles; + OString attribution; LayerJson() : tilejson(2, 0, 0), version(1, 0, 0), scheme(Scheme::xyz)