Go to the documentation of this file.00001
00002 #ifndef vdgl_edgel_chain_h
00003 #define vdgl_edgel_chain_h
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <vcl_iosfwd.h>
00020 #include <vcl_vector.h>
00021 #include <vul/vul_timestamp.h>
00022 #include <vbl/vbl_ref_count.h>
00023 #include <vsl/vsl_binary_io.h>
00024 #include "vdgl_edgel_chain_sptr.h"
00025 #include <vdgl/vdgl_edgel.h>
00026
00027 class vdgl_edgel_chain : public vul_timestamp,
00028 public vbl_ref_count
00029 {
00030
00031 public:
00032
00033
00034 vdgl_edgel_chain() {}
00035 vdgl_edgel_chain(vcl_vector<vdgl_edgel> const& edgels) : es_( edgels) {}
00036
00037
00038
00039 vdgl_edgel_chain( const double x0, const double y0,
00040 const double x1, const double y1);
00041 vdgl_edgel_chain(vdgl_edgel_chain const& x)
00042 : vul_timestamp(), vbl_ref_count(), es_(x.es_) {}
00043 ~vdgl_edgel_chain() {}
00044
00045
00046
00047 bool add_edgel( const vdgl_edgel &e);
00048 bool add_edgels( const vcl_vector<vdgl_edgel> &es, const int index);
00049 bool set_edgel( const int index, const vdgl_edgel &e);
00050
00051 vdgl_edgel_chain_sptr extract_subchain(int start, int end);
00052
00053 bool split( double x, double y,
00054 vdgl_edgel_chain_sptr &ec1, vdgl_edgel_chain_sptr &ec2);
00055
00056 friend vcl_ostream& operator<<(vcl_ostream& s, const vdgl_edgel_chain& p);
00057 friend bool operator==( const vdgl_edgel_chain &ec1, const vdgl_edgel_chain &ec2);
00058 friend bool operator!=( const vdgl_edgel_chain &ec1, const vdgl_edgel_chain &ec2);
00059
00060
00061 unsigned int size() const { return es_.size(); }
00062 vdgl_edgel& edgel( int i) { return es_[i]; }
00063 vdgl_edgel const& edgel( int i) const { return es_[i]; }
00064 vdgl_edgel& operator[]( int i) { return es_[i]; }
00065 vdgl_edgel const& operator[]( int i) const { return es_[i]; }
00066
00067
00068 void notify_change();
00069
00070
00071
00072
00073 void b_write(vsl_b_ostream &os) const;
00074
00075
00076 void b_read(vsl_b_istream &is);
00077
00078
00079 short version() const;
00080
00081
00082 void print_summary(vcl_ostream &os) const;
00083
00084
00085 virtual vcl_string is_a() const { return vcl_string("vdgl_edgel_chain"); }
00086
00087
00088 virtual bool is_class(vcl_string const& cls) const { return cls==is_a(); }
00089
00090
00091 protected:
00092
00093
00094
00095
00096 bool line_gen(double xs, double ys, double xe, double ye,
00097 bool& init, bool& done, double& x, double& y);
00098
00099
00100
00101 vcl_vector<vdgl_edgel> es_;
00102 };
00103
00104
00105 vcl_ostream& operator<<(vcl_ostream& s, const vdgl_edgel_chain& e);
00106
00107
00108 void vsl_b_write(vsl_b_ostream &os, const vdgl_edgel_chain* e);
00109
00110
00111 void vsl_b_read(vsl_b_istream &is, vdgl_edgel_chain* &e);
00112
00113
00114 void vsl_print_summary(vcl_ostream &os, const vdgl_edgel_chain* e);
00115
00116
00117 #endif // vdgl_edgel_chain_h