mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
however in Python the destruction had to be done explicitly to acheive right order. New solution is that QgsMapTool is derived from QObject and on construction, QgsMapCanvas is set as its parent. This way canvas is always deleted after deletion of map tools. Also, because of this, I've divided QgsMeasure to QgsMeasureTool and QgsMeasureDialog (problem with 2 parents with QObject as a base). git-svn-id: http://svn.osgeo.org/qgis/trunk@6908 c8812cc2-4d05-0410-92ff-de0c093fc19c
88 lines
2.3 KiB
C++
88 lines
2.3 KiB
C++
/***************************************************************************
|
|
qgsmeasure.h
|
|
------------------
|
|
begin : March 2005
|
|
copyright : (C) 2005 by Radim Blazek
|
|
email : blazek@itc.it
|
|
***************************************************************************/
|
|
/***************************************************************************
|
|
* *
|
|
* This program 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 *
|
|
* (at your option) any later version. *
|
|
* *
|
|
***************************************************************************/
|
|
|
|
#ifndef QGSMEASUREDIALOG_H
|
|
#define QGSMEASUREDIALOG_H
|
|
|
|
#include "ui_qgsmeasurebase.h"
|
|
|
|
#include "qgspoint.h"
|
|
|
|
class QCloseEvent;
|
|
class QgsMeasureTool;
|
|
|
|
class QgsMeasureDialog : public QDialog, private Ui::QgsMeasureBase
|
|
{
|
|
Q_OBJECT;
|
|
|
|
public:
|
|
|
|
//! Constructor
|
|
QgsMeasureDialog(QgsMeasureTool* tool, Qt::WFlags f = 0);
|
|
|
|
//! Save position
|
|
void saveWindowLocation(void);
|
|
|
|
//! Restore last window position/size and show the window
|
|
void restorePosition(void);
|
|
|
|
//! Add new point
|
|
void addPoint(QgsPoint &point);
|
|
|
|
//! Mose move
|
|
void mouseMove(QgsPoint &point);
|
|
|
|
//! Mouse press
|
|
void mousePress(QgsPoint &point);
|
|
|
|
public slots:
|
|
//! Close
|
|
void close ( void);
|
|
|
|
//! Reset and start new
|
|
void restart ();
|
|
|
|
//! Close event
|
|
void closeEvent(QCloseEvent *e);
|
|
|
|
//! Show the help for the dialog
|
|
void on_btnHelp_clicked();
|
|
|
|
private:
|
|
|
|
//! formats distance to most appropriate units
|
|
QString formatDistance(double distance);
|
|
|
|
//! formats area to most appropriate units
|
|
QString formatArea(double area);
|
|
|
|
//! shows/hides table, shows correct units
|
|
void updateUi();
|
|
|
|
double mTotal;
|
|
|
|
//! Help context id
|
|
static const int context_id = 687883780;
|
|
|
|
//! indicates whether we're measuring distances or areas
|
|
bool mMeasureArea;
|
|
|
|
//! pointer to measure tool which owns this dialog
|
|
QgsMeasureTool* mTool;
|
|
};
|
|
|
|
#endif
|