Source: k2dgrflow/k2ddomain.h
|
|
|
|
/***************************************************************************
k2ddomain.h - description
-------------------
begin : Mon Apr 30 2001
copyright : (C) 2001 by benny
email : bm@cage.rug.ac.be
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef K2DDOMAIN_H
#define K2DDOMAIN_H
//QT includes
#include <qtextstream.h>
#include <qlist.h>
// application specific includes
#include "k2dborderbase.h"
/** DomainType is the datatype we use, a list of borderbases
*/
typedef QList<K2dBorderBase> DomainType;
/**Representation of the domain. Contains a list of borders.
*@author benny
*/
class K2dDomain {
public:
/** Construction of a domain. Is a list with autodelete TRUE, since a border should be only added
once, and has no meaning outside the domain */
K2dDomain();
~K2dDomain();
/** Add a border item at postition index (range 0..nrOfBorders()-1 )
Since BorderBase is abstract, children have to be added */
bool addBorder(uint index, const K2dBorderBase* item ){return domain.insert(index, item); };
/** Remove border at position index
*/
bool removeBorder(uint index){return domain.remove(index); };
/** Append a border item at the end of the domain
*/
void appendBorder(const K2dBorderBase* item){domain.append(item); };
/** Returns true if the border is closed, false if not closed
*/
bool closed();
/** draw on a painter the domain (= the borders), meshed or not
*/
void draw(QPainter* , bool meshed = false );
/** write the domain to a textstream as required by the EasyMesh programm
*/
void EasyMeshFile(QTextStream &cout);
/** Return a listinterator over the borders in the domain
*/
QListIterator<K2dBorderBase> iterator();
/** Return the min or maximum of a certain coordinate over the total domain.
with this, you can draw a rectangle around the domain */
double minCo(uint coord);
double maxCo(uint coord);
/** Returns the number of Borders in the domain
*/
uint nrOfBorders(){return domain.count(); };
/** Return the number of points we represent the borders with
*/
uint nrOfPoints();
/** Return the number of segments we represent the borders with
*/
uint nrOfSegments();
/** Return a pointer to the border at postition index. Beware that
you will actually have children of BorderBase returned to you */
K2dBorderBase* border(uint index){return domain.at(index) ; };
/** We need the possibility to make a deep copy of the domain
*/
K2dDomain copy() const;
/** Related Function : write a domain to the ouputstream in a nice text format.
*/
friend QTextStream &operator<<( QTextStream &, K2dDomain const & );
private:
/** The data is kept in a Qlist of BorderBases
*/
DomainType domain;
};
#endif
Generated by: benny@okidoki on Thu Jun 21 10:41:51 2001, using kdoc 2.0a53. |