Переглянути джерело

add odtohdmap, prepare write xodr to apollo hdmap. not complete.

yuchuli 1 місяць тому
батько
коміт
31e5578aab

+ 74 - 0
src/map/odtohdmap/.gitignore

@@ -0,0 +1,74 @@
+# This file is used to ignore files which are generated
+# ----------------------------------------------------------------------------
+
+*~
+*.autosave
+*.a
+*.core
+*.moc
+*.o
+*.obj
+*.orig
+*.rej
+*.so
+*.so.*
+*_pch.h.cpp
+*_resource.rc
+*.qm
+.#*
+*.*#
+core
+!core/
+tags
+.DS_Store
+.directory
+*.debug
+Makefile*
+*.prl
+*.app
+moc_*.cpp
+ui_*.h
+qrc_*.cpp
+Thumbs.db
+*.res
+*.rc
+/.qmake.cache
+/.qmake.stash
+
+# qtcreator generated files
+*.pro.user*
+CMakeLists.txt.user*
+
+# xemacs temporary files
+*.flc
+
+# Vim temporary files
+.*.swp
+
+# Visual Studio generated files
+*.ib_pdb_index
+*.idb
+*.ilk
+*.pdb
+*.sln
+*.suo
+*.vcproj
+*vcproj.*.*.user
+*.ncb
+*.sdf
+*.opensdf
+*.vcxproj
+*vcxproj.*
+
+# MinGW generated files
+*.Debug
+*.Release
+
+# Python byte code
+*.pyc
+
+# Binaries
+# --------
+*.dll
+*.exe
+

+ 11 - 0
src/map/odtohdmap/main.cpp

@@ -0,0 +1,11 @@
+#include "mainwindow.h"
+
+#include <QApplication>
+
+int main(int argc, char *argv[])
+{
+    QApplication a(argc, argv);
+    MainWindow w;
+    w.show();
+    return a.exec();
+}

+ 51 - 0
src/map/odtohdmap/mainwindow.cpp

@@ -0,0 +1,51 @@
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+
+#include <QFileDialog>
+
+MainWindow::MainWindow(QWidget *parent)
+    : QMainWindow(parent)
+    , ui(new Ui::MainWindow)
+{
+    ui->setupUi(this);
+
+    setWindowTitle("Convert xodr map to Apollo HDMAP");
+}
+
+MainWindow::~MainWindow()
+{
+    delete ui;
+}
+
+void MainWindow::on_pushButton_convert_clicked()
+{
+    QString strlastpath = QString(ServiceIni.Getlastpath().data());
+    QString strxodrpath = QFileDialog::getOpenFileName(this,"Select OpenDrive File",strlastpath,"*.xodr");
+
+    if(strxodrpath.isEmpty())return;
+
+    int indexsplash = strxodrpath.lastIndexOf('/');
+    QString lastPath = strxodrpath.left(indexsplash);
+
+    if(lastPath != strlastpath)
+    {
+        strlastpath = lastPath;
+        ServiceIni.Setlastpath(strlastpath.toStdString());
+    }
+
+    QString strhdmappath = QFileDialog::getSaveFileName(this,"Select HDMAP File",".","*.xml");
+
+    if(strhdmappath.isEmpty())return;
+
+    indexsplash = strxodrpath.lastIndexOf('/');
+    lastPath = strxodrpath.left(indexsplash);
+
+    if(lastPath != strlastpath)
+    {
+        strlastpath = lastPath;
+        ServiceIni.Setlastpath(strlastpath.toStdString());
+    }
+}
+
+
+

+ 31 - 0
src/map/odtohdmap/mainwindow.h

@@ -0,0 +1,31 @@
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QMainWindow>
+
+#include <odtohdmapini.h>
+
+QT_BEGIN_NAMESPACE
+namespace Ui {
+class MainWindow;
+}
+QT_END_NAMESPACE
+
+class MainWindow : public QMainWindow
+{
+    Q_OBJECT
+
+public:
+    MainWindow(QWidget *parent = nullptr);
+    ~MainWindow();
+
+private slots:
+    void on_pushButton_convert_clicked();
+
+private:
+    Ui::MainWindow *ui;
+
+private:
+
+};
+#endif // MAINWINDOW_H

