1 /* 2 Copyright (C) 2010-2014 Kristian Duske 3 4 This file is part of TrenchBroom. 5 6 TrenchBroom is free software: you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation, either version 3 of the License, or 9 (at your option) any later version. 10 11 TrenchBroom is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with TrenchBroom. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 #include "TakeSnapshotVisitor.h" 21 22 #include "Model/Brush.h" 23 #include "Model/Entity.h" 24 #include "Model/Group.h" 25 #include "Model/Layer.h" 26 #include "Model/World.h" 27 28 namespace TrenchBroom { 29 namespace Model { result() const30 const NodeSnapshotList& TakeSnapshotVisitor::result() const { 31 return m_result; 32 } 33 doVisit(World * world)34 void TakeSnapshotVisitor::doVisit(World* world) { handleNode(world); } doVisit(Layer * layer)35 void TakeSnapshotVisitor::doVisit(Layer* layer) { handleNode(layer); } doVisit(Group * group)36 void TakeSnapshotVisitor::doVisit(Group* group) { handleNode(group); } doVisit(Entity * entity)37 void TakeSnapshotVisitor::doVisit(Entity* entity) { handleNode(entity); } doVisit(Brush * brush)38 void TakeSnapshotVisitor::doVisit(Brush* brush) { handleNode(brush); } 39 handleNode(Node * node)40 void TakeSnapshotVisitor::handleNode(Node* node) { 41 NodeSnapshot* snapshot = node->takeSnapshot(); 42 if (snapshot != NULL) 43 m_result.push_back(snapshot); 44 } 45 } 46 } 47