1.1 --- a/linkablemapobj.cpp Wed Jul 16 10:44:44 2008 +0000
1.2 +++ b/linkablemapobj.cpp Wed Jul 16 10:46:14 2008 +0000
1.3 @@ -1,8 +1,12 @@
1.4 +#include <iostream>
1.5 #include <math.h>
1.6
1.7 #include "linkablemapobj.h"
1.8 #include "branchobj.h"
1.9 -#include "mapeditor.h"
1.10 +#include "mapeditor.h" // FIXME needed?
1.11 +#include "vymmodel.h"
1.12 +
1.13 +using namespace std;
1.14
1.15 /////////////////////////////////////////////////////////////////
1.16 // LinkableMapObj
1.17 @@ -54,6 +58,8 @@
1.18
1.19 void LinkableMapObj::init ()
1.20 {
1.21 + model=NULL;
1.22 +
1.23 depth=-1;
1.24 mapEditor=NULL;
1.25 childObj=NULL;
1.26 @@ -99,6 +105,7 @@
1.27 void LinkableMapObj::copy (LinkableMapObj* other)
1.28 {
1.29 MapObj::copy(other);
1.30 + model=other->model;
1.31 bboxTotal=other->bboxTotal;
1.32 setLinkStyle(other->style);
1.33 setLinkColor (other->linkcolor);
1.34 @@ -107,6 +114,16 @@
1.35 objID=other->objID;
1.36 }
1.37
1.38 +void LinkableMapObj::setModel (VymModel *vm)
1.39 +{
1.40 + model=vm;
1.41 +}
1.42 +
1.43 +VymModel* LinkableMapObj::getModel()
1.44 +{
1.45 + return model;
1.46 +}
1.47 +
1.48 void LinkableMapObj::setChildObj(LinkableMapObj* o)
1.49 {
1.50 childObj=o;
1.51 @@ -116,13 +133,14 @@
1.52 {
1.53 parObj=o;
1.54 mapEditor=parObj->getMapEditor();
1.55 + model=parObj->getModel(); // FIXME makes painting slow, but that's obvious because there are no links to paint, hmmm....
1.56 }
1.57
1.58 -void LinkableMapObj::setParObjTmp(LinkableMapObj*,QPointF,int)
1.59 +void LinkableMapObj::setParObjTmp(LinkableMapObj*,QPointF,int) // FIXME make pure virtual
1.60 {
1.61 }
1.62
1.63 -void LinkableMapObj::unsetParObjTmp()
1.64 +void LinkableMapObj::unsetParObjTmp() // FIXME make pure virtual
1.65 {
1.66 }
1.67
1.68 @@ -180,8 +198,12 @@
1.69
1.70 LinkableMapObj::Style LinkableMapObj::getDefLinkStyle ()
1.71 {
1.72 - if (!mapEditor) return UndefinedStyle;
1.73 - Style ls=mapEditor->getMapLinkStyle();
1.74 + if (!model)
1.75 + {
1.76 + qWarning ("LMO::getDefLinkStyle model=NULL");
1.77 + return UndefinedStyle;
1.78 + }
1.79 + Style ls=model->getMapLinkStyle();
1.80 switch (ls)
1.81 {
1.82 case Line:
1.83 @@ -309,10 +331,10 @@
1.84
1.85 void LinkableMapObj::setLinkColor()
1.86 {
1.87 - // Overloaded in BranchObj and childs
1.88 + // Overloaded in BranchObj and children
1.89 // here only set default color
1.90 - if (mapEditor)
1.91 - setLinkColor (mapEditor->getMapDefLinkColor());
1.92 + if (model)
1.93 + setLinkColor (model->getMapDefLinkColor());
1.94 }
1.95
1.96 void LinkableMapObj::setLinkColor(QColor col)
1.97 @@ -606,6 +628,7 @@
1.98 void LinkableMapObj::setMapEditor (MapEditor *me)
1.99 {
1.100 mapEditor=me;
1.101 + model=mapEditor->getModel();
1.102 }
1.103
1.104 MapEditor* LinkableMapObj::getMapEditor ()
1.105 @@ -646,7 +669,7 @@
1.106 // we want to block expensive repositioning, but just do it once at
1.107 // the end, thus check first:
1.108
1.109 - if (mapEditor->isRepositionBlocked()) return;
1.110 + if (mapEditor->getModel()->isRepositionBlocked()) return; // FIXME better go to model directly, maybe via a signal
1.111
1.112 // Pass on the request to parental objects, if this hasn't been done yet
1.113