@@ -73,7 +73,7 @@ namespace mars {
73
73
map = ConfigMap::fromYamlFile (" Text3DConfig.yml" , true );
74
74
ConfigVector::iterator it;
75
75
osg_text::TextInterface *text;
76
- if (map.find (" Labels" ) != map. end ( )) {
76
+ if (map.hasKey (" Labels" )) {
77
77
TextData *td;
78
78
double fixedWidth, fixedHeight;
79
79
bool drawFrame;
@@ -82,50 +82,50 @@ namespace mars {
82
82
83
83
for (it = map[" Labels" ].begin (); it!=map[" Labels" ].end (); ++it) {
84
84
td = new TextData;
85
- td->name = (std::string)it-> children [" name" ][ 0 ];
86
- td->value = (std::string)it-> children [" value" ][ 0 ];
87
- td->posX = it-> children [" posX" ][ 0 ];
88
- td->posY = it-> children [" posY" ][ 0 ];
85
+ td->name = (std::string)(*it) [" name" ];
86
+ td->value = (std::string)(*it) [" value" ];
87
+ td->posX = (*it) [" posX" ];
88
+ td->posY = (*it) [" posY" ];
89
89
fixedWidth = fixedHeight = -1 ;
90
90
drawFrame = false ;
91
91
fontsize = 30 ;
92
92
align = osg_text::ALIGN_LEFT;
93
93
osg_text::Color c, bgColor (0.0 , 0.5 , 0.0 , 0.5 );
94
94
osg_text::Color borderColor (1.0 , 1.0 , 1.0 , 0.5 );
95
- if (it->children . find (" fixedWidth" ) != it-> children . end ( )) {
96
- fixedWidth = it-> children [" fixedWidth" ][ 0 ];
95
+ if (it->hasKey (" fixedWidth" )) {
96
+ fixedWidth = (*it) [" fixedWidth" ];
97
97
}
98
- if (it->children . find (" fixedHeight" ) != it-> children . end ( )) {
99
- fixedHeight = it-> children [" fixedHeight" ][ 0 ];
98
+ if (it->hasKey (" fixedHeight" )) {
99
+ fixedHeight = (*it) [" fixedHeight" ];
100
100
}
101
- if (it->children . find (" frame" ) != it-> children . end ( )) {
102
- drawFrame = it-> children [" frame" ][ 0 ];
101
+ if (it->hasKey (" frame" )) {
102
+ drawFrame = (*it) [" frame" ];
103
103
}
104
- if (it->children . find (" fontsize" ) != it-> children . end ( )) {
105
- fontsize = it-> children [" fontsize" ][ 0 ];
104
+ if (it->hasKey (" fontsize" )) {
105
+ fontsize = (*it) [" fontsize" ];
106
106
}
107
- if (it->children . find (" align" ) != it-> children . end ( )) {
108
- std::string sAlign = (std::string)it-> children [" align" ][ 0 ];
107
+ if (it->hasKey (" align" )) {
108
+ std::string sAlign = (std::string)(*it) [" align" ];
109
109
if (sAlign == " right" ) align = osg_text::ALIGN_RIGHT;
110
110
else if (sAlign == " center" ) align = osg_text::ALIGN_CENTER;
111
111
}
112
- if (it->children . find (" color" ) != it-> children . end ( )) {
113
- c.a = it-> children [" color" ][0 ][ " a" ][ 0 ];
114
- c.r = it-> children [" color" ][0 ][ " r" ][ 0 ];
115
- c.g = it-> children [" color" ][0 ][ " g" ][ 0 ];
116
- c.b = it-> children [" color" ][0 ][ " b" ][ 0 ];
112
+ if (it->hasKey (" color" )) {
113
+ c.a = (*it) [" color" ][" a" ];
114
+ c.r = (*it) [" color" ][" r" ];
115
+ c.g = (*it) [" color" ][" g" ];
116
+ c.b = (*it) [" color" ][" b" ];
117
117
}
118
- if (it->children . find (" bgColor" ) != it-> children . end ( )) {
119
- bgColor.a = it-> children [" bgColor" ][0 ][ " a" ][ 0 ];
120
- bgColor.r = it-> children [" bgColor" ][0 ][ " r" ][ 0 ];
121
- bgColor.g = it-> children [" bgColor" ][0 ][ " g" ][ 0 ];
122
- bgColor.b = it-> children [" bgColor" ][0 ][ " b" ][ 0 ];
118
+ if (it->hasKey (" bgColor" )) {
119
+ bgColor.a = (*it) [" bgColor" ][" a" ];
120
+ bgColor.r = (*it) [" bgColor" ][" r" ];
121
+ bgColor.g = (*it) [" bgColor" ][" g" ];
122
+ bgColor.b = (*it) [" bgColor" ][" b" ];
123
123
}
124
- if (it->children . find (" borderColor" ) != it-> children . end ( )) {
125
- borderColor.a = it-> children [" borderColor" ][0 ][ " a" ][ 0 ];
126
- borderColor.r = it-> children [" borderColor" ][0 ][ " r" ][ 0 ];
127
- borderColor.g = it-> children [" borderColor" ][0 ][ " g" ][ 0 ];
128
- borderColor.b = it-> children [" borderColor" ][0 ][ " b" ][ 0 ];
124
+ if (it->hasKey (" borderColor" )) {
125
+ borderColor.a = (*it) [" borderColor" ][" a" ];
126
+ borderColor.r = (*it) [" borderColor" ][" r" ];
127
+ borderColor.g = (*it) [" borderColor" ][" g" ];
128
+ borderColor.b = (*it) [" borderColor" ][" b" ];
129
129
}
130
130
td->text = textFactory->createText (td->value , fontsize,
131
131
c, td->posX , td->posY , align);
@@ -154,7 +154,7 @@ namespace mars {
154
154
td->name +" /posY" ,
155
155
td->posY , this );
156
156
td->pyId = example.paramId ;
157
- int mask = it-> children [" mask" ][ 0 ]. getInt () ;
157
+ int mask = (*it) [" mask" ];
158
158
example = control->cfg ->getOrCreateProperty (" Text3D" ,
159
159
td->name +" /mask" ,
160
160
mask, this );
0 commit comments