OpenCMISS-Zinc C++ API Documentation
 All Classes Namespaces Files Functions Typedefs Enumerations Enumerator Pages
tessellation.hpp
Go to the documentation of this file.
1 
4 /* OpenCMISS-Zinc Library
5 *
6 * This Source Code Form is subject to the terms of the Mozilla Public
7 * License, v. 2.0. If a copy of the MPL was not distributed with this
8 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
9 #ifndef CMZN_TESSELLATION_HPP__
10 #define CMZN_TESSELLATION_HPP__
11 
12 #include "zinc/tessellation.h"
13 #include "zinc/context.hpp"
14 
15 namespace OpenCMISS
16 {
17 namespace Zinc
18 {
19 
29 {
30 protected:
31  cmzn_tessellation_id id;
32 
33 public:
34 
35  Tessellation() : id(0)
36  { }
37 
38  // takes ownership of C handle, responsibility for destroying it
39  explicit Tessellation(cmzn_tessellation_id in_tessellation_id) :
40  id(in_tessellation_id)
41  { }
42 
43  Tessellation(const Tessellation& tessellation) :
44  id(cmzn_tessellation_access(tessellation.id))
45  { }
46 
47  Tessellation& operator=(const Tessellation& tessellation)
48  {
49  cmzn_tessellation_id temp_id = cmzn_tessellation_access(tessellation.id);
50  if (0 != id)
51  {
52  cmzn_tessellation_destroy(&id);
53  }
54  id = temp_id;
55  return *this;
56  }
57 
58  ~Tessellation()
59  {
60  if (0 != id)
61  {
62  cmzn_tessellation_destroy(&id);
63  }
64  }
65 
71  bool isValid() const
72  {
73  return (0 != id);
74  }
75 
81  cmzn_tessellation_id getId() const
82  {
83  return id;
84  }
85 
92  bool isManaged()
93  {
94  return cmzn_tessellation_is_managed(id);
95  }
96 
109  int setManaged(bool value)
110  {
111  return cmzn_tessellation_set_managed(id, value);
112  }
113 
122  {
123  return cmzn_tessellation_get_circle_divisions(id);
124  }
125 
135  int setCircleDivisions(int circleDivisions)
136  {
137  return cmzn_tessellation_set_circle_divisions(id, circleDivisions);
138  }
139 
146  char *getName()
147  {
148  return cmzn_tessellation_get_name(id);
149  }
150 
158  int setName(const char *name)
159  {
160  return cmzn_tessellation_set_name(id, name);
161  }
162 
176  int getMinimumDivisions(int valuesCount, int *valuesOut)
177  {
178  return cmzn_tessellation_get_minimum_divisions(id, valuesCount, valuesOut);
179  }
180 
193  int setMinimumDivisions(int valuesCount, const int *valuesIn)
194  {
195  return cmzn_tessellation_set_minimum_divisions(id, valuesCount, valuesIn);
196  }
197 
211  int getRefinementFactors(int valuesCount, int *valuesOut)
212  {
213  return cmzn_tessellation_get_refinement_factors(id, valuesCount, valuesOut);
214  }
215 
233  int setRefinementFactors(int valuesCount, const int *valuesIn)
234  {
235  return cmzn_tessellation_set_refinement_factors(id, valuesCount, valuesIn);
236  }
237 
238 };
239 
240 inline bool operator==(const Tessellation& a, const Tessellation& b)
241 {
242  return a.getId() == b.getId();
243 }
244 
245 
254 {
255 private:
256 
257  cmzn_tessellationiterator_id id;
258 
259 public:
260 
261  Tessellationiterator() : id(0)
262  { }
263 
264  // takes ownership of C handle, responsibility for destroying it
265  explicit Tessellationiterator(cmzn_tessellationiterator_id iterator_id) :
266  id(iterator_id)
267  { }
268 
269  Tessellationiterator(const Tessellationiterator& tessellationiterator) :
270  id(cmzn_tessellationiterator_access(tessellationiterator.id))
271  { }
272 
273  Tessellationiterator& operator=(const Tessellationiterator& tessellationiterator)
274  {
275  cmzn_tessellationiterator_id temp_id = cmzn_tessellationiterator_access(tessellationiterator.id);
276  if (0 != id)
277  {
278  cmzn_tessellationiterator_destroy(&id);
279  }
280  id = temp_id;
281  return *this;
282  }
283 
285  {
286  if (0 != id)
287  {
288  cmzn_tessellationiterator_destroy(&id);
289  }
290  }
291 
297  bool isValid() const
298  {
299  return (0 != id);
300  }
301 
311  {
312  return Tessellation(cmzn_tessellationiterator_next(id));
313  }
314 };
315 
324 {
325 protected:
326  cmzn_tessellationmodule_id id;
327 
328 public:
329 
330  Tessellationmodule() : id(0)
331  { }
332 
333  // takes ownership of C handle, responsibility for destroying it
334  explicit Tessellationmodule(cmzn_tessellationmodule_id in_tessellationmodule_id) :
335  id(in_tessellationmodule_id)
336  { }
337 
338  Tessellationmodule(const Tessellationmodule& tessellationModule) :
339  id(cmzn_tessellationmodule_access(tessellationModule.id))
340  { }
341 
342  Tessellationmodule& operator=(const Tessellationmodule& tessellationModule)
343  {
344  cmzn_tessellationmodule_id temp_id = cmzn_tessellationmodule_access(
345  tessellationModule.id);
346  if (0 != id)
347  {
348  cmzn_tessellationmodule_destroy(&id);
349  }
350  id = temp_id;
351  return *this;
352  }
353 
355  {
356  if (0 != id)
357  {
358  cmzn_tessellationmodule_destroy(&id);
359  }
360  }
361 
367  bool isValid() const
368  {
369  return (0 != id);
370  }
371 
377  cmzn_tessellationmodule_id getId() const
378  {
379  return id;
380  }
381 
389  {
390  return Tessellation(cmzn_tessellationmodule_create_tessellation(id));
391  }
392 
406  {
407  return Tessellationiterator(cmzn_tessellationmodule_create_tessellationiterator(id));
408  }
409 
417  {
418  return Tessellation(cmzn_tessellationmodule_find_tessellation_by_name(id, name));
419  }
420 
431  {
432  return cmzn_tessellationmodule_begin_change(id);
433  }
434 
444  int endChange()
445  {
446  return cmzn_tessellationmodule_end_change(id);
447  }
448 
458  {
459  return Tessellation(cmzn_tessellationmodule_get_default_tessellation(id));
460  }
461 
469  int setDefaultTessellation(const Tessellation& tessellation)
470  {
471  return cmzn_tessellationmodule_set_default_tessellation(id, tessellation.getId());
472  }
473 
484  {
485  return Tessellation(cmzn_tessellationmodule_get_default_points_tessellation(id));
486  }
487 
496  {
497  return cmzn_tessellationmodule_set_default_points_tessellation(id, tessellation.getId());
498  }
499 };
500 
502 {
503  return Tessellationmodule(cmzn_context_get_tessellationmodule(id));
504 }
505 
506 } // namespace Zinc
507 }
508 
509 #endif
int endChange()
Definition: tessellation.hpp:444
cmzn_tessellation_id getId() const
Definition: tessellation.hpp:81
char * getName()
Definition: tessellation.hpp:146
bool isValid() const
Definition: tessellation.hpp:71
Tessellation getDefaultTessellation()
Definition: tessellation.hpp:457
Tessellation next()
Definition: tessellation.hpp:310
bool isManaged()
Definition: tessellation.hpp:92
int setCircleDivisions(int circleDivisions)
Definition: tessellation.hpp:135
int getMinimumDivisions(int valuesCount, int *valuesOut)
Definition: tessellation.hpp:176
cmzn_tessellationmodule_id getId() const
Definition: tessellation.hpp:377
An iterator for looping through all the tessellations in a tessellation module.
Definition: tessellation.hpp:253
bool isValid() const
Definition: tessellation.hpp:367
int setMinimumDivisions(int valuesCount, const int *valuesIn)
Definition: tessellation.hpp:193
Tessellation createTessellation()
Definition: tessellation.hpp:388
int beginChange()
Definition: tessellation.hpp:430
Tessellation findTessellationByName(const char *name)
Definition: tessellation.hpp:416
The tessellation controls the number of polygons or line segments.
Definition: tessellation.hpp:28
Tessellation getDefaultPointsTessellation()
Definition: tessellation.hpp:483
int setRefinementFactors(int valuesCount, const int *valuesIn)
Definition: tessellation.hpp:233
Tessellationiterator createTessellationiterator()
Definition: tessellation.hpp:405
Module managing all tessellation objects.
Definition: tessellation.hpp:323
int getRefinementFactors(int valuesCount, int *valuesOut)
Definition: tessellation.hpp:211
int getCircleDivisions()
Definition: tessellation.hpp:121
int setDefaultPointsTessellation(const Tessellation &tessellation)
Definition: tessellation.hpp:495
bool isValid() const
Definition: tessellation.hpp:297
Tessellationmodule getTessellationmodule()
Definition: tessellation.hpp:501
int setManaged(bool value)
Definition: tessellation.hpp:109
int setDefaultTessellation(const Tessellation &tessellation)
Definition: tessellation.hpp:469
int setName(const char *name)
Definition: tessellation.hpp:158