Overte C++ Documentation
UpdateEntityOperator.h
1 //
2 // UpdateEntityOperator.h
3 // libraries/entities/src
4 //
5 // Created by Brad Hefta-Gaub on 8/11/2014.
6 // Copyright 2014 High Fidelity, Inc.
7 //
8 // Distributed under the Apache License, Version 2.0.
9 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
10 //
11 
12 #ifndef hifi_UpdateEntityOperator_h
13 #define hifi_UpdateEntityOperator_h
14 
15 #include "EntitiesLogging.h"
16 #include "EntityItem.h"
17 #include "EntityItemProperties.h"
18 #include "EntityTree.h"
19 #include "EntityTreeElement.h"
20 
21 class UpdateEntityOperator : public RecurseOctreeOperator {
22 public:
23  UpdateEntityOperator(EntityTreePointer tree, EntityTreeElementPointer containingElement,
24  EntityItemPointer existingEntity, const AACube newQueryAACube);
25 
26  ~UpdateEntityOperator();
27 
28  virtual bool preRecursion(const OctreeElementPointer& element) override;
29  virtual bool postRecursion(const OctreeElementPointer& element) override;
30  virtual OctreeElementPointer possiblyCreateChildAt(const OctreeElementPointer& element, int childIndex) override;
31 private:
32  EntityTreePointer _tree;
33  EntityItemPointer _existingEntity;
34  EntityTreeElementPointer _containingElement;
35  AACube _containingElementCube; // we temporarily store our cube here in case we need to delete the containing element
36  EntityItemID _entityItemID;
37  bool _foundOld;
38  bool _foundNew;
39  bool _removeOld;
40  quint64 _changeTime;
41 
42  AACube _oldEntityCube;
43  AACube _newEntityCube;
44 
45  AABox _oldEntityBox; // clamped to domain
46  AABox _newEntityBox; // clamped to domain
47 
48  bool subTreeContainsOldEntity(const OctreeElementPointer& element);
49  bool subTreeContainsNewEntity(const OctreeElementPointer& element);
50 
51  bool _wantDebug;
52 };
53 
54 #endif // hifi_UpdateEntityOperator_h
Abstract ID for editing model items. Used in EntityItem JS API.
Definition: EntityItemID.h:28
derive from this class to use the Octree::recurseTreeWithOperator() method
Definition: Octree.h:43