diff --git a/platform/qt/app/mapwindow.cpp b/platform/qt/app/mapwindow.cpp index da8a9767ce8..bc83e2d972d 100644 --- a/platform/qt/app/mapwindow.cpp +++ b/platform/qt/app/mapwindow.cpp @@ -1,7 +1,9 @@ #include "mapwindow.hpp" #include +#include #include +#include #include #include #include @@ -73,6 +75,33 @@ void MapWindow::keyPressEvent(QKeyEvent *ev) case Qt::Key_S: changeStyle(); break; + case Qt::Key_L: { + m_map.setPaintProperty("water", "fill-color", QColor(255, 0, 0)); + m_map.setPaintProperty("building", "fill-color", "red"); + m_map.setPaintProperty("road-secondary-tertiary", "line-color", "red"); + + m_map.setLayoutProperty("road-label-small", "symbol-placement", "point"); + m_map.setLayoutProperty("road-label-medium", "symbol-placement", "point"); + m_map.setLayoutProperty("road-label-large", "symbol-placement", "point"); + + QFile geojson(":source.geojson"); + geojson.open(QIODevice::ReadOnly); + + QVariantMap testSource; + testSource["type"] = "geojson"; + testSource["data"] = geojson.readAll(); + + m_map.addSource("testSource", testSource); + + QVariantMap testLayer; + testLayer["id"] = "testLayer"; + testLayer["type"] = "fill"; + testLayer["source"] = "testSource"; + + m_map.addLayer(testLayer); + m_map.setPaintProperty("testLayer", "fill-color", QColor("blue")); + } + break; case Qt::Key_Tab: m_map.cycleDebugOptions(); break; diff --git a/platform/qt/app/qmapboxgl.gypi b/platform/qt/app/qmapboxgl.gypi index 62a2939ad2f..22b4e1281e6 100644 --- a/platform/qt/app/qmapboxgl.gypi +++ b/platform/qt/app/qmapboxgl.gypi @@ -17,6 +17,7 @@ 'main.cpp', 'mapwindow.cpp', 'mapwindow.hpp', + 'source.qrc', ], 'include_dirs': [ @@ -30,6 +31,8 @@ '<@(qt_gui_cflags)', '<@(qt_opengl_cflags)', '-fPIC', + # Qt4 generates code with unused variables. + '-Wno-unused-variable', ], 'ldflags': [ '<@(opengl_ldflags)', diff --git a/platform/qt/app/source.geojson b/platform/qt/app/source.geojson new file mode 100644 index 00000000000..f639c1913e4 --- /dev/null +++ b/platform/qt/app/source.geojson @@ -0,0 +1,253 @@ +{ + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + 69.2578125, + -40.17887331434695 + ], + [ + 69.2578125, + -10.141931686131018 + ], + [ + 110.74218749999999, + -10.141931686131018 + ], + [ + 110.74218749999999, + -40.17887331434695 + ], + [ + 69.2578125, + -40.17887331434695 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + -71.71875, + -33.43144133557529 + ], + [ + -71.71875, + 20.3034175184893 + ], + [ + -0.703125, + 20.3034175184893 + ], + [ + -0.703125, + -33.43144133557529 + ], + [ + -71.71875, + -33.43144133557529 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + 97.3828125, + 38.548165423046584 + ], + [ + 97.3828125, + 65.2198939361321 + ], + [ + 155.0390625, + 65.2198939361321 + ], + [ + 155.0390625, + 38.548165423046584 + ], + [ + 97.3828125, + 38.548165423046584 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + 24.93617534637451, + 60.17058143435276 + ], + [ + 24.93617534637451, + 60.17149933938796 + ], + [ + 24.93808507919311, + 60.17149933938796 + ], + [ + 24.93808507919311, + 60.17058143435276 + ], + [ + 24.93617534637451, + 60.17058143435276 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + 24.94398593902588, + 60.170346617317186 + ], + [ + 24.94398593902588, + 60.171456646699184 + ], + [ + 24.947032928466797, + 60.171456646699184 + ], + [ + 24.947032928466797, + 60.170346617317186 + ], + [ + 24.94398593902588, + 60.170346617317186 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + 24.938321113586426, + 60.16800902895082 + ], + [ + 24.938321113586426, + 60.169204528711674 + ], + [ + 24.941797256469727, + 60.169204528711674 + ], + [ + 24.941797256469727, + 60.16800902895082 + ], + [ + 24.938321113586426, + 60.16800902895082 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + 24.939115047454834, + 60.17280143974311 + ], + [ + 24.939115047454834, + 60.17387936902026 + ], + [ + 24.94175434112549, + 60.17387936902026 + ], + [ + 24.94175434112549, + 60.17280143974311 + ], + [ + 24.939115047454834, + 60.17280143974311 + ] + ] + ] + } + }, + { + "type": "Feature", + "properties": {}, + "geometry": { + "type": "Polygon", + "coordinates": [ + [ + [ + 24.944372177124023, + 60.16034398818875 + ], + [ + 24.944372177124023, + 60.16837195311943 + ], + [ + 24.963769912719727, + 60.16837195311943 + ], + [ + 24.963769912719727, + 60.16034398818875 + ], + [ + 24.944372177124023, + 60.16034398818875 + ] + ] + ] + } + } + ] +} \ No newline at end of file diff --git a/platform/qt/app/source.qrc b/platform/qt/app/source.qrc new file mode 100644 index 00000000000..60282b7178a --- /dev/null +++ b/platform/qt/app/source.qrc @@ -0,0 +1,5 @@ + + + source.geojson + +