~charon-developers/charon-utils/trunk

« back to all changes in this revision

Viewing changes to include/charon-utils/Annotation.hxx

  • Committer: Moritz Becker
  • Date: 2014-07-22 17:54:09 UTC
  • Revision ID: moritz.becker@pallas-ludens.com-20140722175409-qwxsbirwwzsgnfwo
Plugin AnnotationFinalizer to evaluate annotation results.

Show diffs side-by-side

added added

removed removed

Lines of Context:
230
230
                                it->second.annotationIds.push_back( _annotation.annotationId );
231
231
                        }
232
232
                        else{
233
 
                                sout << "annotationPoints.empty() = " << annotationPoints.empty() << std::endl;
234
 
                                sout << "annotationPoints.size() = " << annotationPoints.size() << std::endl;
 
233
                                //sout << "annotationPoints.empty() = " << annotationPoints.empty() << std::endl;
 
234
                                //sout << "annotationPoints.size() = " << annotationPoints.size() << std::endl;
235
235
                                sout << "Existing ID: " << newId << std::endl;
236
 
                                std::string msg = "AnnotationList::addAnnotationPoints: annotationId already exists: ";
237
 
                                throw(std::range_error(msg));
 
236
                                //std::string msg = "AnnotationList::addAnnotationPoints: annotationId already exists: ";
 
237
                                //throw(std::range_error(msg));
238
238
                        }
239
239
 
240
240
                }
248
248
        }
249
249
 
250
250
 
251
 
        const Frame* AnnotationList::getFrame( std::string _filename ) const {
252
 
                const std::map<std::string,Frame>::const_iterator it = frames.find( _filename );
253
 
                if( it != frames.end() ){
 
251
        const Frame* AnnotationList::getFrame(std::string _filename) const {
 
252
                const std::map<std::string, Frame>::const_iterator it = frames.find(_filename);
 
253
                if (it != frames.end()){
254
254
                        return &(it->second);
255
255
                }
256
256
                else
257
 
                        throw( std::range_error("AnnotationList::getFrame: frameId out of range") );
 
257
                        throw(std::range_error("AnnotationList::getFrame: frameId out of range"));
258
258
        }
259
259
 
260
 
        
 
260
 
261
261
        /// return vector of all frames
262
262
        const std::vector< const Frame* > AnnotationList::getFrames() const {
263
263
        
296
296
                return vec; //it->second.annotationIds;
297
297
        
298
298
        }
 
299
        
 
300
        bool AnnotationList::deleteAnnotation(int _annotationId){
 
301
 
 
302
                const AnnotationPoints* anno = this->getAnnotationPoints(_annotationId);
 
303
 
 
304
 
 
305
                std::map<std::string, Frame>::iterator it = this->frames.find(anno->filename);
 
306
                if (it != frames.end()){
 
307
                        
 
308
                        Frame &frame = (it->second);
 
309
                        for (int i = 0; i < frame.annotationIds.size(); i++){
 
310
                                if (frame.annotationIds[i] == _annotationId){
 
311
                                        frame.annotationIds.erase(frame.annotationIds.begin()+i);
 
312
 
 
313
                                        // delete annotation object
 
314
 
 
315
                                        this->annotationPoints.erase(_annotationId);
 
316
                                        return 0;
 
317
                                }
 
318
                        }
 
319
 
 
320
                }
 
321
 
 
322
                return 1;
 
323
 
 
324
        }
299
325
 
300
326
} ; /*namespace annotation */
301
327