contrib/oxl/mvl/LineSegSet.h
Go to the documentation of this file.
00001 // This is oxl/mvl/LineSegSet.h
00002 #ifndef LineSegSet_h_
00003 #define LineSegSet_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 //
00008 // \author
00009 //     Andrew W. Fitzgibbon, Oxford RRG, 19 Sep 96
00010 //
00011 //-----------------------------------------------------------------------------
00012 
00013 #include <vcl_vector.h>
00014 #include <vcl_iosfwd.h>
00015 #include <mvl/HomgLineSeg2D.h>
00016 #include <mvl/HomgMetric.h>
00017 
00018 class ImageMetric;
00019 
00020 class LineSegSet
00021 {
00022   // Data Members--------------------------------------------------------------
00023   vcl_vector<HomgLineSeg2D> hlines_;
00024   HomgMetric conditioner_;
00025 
00026  public:
00027   // Constructors/Destructors--------------------------------------------------
00028 
00029   LineSegSet();
00030   LineSegSet(const HomgMetric& c, const vcl_vector<HomgLineSeg2D>& lines, bool is_conditioned = true);
00031   LineSegSet(const char* filename, const HomgMetric& c = 0);
00032   LineSegSet(const LineSegSet& that);
00033  ~LineSegSet();
00034 
00035   LineSegSet& operator=(const LineSegSet& that);
00036 
00037   // Operations----------------------------------------------------------------
00038   unsigned size() const { return hlines_.size(); }
00039 
00040   // Computations--------------------------------------------------------------
00041   int pick_line_index(double x, double y);
00042   HomgLineSeg2D* pick_line(double x, double y);
00043 
00044   // Data Access---------------------------------------------------------------
00045         HomgLineSeg2D& get_homg(int i)       { return hlines_[i]; }
00046   const HomgLineSeg2D& get_homg(int i) const { return hlines_[i]; }
00047 
00048   vcl_vector<HomgLineSeg2D>& get_homg() { return hlines_; }
00049 
00050   int FindNearestLineIndex(double x, double y);
00051 
00052   // Data Control--------------------------------------------------------------
00053   bool load_ascii(vcl_istream&, HomgMetric const& c);
00054   bool save_ascii(vcl_ostream&) const;
00055 
00056   bool set_iuline(int i, void* l);
00057 
00058   void compute_homglines_from_rawlines(const HomgMetric& );
00059 };
00060 
00061 #endif // LineSegSet_h_