-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathintensityMap.cpp
More file actions
89 lines (68 loc) · 2.43 KB
/
Copy pathintensityMap.cpp
File metadata and controls
89 lines (68 loc) · 2.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*************************************************************************
IntensityMap - description
-------------------
authors : Laurent Francioli
copyright : Institut universitaire romand de Sante au Travail
University of Geneva (UniGe)
*************************************************************************/
//---------- Class <IntensityMap> (fichier intensityMap.cpp) ----------
#include "intensityMap.h"
//----------------------------------------------------------------- PUBLIC
//--------------------------------------------------------- Public Methods
void IntensityMap::clear(){
intensities->clear();
mapComplete = false;
}
//Sets the number of Vertices of the model (important to know if map is complete)
void IntensityMap::setNumModelVertices(int numModelVertices)
{
numModelVert = numModelVertices;
evaluateMapComplete();
}
//Re-Evaluate if the map is complete. Should be used if unsure whether the evaluation
//is up-to-date.
bool IntensityMap::evaluateMapComplete()
{
mapComplete = false;
if (numModelVert>0 && intensities->size() == numModelVert)
{
mapComplete = true;
}
return mapComplete;
}
//Loads the map corresponding to the given path. Checks whether the map is complete
void IntensityMap::loadMap(string path)
{
mapPath = path;
if(!mapPath.empty()){
delete intensities;
intensities = IOFile::loadIntensityMap(mapPath.c_str());
}
evaluateMapComplete();
}
//Saves the current map.
//If the map was complete before saving, you need to set overwrite
//to true to actually save the map.
void IntensityMap::saveMap(bool overwrite)
{
if ((overwrite || !mapComplete) && evaluateMapComplete() && !mapPath.empty())
{
IOFile::saveIntensityMap(mapPath.c_str(), intensities);
}
}
//--------------------------------------------------- Operator Overloading
//---------------------------------------------- Constructors - destructor
//Constructor with optional args
IntensityMap::IntensityMap(int numModelVertices, string path){
numModelVert = numModelVertices;
loadMap(path);
evaluateMapComplete();
intensities = new vector<float>;
}
//Destructor
IntensityMap::~IntensityMap ( )
{
delete intensities;
}
//---------------------------------------------------------------- PRIVATE
//------------------------------------------------------ Protected Methods