mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 06:10:04 +00:00 
			
		
		
		
	Open NEXRAD Product stub
This commit is contained in:
		
							parent
							
								
									f7b8778e0d
								
							
						
					
					
						commit
						9b90189566
					
				
					 4 changed files with 115 additions and 20 deletions
				
			
		|  | @ -1,6 +1,9 @@ | |||
| #define NOMINMAX | ||||
| 
 | ||||
| #include "main_window.hpp" | ||||
| #include "./ui_main_window.h" | ||||
| 
 | ||||
| #include <scwx/qt/manager/radar_product_manager.hpp> | ||||
| #include <scwx/qt/manager/settings_manager.hpp> | ||||
| #include <scwx/qt/map/map_widget.hpp> | ||||
| #include <scwx/qt/ui/flow_layout.hpp> | ||||
|  | @ -8,6 +11,8 @@ | |||
| #include <scwx/common/products.hpp> | ||||
| #include <scwx/common/vcp.hpp> | ||||
| 
 | ||||
| #include <QFileDialog> | ||||
| #include <QMessageBox> | ||||
| #include <QSplitter> | ||||
| #include <QToolButton> | ||||
| 
 | ||||
|  | @ -33,6 +38,7 @@ public: | |||
|        activeMap_ {nullptr}, | ||||
|        maps_ {}, | ||||
|        elevationCuts_ {}, | ||||
|        elevationButtonsChanged_ {false}, | ||||
|        resizeElevationButtons_ {false} | ||||
|    { | ||||
|       settings_.setCacheDatabasePath("/tmp/mbgl-cache.db"); | ||||
|  | @ -191,6 +197,66 @@ void MainWindow::showEvent(QShowEvent* event) | |||
|    resizeDocks({ui->radarToolboxDock}, {150}, Qt::Horizontal); | ||||
| } | ||||
| 
 | ||||
| void MainWindow::on_actionOpen_triggered() | ||||
| { | ||||
|    static const std::string nexradFilter = "NEXRAD Products (*)"; | ||||
| 
 | ||||
|    QFileDialog* dialog = new QFileDialog(this); | ||||
| 
 | ||||
|    dialog->setFileMode(QFileDialog::ExistingFile); | ||||
|    dialog->setNameFilter(tr(nexradFilter.c_str())); | ||||
|    dialog->setAttribute(Qt::WA_DeleteOnClose); | ||||
| 
 | ||||
|    // Make sure the parent window properly repaints on close
 | ||||
|    connect( | ||||
|       dialog, | ||||
|       &QFileDialog::finished, | ||||
|       this, | ||||
|       [=]() { update(); }, | ||||
|       Qt::QueuedConnection); | ||||
| 
 | ||||
|    connect( | ||||
|       dialog, | ||||
|       &QFileDialog::fileSelected, | ||||
|       this, | ||||
|       [=](const QString& file) | ||||
|       { | ||||
|          BOOST_LOG_TRIVIAL(info) << "Selected: " << file.toStdString(); | ||||
| 
 | ||||
|          manager::RadarProductManager::LoadFile( | ||||
|             file.toStdString(), | ||||
|             [=](std::shared_ptr<wsr88d::NexradFile> nexradFile) | ||||
|             { | ||||
|                std::shared_ptr<wsr88d::Ar2vFile> level2File = | ||||
|                   std::dynamic_pointer_cast<wsr88d::Ar2vFile>(nexradFile); | ||||
|                std::shared_ptr<wsr88d::Level3File> level3File = | ||||
|                   std::dynamic_pointer_cast<wsr88d::Level3File>(nexradFile); | ||||
| 
 | ||||
|                if (level2File != nullptr) | ||||
|                { | ||||
|                   // TODO: Handle
 | ||||
|                } | ||||
|                else if (level3File != nullptr) | ||||
|                { | ||||
|                   // TODO: Handle
 | ||||
|                } | ||||
|                else | ||||
|                { | ||||
|                   QMessageBox* messageBox = new QMessageBox(this); | ||||
|                   messageBox->setIcon(QMessageBox::Warning); | ||||
|                   messageBox->setText( | ||||
|                      QString("%1\n%2").arg(tr("Unrecognized NEXRAD Product:"), | ||||
|                                            QDir::toNativeSeparators(file))); | ||||
|                   messageBox->setAttribute(Qt::WA_DeleteOnClose); | ||||
|                   messageBox->open(); | ||||
|                } | ||||
|             }, | ||||
|             this); | ||||
|       }); | ||||
| 
 | ||||
|    dialog->open(); | ||||
| } | ||||
| 
 | ||||
