fastmap/MapProject.h
Go to the documentation of this file.
00001 /***************************************************************************
00002 **
00003 **  This file is part of fastmap.
00004 **
00005 **  This file may be distributed and/or modified under the terms of the
00006 **  GNU General Public License version 2 or 3 as published by the Free
00007 **  Software Foundation and appearing in the file LICENSE.GPL included
00008 **  in the packaging of this file.
00009 **
00010 **  This file is distributed in the hope that it will be useful, but WITHOUT
00011 **  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 **  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
00013 **  more details.
00014 **
00015 **  You should have received a copy of the GNU General Public License
00016 **  along with this program. If not, see <http://www.gnu.org/licenses/>.
00017 **
00018 **  See http://www.geopsy.org for more information.
00019 **
00020 **  Created : 2008-09-14
00021 **  Authors:
00022 **    Marc Wathelet
00023 **    Marc Wathelet (LGIT, Grenoble, France)
00024 **
00025 ***************************************************************************/
00026 
00027 #ifndef MAPPROJECT_H
00028 #define MAPPROJECT_H
00029 
00030 #include <QtGui>
00031 
00032 #include <QGpCoreTools.h>
00033 
00034 #include "DrawScene.h"
00035 
00036 class MapView;
00037 
00038 class MapProject : public QObject, public XMLClass
00039 {
00040   Q_OBJECT
00041   Q_PROPERTY(QString script READ script WRITE setScript SCRIPTABLE true)
00042 public:
00043   MapProject();
00044   ~MapProject();
00045 
00046   virtual const QString& xml_tagName() const {return xmlMapProjectTag;}
00047   static const QString xmlMapProjectTag;
00048 
00049   void setName(const QString& name);
00050   QString name() const {return _name;}
00051   QString fileName() const {return _fileName;}
00052 
00053   bool isModified() const {return _modified;}
00054 
00055   bool open(QString fileName=QString::null);
00056   bool save();
00057   bool saveAs(QString fileName=QString::null);
00058   bool isClosable();
00059 
00060   const QString& script() const {return _script;}
00061   void setScript(const QString& s);
00062 
00063   void addConsoleCommand(const QString& cmd);
00064   void addCommand(const QString& cmd);
00065 
00066   QPointF currentPoint() const {return _scene->currentPoint();}
00067 
00068   void addView(MapView * v);
00069   bool removeView(MapView * v);
00070   int viewCount() const {return _views.count();}
00071   MapView * view(int index) {return _views.at(index);}
00072 
00073   void print(int dpi=300);
00074   void exportImage(QString fileName=QString::null, QString imageFormat=QString::null, int dpi=300);
00075   void print(QPrinter& printer);
00076   QPixmap image(int dpi);
00077 
00078   DrawScene * scene() const {return _scene;}
00079 
00080   static const QString pixelImageFilter;
00081   static const QString vectorialImageFilter;
00082   static const QString allImageFilter;
00083 signals:
00084   void newCommand(const QString& cmd);
00085 protected:
00086   virtual void xml_writeProperties(XML_WRITEPROPERTIES_ARGS) const {qobject_writeProperties(this, this, s, context);}
00087   virtual XMLMember xml_member(XML_MEMBER_ARGS) {return qobject_member(this, tag, attributes, context);}
00088   virtual bool xml_setProperty(XML_SETPROPERTY_ARGS) {return qobject_setProperty(this, memberID, tag, attributes, content, context);}
00089 private:
00090   void setFileName(const QString& fileName);
00091   void setModified(bool m);
00092   void setWindowTitle();
00093 
00094   bool _modified;
00095   QString _script;
00096   DrawScene * _scene;
00097   QList<MapView *> _views;
00098   QString _name;
00099   QString _fileName;
00100 };
00101 
00102 #endif // MAPPROJECT_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines