OpenCMISS-Zinc 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 
154  Graphics createGraphics(Graphics::Type graphicsType)
155  {
156  return Graphics(cmzn_scene_create_graphics(id,
157  static_cast<cmzn_graphics_type>(graphicsType)));
158  }
159 
168  {
169  return GraphicsContours(cmzn_scene_create_graphics_contours(id));
170  }
171 
179  {
180  return GraphicsLines(cmzn_scene_create_graphics_lines(id));
181  }
182 
192  {
193  return GraphicsPoints(cmzn_scene_create_graphics_points(id));
194  }
195 
202  {
203  return GraphicsStreamlines(cmzn_scene_create_graphics_streamlines(id));
204  }
205 
213  {
214  return GraphicsSurfaces(cmzn_scene_create_graphics_surfaces(id));
215  }
216 
226  {
227  return Selectionnotifier(cmzn_scene_create_selectionnotifier(id));
228  }
229 
248  Graphics findGraphicsByName(const char *name)
249  {
250  return Graphics(cmzn_scene_find_graphics_by_name(id, name));
251  }
252 
259  {
260  return Graphics(cmzn_scene_get_first_graphics(id));
261  }
262 
269  Graphics getNextGraphics(const Graphics& refGraphics)
270  {
271  return Graphics(cmzn_scene_get_next_graphics(id, refGraphics.getId()));
272  }
273 
281  {
282  return Graphics(cmzn_scene_get_previous_graphics(id, refGraphics.getId()));
283  }
284 
291  {
292  return cmzn_scene_get_number_of_graphics(id);
293  }
294 
300  inline Region getRegion() const
301  {
302  return Region(cmzn_scene_get_region(id));
303  }
304 
311  {
312  return Fontmodule(cmzn_scene_get_fontmodule(id));
313  }
314 
323  {
324  return Glyphmodule(cmzn_scene_get_glyphmodule(id));
325  }
326 
336  {
337  return Materialmodule(cmzn_scene_get_materialmodule(id));
338  }
339 
347  {
348  return Scenefiltermodule(cmzn_scene_get_scenefiltermodule(id));
349  }
350 
358 
366  {
367  return Spectrummodule(cmzn_scene_get_spectrummodule(id));
368  }
369 
377  {
378  return Tessellationmodule(cmzn_scene_get_tessellationmodule(id));
379  }
380 
388  {
389  return Timekeepermodule(cmzn_scene_get_timekeepermodule(id));
390  }
391 
398  {
399  return Field(cmzn_scene_get_selection_field(id));
400  }
401 
412  int setSelectionField(const Field& selectionField)
413  {
414  return cmzn_scene_set_selection_field(id, selectionField.getId());
415  }
416 
437  int getSpectrumDataRange(const Scenefilter& filter, const Spectrum& spectrum,
438  int valuesCount, double *minimumValuesOut, double *maximumValuesOut)
439  {
440  return cmzn_scene_get_spectrum_data_range(id, filter.getId(),
441  spectrum.getId(), valuesCount, minimumValuesOut, maximumValuesOut);
442  }
443 
450  {
451  return cmzn_scene_get_visibility_flag(id);
452  }
453 
461  int setVisibilityFlag(bool visibilityFlag)
462  {
463  return cmzn_scene_set_visibility_flag(id, visibilityFlag);
464  }
465 
477  int moveGraphicsBefore(const Graphics& graphics, const Graphics& refGraphics)
478  {
479  return cmzn_scene_move_graphics_before(id, graphics.getId(), refGraphics.getId());
480  }
481 
488  {
489  return cmzn_scene_remove_all_graphics(id);
490  }
491 
498  int removeGraphics(const Graphics& graphics)
499  {
500  return cmzn_scene_remove_graphics(id, graphics.getId());
501  }
502 
503  Scenepicker createScenepicker();
504 
505 };
506 
507 inline bool operator==(const Scene& a, const Scene& b)
508 {
509  return a.getId() == b.getId();
510 }
511 
513 {
514  return Scene(cmzn_region_get_scene(id));
515 }
516 
518 {
519  return Scene(cmzn_graphics_get_scene(id));
520 }
521 
522 } // namespace Zinc
523 }
524 
525 #endif
Graphics getFirstGraphics()
Definition: scene.hpp:258
Graphics getNextGraphics(const Graphics &refGraphics)
Definition: scene.hpp:269
cmzn_scenefilter_id getId() const
Definition: scenefilter.hpp:86
Lines visualise 1-D elements in the model.
Definition: graphics.hpp:796
int setVisibilityFlag(bool visibilityFlag)
Definition: scene.hpp:461
Materialmodule getMaterialmodule()
Definition: scene.hpp:335
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:498
Surfaces visualise 2-D elements in the model.
Definition: graphics.hpp:964
Glyphmodule getGlyphmodule()
Definition: scene.hpp:322
Base field type: an abstraction of a mathematical field.
Definition: field.hpp:46
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:437
Points graphics visualise discrete locations in the model.
Definition: graphics.hpp:823
Tessellationmodule getTessellationmodule()
Definition: scene.hpp:376
Manages individual user notification of changes to the selection group.
Definition: selection.hpp:160
A hierarchical block/namespace owning domains and fields.
Definition: region.hpp:33
int setSelectionField(const Field &selectionField)
Definition: scene.hpp:412
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:191
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:449
GraphicsLines createGraphicsLines()
Definition: scene.hpp:178
Module object for creating and managing scene viewers.
Definition: sceneviewer.hpp:1086
Field getSelectionField()
Definition: scene.hpp:397
GraphicsContours createGraphicsContours()
Definition: scene.hpp:167
cmzn_scene_id getId() const
Definition: scene.hpp:86
GraphicsStreamlines createGraphicsStreamlines()
Definition: scene.hpp:201
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:512
Module managing all glyphs.
Definition: glyph.hpp:602
int moveGraphicsBefore(const Graphics &graphics, const Graphics &refGraphics)
Definition: scene.hpp:477
Sceneviewermodule getSceneviewermodule()
Definition: sceneviewer.hpp:1158
Scenefiltermodule getScenefiltermodule()
Definition: scene.hpp:346
Graphics findGraphicsByName(const char *name)
Definition: scene.hpp:248
Fontmodule getFontmodule()
Definition: scene.hpp:310
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:852
Spectrummodule getSpectrummodule()
Definition: scene.hpp:365
int removeAllGraphics()
Definition: scene.hpp:487
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:387
int beginChange()
Definition: scene.hpp:100
The contours derived graphics type.
Definition: graphics.hpp:663
Scene getScene()
Definition: scene.hpp:517
cmzn_graphics_id getId() const
Definition: graphics.hpp:153
Region getRegion() const
Definition: scene.hpp:300
Graphics getPreviousGraphics(const Graphics &refGraphics)
Definition: scene.hpp:280
Selectionnotifier createSelectionnotifier()
Definition: scene.hpp:225
int getNumberOfGraphics()
Definition: scene.hpp:290
A set of nodes or points.
Definition: node.hpp:421
GraphicsSurfaces createGraphicsSurfaces()
Definition: scene.hpp:212