[Qt-interest] Graphical library design

GZimmermann at t-systems.com GZimmermann at t-systems.com
Thu Jul 30 19:12:49 CEST 2009


Sounds like a beginner's course in C++ ... Since efficency won't be an
issue and you needn't actually draw anything I'd suggest to stick to
standard C++ (it's in your books!). QT is clearly overkill for this
unless you actually want to draw something on the screen.
 
Probably two classes will suffice:
 
class 2dobject
{
    protected:
        unsigned corners;     <-- or, much better, use an stl container,
something like list<pair<int, int> >
 
        //do something interesting here
};
 
If you later need to do so (drawing will probably be the next lesson)
you can use this as a base class and derive specialized classes from
here.
 
 
class 2dobject_group
{
    protected:
        list<2dobject> 2dobj;
 
        //methods
};
 
 
 
 
Regards,
 
Gerrit
 
 
 
 
 
________________________________

Von: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] Im Auftrag von Patric
Gesendet: Donnerstag, 30. Juli 2009 17:07
An: qt-interest at trolltech.com
Betreff: [Qt-interest] Graphical library design


Hey guys :), 
I have a task here. It's about a library, graphical library with
approximately 10 classes and 600 lines of code. No visual rendering is
needed. 
Here it is :  
 
Create an object model library for 2D coordinate space and flexible
representation of geometric shapes. Support the following features: 
-circle, triangle, rectangle, polygon with arbitrary number of vertexes 
-create/destroy a shape 
-store shape coordinates 
-grouping of the shapes i.e. several shapes logically grouped together 

It's the first time I'm doing such a thing, and if I can ask you about
some hints, maybe some design patterns that I should read about and
implement the library that way. 
 
The library has to be written on C++, it's not necessary to be QT. 
 
Thank you in advance. :) 

Best regards, 
Patric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090730/83fe70b5/attachment.html 


More information about the Qt-interest-old mailing list