1 #ifndef Csc3dElementModelsRepository_h
2 #define Csc3dElementModelsRepository_h
11 class CscEntityModelsRepository;
18 class CscObjectModelsRepository;
19 class CscPlaceModelsRepository;
21 class Csc3dElementModelResolverOffline;
32 string toString()
const;
53 void setOnlineLibraryServiceEnabled(
bool enabled);
55 inline static const string EntityModelFileNamePrefix =
"Conscience_";
56 inline static const string PlaceModelFileNamePrefix =
"Conscience_";
57 inline static const string ObjectModelFileNamePrefix =
"Conscience_Object_";
59 static fs::path get3dElementModelsDaeDirectoryPath(
Csc3dElementType elementType);
60 static fs::path get3dElementModelsglTFDirectoryPath(
Csc3dElementType elementType);
61 static fs::path get3dElementModelsObjDirectoryPath(
Csc3dElementType elementType);
62 static fs::path get3dElementModelsLogoDirectoryPath(
Csc3dElementType elementType);
66 static fs::path get3dElementModelSourceDirectoryPath(
Csc3dElementType elementType, CscWorldElementModelFormat format);
68 static fs::path get3dElementModelsLocalRepositoryPath(
Csc3dElementType elementType);
70 static void set3dElementModelsLocalRepositoryPath(
Csc3dElementType elementType, fs::path directoryPath);
102 virtual optional<CscWorldElementModelSourceSpec> getModelSource(
const string &modelId, optional<CscWorldElementModelFormat> requestedFormat = {}, optional<OnProgressCallback>
onProgress = {});
107 vector<string> getAllAvailableIds();
113 vector<ptr<const Csc3dElementModel>> getAllAvailableModels(optional<CscWorldElementModelFormat> requestedFormat = {});
120 void importLocalModelFile(
const fs::path &filePath,
const Csc3dElementModelImportData &importData);
124 unique_ptr<CscLogger>
logger = CscLogger::getForCategory(
"Csc3dElementModelsRepository");
125 void recheckOnlineMode();
130 inline static optional<fs::path> ConscienceEntitiesRessourceLocalRepositoryPath = {};
131 inline static optional<fs::path> ConsciencePlacesRessourceLocalRepositoryPath = {};
132 inline static optional<fs::path> ConscienceObjectsRessourceLocalRepositoryPath = {};
134 bool onlineModeAllowed =
false;
141 unsigned long long lastOnlineCheckTimeMillis = 0;
150 template <
class TModel>
153 const lock_guard<mutex> lock(cacheMutex);
154 map<string, ptr<const Csc3dElementModel>>::iterator match = modelsCache.find(
id);
155 if (match != modelsCache.end()) {
157 return newptr<const TModel>(*match->second);
161 LOGGER_TRACE(
"getModel(" +
id +
") - cache miss, delegate to resolver");
165 const lock_guard<mutex> lock(resolverOnlineCheckMutex);
166 auto modelPtr = resolver->resolve(
id);
168 model = newptr<TModel>(*modelPtr);
172 if (model !=
nullptr) {
174 modelsCache[id] = model;
185 fs::path getModelSourceDirectoryPath(CscWorldElementModelFormat format);
190 static constexpr
int MODEL_ID_FIRE = 777;
191 static constexpr
int MODEL_ID_PERSON = 10;
192 static constexpr
int MODEL_ID_UNCONSCIOUS_PERSON = 49;
193 static constexpr
int MODEL_ID_ARROW_BLUE = 0;
194 static constexpr
int MODEL_ID_TENNIS_BALL = 1;
195 static constexpr
int MODEL_ID_CUBE = 3;
196 static constexpr
int MODEL_ID_CAR = 2;
197 static constexpr
int MODEL_ID_BED = 161;
198 static constexpr
int MODEL_ID_CHAIR = 17;
199 static constexpr
int MODEL_ID_PERSON_STANDING = 160;
200 static constexpr
int MODEL_ID_PERSON_NURSE = 189;
208 unsigned long long lastModificationTimeMillis)
216 #define PLACE_MODEL_NAME_CHECKERBOARD "checkerboard"
217 #define PLACE_MODEL_OWNER_CHECKERBOARD "Conscience"
220 static constexpr
int MODEL_ID_CHECKERBOARD = 32;
228 unsigned long long lastModificationTimeMillis)