started doxygen documentation
authorinsilmaril
Wed, 25 Apr 2007 16:02:54 +0000
changeset 47080ae7b79828c
parent 469 e21e3b8c312c
child 471 9c26d66d4c53
started doxygen documentation
floatobj.cpp
floatobj.h
frameobj.cpp
frameobj.h
     1.1 --- a/floatobj.cpp	Wed Apr 25 16:02:54 2007 +0000
     1.2 +++ b/floatobj.cpp	Wed Apr 25 16:02:54 2007 +0000
     1.3 @@ -40,7 +40,7 @@
     1.4      setChildObj(this);
     1.5  	floatExport=true;
     1.6  	zPlane=Z_ICON;
     1.7 -	setLinkStyle (StyleParabel);
     1.8 +	setLinkStyle (LinkableMapObj::Parabel);
     1.9  	setHideLinkUnselected(true);
    1.10  }
    1.11  
     2.1 --- a/floatobj.h	Wed Apr 25 16:02:54 2007 +0000
     2.2 +++ b/floatobj.h	Wed Apr 25 16:02:54 2007 +0000
     2.3 @@ -3,6 +3,9 @@
     2.4  
     2.5  #include "ornamentedobj.h"
     2.6  
     2.7 +/*! \brief Base class for objects floating in the map, which means they can be positioned freely. */
     2.8 +
     2.9 +
    2.10  /////////////////////////////////////////////////////////////////////////////
    2.11  class FloatObj:public OrnamentedObj {
    2.12  public:
     3.1 --- a/frameobj.cpp	Wed Apr 25 16:02:54 2007 +0000
     3.2 +++ b/frameobj.cpp	Wed Apr 25 16:02:54 2007 +0000
     3.3 @@ -25,7 +25,8 @@
     3.4  void FrameObj::init()
     3.5  {
     3.6      type=NoFrame;
     3.7 -    border=0;
     3.8 +    padding=10;
     3.9 +	borderWidth=1;
    3.10  	penColor=QColor (Qt::black);
    3.11  	brushColor=QColor (Qt::white);
    3.12  }
    3.13 @@ -44,7 +45,7 @@
    3.14  			break;
    3.15      }
    3.16  	type=NoFrame;
    3.17 -	border=0;
    3.18 +	padding=0;
    3.19  }
    3.20  
    3.21  void FrameObj::move(double x, double y)
    3.22 @@ -93,12 +94,32 @@
    3.23      }
    3.24  }
    3.25  
    3.26 -int FrameObj::getBorder()
    3.27 +void FrameObj::setPadding (const int &i)
    3.28  {
    3.29 -	return border;
    3.30 +	padding=i;
    3.31 +	repaint();
    3.32  }
    3.33  
    3.34 -FrameType FrameObj::getFrameType()
    3.35 +int FrameObj::getPadding()
    3.36 +{
    3.37 +	if (type==NoFrame) 
    3.38 +		return 0;
    3.39 +	else	
    3.40 +		return padding;
    3.41 +}
    3.42 +
    3.43 +void FrameObj::setBorderWidth (const int &i)
    3.44 +{
    3.45 +	borderWidth=i;
    3.46 +	repaint();
    3.47 +}
    3.48 +
    3.49 +int FrameObj::getBorderWidth()
    3.50 +{
    3.51 +	return borderWidth;
    3.52 +}
    3.53 +
    3.54 +FrameObj::FrameType FrameObj::getFrameType()
    3.55  {
    3.56  	return type;
    3.57  }
    3.58 @@ -127,16 +148,13 @@
    3.59  		switch (type)
    3.60  		{
    3.61  			case NoFrame:
    3.62 -				border=0;
    3.63  				break;
    3.64  			case Rectangle:
    3.65 -				border=10;
    3.66  				rectFrame = scene->addRect(QRectF(0,0,0,0), QPen(penColor), brushColor);
    3.67  				rectFrame->setZValue(Z_FRAME);
    3.68  				rectFrame->show();
    3.69  				break;
    3.70  			case Ellipse:
    3.71 -				border=10;
    3.72  				ellipseFrame = scene->addEllipse(QRectF(0,0,0,0), QPen(penColor), brushColor);
    3.73  				ellipseFrame->setZValue(Z_FRAME);
    3.74  				ellipseFrame->show();
    3.75 @@ -180,15 +198,19 @@
    3.76  
    3.77  void FrameObj::repaint()
    3.78  {
    3.79 +	QPen pen;
    3.80 +	pen.setColor (penColor);
    3.81 +	pen.setWidth (borderWidth);
    3.82 +	QBrush brush (brushColor);
    3.83  	switch (type)
    3.84  	{
    3.85  		case Rectangle:
    3.86 -			rectFrame->setPen   (penColor);
    3.87 -			rectFrame->setBrush (brushColor);
    3.88 +			rectFrame->setPen   (pen);
    3.89 +			rectFrame->setBrush (brush);
    3.90  			break;
    3.91  		case Ellipse:
    3.92 -			ellipseFrame->setPen   (penColor);
    3.93 -			ellipseFrame->setBrush (brushColor);
    3.94 +			ellipseFrame->setPen   (pen);
    3.95 +			ellipseFrame->setBrush (brush);
    3.96  			break;
    3.97  		default:
    3.98  			break;
    3.99 @@ -220,9 +242,17 @@
   3.100  
   3.101  QString FrameObj::saveToDir ()
   3.102  {
   3.103 +	if (type==NoFrame) return QString();
   3.104  	QString	frameTypeAttr=attribut ("frameType",getFrameTypeName());
   3.105  	QString	penColAttr=attribut ("penColor",penColor.name() );
   3.106  	QString	brushColAttr=attribut ("brushColor",brushColor.name() );
   3.107 -	return singleElement ("frame",frameTypeAttr + penColAttr + brushColAttr);
   3.108 +	QString	paddingAttr=attribut ("padding",QString::number (padding) );
   3.109 +	QString	borderWidthAttr=attribut ("borderWidth",QString::number (borderWidth) );
   3.110 +	return singleElement (
   3.111 +		"frame",frameTypeAttr + 
   3.112 +		penColAttr + 
   3.113 +		brushColAttr +
   3.114 +		paddingAttr +
   3.115 +		borderWidthAttr);
   3.116  }
   3.117  
     4.1 --- a/frameobj.h	Wed Apr 25 16:02:54 2007 +0000
     4.2 +++ b/frameobj.h	Wed Apr 25 16:02:54 2007 +0000
     4.3 @@ -3,10 +3,16 @@
     4.4  
     4.5  #include "mapobj.h"
     4.6  
     4.7 -enum FrameType {NoFrame,Rectangle,Ellipse};
     4.8 +
     4.9 +/*! \brief This class adds a frame to a MapObj. 
    4.10 +*/
    4.11  
    4.12  class FrameObj:public MapObj {
    4.13  public:
    4.14 +
    4.15 +	/*! \brief Supported frame types */
    4.16 +	enum FrameType {NoFrame,Rectangle,Ellipse};
    4.17 +
    4.18      FrameObj();
    4.19      FrameObj(QGraphicsScene*);
    4.20      ~FrameObj();
    4.21 @@ -17,7 +23,10 @@
    4.22  	void positionBBox();			 
    4.23  	void calcBBoxSize();			
    4.24  	void setRect (const QRectF &);	  // set dimensions			
    4.25 -    int getBorder();
    4.26 +    void setPadding(const int &);
    4.27 +    int getPadding();
    4.28 +    void setBorderWidth (const int &);
    4.29 +    int getBorderWidth ();
    4.30      FrameType getFrameType ();
    4.31      QString getFrameTypeName ();
    4.32      void setFrameType (const FrameType &);
    4.33 @@ -31,10 +40,11 @@
    4.34  	QString saveToDir ();
    4.35  
    4.36  private:
    4.37 -    FrameType type;
    4.38 +    FrameType type;			//!< Frame type
    4.39      QGraphicsRectItem * rectFrame;
    4.40      QGraphicsEllipseItem * ellipseFrame;
    4.41 -    int border;									// distance text - frame
    4.42 +    int padding;					// distance text - frame
    4.43 +	int borderWidth;
    4.44  	QColor penColor;
    4.45  	QColor brushColor;
    4.46  };