SceneGroup.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2012-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5  *
6  * ArmarX is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * ArmarX is distributed in the hope that it will be useful, but
11  * 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, see <http://www.gnu.org/licenses/>.
17  *
18  * @package MemoryX::gui-plugins::SceneEditor
19  * @date 2015
20  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
21  * GNU General Public License
22  */
23 
24 #include <string>
25 #include <vector>
26 #include <algorithm>
27 
28 #include "SceneGroup.h"
29 
31 {
32  return this->groupID;
33 }
34 
35 std::vector<scene3D::SceneObjectPtr> scene3D::SceneGroup::getAllObjects()
36 {
37  return this->objects;
38 }
39 
41 {
42  return std::find(objects.begin(), objects.end(), object) != objects.end();
43 }
44 
46 {
47  //Check if object already exists in group
48  if (object == NULL || this->contains(object))
49  {
50  return;
51  }
52 
53  //Otherwise push object in our list
54  objects.push_back(object);
55 }
56 
58 {
59  //Parameter is not null and object is contained in group
60  if (object != NULL && this->contains(object))
61  {
62  //Remove object from list
63  objects.erase(std::remove(objects.begin(), objects.end(), object), objects.end());
64  }
65 }
66 
68 {
69  this->objects.clear();
70 }
71 
72 scene3D::SceneGroup::SceneGroup(const std::string& groupID) : groupID(groupID)
73 {
74 
75 }
76 
77 void scene3D::SceneGroup::setGroupId(std::string groupId)
78 {
79  this->groupID = groupId;
80 }
scene3D::SceneGroup::getGroupId
std::string getGroupId()
Returns the ID of the SceneGroup.
Definition: SceneGroup.cpp:30
scene3D::SceneGroup::addObject
void addObject(scene3D::SceneObjectPtr object)
Adds an Object to the SceneGroup.
Definition: SceneGroup.cpp:45
scene3D::SceneGroup::clearGroup
void clearGroup()
Removes all Objects from the SceneGroup.
Definition: SceneGroup.cpp:67
armarx::armem::contains
bool contains(const MemoryID &general, const MemoryID &specific)
Indicates whether general is "less specific" than, or equal to, specific, i.e.
Definition: MemoryID.cpp:558
scene3D::SceneGroup::contains
bool contains(scene3D::SceneObjectPtr object)
Checks, if SceneGroup contains Object.
Definition: SceneGroup.cpp:40
SceneGroup.h
scene3D::SceneObjectPtr
boost::intrusive_ptr< SceneObject > SceneObjectPtr
Definition: PointerDefinitions.h:40
scene3D::SceneGroup::getAllObjects
std::vector< scene3D::SceneObjectPtr > getAllObjects()
Returns all Objects in SceneGroup.
Definition: SceneGroup.cpp:35
scene3D::SceneGroup::SceneGroup
SceneGroup(const std::string &groupID)
Constructor Creates an instance of the class.
Definition: SceneGroup.cpp:72
scene3D::SceneGroup::removeObject
void removeObject(scene3D::SceneObjectPtr object)
Removes an Object from the SceneGroup.
Definition: SceneGroup.cpp:57