SLProject  4.2.000
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
AppWAISlamParamHelper.h File Reference
#include <Utils.h>
#include <string>
Include dependency graph for AppWAISlamParamHelper.h:

Go to the source code of this file.

Classes

struct  SlamVideoInfos
 
struct  SlamMapInfos
 

Functions

static bool extractSlamVideoInfosFromFileName (std::string fileName, SlamVideoInfos *slamVideoInfos)
 
static std::string constructSlamMapIdentifierString (std::string location, std::string area, std::string extractorType, int nLevels, std::string dateTime="")
 
static bool extractSlamMapInfosFromFileName (std::string fileName, SlamMapInfos *slamMapInfos)
 
static std::string constructSlamLocationDir (std::string locationsRootDir, std::string location)
 
static std::string constructSlamAreaDir (std::string locationsRootDir, std::string location, std::string area)
 
static std::string constructSlamMapDir (std::string locationsRootDir, std::string location, std::string area)
 
static std::string constructSlamMapImgDir (std::string mapDir, std::string mapFileName)
 
static std::string constructSlamVideoDir (std::string locationsRootDir, std::string location, std::string area)
 
static std::string constructSlamMapFileName (std::string location, std::string area, std::string extractorType, int nLevels, std::string dateTime="", bool binaryMap=false)
 
static std::string constructBinarySlamMapFileName (std::string location, std::string area, std::string extractorType, int nLevels, std::string dateTime="")
 
static std::string constructSlamMarkerDir (std::string locationsRootDir, std::string location, std::string area)
 

Function Documentation

◆ constructBinarySlamMapFileName()

static std::string constructBinarySlamMapFileName ( std::string  location,
std::string  area,
std::string  extractorType,
int  nLevels,
std::string  dateTime = "" 
)
static

Definition at line 148 of file AppWAISlamParamHelper.h.

153 {
154  std::string result = constructSlamMapIdentifierString(location, area, extractorType, nLevels, dateTime) + ".waimap";
155 
156  return result;
157 }
static std::string constructSlamMapIdentifierString(std::string location, std::string area, std::string extractorType, int nLevels, std::string dateTime="")

◆ constructSlamAreaDir()

static std::string constructSlamAreaDir ( std::string  locationsRootDir,
std::string  location,
std::string  area 
)
static

Definition at line 103 of file AppWAISlamParamHelper.h.

104 {
105  std::string result = constructSlamLocationDir(locationsRootDir, location) + Utils::getFileNameWOExt(area) + "/";
106 
107  return result;
108 }
static std::string constructSlamLocationDir(std::string locationsRootDir, std::string location)
string getFileNameWOExt(const string &pathFilename)
Returns the filename without extension.
Definition: Utils.cpp:616

◆ constructSlamLocationDir()

static std::string constructSlamLocationDir ( std::string  locationsRootDir,
std::string  location 
)
static

Definition at line 96 of file AppWAISlamParamHelper.h.

97 {
98  std::string result = Utils::unifySlashes(locationsRootDir) + location + "/";
99 
100  return result;
101 }
string unifySlashes(const string &inputDir, bool withTrailingSlash)
Returns the inputDir string with unified forward slashes, e.g.: "dirA/dirB/".
Definition: Utils.cpp:368

◆ constructSlamMapDir()

static std::string constructSlamMapDir ( std::string  locationsRootDir,
std::string  location,
std::string  area 
)
static

Definition at line 110 of file AppWAISlamParamHelper.h.

111 {
112  std::string result = constructSlamAreaDir(locationsRootDir, location, area) + "maps/";
113 
114  return result;
115 }
static std::string constructSlamAreaDir(std::string locationsRootDir, std::string location, std::string area)

◆ constructSlamMapFileName()

static std::string constructSlamMapFileName ( std::string  location,
std::string  area,
std::string  extractorType,
int  nLevels,
std::string  dateTime = "",
bool  binaryMap = false 
)
static

Definition at line 133 of file AppWAISlamParamHelper.h.

