Points&Forces (survey)
Software tools facilitating the task of surveying architecture
a_screenlayer.cxx
Go to the documentation of this file.
1 /*
2  Copyright 2002-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 #include "a_screenlayer.h"
17 #include "vtkPoints.h"
18 #include "vtkCellArray.h"
19 #include "vtkPolyDataMapper.h"
20 #include "vtkProperty.h"
21 #include "vtkDelaunay2D.h"
22 
23 //#include "a_screen.h"
24 
25 //---------------------------------------------------------------------------
27 {
28  name_ = "noname";
29  R_ = G_ = B_ = 1;
30  thickness_ = 1;
31  int pt[2];
32  vtkPoints * points = vtkPoints::New();
33  polydata_ = vtkPolyData::New();
34  polydata_->Allocate(100,100);
35  polydata_->SetPoints(points);
36  vtkPolyDataMapper * map = vtkPolyDataMapper::New();
37  map->SetInputData(polydata_);
38  vtkMapper::SetResolveCoincidentTopologyToPolygonOffset();
39  actor_ = vtkActor::New();
40  actor_->SetMapper(map);
41  actor_->GetProperty()->SetColor(0,0,0);
42  actor_->DragableOff();
43  polydata2_ = vtkPolyData::New();
44  polydata2_->Allocate(100,100);
45  polydata2_->SetPoints(points);
46  vtkPolyDataMapper * map2 = vtkPolyDataMapper::New();
47  map2->SetInputData(polydata2_);
48  vtkMapper::SetResolveCoincidentTopologyToPolygonOffset();
49  actor2_ = vtkActor::New();
50  actor2_->SetMapper(map2);
51  actor2_->GetProperty()->SetColor(0,0,0);
52  actor2_->DragableOff();
53  empty_ = true;
54  surface_actor_ = 0;
55  points_polyline_ = 0;
58 }
59 //---------------------------------------------------------------------------
61 {
62  polydata_->Delete();
63  actor_->Delete();
64 }
65 //---------------------------------------------------------------------------
67 {
68  polydata_->GetLines()->Reset();
69  polydata_->GetVerts()->Reset();
70  polydata_->Modified();
71  actor_->GetProperty()->SetColor(1,1,1);
72  polydata2_->GetLines()->Reset();
73  polydata2_->GetVerts()->Reset();
74  polydata2_->Modified();
75  actor2_->GetProperty()->SetColor(1,1,1);
76  if (surface_actor_)
77  {
78  surface_actor_->GetProperty()->SetColor(1,1,1);
79  surface_actor_->Modified();
80  }
81 }
82 //---------------------------------------------------------------------------
83 void a_screenlayer::color(float r, float g, float b)
84 {
85  if ((r>=0)&&(g>=0)&&(b>=0)&&(r<=1)&&(g<=1)&&(b<=1))
86  {
87  actor_->GetProperty()->SetColor(r,g,b);
88  actor2_->GetProperty()->SetColor(r,g,b);
89  if (surface_actor_)
90  surface_actor_->GetProperty()->SetColor(r,g,b);
91  R_ = r; G_ = g; B_ = b;
92  }
93 }
94 //---------------------------------------------------------------------------
95 void a_screenlayer::R(float v)
96 {
97  if ((v>=0)&&(v<=1))
98  {
99  actor_->GetProperty()->SetColor(v,G_,B_);
100  actor2_->GetProperty()->SetColor(v,G_,B_);
101  if (surface_actor_)
102  surface_actor_->GetProperty()->SetColor(v,G_,B_);
103  R_ = v;
104  }
105 }
106 //---------------------------------------------------------------------------
107 void a_screenlayer::G(float v)
108 {
109  if ((v>=0)&&(v<=1))
110  {
111  actor_->GetProperty()->SetColor(R_,v,B_);
112  actor2_->GetProperty()->SetColor(R_,v,B_);
113  if (surface_actor_)
114  surface_actor_->GetProperty()->SetColor(R_,v,B_);
115  G_ = v;
116  }
117 }
118 //---------------------------------------------------------------------------
119 void a_screenlayer::B(float v)
120 {
121  if ((v>=0)&&(v<=1))
122  {
123  actor_->GetProperty()->SetColor(R_,G_,v);
124  actor2_->GetProperty()->SetColor(R_,G_,v);
125  if (surface_actor_)
126  surface_actor_->GetProperty()->SetColor(R_,G_,v);
127  B_ = v;
128  }
129 }
130 //---------------------------------------------------------------------------
132 {
133  if (v>0)
134  {
135  actor_->GetProperty()->SetPointSize(v);
136  actor_->GetProperty()->SetLineWidth(v);
137  actor2_->GetProperty()->SetLineWidth(v);
138  thickness_ = v;
139  }
140 }
141 //---------------------------------------------------------------------------
142 void a_screenlayer::point(double x[3])
143 {
144  if (!has_vertices_)
145  {
146  has_vertices_ = true;
147  vtkCellArray * vertices = vtkCellArray::New();
148  polydata_->SetVerts(vertices);
149  vertices->Delete();
150  }
151  vtkIdType pt[1];
152  vtkPoints * points = polydata_->GetPoints();
153  pt[0] = points->InsertNextPoint(x[0],x[1],x[2]);
154  polydata_->GetVerts()->InsertNextCell(1,pt);
155  points->GetData()->Modified();
156  empty_ = false;
157 }
158 //---------------------------------------------------------------------------
159 void a_screenlayer::point(double x, double y, double z)
160 {
161  if (!has_vertices_)
162  {
163  has_vertices_ = true;
164  vtkCellArray * vertices = vtkCellArray::New();
165  polydata_->SetVerts(vertices);
166  vertices->Delete();
167  }
168  vtkPoints * points = polydata_->GetPoints();
169  vtkIdType pt = points->InsertNextPoint(x,y,z);
170  polydata_->GetVerts()->InsertNextCell(1,&pt);
171  points->GetData()->Modified();
172  empty_ = false;
173 }
174 //---------------------------------------------------------------------------
175 void a_screenlayer::line(double x[6])
176 {
177  if (!has_lines_)
178  {
179  has_lines_ = true;
180  vtkCellArray * lines = vtkCellArray::New();
181  polydata_->SetLines(lines);
182  lines->Delete();
183  }
184  vtkIdType pt[2];
185  vtkPoints * points = polydata_->GetPoints();
186  pt[0] = points->InsertNextPoint(x[0],x[1],x[2]);
187  pt[1] = points->InsertNextPoint(x[3],x[4],x[5]);
188  polydata_->GetLines()->InsertNextCell(2,pt);
189  points->GetData()->Modified();
190  empty_ = false;
191 }
192 //---------------------------------------------------------------------------
193 void a_screenlayer::line(double x1, double y1, double z1, double x2, double y2, double z2)
194 {
195  if (!has_lines_)
196  {
197  has_lines_ = true;
198  vtkCellArray * lines = vtkCellArray::New();
199  polydata_->SetLines(lines);
200  lines->Delete();
201  }
202  vtkIdType pt[2];
203  vtkPoints * points = polydata_->GetPoints();
204  pt[0] = points->InsertNextPoint(x1,y1,z1);
205  pt[1] = points->InsertNextPoint(x2,y2,z2);
206  polydata_->GetLines()->InsertNextCell(2,pt);
207  points->GetData()->Modified();
208  empty_ = false;
209 }
210 //---------------------------------------------------------------------------
211 void a_screenlayer::vertex(double x, double y, double z)
212 {
213  if (!points_polyline_)
214  points_polyline_ = vtkPoints::New();
215  points_polyline_->InsertNextPoint(x,y,z);
216 }
217 //---------------------------------------------------------------------------
218 void a_screenlayer::vertex(double x[3])
219 {
220  if (!points_polyline_)
221  points_polyline_ = vtkPoints::New();
222  points_polyline_->InsertNextPoint(x[0],x[1],x[2]);
223 }
224 //---------------------------------------------------------------------------
226 {
227  if (!points_polyline_)
228  return;
229  if (!has_polylines_)
230  {
231  has_polylines_ = true;
232  vtkCellArray * polylines = vtkCellArray::New();
233  polydata2_->SetLines(polylines);
234  polylines->Delete();
235  }
236  vtkPoints * points = polydata2_->GetPoints();
237  vtkCellArray * lines = polydata2_->GetLines();
238  lines->InsertNextCell(points_polyline_->GetNumberOfPoints());
239  for (int i = 0; i < points_polyline_->GetNumberOfPoints(); i++)
240  {
241  double xp[3];
242  points_polyline_->GetPoint(i,xp);
243  int p = points->InsertNextPoint(xp);
244  // int p = points->InsertNextPoint(xp[0], xp[1], xp[2]);
245  lines->InsertCellPoint(p);
246  }
247  points_polyline_->Delete();
248  points_polyline_ = 0;
249  points->GetData()->Modified();
250 // polydata2_->Modified();
251  //std::cerr << "nl: " << polydata2_->GetLines()->GetNumberOfCells() << std::endl;
252 }
253 //---------------------------------------------------------------------------
255 {
256  if (!points_polyline_)
257  return;
258  if (!has_polylines_)
259  {
260  has_polylines_ = true;
261  vtkCellArray * polylines = vtkCellArray::New();
262  polydata2_->SetLines(polylines);
263  polylines->Delete();
264  }
265  vtkPoints * points = polydata2_->GetPoints();
266  vtkCellArray * lines = polydata2_->GetLines();
267  lines->InsertNextCell(points_polyline_->GetNumberOfPoints()+1);
268  int p0;
269  for (int i = 0; i < points_polyline_->GetNumberOfPoints(); i++)
270  {
271  double xp[3];
272  points_polyline_->GetPoint(i,xp);
273  int p = points->InsertNextPoint(xp);
274  lines->InsertCellPoint(p);
275  if (i==0) p0=p;
276  }
277  lines->InsertCellPoint(p0);
278  points_polyline_->Delete();
279  points_polyline_ = 0;
280  points->GetData()->Modified();
281 // polydata2_->Modified();
282 }
283 //---------------------------------------------------------------------------
284 void a_screenlayer::surfacepoint(double x, double y, double z)
285 {
288  surface_points_ = vtkPoints::New();
289  surface_points_->InsertNextPoint(x,y,z);
290  surface_points_->Modified();
292  {
293  vtkPolyData * data = vtkPolyData::New();
294  data->SetPoints(surface_points_);
295  surface_points_->Delete();
296  vtkDelaunay2D * del = vtkDelaunay2D::New();
297  del->SetInputData(data);
298  data->Delete();
299  del->SetTolerance(0.001);
300  vtkPolyDataMapper * map = vtkPolyDataMapper::New();
301  map->SetInputConnection(del->GetOutputPort());
302  vtkMapper::SetResolveCoincidentTopologyToPolygonOffset();
303  surface_actor_ = vtkActor::New();
304  surface_actor_->SetMapper(map);
305  surface_actor_->GetProperty()->SetColor(R_,G_,B_);
306  surface_actor_->DragableOff();
307  }
308 }
309 //---------------------------------------------------------------------------
311 {
312  vtkIdType pt[1];
313  vtkCellArray * old_pts = polydata_->GetVerts();
314  vtkCellArray * new_pts = vtkCellArray::New();
315  old_pts->InitTraversal();
316  for (int i = 0; i < old_pts->GetNumberOfCells()-1; i++)
317  {
318  vtkIdType npts;
319  const vtkIdType * pts = nullptr;
320  old_pts->GetNextCell(npts, pts);
321  new_pts->InsertNextCell(npts, pts);
322  }
323  polydata_->SetVerts(new_pts);
324  new_pts->Delete();
325  new_pts->Modified();
326 // polydata_->Modified();
327 }
328 //---------------------------------------------------------------------------
330 {
331  vtkIdType pt[1];
332  vtkCellArray * old_lis = polydata_->GetLines();
333  vtkCellArray * new_lis = vtkCellArray::New();
334  old_lis->InitTraversal();
335  for (int i = 0; i < old_lis->GetNumberOfCells()-1; i++)
336  {
337  vtkIdType npts;
338  const vtkIdType * pts = nullptr;
339  old_lis->GetNextCell(npts, pts);
340  new_lis->InsertNextCell(npts, pts);
341  }
342  polydata_->SetLines(new_lis);
343  new_lis->Delete();
344  polydata_->Modified();
345 }
346 //---------------------------------------------------------------------------
348 {
349  vtkIdType pt[1];
350  vtkCellArray * old_lis = polydata2_->GetLines();
351  vtkCellArray * new_lis = vtkCellArray::New();
352  old_lis->InitTraversal();
353  for (int i = 0; i < old_lis->GetNumberOfCells()-1; i++)
354  {
355  vtkIdType npts;
356  const vtkIdType * pts = nullptr;
357  old_lis->GetNextCell(npts, pts);
358  new_lis->InsertNextCell(npts, pts);
359  }
360  polydata2_->SetLines(new_lis);
361  new_lis->Delete();
362  polydata2_->Modified();
363 }
364 //---------------------------------------------------------------------------
365 void a_screenlayer::dxfout(std::ostream& o) const
366 {
367  vtkIdType npt;
368  const vtkIdType * ref_pt = nullptr;
369  double pt[3];
370  int stop;
371 
372  //for each point
373  vtkCellArray * cells;
374  cells = polydata_->GetVerts();
375  cells->InitTraversal();
376  do
377  {
378  stop = cells->GetNextCell(npt,ref_pt);
379  if (stop != 0)
380  {
381  polydata_->GetPoint(ref_pt[0],pt);
382  o << " 0" << std::endl << "POINT" << std::endl;
383  o << " 8" << std::endl << name_ << std::endl;
384  o << " 10" << std::endl << pt[0] << std::endl;
385  o << " 20" << std::endl << pt[1] << std::endl;
386  o << " 30" << std::endl << pt[2] << std::endl;
387  }
388  }
389  while (stop != 0);
390 
391  //for each line
392  cells = polydata_->GetLines();
393  cells->InitTraversal();
394  npt = 2;
395  do
396  {
397  stop = cells->GetNextCell(npt,ref_pt);
398  if (stop != 0)
399  {
400  polydata_->GetPoint(ref_pt[0],pt);
401  o << " 0" << std::endl << "LINE" << std::endl;
402  o << " 8" << std::endl << name_ << std::endl;
403  o << " 10" << std::endl << pt[0] << std::endl;
404  o << " 20" << std::endl << pt[1] << std::endl;
405  o << " 30" << std::endl << pt[2] << std::endl;
406  polydata_->GetPoint(ref_pt[1],pt);
407  o << " 11" << std::endl << pt[0] << std::endl;
408  o << " 21" << std::endl << pt[1] << std::endl;
409  o << " 31" << std::endl << pt[2] << std::endl;
410  }
411  }
412  while (stop != 0);
413 
414  //for polyline
415  cells = polydata2_->GetLines();
416  cells->InitTraversal();
417  do
418  {
419  stop = cells->GetNextCell(npt,ref_pt);
420  if (stop != 0)
421  {
422  o << " 0" << std::endl << "POLYLINE" << std::endl;
423  o << " 8" << std::endl << name_ << std::endl;
424  o << " 66" << std::endl << 1 << std::endl;//?
425  o << " 70" << std::endl << 8 << std::endl;//3d polyline, necessary
426  for (int j=0; j<npt; j++)
427  {
428  polydata_->GetPoint(ref_pt[j],pt);
429  o << " 0" << std::endl << "VERTEX" << std::endl;
430  o << " 8" << std::endl << name_ << std::endl;
431  o << " 10" << std::endl << pt[0] << std::endl;
432  o << " 20" << std::endl << pt[1] << std::endl;
433  o << " 30" << std::endl << pt[2] << std::endl;
434  o << " 70" << std::endl << 32 << std::endl;//3d polyline, necessary
435  }
436  o << " 0" << std::endl << "SEQEND" << std::endl;
437  o << " 8" << std::endl << name_ << std::endl;
438  }
439  }
440  while (stop != 0);
441 
442  //for surfaces
443  if (surface_actor_)
444  {
445  vtkPolyData * data = (vtkPolyData *)(surface_actor_->GetMapper()->GetInput());
446  vtkCellArray * triangles = data->GetPolys();
447  int stop;
448  int i_tri = -1;
449  triangles->InitTraversal();
450  do
451  {
452  vtkIdType npt;
453  const vtkIdType * ref_pt = nullptr;
454  stop = triangles->GetNextCell(npt,ref_pt);
455  i_tri++;
456  if (stop != 0)
457  {
458  double pt[3];
459  data->GetPoint(ref_pt[0],pt);
460  o << " 0" << std::endl << "3DFACE" << std::endl;
461  o << " 8" << std::endl << name_ << std::endl;
462  o << " 10" << std::endl << pt[0] << std::endl;
463  o << " 20" << std::endl << pt[1] << std::endl;
464  o << " 30" << std::endl << pt[2] << std::endl;
465  data->GetPoint(ref_pt[1],pt);
466  o << " 11" << std::endl << pt[0] << std::endl;
467  o << " 21" << std::endl << pt[1] << std::endl;
468  o << " 31" << std::endl << pt[2] << std::endl;
469  data->GetPoint(ref_pt[2],pt);
470  o << " 12" << std::endl << pt[0] << std::endl;
471  o << " 22" << std::endl << pt[1] << std::endl;
472  o << " 32" << std::endl << pt[2] << std::endl;
473  o << " 13" << std::endl << pt[0] << std::endl;
474  o << " 23" << std::endl << pt[1] << std::endl;
475  o << " 33" << std::endl << pt[2] << std::endl;
476  }
477  }
478  while (stop != 0);
479  }
480 }
481 //---------------------------------------------------------------------------
482 void a_screenlayer::ptin(std::istream& in)
483 {
484  int n_pts;
485  double x[3];
486  in >> n_pts;
487  for (int i=0; i<n_pts; i++)
488  {
489  in >> x[0] >> x[1] >> x[2];
490  this->point(x);
491  }
492 }
493 //---------------------------------------------------------------------------
494 void a_screenlayer::ptout(std::ostream& o) const
495 {
496  vtkIdType npt;
497  const vtkIdType * ref_pt = nullptr;
498  double pt[3];
499  int stop;
500 
501  //for each point
502  vtkCellArray * cells;
503  int n_pts = polydata_->GetNumberOfVerts();
504  cells = polydata_->GetVerts();
505  o << n_pts << std::endl;
506  cells->InitTraversal();
507  do
508  {
509  stop = cells->GetNextCell(npt,ref_pt);
510  if (stop != 0)
511  {
512  polydata_->GetPoint(ref_pt[0],pt);
513  o << pt[0] << "\t" << pt[1] << "\t" << pt[2] << std::endl;
514  }
515  }
516  while (stop != 0);
517 }
518 //***********************************************************
519 //-operator>>----------------------------------------------------------------
520 std::istream& operator>> (std::istream& i, a_screenlayer& l)
521 {
522  i >> l.name_;
523  float r,g,b;
524  i >> r >> g >> b;
525  l.color(r,g,b);
526  int t;
527  i >> t;
528  l.thickness(t);
529  int n_point,n_line,n_polyline;
530  i >> n_point >> n_line >> n_polyline;
531  double x[6];
532  for (int k = 0; k < n_point; k++)
533  {
534  i >> x[0] >> x[1] >> x[2];
535  l.point(x);
536  }
537  for (int k = 0; k < n_line; k++)
538  {
539  i >> x[0] >> x[1] >> x[2];
540  i >> x[3] >> x[4] >> x[5];
541  l.line(x);
542  }
543  for (int k = 0; k < n_polyline; k++)
544  {
545  int n;
546  i >> n;
547  for (int j=0; j<n; j++)
548  {
549  i >> x[0] >> x[1] >> x[2];
550  l.vertex(x);
551  }
552  l.endpolyline();
553  }
554  if ((n_point != 0)||(n_line != 0)||(n_polyline != 0))
555  l.empty(false);
556  //std::cerr << "nl2: " << l.polydata2_->GetLines()->GetNumberOfCells() << std::endl;
557  return i;
558 }
559 //-operator<<----------------------------------------------------------------
560 std::ostream& operator<< (std::ostream& o, const a_screenlayer& l)
561 {
562  o << l.name() << std::endl;
563  o << l.R() << " " << l.G() << " " << l.B() << std::endl;
564  o << l.thickness() << std::endl;
565  o << l.polydata_->GetVerts()->GetNumberOfCells() << " ";
566  o << l.polydata_->GetLines()->GetNumberOfCells() << " ";
567  o << l.polydata2_->GetLines()->GetNumberOfCells() << std::endl;
568 
569  vtkIdType npt;
570  const vtkIdType * ref_pt = nullptr;
571  double pt[3];
572  int stop;
573 
574  //for each point
575  vtkCellArray * cells;
576  cells = l.polydata_->GetVerts();
577  cells->InitTraversal();
578  do
579  {
580  stop = cells->GetNextCell(npt,ref_pt);
581  if (stop != 0)
582  {
583  l.polydata_->GetPoint(ref_pt[0],pt);
584  o << pt[0] << " " << pt[1] << " " << pt[2] << std::endl;
585  }
586  }
587  while (stop != 0);
588 
589  //for each line
590  cells = l.polydata_->GetLines();
591  cells->InitTraversal();
592  npt = 2;
593  do
594  {
595  stop = cells->GetNextCell(npt,ref_pt);
596  if (stop != 0)
597  {
598  l.polydata_->GetPoint(ref_pt[0],pt);
599  o << pt[0] << " " << pt[1] << " " << pt[2] << " ";
600  l.polydata_->GetPoint(ref_pt[1],pt);
601  o << pt[0] << " " << pt[1] << " " << pt[2] << std::endl;
602  }
603  }
604  while (stop != 0);
605 
606  //for each polyline
607  cells = l.polydata2_->GetLines();
608  cells->InitTraversal();
609  do
610  {
611  stop = cells->GetNextCell(npt,ref_pt);
612  if (stop != 0)
613  {
614  o << npt << std::endl;
615  for (int i=0; i<npt; i++)
616  {
617  l.polydata2_->GetPoint(ref_pt[i],pt);
618  o << pt[0] << " " << pt[1] << " " << pt[2] << std::endl;
619  }
620  }
621  }
622  while (stop != 0);
623 
624  return o;
625 }
626 //---------------------------------------------------------------------------
627 void a_screenlayer::open(const std::string file)
628 {
629  std::ifstream ff(file.c_str());
630  if (ff) ff >> *this;
631 }
632 //---------------------------------------------------------------------------
633 void a_screenlayer::save(const std::string file)
634 {
635  std::ofstream ff(file.c_str());
636  if (ff) ff << *this;
637 }
638 //---------------------------------------------------------------------------
640 {
641  name_ = l.name();
642  // R_ = l.R(); G_ = l.G(); B_ = l.B();
643  // actor_->GetProperty()->SetColor(R_,G_,B_);
644  color(l.R(),l.G(),l.B());
645  thickness(l.thickness());
646 
647  vtkIdType npt;
648  const vtkIdType * ref_pt = nullptr;
649  double pt1[3];
650  double pt2[3];
651  int stop;
652 
653  //for each point
654  vtkCellArray * cells;
655  cells = l.polydata_->GetVerts();
656  cells->InitTraversal();
657  do
658  {
659  stop = cells->GetNextCell(npt,ref_pt);
660  if (stop != 0)
661  {
662  l.polydata_->GetPoint(ref_pt[0],pt1);
663  this->point(pt1[0],pt1[1],pt1[2]);
664  }
665  }
666  while (stop != 0);
667 
668  //for each line
669  cells = l.polydata_->GetLines();
670  cells->InitTraversal();
671  npt = 2;
672  do
673  {
674  stop = cells->GetNextCell(npt,ref_pt);
675  if (stop != 0)
676  {
677  l.polydata_->GetPoint(ref_pt[0],pt1);
678  l.polydata_->GetPoint(ref_pt[1],pt2);
679  this->line(pt1[0],pt1[1],pt1[2],pt2[0],pt2[1],pt2[2]);
680  }
681  }
682  while (stop != 0);
683 
684  //for each polyline
685  cells = l.polydata2_->GetLines();
686  cells->InitTraversal();
687  do
688  {
689  stop = cells->GetNextCell(npt,ref_pt);
690  if (stop != 0)
691  {
692  for (int i=0; i<npt; i++)
693  {
694  l.polydata2_->GetPoint(ref_pt[i],pt1);
695  this->vertex(pt1[0],pt1[1],pt1[2]);
696  }
697  this->endpolyline();
698  }
699  }
700  while (stop != 0);
701 }
702 //---------------------------------------------------------------------------
704 {
705  // std::cout << *(actor_->GetMapper());
706  double b[6];
707  polydata_->Modified();
708  actor_->GetMapper()->Update();
709  actor_->GetMapper()->GetBounds(b);
710  polydata_->GetPoints()->Modified();
711  polydata_->ComputeBounds();
712  polydata_->GetBounds(b);
713  std::cout << name_ << ": ";
714  for (int k=0; k<6; k++) std::cout << b[k] << " ";
715  std::cout << std::endl;
716 }
717 //---------------------------------------------------------------------------
718 void d_v(a_screenlayer * la) {delete la;}
719 //---------------------------------------------------------------------------
720 void delete_vector(std::vector<a_screenlayer *> & v)
721 {
722  for (int i = 0; i < v.size(); i++)
723  delete v[i];
724  // std::for_each(v.begin(),v.end(),d_v);
725  v.clear();
726 }
void d_v(a_screenlayer *la)
void delete_vector(std::vector< a_screenlayer * > &v)
std::istream & operator>>(std::istream &i, a_screenlayer &l)
std::ostream & operator<<(std::ostream &o, const a_screenlayer &l)
a_mat_sq x2(3)
layer used by screen to draw vector graphics
Definition: a_screenlayer.h:31
void eraselastpolyline()
void append(const a_screenlayer &)
void surfacepoint(double x, double y, double z)
float R() const
Definition: a_screenlayer.h:44
void name(std::string aname)
Definition: a_screenlayer.h:36
float B() const
Definition: a_screenlayer.h:46
void color(float r, float g, float b)
vtkPoints * points_polyline_
Definition: a_screenlayer.h:94
void vertex(double x, double y, double z)
void B(float v)
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
void G(float v)
vtkActor * actor_
Definition: a_screenlayer.h:88
vtkActor * surface_actor_
Definition: a_screenlayer.h:90
vtkPolyData * polydata_
Definition: a_screenlayer.h:91
void thickness(const int)
bool empty() const
Definition: a_screenlayer.h:38
void R(float v)
int thickness() const
Definition: a_screenlayer.h:48
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
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_
double v(const uint32_t step, const uint32_t n)
Definition: generate.cxx:42
uint32_t n[]
Definition: generate.cxx:34
std::istringstream in
Definition: ply2tri.cxx:32
Definition: stlb2stla.cxx:21