Layer Class Reference

To hold the configuration of a single layer in a view mode ( ViewMode ). It knows its height and which features that should be painted in this layer. More...

#include <viewmode.h>

Collaboration diagram for Layer:

Collaboration graph
[legend]
List of all members.

Public Types

typedef QPtrList< Database::SecondaryIterator<
SpatialFeatureData > > 
FeatureList

Public Member Functions

 Layer (const QDomElement &elem, SecItDict &)
 ~Layer ()
TR_PIX heightInPix (TR_PIX totalheight)

Public Attributes

bool allowOverlap
int height
FeatureList featureList

Detailed Description

To hold the configuration of a single layer in a view mode ( ViewMode ). It knows its height and which features that should be painted in this layer.

Definition at line 36 of file viewmode.h.


Member Typedef Documentation

typedef QPtrList< Database::SecondaryIterator<SpatialFeatureData> > Layer::FeatureList

Definition at line 43 of file viewmode.h.


Constructor & Destructor Documentation

Layer::Layer ( const QDomElement elem,
SecItDict  
)

Definition at line 26 of file viewmode.cpp.

References QDomElement::attribute(), featureList, height, QDomNode::isElement(), QDomNode::isNull(), QDomNode::nextSibling(), QDomNode::nodeName(), QPtrList::prepend(), QPtrList::setAutoDelete(), QDomNode::toElement(), QString::toInt(), and QMessageBox::warning().

00027 {
00028 //     cerr << "in layer ctor" << endl;
00029     featureList.setAutoDelete( true );
00030 
00031     QString heightStr = elem.attribute( "height","");
00032     height = heightStr.toInt();
00033 //     cerr << "height in Layer ctor = " << height << endl;
00034     QDomNode node = elem.firstChild();
00035     while ( !node.isNull() )
00036     {
00037         if ( node.isElement() && node.nodeName() == "feature" )
00038         {
00039             QDomElement featureElem = node.toElement();
00040             //featureName = "features/";
00041             //            std::string featureName = std::string(featureElem.attribute("name","").ascii() );
00042             QString featureName = featureElem.attribute("name","");
00043             //  GeneralData * dummy = GeneralMaker::newData( featureName );
00044 //             cerr << "feature=" << featureName << endl;
00045 
00046             Database::SecondaryIterator<SpatialFeatureData> * it = secItDict[featureName];
00047             if ( it )
00048             {
00049                 featureList.prepend( it );
00050             }
00051             else
00052             {
00053                 QMessageBox::warning(
00054                     NULL, "Unknown feature specified",
00055                     QString( "The feature \n\'%1\' specified in configuration file\n is not of unknown type." ).
00056                     arg( featureName ),
00057                     "&Ok"  );
00058             }
00059         }
00060         node = node.nextSibling();
00061     }
00062 }

Layer::~Layer (  )  [inline]

Definition at line 40 of file viewmode.h.

00041     {}


Member Function Documentation

TR_PIX Layer::heightInPix ( TR_PIX  totalheight  ) 

Definition at line 64 of file viewmode.cpp.

References height, and TR_PIX.

Referenced by TrapperView::paintFeatures().

00065 {
00066     //  cerr <<"totalheight="<<totalHeight<< endl;
00067     // cerr <<"height="<<height<< endl;
00068     TR_PIX res = ( int ) (( height * totalHeight )/ 100 );
00069     // cerr <<"res="<<res<<endl;
00070     return res;
00071 }


Member Data Documentation

bool Layer::allowOverlap

Definition at line 44 of file viewmode.h.

int Layer::height

Definition at line 45 of file viewmode.h.

Referenced by heightInPix(), and Layer().

FeatureList Layer::featureList

Definition at line 46 of file viewmode.h.

Referenced by Layer(), and TrapperView::paintFeatures().


The documentation for this class was generated from the following files:
Generated on Fri Jul 17 20:19:49 2009 for ngsview by  doxygen 1.5.1