[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-kuml-devel
Subject:    More details on the label design
From:       Darius Stachow <dstachow () ngi ! de>
Date:       2000-07-20 14:58:14
[Download RAW message or body]

Hi Keith,

I am sorry for my late mail but when I start coding it's not easy for me to 
stop myself from doing ;-)

I have written some comments in the class LabelLayouterA1 (labellayoutera1.h). 
 
I hope they will show you how the label layouter classes should work. 

You just have to call a label layouter with a SwitchLine object as parameter 
and than the layouter class should do the rest and find the correct layout 
(or paint) algorithm for the specific line type.

I don't know if you have decided where to store the label layouter objects 
but I think you may store them directly in the StepLine object. When if the 
position of the line changes (by calling setStartPoint() for instance) all 
stored label layouter are called to adjust the DrawingLabel objects. 

In my design every label layouter was associated with a DrawingLabel object. 
The DrawingLabel object was the graphical representation for the label text 
in the editor and a called label layouter just changed the position of the 
label view. The label view could be moved and resized just like all other 
rectangular views in kuml.

As far as I have understood your approach you are not layouting/repositioning 
a graphical editor object but paint directly what makes it possible to draw 
angled text.
In this case you have to call within the drawItem() method of SwitchLine the 
paint (operate) method for each stored label layouter object.
Hmm, to paint something you need of course a painter but in the operate 
method it will not be provided as input parameter.
I am not sure how to obtain it. You are getting a pointer to the view 
controller object. But this may be enough to create a temporarly QPainter and 
than you could paint within the operate methods.


// Your approach: paint the labels within the paint event
void SwitchLine::drawItem(QPainter *p) {
 while(iterLayouter)
  iterLayouter->operate(this);
  iterLayouter++;
 }
}

// My approach: Call the label layouter to reposition the connected 
graphical label text objects [DrawingLabel]
void SwitchLine::setStartPoint(x, y) {
 while(iterLayouter)
  iterLayouter->operate(this);
  iterLayouter++;
 }
}



-----------------------------------------------------------------
Darius Stachow          e-mail  dstachow@ngi.de
Borgfelder Str. 16              stacho_d@informatik.fh-hamburg.de
20537 Hamburg
Germany
Bite my shiny metal ass

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic