|
@@ -289,7 +289,12 @@ ADCIntelligentVehicle::ADCIntelligentVehicle(QWidget *parent)
|
|
|
|
|
|
mMapview = new QWebEngineView(ui->stackedWidget->widget(1));
|
|
mMapview = new QWebEngineView(ui->stackedWidget->widget(1));
|
|
// qDebug((QDir::currentPath()).toLatin1().data());
|
|
// qDebug((QDir::currentPath()).toLatin1().data());
|
|
|
|
+#ifndef USEGOOGLEMAP
|
|
mMapview->load(QUrl(QString("file:///%1/%2").arg(QApplication::applicationDirPath()).arg("BaiDuMap.html")));
|
|
mMapview->load(QUrl(QString("file:///%1/%2").arg(QApplication::applicationDirPath()).arg("BaiDuMap.html")));
|
|
|
|
+#else
|
|
|
|
+ mMapview->setUrl(QUrl("https://www.google.com/maps"));
|
|
|
|
+// mMapview->load(QUrl(QString("file:///%1/%2").arg(QApplication::applicationDirPath()).arg("googlemap.html")));
|
|
|
|
+#endif
|
|
mMapview->setGeometry(1000,100,500,500);
|
|
mMapview->setGeometry(1000,100,500,500);
|
|
}
|
|
}
|
|
/********************************************************************************/
|
|
/********************************************************************************/
|
|
@@ -966,9 +971,22 @@ void ADCIntelligentVehicle::onStateTimerMap()
|
|
double flon = ServiceCarStatus.location->gps_lng;
|
|
double flon = ServiceCarStatus.location->gps_lng;
|
|
double fang = ServiceCarStatus.location->ins_heading_angle;
|
|
double fang = ServiceCarStatus.location->ins_heading_angle;
|
|
|
|
|
|
- char strscript[256];
|
|
|
|
|
|
+ char strscript[1000];
|
|
snprintf(strscript,255,"theLocation(%11.7f,%11.7f,%11.7f);",flon,flat,fang);
|
|
snprintf(strscript,255,"theLocation(%11.7f,%11.7f,%11.7f);",flon,flat,fang);
|
|
|
|
+#ifndef USEGOOGLEMAP
|
|
|
|
+ mMapview->page()->runJavaScript(strscript);
|
|
|
|
+#else
|
|
|
|
+
|
|
|
|
+ snprintf(strscript,1000,"var latLng = new google.maps.LatLng(%11.7f,%11.7f);"
|
|
|
|
+ "var mapOptions = { center: latLng, zoom: 13 };"
|
|
|
|
+ "new google.maps.Map(document.getElementById('map'), mapOptions);",flon,flat);
|
|
mMapview->page()->runJavaScript(strscript);
|
|
mMapview->page()->runJavaScript(strscript);
|
|
|
|
+// QString js = QString("var latLng = new google.maps.LatLng(40.758896, -73.985130);"
|
|
|
|
+// "var mapOptions = { center: latLng, zoom: 13 };"
|
|
|
|
+// "new google.maps.Map(document.getElementById('map'), mapOptions);");
|
|
|
|
+ // mMapview->page()->runJavaScript(js);
|
|
|
|
+
|
|
|
|
+#endif
|
|
}
|
|
}
|
|
/************************************************************************/
|
|
/************************************************************************/
|
|
}
|
|
}
|