OpenCMISS-Zinc 3.0.0 Release C++ API Documentation
 All Classes Namespaces Files Functions Typedefs Enumerations Enumerator Pages
scene.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_SCENE_HPP__
10 #define CMZN_SCENE_HPP__
11 
12 #include "zinc/scene.h"
13 #include "zinc/field.hpp"
14 #include "zinc/graphics.hpp"
15 #include "zinc/region.hpp"
16 #include "zinc/scenefilter.hpp"
17 #include "zinc/selection.hpp"
18 #include "zinc/timekeeper.hpp"
19 
20 namespace OpenCMISS
21 {
22 namespace Zinc
23 {
24 
25 class Sceneviewermodule;
26 class Scenepicker;
27 
34 class Scene
35 {
36 
37 protected:
38  cmzn_scene_id id;
39 
40 public:
41 
42  Scene() : id(0)
43  { }
44 
45  // takes ownership of C handle, responsibility for destroying it
46  explicit Scene(cmzn_scene_id scene_id) : id(scene_id)
47  { }
48 
49  Scene(const Scene& scene) : id(cmzn_scene_access(scene.id))
50  { }
51 
52  Scene& operator=(const Scene& scene)
53  {
54  cmzn_scene_id temp_id = cmzn_scene_access(scene.id);
55  if (0 != id)
56  {
57  cmzn_scene_destroy(&id);
58  }
59  id = temp_id;
60  return *this;
61  }
62 
63  ~Scene()
64  {
65  if (0 != id)
66  {
67  cmzn_scene_destroy(&id);
68  }
69  }
70 
76  bool isValid() const
77  {
78  return (0 != id);
79  }
80 
86  cmzn_scene_id getId() const
87  {
88  return id;
89  }
90 
101  {
102  return cmzn_scene_begin_change(id);
103  }
104 
114  int endChange()
115  {
116  return cmzn_scene_end_change(id);
117  }
118 
144  int convertToPointCloud(const Scenefilter& filter, const Nodeset& nodeset,
145  const Field& coordinateField, double lineDensity, double lineDensityScaleFactor,
146  double surfaceDensity, double surfaceDensityScaleFactor)
147  {
148  return cmzn_scene_convert_to_point_cloud(id, filter.getId(),
149  nodeset.getId(), coordinateField.getId(),
150  lineDensity, lineDensityScaleFactor,
151  surfaceDensity, surfaceDensityScaleFactor);
152  }
153 
161  {
162  return Graphics(cmzn_scene_create_graphics(id,
163  static_cast<cmzn_graphics_type>(graphicsType)));
164  }
165 
174  {
175  return GraphicsContours(cmzn_scene_create_graphics_contours(id));
176  }
177 
185  {
186  return GraphicsLines(cmzn_scene_create_graphics_lines(id));
187  }
188 
198  {
199  return GraphicsPoints(cmzn_scene_create_graphics_points(id));
200  }
201 
208  {
209  return GraphicsStreamlines(cmzn_scene_create_graphics_streamlines(id));
210  }
211 
219  {
220  return GraphicsSurfaces(cmzn_scene_create_graphics_surfaces(id));
221  }
222 
232  {
233  return Selectionnotifier(cmzn_scene_create_selectionnotifier(id));
234  }
235 
254  Graphics findGraphicsByName(const char *name)
255  {
256  return Graphics(cmzn_scene_find_graphics_by_name(id, name));
257  }
258 
265  {
266  return Graphics(cmzn_scene_get_first_graphics(id));
267  }
268 
275  Graphics getNextGraphics(const Graphics& refGraphics)
276  {
277  return Graphics(cmzn_scene_get_next_graphics(id, refGraphics.getId()));
278  }
279 
287  {
288  return Graphics(cmzn_scene_get_previous_graphics(id, refGraphics.getId()));
289  }
290 
297  {
298  return cmzn_scene_get_number_of_graphics(id);
299  }
300 
306  inline Region getRegion() const
307  {
308  return Region(cmzn_scene_get_region(id));
309  }
310 
317  {
318  return Fontmodule(cmzn_scene_get_fontmodule(id));
319  }
320 
329  {
330  return Glyphmodule(cmzn_scene_get_glyphmodule(id));
331  }
332 
342  {
343  return Materialmodule(cmzn_scene_get_materialmodule(id));
344  }
345 
353  {
354  return Scenefiltermodule(cmzn_scene_get_scenefiltermodule(id));
355  }
356 
364 
372  {
373  return Spectrummodule(cmzn_scene_get_spectrummodule(id));
374  }
375 
383  {
384  return Tessellationmodule(cmzn_scene_get_tessellationmodule(id));
385  }
386 
394  {
395  return Timekeepermodule(cmzn_scene_get_timekeepermodule(id));
396  }
397 
404  {
405  return Field(cmzn_scene_get_selection_field(id));
406  }
407 
418  int setSelectionField(const Field& selectionField)
419  {
420  return cmzn_scene_set_selection_field(id, selectionField.getId());
421  }
422 
443  int getSpectrumDataRange(const Scenefilter& filter, const Spectrum& spectrum,
444  int valuesCount, double *minimumValuesOut, double *maximumValuesOut)
445  {
446  return cmzn_scene_get_spectrum_data_range(id, filter.getId(),
447  spectrum.getId(), valuesCount, minimumValuesOut, maximumValuesOut);
448  }
449 
456  {
457  return cmzn_scene_get_visibility_flag(id);
458  }
459 
467  int setVisibilityFlag(bool visibilityFlag)
468  {
469  return cmzn_scene_set_visibility_flag(id, visibilityFlag);
470  }
471 
483  int moveGraphicsBefore(const Graphics& graphics, const Graphics& refGraphics)
484  {
485  return cmzn_scene_move_graphics_before(id, graphics.getId(), refGraphics.getId());
486  }
487 
494  {
495  return cmzn_scene_remove_all_graphics(id);
496  }
497 
504  int removeGraphics(const Graphics& graphics)
505  {
506  return cmzn_scene_remove_graphics(id, graphics.getId());
507  }
508 
516 
517 };
518 
519 inline bool operator==(const Scene& a, const Scene& b)
520 {
521  return a.getId() == b.getId();
522 }
523 
525 {
526  return Scene(cmzn_region_get_scene(id));
527 }
528 
530 {
531  return Scene(cmzn_graphics_get_scene(id));
532 }
533 
534 } // namespace Zinc
535 }
536 
537 #endif
Graphics getFirstGraphics()
Definition: scene.hpp:264
Graphics getNextGraphics(const Graphics &refGraphics)
Definition: scene.hpp:275
cmzn_scenefilter_id getId() const
Definition: scenefilter.hpp:86
Lines visualise 1-D elements in the model.
Definition: graphics.hpp:824
int setVisibilityFlag(bool visibilityFlag)
Definition: scene.hpp:467
Materialmodule getMaterialmodule()
Definition: scene.hpp:341
Utility object for picking graphics and model objects.
Definition: scenepicker.hpp:32
int endChange()
Definition: scene.hpp:114
int removeGraphics(const Graphics &graphics)
Definition: scene.hpp:504
Surfaces visualise 2-D elements in the model.
Definition: graphics.hpp:991
Scenepicker createScenepicker()
Definition: scenepicker.hpp:236
Glyphmodule getGlyphmodule()
Definition: scene.hpp:328
Base field type: an abstraction of a mathematical field.
Definition: field.hpp:46
Graphics createGraphics(Graphics::Type graphicsType)
Definition: scene.hpp:160
Module managing all fonts.
Definition: font.hpp:268
cmzn_nodeset_id getId() const
Definition: node.hpp:474
bool isValid() const
Definition: scene.hpp:76
Container/manager for graphics visualising a region.
Definition: scene.hpp:34
int getSpectrumDataRange(const Scenefilter &filter, const Spectrum &spectrum, int valuesCount, double *minimumValuesOut, double *maximumValuesOut)
Definition: scene.hpp:443
Points graphics visualise discrete locations in the model.
Definition: graphics.hpp:851
Tessellationmodule getTessellationmodule()
Definition: scene.hpp:382
Manages individual user notification of changes to the selection group.
Definition: selection.hpp:158
A hierarchical block/namespace owning domains and fields.
Definition: region.hpp:33
int setSelectionField(const Field &selectionField)
Definition: scene.hpp:418
Base graphics type: produces 3-D graphics visualising domains and fields.
Definition: graphics.hpp:45
cmzn_spectrum_id getId() const
Definition: spectrum.hpp:638
Module managing all scene filters.
Definition: scenefilter.hpp:308
GraphicsPoints createGraphicsPoints()
Definition: scene.hpp:197
int convertToPointCloud(const Scenefilter &filter, const Nodeset &nodeset, const Field &coordinateField, double lineDensity, double lineDensityScaleFactor, double surfaceDensity, double surfaceDensityScaleFactor)
Definition: scene.hpp:144
cmzn_field_id getId() const
Definition: field.hpp:98
bool getVisibilityFlag()
Definition: scene.hpp:455
GraphicsLines createGraphicsLines()
Definition: scene.hpp:184
Module object for creating and managing scene viewers.
Definition: sceneviewer.hpp:1078
Field getSelectionField()
Definition: scene.hpp:403
GraphicsContours createGraphicsContours()
Definition: scene.hpp:173
cmzn_scene_id getId() const
Definition: scene.hpp:86
GraphicsStreamlines createGraphicsStreamlines()
Definition: scene.hpp:207
Module managing all spectrums.
Definition: spectrum.hpp:847
Module managing all materials.
Definition: material.hpp:278
Zinc Spectrum maps values of graphics data fields to colours.
Definition: spectrum.hpp:581
Scene getScene()
Definition: scene.hpp:524
Module managing all glyphs.
Definition: glyph.hpp:602
int moveGraphicsBefore(const Graphics &graphics, const Graphics &refGraphics)
Definition: scene.hpp:483
Sceneviewermodule getSceneviewermodule()
Definition: sceneviewer.hpp:1158
Scenefiltermodule getScenefiltermodule()
Definition: scene.hpp:352
Graphics findGraphicsByName(const char *name)
Definition: scene.hpp:254
Fontmodule getFontmodule()
Definition: scene.hpp:316
Module managing all tessellation objects.
Definition: tessellation.hpp:247
Streamlines visualise the path of a fluid particle tracking along a vector field. ...
Definition: graphics.hpp:880
Spectrummodule getSpectrummodule()
Definition: scene.hpp:371
int removeAllGraphics()
Definition: scene.hpp:493
Module for finding and managing timekeepers.
Definition: timekeeper.hpp:222
Type
Definition: graphics.hpp:131
Scene filters determines which graphics are drawn.
Definition: scenefilter.hpp:33
Timekeepermodule getTimekeepermodule()
Definition: scene.hpp:393
int beginChange()
Definition: scene.hpp:100
The contours derived graphics type.
Definition: graphics.hpp:691
Scene getScene()
Definition: scene.hpp:529
cmzn_graphics_id getId() const
Definition: graphics.hpp:153
Region getRegion() const
Definition: scene.hpp:306
Graphics getPreviousGraphics(const Graphics &refGraphics)
Definition: scene.hpp:286
Selectionnotifier createSelectionnotifier()
Definition: scene.hpp:231
int getNumberOfGraphics()
Definition: scene.hpp:296
A set of nodes or points.
Definition: node.hpp:421
GraphicsSurfaces createGraphicsSurfaces()
Definition: scene.hpp:218