@@ -102,6 +102,8 @@ class Rendering extends Component {
102
102
objSensorsToRender : [ this . defaultSensor . Object ] ,
103
103
laneSensorsToRender : [ this . defaultSensor . Lane ]
104
104
} ;
105
+ this . currentLabelIndex = 0 ;
106
+ this . labelAttributes = [ [ "id" , "prob" ] , [ "class" , "type" ] , "transl" ] ;
105
107
}
106
108
107
109
render ( ) {
@@ -158,6 +160,7 @@ class Rendering extends Component {
158
160
( ) => this . setState ( { renderLabels : ! renderLabels } ) ,
159
161
renderLabels
160
162
) }
163
+ { this . renderLabelAttributes ( renderLabels ) }
161
164
{ this . renderToggleSwitch ( "Axes" , ( ) => this . toggleHelperAxes ( ) , helperAxesVisible ) }
162
165
{ this . renderToggleSwitch ( "Grid" , ( ) => this . toggleGrid ( ) , gridVisible ) }
163
166
< div className = { gridVisible ? "" : "d-none" } >
@@ -221,6 +224,29 @@ class Rendering extends Component {
221
224
) ;
222
225
} ;
223
226
227
+ renderLabelAttributes = ( renderLabels ) => {
228
+ if ( renderLabels ) {
229
+ return (
230
+ < React . Fragment >
231
+ < div
232
+ className = "menu-switch"
233
+ onClick = { ( ) => this . switchLabelAttributes ( this . currentLabelIndex ++ ) }
234
+ >
235
+ < small className = "mr-2 ml-2 mb-1" > switch Attributes</ small >
236
+ </ div >
237
+ </ React . Fragment >
238
+ ) ;
239
+ } else {
240
+ return < React . Fragment > </ React . Fragment > ;
241
+ }
242
+ } ;
243
+
244
+ switchLabelAttributes = ( index ) => {
245
+ if ( index === this . labelAttributes . length - 1 ) {
246
+ this . currentLabelIndex = 0 ;
247
+ }
248
+ } ;
249
+
224
250
renderSensorSelect = ( sensorType , selectSensors ) => {
225
251
let colors ;
226
252
let defaultColors ;
@@ -718,7 +744,19 @@ class Rendering extends Component {
718
744
if ( object . exist_prob !== undefined ) {
719
745
existProb = object . exist_prob ;
720
746
}
721
- return `ID: ${ object . id } \n Prob.: ${ existProb . toFixed ( 2 ) } ` ;
747
+ let pose = object . pose || 0 ;
748
+ let translation = pose . translation || 0 ;
749
+ let transX = translation . x || 0 ;
750
+ switch ( this . currentLabelIndex ) {
751
+ case 0 :
752
+ return `ID: ${ object . id } \n Prob.: ${ existProb . toFixed ( 2 ) } ` ;
753
+ case 1 :
754
+ return `Class: ${ object . class } \n Type: ${ object . type } ` ;
755
+ case 2 :
756
+ return `Transl.: \n X: ${ transX . toFixed ( 3 ) || translation } ` ;
757
+ default :
758
+ break ;
759
+ }
722
760
} ;
723
761
724
762
createDefaultLabel = ( text , color ) => {
0 commit comments