+ 45 - 0
src/map/odtohdmap/mainwindow.ui

@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>637</width>
+    <height>425</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>MainWindow</string>
+  </property>
+  <widget class="QWidget" name="centralwidget">
+   <widget class="QPushButton" name="pushButton_convert">
+    <property name="geometry">
+     <rect>
+      <x>130</x>
+      <y>60</y>
+      <width>171</width>
+      <height>41</height>
+     </rect>
+    </property>
+    <property name="text">
+     <string>Convert</string>
+    </property>
+   </widget>
+  </widget>
+  <widget class="QMenuBar" name="menubar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>637</width>
+     <height>27</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QStatusBar" name="statusbar"/>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 38 - 0
src/map/odtohdmap/odtohdmap.pro

@@ -0,0 +1,38 @@
+QT       += core gui
+
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+
+CONFIG += c++17
+
+# You can make your code fail to compile if it uses deprecated APIs.
+# In order to do so, uncomment the following line.
+#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
+
+SOURCES += \
+    main.cpp \
+    mainwindow.cpp \
+    odtohdmapini.cpp
+
+HEADERS += \
+    mainwindow.h \
+    odtohdmapini.h
+
+FORMS += \
+    mainwindow.ui
+
+!include(../../common/common/xodr/OpenDrive/OpenDrive.pri ) {
+    error( "Couldn't find the OpenDrive.pri file!" )
+}
+
+!include(../../common/common/xodr/TinyXML/TinyXML.pri ) {
+    error( "Couldn't find the TinyXML.pri file!" )
+}
+
+!include(../../common/common/xodr/odaux/odaux.pri ) {
+    error( "Couldn't find the odaux.pri file!" )
+}
+
+# Default rules for deployment.
+qnx: target.path = /tmp/$${TARGET}/bin
+else: unix:!android: target.path = /opt/$${TARGET}/bin
+!isEmpty(target.path): INSTALLS += target

+ 31 - 0
src/map/odtohdmap/odtohdmapini.cpp

@@ -0,0 +1,31 @@
+#include "odtohdmapini.h"
+
+odtohdmapini::odtohdmapini() {
+    mstrinipath = "./odtohdmap.ini";
+    QSettings * configini = new QSettings(mstrinipath,QSettings::IniFormat);
+
+    mstrlastpath = configini->value("setting/lastpath").toString().toStdString();
+    if(mstrlastpath == "")
+    {
+        mstrlastpath = ".";
+    }
+
+}
+
+
+odtohdmapini & odtohdmapini::Inst()
+{
+    static odtohdmapini xodtohdmapIni;
+    return xodtohdmapIni;
+}
+
+
+std::string odtohdmapini::Getlastpath(){
+    return mstrlastpath;
+}
+void odtohdmapini::Setlastpath(std::string strlastpath){
+    mstrlastpath = strlastpath;
+    QSettings * configini = new QSettings(mstrinipath,QSettings::IniFormat);
+    configini->setValue("setting/lastpath",QString(strlastpath.data()));
+    delete configini;
+}

+ 27 - 0
src/map/odtohdmap/odtohdmapini.h

@@ -0,0 +1,27 @@
+#ifndef ODTOHDMAPINI_H
+#define ODTOHDMAPINI_H
+
+#include <QSettings>
+
+class odtohdmapini
+{
+public:
+    odtohdmapini();
+
+public:
+    static odtohdmapini & Inst();
+
+private:
+    QString mstrinipath;
+
+private:
+    std::string mstrlastpath = ".";
+
+public:
+    std::string Getlastpath();
+    void Setlastpath(std::string strmd5);
+};
+
+#define ServiceIni odtohdmapini::Inst()
+
+#endif // ODTOHDMAPINI_H