Atoms Crowd  4.1.0
HeightFields.h
1 #pragma once
2 // ===========================================================================
3 // Copyright (c) 2015 Toolchefs Ltd. All rights reserved.
4 //
5 // Use of this software is subject to the terms of the Toolchefs license
6 // agreement provided at the time of installation or download, or which
7 // otherwise accompanies this software in either electronic or hard copy form.
8 // ===========================================================================
9 
10 #include <AtomsCore/Globals.h>
11 #include <Atoms/Globals.h>
12 #include <Atoms/HeightField.h>
13 #include <map>
14 
15 namespace Atoms
16 {
18  class ATOMS_EXPORT HeightFields
19  {
20  public:
21 
24 
27 
30 
33 
36 
38 
42  AtomsPtr<HeightField> heightField(const std::string& name);
43  AtomsWPtr<HeightField> heightFieldWPtr(const std::string& name);
44  HeightField* heightFieldPtr(const std::string& name);
45 
47  bool hasHeightField(const std::string& name);
48 
50 
54  void addHeightField(const std::string& name, AtomsPtr<HeightField>& field, bool replace = false, bool animated = false, short gridMode = 0);
55 
57  void insertHeightField(const std::string& name, AtomsPtr<HeightField>& field, bool replace = false, bool animated = false);
58 
60 
63  void removeHeightField(const std::string& name);
64 
66 
69  std::vector<std::string> heightFieldNames();
70 
72 
76  bool heightFieldExists(const std::string& name);
77 
79 
83  void setAnimated(const std::string& name, bool value);
84 
86 
90  bool isAnimated(const std::string& name);
91 
93  unsigned int numHeightFields();
94 
96  void clear();
97 
98  private:
99 
100  typedef std::map<std::string, std::pair<AtomsPtr<HeightField>, bool>> HeightFieldsMap;
101 
103 
106  HeightFieldsMap m_heightFieldsMap;
107  };
108 }
Atoms::HeightFields::hasHeightField
bool hasHeightField(const std::string &name)
Checks if an height field with the given name exists.
Atoms::HeightFields::removeHeightField
void removeHeightField(const std::string &name)
Removes an hf from the map.
Atoms::HeightFields::heightField
AtomsPtr< HeightField > heightField(const std::string &name)
Gets an hf.
Atoms::HeightFields::setAnimated
void setAnimated(const std::string &name, bool value)
Sets the hf animated flag.
Atoms::HeightFields
Container for all agent types.
Definition: HeightFields.h:19
Atoms::HeightFields::isAnimated
bool isAnimated(const std::string &name)
Checks if an hf is animated.
Atoms::HeightFields::instance
static HeightFields & instance()
Singleton access.
Atoms::HeightFields::HeightFields
HeightFields(const HeightFields &)
Private copy constructor.
Atoms::HeightFields::clear
void clear()
Removes all hf.
Atoms::HeightFields::heightFieldNames
std::vector< std::string > heightFieldNames()
Gets all hf names.
Atoms::HeightFields::operator=
HeightFields & operator=(const HeightFields &)
Private assign operator.
Atoms
Atoms namespace.
Definition: Agent.h:28
Atoms::HeightFields::~HeightFields
~HeightFields()
Private destructor.
Atoms::HeightFields::heightFieldExists
bool heightFieldExists(const std::string &name)
Checks if a hf exists.
Atoms::HeightFields::addHeightField
void addHeightField(const std::string &name, AtomsPtr< HeightField > &field, bool replace=false, bool animated=false, short gridMode=0)
Adds an hf to the map.
Atoms::HeightFields::numHeightFields
unsigned int numHeightFields()
Gets the number of hf.
Atoms::HeightField
Container for all agent types.
Definition: HeightField.h:17
Atoms::HeightFields::HeightFields
HeightFields()
Private constructor.
Atoms::HeightFields::insertHeightField
void insertHeightField(const std::string &name, AtomsPtr< HeightField > &field, bool replace=false, bool animated=false)
Adds an hf to the map.