contrib/brl/vvid/vvid_frame_trail.cxx
Go to the documentation of this file.
00001 #include "vvid_frame_trail.h"
00002 //:
00003 // \file
00004 #include <vtol/vtol_topology_object.h>
00005 #include <vsol/vsol_spatial_object_2d.h>
00006 
00007 vvid_frame_trail::vvid_frame_trail()
00008 {
00009   window_ = 0;
00010 }
00011 
00012 vvid_frame_trail::~vvid_frame_trail()
00013 {
00014 }
00015 
00016 void vvid_frame_trail::clear()
00017 {
00018   spat_obj_queue_.clear();
00019   topo_queue_.clear();
00020 }
00021 
00022 void vvid_frame_trail::
00023 add_spatial_objects(vcl_vector<vsol_spatial_object_2d_sptr> const& sos)
00024 {
00025   //if the window is full, eliminate oldest objects
00026   if (spat_obj_queue_.size()>window_)
00027     spat_obj_queue_.pop_back();
00028 
00029   spat_obj_queue_.push_front(sos);
00030 }
00031 
00032 void vvid_frame_trail::
00033 add_topology_objects(vcl_vector<vtol_topology_object_sptr> const & tos)
00034 {
00035   //update the spatial object queue
00036 
00037   //if the window is full, eliminate oldest objects
00038   if (topo_queue_.size()>window_)
00039     topo_queue_.pop_back();
00040 
00041   topo_queue_.push_front(tos);
00042 }
00043 
00044 
00045 void vvid_frame_trail::
00046 get_topology_objects(vcl_vector<vtol_topology_object_sptr>& topo_objs)
00047 {
00048   topo_objs.clear();
00049   for (vcl_deque< vcl_vector<vtol_topology_object_sptr> >::iterator tpt = topo_queue_.begin();
00050        tpt != topo_queue_.end(); tpt++)
00051     for (vcl_vector<vtol_topology_object_sptr>:: iterator tot = (*tpt).begin();
00052          tot != (*tpt).end(); tot++)
00053       topo_objs.push_back(*tot);
00054 }
00055 
00056 void vvid_frame_trail::
00057 get_spatial_objects(vcl_vector<vsol_spatial_object_2d_sptr>& spat_objs)
00058 {
00059   spat_objs.clear();
00060   for (vcl_deque<vcl_vector<vsol_spatial_object_2d_sptr> >::iterator sit =
00061        spat_obj_queue_.begin(); sit != spat_obj_queue_.end(); sit++)
00062     for (vcl_vector<vsol_spatial_object_2d_sptr>::iterator sot = (*sit).begin();
00063          sot != (*sit).end(); sot++)
00064       spat_objs.push_back(*sot);
00065 }