vymmodel.h
author insilmaril
Mon May 05 13:46:42 2008 +0000 (2008-05-05)
changeset 689 c7b1178aec77
parent 665 a7db20d79c32
child 696 0c2d74acf035
permissions -rw-r--r--
Some code cleanup and experimental stuff to support animations later
insilmaril@650
     1
#ifndef VYMMODEL_H
insilmaril@650
     2
#define VYMMODEL_H
insilmaril@650
     3
insilmaril@650
     4
#include <QGraphicsScene>
insilmaril@650
     5
insilmaril@650
     6
#include "mapcenterobj.h"
insilmaril@650
     7
#include "mapeditor.h"
insilmaril@650
     8
insilmaril@650
     9
insilmaril@650
    10
/*! \brief This will later be divided into Model/View
insilmaril@650
    11
*/
insilmaril@650
    12
insilmaril@650
    13
class VymModel{
insilmaril@650
    14
public:
insilmaril@650
    15
	VymModel();
insilmaril@650
    16
	~VymModel ();
insilmaril@650
    17
    void clear();
insilmaril@650
    18
    void init();
insilmaril@650
    19
	void setMapEditor(MapEditor *me);	// FIXME should not be necessary in Model/View
insilmaril@650
    20
	MapEditor* getMapEditor();
insilmaril@650
    21
	void setVersion(const  QString &);
insilmaril@650
    22
	void setAuthor  (const QString &);
insilmaril@650
    23
	QString getAuthor ();
insilmaril@650
    24
	void setComment (const QString &);
insilmaril@650
    25
	QString getComment ();
insilmaril@650
    26
	QString getDate();
insilmaril@650
    27
	void setScene(QGraphicsScene *s);
insilmaril@650
    28
	QGraphicsScene *getScene();
insilmaril@650
    29
	MapCenterObj* addMapCenter();
insilmaril@684
    30
	MapCenterObj* addMapCenter(QPointF absPos);
insilmaril@650
    31
	MapCenterObj* removeMapCenter(MapCenterObj *mco);
insilmaril@652
    32
insilmaril@650
    33
	BranchObj* first();					// FIXME replaced by ModelIndex later
insilmaril@650
    34
	BranchObj* next(BranchObj *bo);		// FIXME replaced by ModelIndex later
insilmaril@650
    35
insilmaril@652
    36
    LinkableMapObj* findMapObj(QPointF,LinkableMapObj*);	// find MapObj 
insilmaril@652
    37
    LinkableMapObj* findObjBySelect (const QString &s);		// find MapObj by select string
insilmaril@652
    38
    LinkableMapObj* findID (const QString &s);				// find MapObj by previously set ID
insilmaril@652
    39
	QString saveToDir (const QString&,const QString&,int, const QPointF&);// Save data recursivly to tempdir
insilmaril@652
    40
insilmaril@652
    41
insilmaril@652
    42
////////////////////////////////////////// View related
insilmaril@652
    43
    // void updateLink();  FIXME needed?
insilmaril@650
    44
    void updateRelPositions();
insilmaril@650
    45
insilmaril@650
    46
	QRectF getTotalBBox();
insilmaril@650
    47
	void reposition();					//!< Call reposition for all MCOs
insilmaril@650
    48
	void setHideTmp (HideTmpMode mode);	
insilmaril@665
    49
	QPolygonF shape(BranchObj *bo);		//!< Returns arbitrary shape of subtree
insilmaril@665
    50
	void moveAway (LinkableMapObj *lmo);//!< Autolayout: Move all out of the way
insilmaril@652
    51
insilmaril@652
    52
////////////////////////////////////////// Selection related 
insilmaril@652
    53
	LinkableMapObj* getSelection();
insilmaril@652
    54
	BranchObj* getSelectedBranch();
insilmaril@652
    55
	bool select (const QString &s);
insilmaril@652
    56
	QString getSelectString (LinkableMapObj *lmo);
insilmaril@652
    57
insilmaril@650
    58
private:
insilmaril@650
    59
	QGraphicsScene *mapScene;
insilmaril@650
    60
	MapEditor *mapEditor;
insilmaril@650
    61
	QList <MapCenterObj*> mapCenters;
insilmaril@650
    62
	QString version;	//!< version string saved in vym file
insilmaril@650
    63
	QString author;
insilmaril@650
    64
	QString comment;
insilmaril@650
    65
	QDate date;
insilmaril@650
    66
};
insilmaril@650
    67
insilmaril@650
    68
insilmaril@650
    69
#endif