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 
248 {
249 protected:
250  cmzn_tessellationmodule_id id;
251 
252 public:
253 
254  Tessellationmodule() : id(0)
255  { }
256 
257  // takes ownership of C handle, responsibility for destroying it
258  explicit Tessellationmodule(cmzn_tessellationmodule_id in_tessellationmodule_id) :
259  id(in_tessellationmodule_id)
260  { }
261 
262  Tessellationmodule(const Tessellationmodule& tessellationModule) :
263  id(cmzn_tessellationmodule_access(tessellationModule.id))
264  { }
265 
266  Tessellationmodule& operator=(const Tessellationmodule& tessellationModule)
267  {
268  cmzn_tessellationmodule_id temp_id = cmzn_tessellationmodule_access(
269  tessellationModule.id);
270  if (0 != id)
271  {
272  cmzn_tessellationmodule_destroy(&id);
273  }
274  id = temp_id;
275  return *this;
276  }
277 
279  {
280  if (0 != id)
281  {
282  cmzn_tessellationmodule_destroy(&id);
283  }
284  }
285 
291  bool isValid() const
292  {
293  return (0 != id);
294  }
295 
301  cmzn_tessellationmodule_id getId() const
302  {
303  return id;
304  }
305 
313  {
314  return Tessellation(cmzn_tessellationmodule_create_tessellation(id));
315  }
316 
324  {
325  return Tessellation(cmzn_tessellationmodule_find_tessellation_by_name(id, name));
326  }
327 
338  {
339  return cmzn_tessellationmodule_begin_change(id);
340  }
341 
351  int endChange()
352  {
353  return cmzn_tessellationmodule_end_change(id);
354  }
355 
365  {
366  return Tessellation(cmzn_tessellationmodule_get_default_tessellation(id));
367  }
368 
376  int setDefaultTessellation(const Tessellation& tessellation)
377  {
378  return cmzn_tessellationmodule_set_default_tessellation(id, tessellation.getId());
379  }
380 
391  {
392  return Tessellation(cmzn_tessellationmodule_get_default_points_tessellation(id));
393  }
394 
403  {
404  return cmzn_tessellationmodule_set_default_points_tessellation(id, tessellation.getId());
405  }
406 };
407 
409 {
410  return Tessellationmodule(cmzn_context_get_tessellationmodule(id));
411 }
412 
413 } // namespace Zinc
414 }
415 
416 #endif
int endChange()
Definition: tessellation.hpp:351
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:364
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:301
bool isValid() const
Definition: tessellation.hpp:291
int setMinimumDivisions(int valuesCount, const int *valuesIn)
Definition: tessellation.hpp:193
Tessellation createTessellation()
Definition: tessellation.hpp:312
int beginChange()
Definition: tessellation.hpp:337
Tessellation findTessellationByName(const char *name)
Definition: tessellation.hpp:323
The tessellation controls the number of polygons or line segments.
Definition: tessellation.hpp:28
Tessellation getDefaultPointsTessellation()
Definition: tessellation.hpp:390
int setRefinementFactors(int valuesCount, const int *valuesIn)
Definition: tessellation.hpp:233
Module managing all tessellation objects.
Definition: tessellation.hpp:247
int getRefinementFactors(int valuesCount, int *valuesOut)
Definition: tessellation.hpp:211
int getCircleDivisions()
Definition: tessellation.hpp:121
int setDefaultPointsTessellation(const Tessellation &tessellation)
Definition: tessellation.hpp:402
Tessellationmodule getTessellationmodule()
Definition: tessellation.hpp:408
int setManaged(bool value)
Definition: tessellation.hpp:109
int setDefaultTessellation(const Tessellation &tessellation)
Definition: tessellation.hpp:376
int setName(const char *name)
Definition: tessellation.hpp:158