#include <OSGQFieldLabelFactory.h>
Public Types | |
| typedef QFieldValueLabelBase *(* | LabelCreateF )(QFieldViewBase *, UInt32) |
Public Member Functions | |
| ~QFieldLabelFactory (void) | |
| bool | registerLabel (const std::string &strFieldContentsName, LabelCreateF labelCreateFunc) |
| bool | registerDefaultLabel (const std::string &strFieldContentsName, LabelCreateF labelCreateFunc) |
| QFieldValueLabelBase * | createLabel (QFieldViewBase *pView, UInt32 uiIndex) |
Static Public Member Functions | |
| static QFieldLabelFactory & | the () |
Private Types | |
| typedef std::map< std::string, LabelCreateF > | LabelMap |
| typedef std::map< std::string, LabelCreateF >::iterator | LabelMapIt |
Private Member Functions | |
| QFieldLabelFactory (void) | |
Private Attributes | |
| LabelMap | _labelMap |
| LabelCreateF | _defaultLabelCreateFunc |
Static Private Attributes | |
| static QFieldLabelFactory * | _the = 0 |
Definition at line 59 of file OSGQFieldLabelFactory.h.
typedef std::map<std::string, LabelCreateF> osg::QFieldLabelFactory::LabelMap [private] |
Definition at line 76 of file OSGQFieldLabelFactory.h.
typedef std::map<std::string, LabelCreateF>::iterator osg::QFieldLabelFactory::LabelMapIt [private] |
Definition at line 77 of file OSGQFieldLabelFactory.h.
| QFieldLabelFactory::~QFieldLabelFactory | ( | void | ) |
| QFieldLabelFactory::QFieldLabelFactory | ( | void | ) | [private] |
Definition at line 104 of file OSGQFieldLabelFactory.cpp.
00105 : _labelMap ( ), 00106 _defaultLabelCreateFunc(&QGenericFieldValueLabel::create) 00107 { 00108 }
| QFieldLabelFactory & QFieldLabelFactory::the | ( | void | ) | [static] |
Definition at line 69 of file OSGQFieldLabelFactory.cpp.
References _the.
Referenced by osg::QMFieldView::acquireLabel(), osg::QSFieldView::initSelf(), osg::QLabelRegisterWrapper< FieldLabelType >::QLabelRegisterWrapper(), and osg::QMFieldView::sizeHint().
00070 { 00071 if(!_the) 00072 _the = new QFieldLabelFactory; 00073 00074 return *_the; 00075 }
| bool QFieldLabelFactory::registerLabel | ( | const std::string & | strFieldContentsName, | |
| LabelCreateF | labelCreateFunc | |||
| ) |
Definition at line 78 of file OSGQFieldLabelFactory.cpp.
References _labelMap.
Referenced by osg::QLabelRegisterWrapper< FieldLabelType >::QLabelRegisterWrapper().
00080 { 00081 _labelMap[strFieldContentName] = labelCreateFunc; 00082 00083 return true; 00084 }
| bool osg::QFieldLabelFactory::registerDefaultLabel | ( | const std::string & | strFieldContentsName, | |
| LabelCreateF | labelCreateFunc | |||
| ) |
| QFieldValueLabelBase * QFieldLabelFactory::createLabel | ( | QFieldViewBase * | pView, | |
| UInt32 | uiIndex | |||
| ) |
Definition at line 87 of file OSGQFieldLabelFactory.cpp.
References _defaultLabelCreateFunc, _labelMap, osg::TypeBase::getCName(), osg::Field::getContentType(), and osg::QFieldViewBase::getFieldPtr().
Referenced by osg::QMFieldView::acquireLabel(), osg::QSFieldView::initSelf(), and osg::QMFieldView::sizeHint().
00088 { 00089 const Char8 *szContentTypeName = 00090 pView->getFieldPtr()->getContentType().getCName(); 00091 00092 LabelMapIt iter = _labelMap.find(szContentTypeName); 00093 00094 if(iter != _labelMap.end()) 00095 { 00096 return (*iter).second(pView, uiIndex); 00097 } 00098 else 00099 { 00100 return _defaultLabelCreateFunc(pView, uiIndex); 00101 } 00102 }
QFieldLabelFactory * QFieldLabelFactory::_the = 0 [static, private] |
LabelMap osg::QFieldLabelFactory::_labelMap [private] |
Definition at line 83 of file OSGQFieldLabelFactory.h.
Referenced by createLabel(), and registerLabel().
1.5.5