Points&Forces (survey)
Software tools facilitating the task of surveying architecture
a_image.h
Go to the documentation of this file.
1 /*
2  Copyright 2010-2016 Pierre SMARS (smars@yuntech.edu.tw)
3  This program is free software: you can redistribute it and/or modify
4  it under the terms of the GNU General Public License as published by
5  the Free Software Foundation, either version 2 of the License, or
6  (at your option) any later version.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16 #ifndef _A_IMAGE_H_
17 #define _A_IMAGE_H_
18 
19 // .NAME a_image
20 // .SECTION Author
21 // Pierre Smars
22 
23 #include "vtkPoints.h"
24 #include "vtkDoubleArray.h"
25 #include "vtkFloatArray.h"
26 #include "vtkTexture.h"
27 #include "a_pmat.h"
28 #include <string>
29 #include <iostream>
30 #include <vector>
31 
32 class a_image
33 {
34  public:
35  a_image(const std::string& image_file, const std::string& matrix_file);
36  ~a_image();
37  static const std::string help();
38  virtual std::string type() const {return "a_image";}
39  vtkTexture * texture() const {return texture_;}
40  void image(const std::string& file_name);
41  void pmatrix(const std::string& file_name);
42  void gettcoords(vtkPoints *, vtkFloatArray * tcoords) const;
43  inline void name(std::string aname) {name_ =aname;}
44  inline std::string name() const {return name_;}
45  inline bool operator==(const std::string& s) {return name_ ==s;}
46  inline bool operator!=(const std::string& s) {return name_ !=s;}
47 
48  //: input/output
49  friend std::istream& operator>> (std::istream& i, a_image& l);
50  friend std::ostream& operator<< (std::ostream& o, const a_image& l);
51  virtual void read(std::istream& in) {};
52  virtual void write(std::ostream& o) const {};
53  void open(const std::string file);
54  void save(const std::string file);
55 
56  class file_error {};
57 
58  protected:
59  void file_exist(const std::string& name) const;
60  void texture_coordinates(const double * x, float * tcoord) const;
61  std::string name_;
62  vtkTexture * texture_;
63  int * bb_; //bounding box of the image
64  a_pmat * p_; //projection matrix of the image
65 };
66 
67 inline bool operator==(a_image * l, const std::string s) {return (*l) ==s;}
68 inline bool operator!=(a_image * l, const std::string s) {return (*l) !=s;}
69 void delete_vector(std::vector<a_image *> &);
70 
71 #endif
bool operator==(a_image *l, const std::string s)
Definition: a_image.h:67
void delete_vector(std::vector< a_image * > &)
Definition: a_image.cxx:146
bool operator!=(a_image *l, const std::string s)
Definition: a_image.h:68
bool operator!=(const std::string &s)
Definition: a_image.h:46
virtual void write(std::ostream &o) const
Definition: a_image.h:52
a_image(const std::string &image_file, const std::string &matrix_file)
Definition: a_image.cxx:43
void file_exist(const std::string &name) const
Definition: a_image.cxx:75
vtkTexture * texture() const
Definition: a_image.h:39
virtual std::string type() const
Definition: a_image.h:38
void image(const std::string &file_name)
Definition: a_image.cxx:83
void save(const std::string file)
std::string name_
Definition: a_image.h:61
friend std::istream & operator>>(std::istream &i, a_image &l)
void texture_coordinates(const double *x, float *tcoord) const
Definition: a_image.cxx:116
std::string name() const
Definition: a_image.h:44
void name(std::string aname)
Definition: a_image.h:43
virtual void read(std::istream &in)
Definition: a_image.h:51
void pmatrix(const std::string &file_name)
Definition: a_image.cxx:105
friend std::ostream & operator<<(std::ostream &o, const a_image &l)
static const std::string help()
Definition: a_image.cxx:57
bool operator==(const std::string &s)
Definition: a_image.h:45
int * bb_
Definition: a_image.h:63
void gettcoords(vtkPoints *, vtkFloatArray *tcoords) const
Definition: a_image.cxx:131
a_pmat * p_
Definition: a_image.h:64
vtkTexture * texture_
Definition: a_image.h:62
void open(const std::string file)
~a_image()
Definition: a_image.cxx:52
std::istringstream in
Definition: ply2tri.cxx:32
std::string image_file("")