mapcenterobj.cpp
author insilmaril
Tue May 26 11:24:51 2009 +0000 (2009-05-26)
changeset 774 2f002657dada
parent 767 6d2b32f305f9
permissions -rw-r--r--
added missing new files
insilmaril@406
     1
#include <QDateTime>
insilmaril@0
     2
insilmaril@641
     3
#include "floatimageobj.h"
insilmaril@641
     4
#include "geometry.h"
insilmaril@0
     5
#include "mapcenterobj.h"
insilmaril@0
     6
insilmaril@0
     7
/////////////////////////////////////////////////////////////////
insilmaril@0
     8
// MapCenterObj
insilmaril@0
     9
/////////////////////////////////////////////////////////////////
insilmaril@0
    10
MapCenterObj::MapCenterObj() : BranchObj ()
insilmaril@0
    11
{
insilmaril@0
    12
//    cout << "Const MapCenterObj\n";
insilmaril@0
    13
    init();
insilmaril@0
    14
}
insilmaril@0
    15
insilmaril@408
    16
MapCenterObj::MapCenterObj(QGraphicsScene* s) : BranchObj (s)
insilmaril@0
    17
{
insilmaril@408
    18
//    cout << "Const MapCenterObj   canvas="<<s<<"\n";
insilmaril@0
    19
    init();
insilmaril@0
    20
}
insilmaril@0
    21
insilmaril@0
    22
MapCenterObj::~MapCenterObj() 
insilmaril@0
    23
{
insilmaril@421
    24
//    cout << "Destr MapCenterObj\n";
insilmaril@661
    25
	clear();
insilmaril@0
    26
}	
insilmaril@0
    27
insilmaril@0
    28
void MapCenterObj::clear() 
insilmaril@0
    29
{
insilmaril@0
    30
	BranchObj::clear();
insilmaril@0
    31
}
insilmaril@0
    32
insilmaril@0
    33
void MapCenterObj::init () 
insilmaril@0
    34
{
insilmaril@83
    35
	BranchObj::init();
insilmaril@459
    36
    orientation=LinkableMapObj::UndefinedOrientation;
insilmaril@0
    37
insilmaril@411
    38
	// TODO this should be done in TextObj later...
insilmaril@164
    39
	//QFont font ("Sans Serif,16,-1,5,50,0,0,0,0,0");		
insilmaril@164
    40
	//heading->setFont(font);
insilmaril@773
    41
	//FIXME-2 no treeitem yet:  setDefAttr(MovedBranch); and already in BI::createMapObj ?!?
insilmaril@0
    42
insilmaril@459
    43
	frame->setFrameType (FrameObj::Rectangle);
insilmaril@0
    44
}
insilmaril@0
    45
insilmaril@0
    46
insilmaril@0
    47
void MapCenterObj::updateLink()
insilmaril@0
    48
{
insilmaril@0
    49
	// set childPos to middle of MapCenterObj
insilmaril@169
    50
	childPos.setX( clickBox.topLeft().x() + (int)(clickBox.width())/2 );
insilmaril@169
    51
	childPos.setY( clickBox.topLeft().y() + (int)(clickBox.height())/2 );
insilmaril@0
    52
	parPos=childPos;		
insilmaril@753
    53
	for (int i=0; i<treeItem->branchCount(); ++i)
insilmaril@753
    54
		treeItem->getBranchObjNum(i)->updateLink();
insilmaril@0
    55
}
insilmaril@0
    56
insilmaril@388
    57
void MapCenterObj::updateRelPositions()
insilmaril@388
    58
{
insilmaril@388
    59
	if (repositionRequest) unsetAllRepositionRequests();
insilmaril@388
    60
insilmaril@388
    61
	// update relative Positions of branches and floats
insilmaril@753
    62
	for (int i=0; i<treeItem->branchCount(); ++i)
insilmaril@388
    63
	{
insilmaril@753
    64
		treeItem->getBranchObjNum(i)->setRelPos();
insilmaril@753
    65
		treeItem->getBranchObjNum(i)->setOrientation();
insilmaril@388
    66
	}
insilmaril@388
    67
	
insilmaril@404
    68
	for (int i=0; i<floatimage.size(); ++i)
insilmaril@404
    69
		floatimage.at(i)->setRelPos();
insilmaril@388
    70
insilmaril@388
    71
	if (repositionRequest) reposition();
insilmaril@388
    72
}
insilmaril@388
    73