OpenCMISS-Zinc 3.0.0 Release C++ API Documentation
 All Classes Namespaces Files Functions Typedefs Enumerations Enumerator Pages
scenefilter.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_SCENEFILTER_HPP__
10 #define CMZN_SCENEFILTER_HPP__
11 
12 #include "zinc/scenefilter.h"
13 #include "zinc/context.hpp"
14 #include "zinc/graphics.hpp"
15 #include "zinc/region.hpp"
16 
17 namespace OpenCMISS
18 {
19 namespace Zinc
20 {
21 
22 class ScenefilterOperator;
23 
34 {
35 protected:
36  cmzn_scenefilter_id id;
37 
38 public:
39 
40  Scenefilter() : id(0)
41  { }
42 
43  // takes ownership of C handle, responsibility for destroying it
44  explicit Scenefilter(cmzn_scenefilter_id in_filter_id) :
45  id(in_filter_id)
46  { }
47 
48  Scenefilter(const Scenefilter& scenefilter) :
49  id(cmzn_scenefilter_access(scenefilter.id))
50  { }
51 
52  Scenefilter& operator=(const Scenefilter& scenefilter)
53  {
54  cmzn_scenefilter_id temp_id = cmzn_scenefilter_access(scenefilter.id);
55  if (0 != id)
56  {
57  cmzn_scenefilter_destroy(&id);
58  }
59  id = temp_id;
60  return *this;
61  }
62 
63  ~Scenefilter()
64  {
65  if (0 != id)
66  {
67  cmzn_scenefilter_destroy(&id);
68  }
69  }
70 
76  bool isValid() const
77  {
78  return (0 != id);
79  }
80 
86  cmzn_scenefilter_id getId() const
87  {
88  return id;
89  }
90 
97  bool isManaged()
98  {
99  return cmzn_scenefilter_is_managed(id);
100  }
101 
114  int setManaged(bool value)
115  {
116  return cmzn_scenefilter_set_managed(id, value);
117  }
118 
126  bool evaluateGraphics(const Graphics& graphics)
127  {
128  return cmzn_scenefilter_evaluate_graphics(id, graphics.getId());
129  }
130 
136  bool isInverse()
137  {
138  return cmzn_scenefilter_is_inverse(id);
139  }
140 
148  int setInverse(bool value)
149  {
150  return cmzn_scenefilter_set_inverse(id, value);
151  }
152 
159  char *getName()
160  {
161  return cmzn_scenefilter_get_name(id);
162  }
163 
170  int setName(const char *name)
171  {
172  return cmzn_scenefilter_set_name(id, name);
173  }
174 
183 };
184 
194 {
195 public:
196 
198  { }
199 
200  // takes ownership of C handle, responsibility for destroying it
201  explicit ScenefilterOperator(cmzn_scenefilter_operator_id operator_filter_id) :
202  Scenefilter(reinterpret_cast<cmzn_scenefilter_id>(operator_filter_id))
203  { }
204 
210  cmzn_scenefilter_operator_id getDerivedId()
211  {
212  return reinterpret_cast<cmzn_scenefilter_operator_id>(id);
213  }
214 
223  int appendOperand(const Scenefilter& operand)
224  {
225  return cmzn_scenefilter_operator_append_operand(getDerivedId(), operand.getId());
226  }
227 
233  {
234  return Scenefilter(cmzn_scenefilter_operator_get_first_operand(getDerivedId()));
235  }
236 
245  {
246  return Scenefilter(cmzn_scenefilter_operator_get_next_operand(getDerivedId(), refOperand.getId()));
247  }
248 
255  bool isOperandActive(const Scenefilter& operand)
256  {
257  return cmzn_scenefilter_operator_is_operand_active(getDerivedId(), operand.getId());
258  }
259 
267  int setOperandActive(const Scenefilter& operand, bool isActive)
268  {
269  return cmzn_scenefilter_operator_set_operand_active(getDerivedId(), operand.getId(), isActive);
270  }
271 
281  int insertOperandBefore(const Scenefilter& operand, const Scenefilter& refOperand)
282  {
283  return cmzn_scenefilter_operator_insert_operand_before(getDerivedId(), operand.getId(), refOperand.getId());
284  }
285 
292  int removeOperand(const Scenefilter& operand)
293  {
294  return cmzn_scenefilter_operator_remove_operand(getDerivedId(), operand.getId());
295  }
296 };
297 
299 {
300  return ScenefilterOperator(cmzn_scenefilter_cast_operator(id));
301 }
302 
309 {
310 protected:
311  cmzn_scenefiltermodule_id id;
312 
313 public:
314 
315  Scenefiltermodule() : id(0)
316  { }
317 
318  // takes ownership of C handle, responsibility for destroying it
319  explicit Scenefiltermodule(cmzn_scenefiltermodule_id in_filtermodule_id) :
320  id(in_filtermodule_id)
321  { }
322 
323  Scenefiltermodule(const Scenefiltermodule& scenefiltermodule) :
324  id(cmzn_scenefiltermodule_access(scenefiltermodule.id))
325  { }
326 
327  Scenefiltermodule& operator=(const Scenefiltermodule& scenefiltermodule)
328  {
329  cmzn_scenefiltermodule_id temp_id = cmzn_scenefiltermodule_access(
330  scenefiltermodule.id);
331  if (0 != id)
332  {
333  cmzn_scenefiltermodule_destroy(&id);
334  }
335  id = temp_id;
336  return *this;
337  }
338 
340  {
341  if (0 != id)
342  {
343  cmzn_scenefiltermodule_destroy(&id);
344  }
345  }
346 
352  bool isValid() const
353  {
354  return (0 != id);
355  }
356 
362  cmzn_scenefiltermodule_id getId() const
363  {
364  return id;
365  }
366 
375  {
376  return Scenefilter(cmzn_scenefiltermodule_create_scenefilter_visibility_flags(id));
377  }
378 
387  {
388  return Scenefilter(cmzn_scenefiltermodule_create_scenefilter_field_domain_type(id,
389  static_cast<cmzn_field_domain_type>(domainType)));
390  }
391 
399  {
400  return Scenefilter(cmzn_scenefiltermodule_create_scenefilter_graphics_name(id, matchName));
401  }
402 
410  {
411  return Scenefilter(cmzn_scenefiltermodule_create_scenefilter_graphics_type(id,
412  static_cast<cmzn_graphics_type>(graphicsType)));
413  }
414 
423  {
424  return Scenefilter(cmzn_scenefiltermodule_create_scenefilter_region(
425  id, matchRegion.getId()));
426  }
427 
435  {
436  return ScenefilterOperator(reinterpret_cast<cmzn_scenefilter_operator_id>(
437  cmzn_scenefiltermodule_create_scenefilter_operator_and(id)));
438  }
439 
447  {
448  return ScenefilterOperator(reinterpret_cast<cmzn_scenefilter_operator_id>(
449  cmzn_scenefiltermodule_create_scenefilter_operator_or(id)));
450  }
451 
459  {
460  return Scenefilter(cmzn_scenefiltermodule_find_scenefilter_by_name(id, name));
461  }
462 
473  {
474  return cmzn_scenefiltermodule_begin_change(id);
475  }
476 
486  int endChange()
487  {
488  return cmzn_scenefiltermodule_end_change(id);
489  }
490 
497  {
498  return Scenefilter(cmzn_scenefiltermodule_get_default_scenefilter(id));
499  }
500 
508  {
509  return cmzn_scenefiltermodule_set_default_scenefilter(id, filter.getId());
510  }
511 };
512 
514 {
515  return Scenefiltermodule(cmzn_context_get_scenefiltermodule(id));
516 }
517 
518 } // namespace Zinc
519 }
520 
521 #endif
Scenefilter createScenefilterRegion(const Region &matchRegion)
Definition: scenefilter.hpp:422
cmzn_scenefilter_id getId() const
Definition: scenefilter.hpp:86
Scenefilter getFirstOperand()
Definition: scenefilter.hpp:232
int setDefaultScenefilter(const Scenefilter &filter)
Definition: scenefilter.hpp:507
Scenefilter findScenefilterByName(const char *name)
Definition: scenefilter.hpp:458
int endChange()
Definition: scenefilter.hpp:486
Scenefilter createScenefilterFieldDomainType(Field::DomainType domainType)
Definition: scenefilter.hpp:386
bool isValid() const
Definition: scenefilter.hpp:352
int insertOperandBefore(const Scenefilter &operand, const Scenefilter &refOperand)
Definition: scenefilter.hpp:281
bool isValid() const
Definition: scenefilter.hpp:76
cmzn_scenefilter_operator_id getDerivedId()
Definition: scenefilter.hpp:210
A hierarchical block/namespace owning domains and fields.
Definition: region.hpp:33
Base graphics type: produces 3-D graphics visualising domains and fields.
Definition: graphics.hpp:45
cmzn_region_id getId() const
Definition: region.hpp:84
Module managing all scene filters.
Definition: scenefilter.hpp:308
An operator OR or AND specific scene filter type.
Definition: scenefilter.hpp:193
int removeOperand(const Scenefilter &operand)
Definition: scenefilter.hpp:292
Scenefilter createScenefilterGraphicsName(const char *matchName)
Definition: scenefilter.hpp:398
Scenefilter getDefaultScenefilter()
Definition: scenefilter.hpp:496
int setName(const char *name)
Definition: scenefilter.hpp:170
bool isManaged()
Definition: scenefilter.hpp:97
DomainType
Definition: field.hpp:190
ScenefilterOperator createScenefilterOperatorAnd()
Definition: scenefilter.hpp:434
Scenefilter getNextOperand(const Scenefilter &refOperand)
Definition: scenefilter.hpp:244
Scenefilter createScenefilterVisibilityFlags()
Definition: scenefilter.hpp:374
ScenefilterOperator castOperator()
Definition: scenefilter.hpp:298
int setOperandActive(const Scenefilter &operand, bool isActive)
Definition: scenefilter.hpp:267
Scenefiltermodule getScenefiltermodule()
Definition: scenefilter.hpp:513
int appendOperand(const Scenefilter &operand)
Definition: scenefilter.hpp:223
int setManaged(bool value)
Definition: scenefilter.hpp:114
bool isInverse()
Definition: scenefilter.hpp:136
int setInverse(bool value)
Definition: scenefilter.hpp:148
Type
Definition: graphics.hpp:131
Scene filters determines which graphics are drawn.
Definition: scenefilter.hpp:33
cmzn_scenefiltermodule_id getId() const
Definition: scenefilter.hpp:362
Scenefilter createScenefilterGraphicsType(Graphics::Type graphicsType)
Definition: scenefilter.hpp:409
bool evaluateGraphics(const Graphics &graphics)
Definition: scenefilter.hpp:126
char * getName()
Definition: scenefilter.hpp:159
bool isOperandActive(const Scenefilter &operand)
Definition: scenefilter.hpp:255
cmzn_graphics_id getId() const
Definition: graphics.hpp:153
int beginChange()
Definition: scenefilter.hpp:472
ScenefilterOperator createScenefilterOperatorOr()
Definition: scenefilter.hpp:446