139 {
140  std::string result = constructSlamMapIdentifierString(location, area, extractorType, nLevels, dateTime);
141  if (binaryMap)
142  result += ".waimap";
143  else
144  result += ".json.gz";
145  return result;
146 }

◆ constructSlamMapIdentifierString()

static std::string constructSlamMapIdentifierString ( std::string  location,
std::string  area,
std::string  extractorType,
int  nLevels,
std::string  dateTime = "" 
)
static

Definition at line 47 of file AppWAISlamParamHelper.h.

52 {
53  if (dateTime.empty())
54  {
55  dateTime = Utils::getDateTime2String();
56  }
57 
58  std::string result = "DEVELOPMENT-map_" + dateTime + "_" + location + "_" + area + "_" + extractorType + "_" + std::to_string(nLevels);
59 
60  return result;
61 }
string getDateTime2String()
Returns local time as string like "20190213-154611".
Definition: Utils.cpp:289

◆ constructSlamMapImgDir()

static std::string constructSlamMapImgDir ( std::string  mapDir,
std::string  mapFileName 
)
static

Definition at line 117 of file AppWAISlamParamHelper.h.

118 {
119  SlamMapInfos mapInfos;
120 
121  std::string result = Utils::unifySlashes(mapDir + Utils::getFileNameWOExt(mapFileName));
122 
123  return result;
124 }

◆ constructSlamMarkerDir()

static std::string constructSlamMarkerDir ( std::string  locationsRootDir,
std::string  location,
std::string  area 
)
static

Definition at line 159 of file AppWAISlamParamHelper.h.

160 {
161  std::string result = constructSlamAreaDir(locationsRootDir, location, area) + "markers/";
162 
163  return result;
164 }

◆ constructSlamVideoDir()

static std::string constructSlamVideoDir ( std::string  locationsRootDir,
std::string  location,
std::string  area 
)
static

Definition at line 126 of file AppWAISlamParamHelper.h.

127 {
128  std::string result = constructSlamAreaDir(locationsRootDir, location, area) + "videos/";
129 
130  return result;
131 }

◆ extractSlamMapInfosFromFileName()

static bool extractSlamMapInfosFromFileName ( std::string  fileName,
SlamMapInfos slamMapInfos 
)
static

Definition at line 63 of file AppWAISlamParamHelper.h.

65 {
66  bool result = false;
67 
68  *slamMapInfos = {};
69 
70  fileName = Utils::getFileNameWOExt(fileName);
71 
72  std::vector<std::string> stringParts;
73  Utils::splitString(fileName, '_', stringParts);
74 
75  if (stringParts.size() >= 4)
76  {
77  slamMapInfos->dateTime = stringParts[1];
78  slamMapInfos->location = stringParts[2];
79  slamMapInfos->area = stringParts[3];
80 
81  result = true;
82  }
83 
84  if (stringParts.size() >= 5)
85  {
86  slamMapInfos->extractorType = stringParts[4];
87  }
88 
89  if (stringParts.size() >= 6)
90  {
91  slamMapInfos->nLevels = std::stoi(stringParts[5]);
92  }
93  return result;
94 }
void splitString(const string &s, char delimiter, vector< string > &splits)
Splits an input string at a delimiter character into a string vector.
Definition: Utils.cpp:152
std::string location
std::string dateTime
std::string extractorType

◆ extractSlamVideoInfosFromFileName()

static bool extractSlamVideoInfosFromFileName ( std::string  fileName,
SlamVideoInfos slamVideoInfos 
)
static

Definition at line 25 of file AppWAISlamParamHelper.h.

27 {
28  bool result = false;
29 
30  std::vector<std::string> stringParts;
31  Utils::splitString(fileName, '_', stringParts);
32 
33  if (stringParts.size() == 5)
34  {
35  slamVideoInfos->dateTime = stringParts[0];
36  slamVideoInfos->weatherConditions = stringParts[1];
37  slamVideoInfos->deviceString = stringParts[2];
38  slamVideoInfos->purpose = stringParts[3];
39  slamVideoInfos->resolution = stringParts[4];
40 
41  result = true;
42  }
43 
44  return result;
45 }
std::string weatherConditions
std::string deviceString