Points&Forces (survey)
Software tools facilitating the task of surveying architecture
a_screenlayer.h
Go to the documentation of this file.
1 /*
2  Copyright 2010-2022 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_SCREEN_LAYER_H_
17 #define _A_SCREEN_LAYER_H_
18 
19 // .NAME a_screenlayer
20 // .SECTION Author
21 // Pierre Smars
22 
23 #include "vtkActor.h"
24 #include "vtkPolyData.h"
25 #include <string>
26 #include <iostream>
27 #include <vector>
28 
31 {
32  public:
33  a_screenlayer();
35  void reset();
36  inline void name(std::string aname) {name_ =aname;}
37  inline std::string name() const {return name_;}
38  inline bool empty() const {return polydata_->GetNumberOfCells() == 0;}
39  inline void empty(bool code) {empty_ = code;}
40  void color(float r, float g, float b);
41  void R(float v);
42  void G(float v);
43  void B(float v);
44  inline float R() const {return R_;}
45  inline float G() const {return G_;}
46  inline float B() const {return B_;}
47  void thickness(const int);
48  inline int thickness() const {return thickness_;}
49  inline vtkActor * actor() {return actor_;} //const?
50  inline vtkActor * actor2() {return actor2_;} //const?
51  inline vtkActor * surfaceactor() {return surface_actor_;} //const?
52  inline vtkPolyData * polydata() {return polydata_;} //const?
53  inline vtkPolyData * polydata2() {return polydata2_;} //const?
54  inline bool operator==(const std::string s) const {return name_==s;}
55  inline bool operator!=(const std::string s) const {return name_!=s;}
56  void point(double x, double y, double z);
57  void point(double x[3]);
58  void line(double x1, double y1, double z1, double x2, double y2, double z2);
59  void line(double x[6]);
60  void vertex(double x, double y, double z);
61  void vertex(double x[3]);
62  void endpolyline();
63  void closepolyline();
64  void surfacepoint(double x, double y, double z);
65  inline bool hassurface() {return number_of_surface_point_>2;}
66  inline bool surfaceready() {return number_of_surface_point_==3;}
67  void eraselastpoint();
68  void eraselastline();
69  void eraselastpolyline();
70  void dxfout(std::ostream& o) const;
71  void ptin(std::istream& in);
72  void ptout(std::ostream& o) const;
73  inline void visibility(const int code) {actor_->SetVisibility(code);}
74  inline bool isvisible() const {return actor_->GetVisibility()==1;}
75  inline bool isnotvisible() const {return actor_->GetVisibility()==0;}
76 
77  //: input/output
78  friend std::istream& operator>> (std::istream& i, a_screenlayer& l);
79  friend std::ostream& operator<< (std::ostream& o, const a_screenlayer& l);
80  void open(const std::string file);
81  void save(const std::string file);
82  void append(const a_screenlayer&);
83 
84  void reset_mapper_clipping();
85 
86  protected:
87  std::string name_;
88  vtkActor * actor_;
89  vtkActor * actor2_;
90  vtkActor * surface_actor_;
91  vtkPolyData * polydata_;
92  vtkPolyData * polydata2_;
93  vtkPoints * surface_points_;
94  vtkPoints * points_polyline_;
95  float R_; //colors
96  float G_;
97  float B_;
99  bool empty_;
105 };
106 
107 inline bool operator==(a_screenlayer * l, const std::string s) {return (*l) ==s;}
108 inline bool operator!=(a_screenlayer * l, const std::string s) {return (*l) !=s;}
109 void delete_vector(std::vector<a_screenlayer *> &);
110 
111 #endif
bool operator!=(a_screenlayer *l, const std::string s)
void delete_vector(std::vector< a_screenlayer * > &)
bool operator==(a_screenlayer *l, const std::string s)
a_mat_sq x2(3)
layer used by screen to draw vector graphics
Definition: a_screenlayer.h:31
bool hassurface()
Definition: a_screenlayer.h:65
bool isvisible() const
Definition: a_screenlayer.h:74
void eraselastpolyline()
void append(const a_screenlayer &)
void surfacepoint(double x, double y, double z)
float R() const
Definition: a_screenlayer.h:44
vtkActor * actor2()
Definition: a_screenlayer.h:50
void name(std::string aname)
Definition: a_screenlayer.h:36
float B() const
Definition: a_screenlayer.h:46
vtkPolyData * polydata()
Definition: a_screenlayer.h:52
vtkPolyData * polydata2()
Definition: a_screenlayer.h:53
bool operator!=(const std::string s) const
Definition: a_screenlayer.h:55
friend std::istream & operator>>(std::istream &i, a_screenlayer &l)
void color(float r, float g, float b)
vtkPoints * points_polyline_
Definition: a_screenlayer.h:94
bool isnotvisible() const
Definition: a_screenlayer.h:75
void vertex(double x, double y, double z)
vtkActor * surfaceactor()
Definition: a_screenlayer.h:51
void reset_mapper_clipping()
void line(double x1, double y1, double z1, double x2, double y2, double z2)
std::string name_
Definition: a_screenlayer.h:87
vtkActor * actor_
Definition: a_screenlayer.h:88
vtkActor * surface_actor_
Definition: a_screenlayer.h:90
vtkPolyData * polydata_
Definition: a_screenlayer.h:91
bool operator==(const std::string s) const
Definition: a_screenlayer.h:54
bool empty() const
Definition: a_screenlayer.h:38
int thickness() const
Definition: a_screenlayer.h:48
void visibility(const int code)
Definition: a_screenlayer.h:73
bool surfaceready()
Definition: a_screenlayer.h:66
void ptout(std::ostream &o) const
void point(double x, double y, double z)
vtkPolyData * polydata2_
Definition: a_screenlayer.h:92
vtkPoints * surface_points_
Definition: a_screenlayer.h:93
void dxfout(std::ostream &o) const
friend std::ostream & operator<<(std::ostream &o, const a_screenlayer &l)
vtkActor * actor()
Definition: a_screenlayer.h:49
void save(const std::string file)
float G() const
Definition: a_screenlayer.h:45
void ptin(std::istream &in)
vtkActor * actor2_
Definition: a_screenlayer.h:89
void open(const std::string file)
int number_of_surface_point_
void empty(bool code)
Definition: a_screenlayer.h:39
std::string name() const
Definition: a_screenlayer.h:37
double v(const uint32_t step, const uint32_t n)
Definition: generate.cxx:42
std::istringstream in
Definition: ply2tri.cxx:32