00001 #ifndef bvgl_change_obj_h_ 00002 #define bvgl_change_obj_h_ 00003 //: 00004 // \file 00005 // \brief Helper classes to annotate polygonal regions in images 00006 // \author Ozge C. Ozcanli ozge@lems.brown.edu 00007 // \date September 26, 2008 00008 // 00009 // \verbatim 00010 // Modifications 00011 // <None yet> 00012 // \endverbatim 00013 00014 #include <vgl/vgl_polygon.h> 00015 #include <vcl_string.h> 00016 #include <vbl/vbl_ref_count.h> 00017 #include <vsl/vsl_binary_io.h> 00018 00019 class bvgl_change_obj: public vbl_ref_count 00020 { 00021 public: 00022 bvgl_change_obj(vgl_polygon<double> const& poly) : class_("unknown"), poly_(poly) {} 00023 bvgl_change_obj(vgl_polygon<double> const& poly, vcl_string cls) : class_(cls), poly_(poly) {} 00024 bvgl_change_obj(const bvgl_change_obj& other); 00025 bvgl_change_obj() {} 00026 ~bvgl_change_obj() {} 00027 00028 //: binary IO write 00029 void b_write(vsl_b_ostream& os); 00030 00031 //: binary IO read 00032 void b_read(vsl_b_istream& is); 00033 00034 //: Return IO version number; 00035 unsigned char version() const; 00036 00037 vgl_polygon<double> poly() const {return poly_; } 00038 00039 //: return the centroid of the polygon 00040 void centroid(double &x, double& y) const; 00041 00042 vcl_string type() const { return class_; } 00043 //void xml_read(); 00044 //void xml_write(); 00045 private: 00046 vcl_string class_; 00047 vgl_polygon<double> poly_; 00048 }; 00049 00050 #endif // bvgl_change_obj_h_