Graphite  Version 3
An experimental 3D geometry processing program
composite_grob.h
Go to the documentation of this file.
1 /*
2  * OGF/Graphite: Geometry and Graphics Programming Library + Utilities
3  * Copyright (C) 2000 Bruno Levy
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  *
19  * If you modify this software, you should include a notice giving the
20  * name of the person performing the modification, the date of modification,
21  * and the reason for such modification.
22  *
23  * Contact: Bruno Levy
24  *
25  * levy@loria.fr
26  *
27  * ISA Project
28  * LORIA, INRIA Lorraine,
29  * Campus Scientifique, BP 239
30  * 54506 VANDOEUVRE LES NANCY CEDEX
31  * FRANCE
32  *
33  * Note that the GNU General Public License does not permit incorporating
34  * the Software into proprietary programs.
35  */
36 
37 #ifndef H_OGF_SCENE_GRAPH_TYPES_COMPOSITE_GROB_H
38 #define H_OGF_SCENE_GRAPH_TYPES_COMPOSITE_GROB_H
39 
43 
44 #include <map>
45 
51 namespace OGF {
52 
53 //_________________________________________________________
54 
55 
60  gom_class SCENE_GRAPH_API CompositeGrobScope : public Scope {
61  public:
68 
72  ~CompositeGrobScope() override;
73 
77  Any resolve(const std::string& name) override;
78 
82  void list_names(std::vector<std::string>& names) const override;
83  };
84 
85 
93  gom_class SCENE_GRAPH_API CompositeGrob : public Grob {
94  public:
95 
102 
103  gom_properties:
104 
109  Scope* get_objects() const {
110  return new CompositeGrobScope(const_cast<CompositeGrob*>(this));
111  }
112 
113  gom_slots:
119  bool is_bound(const std::string& name) const;
120 
126  Grob* resolve(const std::string& name) const;
127 
134  Grob* ith_child(index_t i) const;
135 
141  void add_child(Node* child) override;
142 
147  void remove_child(Node* child) override;
148 
149  public:
150 
154  Box3d bbox() const override;
155 
159  Box3d world_bbox() const override;
160  };
161 
162 
168 
169 //_________________________________________________________
170 
171 }
172 #endif
173 
A smart pointer with reference-counted copy semantics.
Definition: smart_pointer.h:76
A class that stores a variable of arbitrary type.
Definition: any.h:62
A 3d axis aligned box.
Definition: geometry.h:235
An Interpreter Scope that corresponds to the objects in a CompositeGrob.
void list_names(std::vector< std::string > &names) const override
Lists all the variable names available in this scope.
Any resolve(const std::string &name) override
Finds a variable by id.
CompositeGrobScope(CompositeGrob *grob)
CompositeGrobScope constructor.
~CompositeGrobScope() override
CompositeGrobScope destructor.
A Composite Graphite Object.
Box3d bbox() const override
Gets the bounding box.
Grob * ith_child(index_t i) const
Gets a child by index.
Grob * resolve(const std::string &name) const
Finds a child by name.
Box3d world_bbox() const override
Gets the bounding box in world coordinates.
CompositeGrob(CompositeGrob *parent)
CompositeGrob constructor.
void add_child(Node *child) override
Adds a child to this Grob.
void remove_child(Node *child) override
Removes a child from this Grob.
Base class for all 3D Graphite objects.
Definition: grob.h:68
A composite object in the GOM system.
Definition: node.h:58
A naming scope in an Interpreter.
Definition: interpreter.h:69
The base class for all 3D objects in the system.
The abstract base class for the GOM interpreter.
geo_index_t index_t
The type for storing and manipulating indices.
Definition: numeric.h:329
Global Graphite namespace.
Definition: common.h:76
SmartPointer< CompositeGrob > CompositeGrob_var
An automatic reference-counted pointer to a CompositeGrob.
Definitions common to all include files in the scene_graph library.