| void MainWindow::on_actionExit_triggered() | ||||
| { | ||||
|    close(); | ||||
|  |  | |||
|  | @ -30,6 +30,7 @@ public: | |||
|    void showEvent(QShowEvent* event) override; | ||||
| 
 | ||||
| private slots: | ||||
|    void on_actionOpen_triggered(); | ||||
|    void on_actionExit_triggered(); | ||||
| 
 | ||||
| private: | ||||
|  |  | |||
|  | @ -35,23 +35,25 @@ | |||
|      <x>0</x> | ||||
|      <y>0</y> | ||||
|      <width>1024</width> | ||||
|      <height>21</height> | ||||
|      <height>22</height> | ||||
|     </rect> | ||||
|    </property> | ||||
|    <widget class="QMenu" name="menu_File"> | ||||
|    <widget class="QMenu" name="menuFile"> | ||||
|     <property name="title"> | ||||
|      <string>&File</string> | ||||
|     </property> | ||||
|     <addaction name="actionOpen"/> | ||||
|     <addaction name="separator"/> | ||||
|     <addaction name="actionExit"/> | ||||
|    </widget> | ||||
|    <widget class="QMenu" name="menu_Help"> | ||||
|    <widget class="QMenu" name="menuHelp"> | ||||
|     <property name="title"> | ||||
|      <string>&Help</string> | ||||
|     </property> | ||||
|     <addaction name="actionAboutSupercellWx"/> | ||||
|    </widget> | ||||
|    <addaction name="menu_File"/> | ||||
|    <addaction name="menu_Help"/> | ||||
|    <addaction name="menuFile"/> | ||||
|    <addaction name="menuHelp"/> | ||||
|   </widget> | ||||
|   <widget class="QStatusBar" name="statusbar"/> | ||||
|   <widget class="QDockWidget" name="radarToolboxDock"> | ||||
|  | @ -247,6 +249,14 @@ | |||
|     <string>About &Supercell Wx...</string> | ||||
|    </property> | ||||
|   </action> | ||||
|   <action name="actionOpen"> | ||||
|    <property name="text"> | ||||
|     <string>&Open...</string> | ||||
|    </property> | ||||
|    <property name="shortcut"> | ||||
|     <string>Ctrl+O</string> | ||||
|    </property> | ||||
|   </action> | ||||
|  </widget> | ||||
|  <resources/> | ||||
|  <connections/> | ||||
|  |  | |||
|  | @ -4,32 +4,32 @@ | |||
| <context> | ||||
|     <name>MainWindow</name> | ||||
|     <message> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="59"/> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="61"/> | ||||
|         <source>Toolbox</source> | ||||
|         <translation type="unfinished"></translation> | ||||
|     </message> | ||||
|     <message> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="96"/> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="98"/> | ||||
|         <source>...</source> | ||||
|         <translation type="unfinished"></translation> | ||||
|     </message> | ||||
|     <message> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="184"/> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="186"/> | ||||
|         <source>Level 3</source> | ||||
|         <translation type="unfinished"></translation> | ||||
|     </message> | ||||
|     <message> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="211"/> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="213"/> | ||||
|         <source>Settings</source> | ||||
|         <translation type="unfinished"></translation> | ||||
|     </message> | ||||
|     <message> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="217"/> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="219"/> | ||||
|         <source>Declutter</source> | ||||
|         <translation type="unfinished"></translation> | ||||
|     </message> | ||||
|     <message> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="127"/> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="129"/> | ||||
|         <source>Radar Site</source> | ||||
|         <translation type="unfinished"></translation> | ||||
|     </message> | ||||
|  | @ -44,49 +44,67 @@ | |||
|         <translation type="unfinished"></translation> | ||||
|     </message> | ||||
|     <message> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="49"/> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="51"/> | ||||
|         <source>&Help</source> | ||||
|         <translation type="unfinished"></translation> | ||||
|     </message> | ||||
|     <message> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="110"/> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="112"/> | ||||
|         <source>Volume Coverage Pattern</source> | ||||
|         <translation type="unfinished"></translation> | ||||
|     </message> | ||||
|     <message> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="113"/> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="115"/> | ||||
|         <source>VCP</source> | ||||
|         <translation type="unfinished"></translation> | ||||
|     </message> | ||||
|     <message> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="134"/> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="136"/> | ||||
|         <source>Clear Air Mode</source> | ||||
|         <translation type="unfinished"></translation> | ||||
|     </message> | ||||
|     <message> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="151"/> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="153"/> | ||||
|         <source>Radar Products</source> | ||||
|         <translation type="unfinished"></translation> | ||||
|     </message> | ||||
|     <message> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="157"/> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="159"/> | ||||
|         <source>Level 2</source> | ||||
|         <translation type="unfinished"></translation> | ||||
|     </message> | ||||
|     <message> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="204"/> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="206"/> | ||||
|         <source>Elevation</source> | ||||
|         <translation type="unfinished"></translation> | ||||
|     </message> | ||||
|     <message> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="242"/> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="244"/> | ||||
|         <source>E&xit</source> | ||||
|         <translation type="unfinished"></translation> | ||||
|     </message> | ||||
|     <message> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="247"/> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="249"/> | ||||
|         <source>About &Supercell Wx...</source> | ||||
|         <translation type="unfinished"></translation> | ||||
|     </message> | ||||
|     <message> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="254"/> | ||||
|         <source>&Open...</source> | ||||
|         <translation type="unfinished"></translation> | ||||
|     </message> | ||||
|     <message> | ||||
|         <location filename="../source/scwx/qt/main/main_window.ui" line="257"/> | ||||
|         <source>Ctrl+O</source> | ||||
|         <translation type="unfinished"></translation> | ||||
|     </message> | ||||
| </context> | ||||
| <context> | ||||
|     <name>scwx::qt::main::MainWindow</name> | ||||
|     <message> | ||||
|         <location filename="../source/scwx/qt/main/main_window.cpp" line="248"/> | ||||
|         <source>Unrecognized NEXRAD Product:</source> | ||||
|         <translation type="unfinished"></translation> | ||||
|     </message> | ||||
| </context> | ||||
| </TS> | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat