Advertisement
Guest User

Untitled

a guest
Oct 1st, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.14 KB | None | 0 0
  1. ApplicationWindow {
  2. visible: true
  3. width: 720
  4. height: 1280
  5. title: qsTr("")
  6. id: root
  7. Map {
  8. id: map
  9. anchors.centerIn: parent;
  10. anchors.fill: parent
  11. zoomLevel: 11
  12. objectName: "mainMap"
  13.  
  14. center {
  15. id: mapCenter
  16. latitude : 50.89
  17. longitude: 11.23
  18. }
  19. plugin: Plugin {
  20. name: "here"
  21. PluginParameter { name: "here.app_id"; value: "R9qav4Kw6gO5XKSxNiOO" }
  22. PluginParameter { name: "here.token"; value: "58UCNRCr1dZxhLL2Bmmz3Q" }
  23. PluginParameter { name: "here.proxy"; value: "system" }
  24. }
  25. function setPosition(pos) {
  26. map.toCoordinate(pos);
  27. map.update();
  28. }
  29. }
  30.  
  31. #include <QGuiApplication>
  32. #include <QQmlApplicationEngine>
  33. #include <QGuiApplication>
  34. #include <QQmlApplicationEngine>
  35. #include <QQmlContext>
  36. #include <QObject>
  37. #include <QTime>
  38. #include <QBasicTimer>
  39. #include <QDebug>
  40. #include <QEasingCurve>
  41. #include <QGeoCoordinate>
  42. #include <QtPositioning/private/qgeoprojection_p.h>
  43. #include <QGeoServiceProvider>
  44. #include <QDebug>
  45. #include <QNetworkRequest>
  46.  
  47. int main(int argc, char *argv[])
  48. {
  49. QGuiApplication app(argc, argv);
  50. QUrl data("https://lstsim.de/js/dispatch/1.js");
  51. QNetworkRequest request(data);
  52.  
  53. QQmlApplicationEngine engine;
  54. engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
  55. QObject *rootObject = engine.rootObjects().first();
  56. QObject* mainMapCenter = rootObject->findChild<QObject*>("mainMap");
  57. if(mainMapCenter != NULL){
  58. QVariant returnedValue;
  59. QPoint point(12,12);
  60. QMetaObject::invokeMethod(mainMapCenter, "setPosition",
  61. Q_RETURN_ARG(QVariant, returnedValue),
  62. Q_ARG(QVariant, point));
  63. qDebug() << "found map";
  64. }
  65. return app.exec();
  66. }
  67.  
  68. function centermyposition(){ //sets my position, but only once (do not update automatically)
  69. var coord = Qt.createQmlObject('import QtMobility.location 1.1; Coordinate{latitude:' + positionSource.position.coordinate.latitude + ';longitude:' + positionSource.position.coordinate.longitude + ';}', positionSource, "coord");
  70. map.center = coord;
  71. myMapRoot.updateViewport()
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement