mapnik/demo/viewer/mainwindow.hpp

118 lines
2.8 KiB
C++
Raw Normal View History

2007-08-07 17:09:41 +02:00
/* This file is part of Mapnik (c++ mapping toolkit)
2011-10-23 16:09:12 +02:00
*
2021-01-05 15:39:07 +01:00
* Copyright (C) 2021 Artem Pavlenko
2007-08-07 17:09:41 +02:00
*
* Mapnik is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
2016-01-26 10:54:42 +01:00
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
2007-08-07 17:09:41 +02:00
*/
#ifndef MAINWINDOW_HPP
#define MAINWINDOW_HPP
#include <QMainWindow>
#include <QList>
#include <QActionGroup>
#include <QStatusBar>
#include <QAbstractItemModel>
#include <QDoubleSpinBox>
2007-08-07 17:09:41 +02:00
#include "mapwidget.hpp"
2022-01-26 23:34:08 +01:00
// using namespace mapnik;
2007-08-07 17:09:41 +02:00
class LayerTab;
class StyleTab;
class QSlider;
class QComboBox;
class QDoubleSpinBox;
2007-08-07 17:09:41 +02:00
class MainWindow : public QMainWindow
{
Q_OBJECT
2022-01-26 23:34:08 +01:00
public:
MainWindow();
virtual ~MainWindow();
2022-01-26 23:34:08 +01:00
void set_default_extent(double x0, double y0, double x1, double y1);
void set_scaling_factor(double scaling_factor);
2022-01-26 23:34:08 +01:00
public:
std::shared_ptr<mapnik::Map> get_map();
2022-01-26 23:34:08 +01:00
protected:
void closeEvent(QCloseEvent* event);
2022-01-26 23:34:08 +01:00
public slots:
void zoom_all();
void zoom_to_box();
void pan();
void info();
void export_as();
2022-01-26 23:34:08 +01:00
void open(QString const& path = QString());
void reload();
void save();
void print();
void about();
void pan_left();
void pan_right();
void pan_up();
void pan_down();
2022-01-26 23:34:08 +01:00
private:
void createActions();
void createMenus();
void createToolBars();
void createContextMenu();
void load_map_file(QString const& filename);
2011-10-23 16:09:12 +02:00
QString currentPath;
QString filename_;
2022-01-26 23:34:08 +01:00
QAbstractItemModel* model;
LayerTab* layerTab_;
StyleTab* styleTab_;
MapWidget* mapWidget_;
// actions
QList<QAction*> exportAsActs;
QActionGroup* toolsGroup;
2007-08-07 17:09:41 +02:00
2022-01-26 23:34:08 +01:00
QAction* zoomAllAct;
QAction* zoomBoxAct;
QAction* panAct;
QAction* infoAct;
QAction* openAct;
QAction* saveAct;
QAction* printAct;
QAction* exitAct;
QAction* aboutAct;
QAction* panLeftAct;
QAction* panRightAct;
QAction* panUpAct;
QAction* panDownAct;
QAction* reloadAct;
QAction* layerInfo;
// toolbars
QToolBar* fileToolBar;
QToolBar* editToolBar;
// menus
QMenu* exportMenu;
QMenu* fileMenu;
QMenu* helpMenu;
// status bar
QStatusBar* status;
QSlider* slider_;
QComboBox* renderer_selector_;
QDoubleSpinBox* scale_factor_;
mapnik::box2d<double> default_extent_;
2007-08-07 17:09:41 +02:00
};
2022-01-26 23:34:08 +01:00
#endif // MAINWINDOW_HPP