3D Repo Bouncer  1.4
repo_bson_factory.h
1 
23 #pragma once
24 #include "../repo_node_utils.h"
25 
26 #include "repo_bson_project_settings.h"
27 #include "repo_bson_role.h"
28 #include "repo_bson_role_settings.h"
29 #include "repo_bson_user.h"
30 #include "repo_node.h"
31 #include "repo_node_camera.h"
32 #include "repo_node_metadata.h"
33 #include "repo_node_material.h"
34 #include "repo_node_map.h"
35 #include "repo_node_mesh.h"
36 #include "repo_node_reference.h"
37 #include "repo_node_revision.h"
38 #include "repo_node_texture.h"
39 #include "repo_node_transformation.h"
40 
41 namespace repo {
42  namespace core {
43  namespace model {
44  class REPO_API_EXPORT RepoBSONFactory
45  {
46  public:
47 
60  static RepoProjectSettings makeRepoProjectSettings(
61  const std::string &uniqueProjectName,
62  const std::string &owner,
63  const std::string &type = REPO_DEFAULT_PROJECT_TYPE_ARCHITECTURAL,
64  const std::string &description = std::string(),
65  const double pinSize = REPO_DEFAULT_PROJECT_PIN_SIZE,
66  const double avatarHeight = REPO_DEFAULT_PROJECT_AVATAR_HEIGHT,
67  const double visibilityLimit = REPO_DEFAULT_PROJECT_VISIBILITY_LIMIT,
68  const double speed = REPO_DEFAULT_PROJECT_SPEED,
69  const double zNear = REPO_DEFAULT_PROJECT_ZNEAR,
70  const double zFar = REPO_DEFAULT_PROJECT_ZFAR);
71 
81  static RepoRole makeRepoRole(
82  const std::string &roleName,
83  const std::string &database,
84  const std::vector<RepoPermission> &permissions = std::vector<RepoPermission>(),
85  const RepoRole &oldRole = RepoRole());
86 
95  static RepoRole _makeRepoRole(
96  const std::string &roleName,
97  const std::string &database,
98  const std::vector<RepoPrivilege> &privileges,
99  const std::vector<std::pair<std::string, std::string>> &inheritedRoles
100  = std::vector<std::pair<std::string, std::string>>()
101  );
102 
103  static RepoRoleSettings makeRepoRoleSettings(
104  const std::string &uniqueRoleName,
105  const std::string &color,
106  const std::string &description = std::string(),
107  const std::vector<std::string> &modules = std::vector<std::string>());
108 
122  static RepoUser makeRepoUser(
123  const std::string &userName,
124  const std::string &password,
125  const std::string &firstName,
126  const std::string &lastName,
127  const std::string &email,
128  const std::list<std::pair<std::string, std::string>> &roles,
129  const std::list<std::pair<std::string, std::string>> &apiKeys,
130  const std::vector<char> &avatar);
131 
132  /*
133  * -------------------- REPO NODES ------------------------
134  */
135 
148  static RepoBSON appendDefaults(
149  const std::string &type,
150  const unsigned int api = REPO_NODE_API_LEVEL_0,
151  const repoUUID &sharedId = generateUUID(),
152  const std::string &name = std::string(),
153  const std::vector<repoUUID> &parents = std::vector<repoUUID>(),
154  const repoUUID &uniqueID = generateUUID());
155 
169  static CameraNode makeCameraNode(
170  const float &aspectRatio,
171  const float &farClippingPlane,
172  const float &nearClippingPlane,
173  const float &fieldOfView,
174  const repo_vector_t &lookAt,
175  const repo_vector_t &position,
176  const repo_vector_t &up,
177  const std::string &name = std::string(),
178  const int &apiLevel = REPO_NODE_API_LEVEL_1);
179 
186  static MaterialNode makeMaterialNode(
187  const repo_material_t &material,
188  const std::string &name = std::string(),
189  const int &apiLevel = REPO_NODE_API_LEVEL_1);
190 
197  static MapNode makeMapNode(
198  const uint32_t &width,
199  const uint32_t &zoom,
200  const float &tilt,
201  const float &tileSize,
202  const float &longitude,
203  const float &latitude,
204  const repo_vector_t &centrePoint,
205  const std::string &apiKey = std::string(),
206  const std::string &name = std::string(),
207  const int &apiLevel = REPO_NODE_API_LEVEL_1);
208 
218  static MetadataNode makeMetaDataNode(
219  RepoBSON &metadata,
220  const std::string &mimeType = std::string(),
221  const std::string &name = std::string(),
222  const std::vector<repoUUID> &parents = std::vector<repoUUID>(),
223  const int &apiLevel = REPO_NODE_API_LEVEL_1);
224 
234  static MetadataNode makeMetaDataNode(
235  const std::vector<std::string> &keys,
236  const std::vector<std::string> &values,
237  const std::string &name = std::string(),
238  const std::vector<repoUUID> &parents = std::vector<repoUUID>(),
239  const int &apiLevel = REPO_NODE_API_LEVEL_1);
253  static MeshNode makeMeshNode(
254  const std::vector<repo_vector_t> &vertices,
255  const std::vector<repo_face_t> &faces,
256  const std::vector<repo_vector_t> &normals,
257  const std::vector<std::vector<float>> &boundingBox,
258  const std::vector<std::vector<repo_vector2d_t>> &uvChannels = std::vector<std::vector<repo_vector2d_t>>(),
259  const std::vector<repo_color4d_t> &colors = std::vector<repo_color4d_t>(),
260  const std::vector<std::vector<float>> &outline = std::vector<std::vector<float>>(),
261  const std::string &name = std::string(),
262  const int &apiLevel = REPO_NODE_API_LEVEL_1);
263 
274  static ReferenceNode makeReferenceNode(
275  const std::string &database,
276  const std::string &project,
277  const repoUUID &revisionID = stringToUUID(REPO_HISTORY_MASTER_BRANCH),
278  const bool &isUniqueID = false,
279  const std::string &name = std::string(),
280  const int &apiLevel = REPO_NODE_API_LEVEL_1);
281 
299  static RevisionNode makeRevisionNode(
300  const std::string &user,
301  const repoUUID &branch,
302  const std::vector<repoUUID> &currentNodes,
303  //const std::vector<repoUUID> &added,
304  //const std::vector<repoUUID> &removed,
305  //const std::vector<repoUUID> &modified,
306  const std::vector<std::string> &files = std::vector<std::string>(),
307  const std::vector<repoUUID> &parent = std::vector<repoUUID>(),
308  const std::vector<double> &worldOffset = std::vector<double>(),
309  const std::string &message = std::string(),
310  const std::string &tag = std::string(),
311  const int &apiLevel = REPO_NODE_API_LEVEL_1
312  );
313 
324  static TextureNode makeTextureNode(
325  const std::string &name,
326  const char *data,
327  const uint32_t &byteCount,
328  const uint32_t &width,
329  const uint32_t &height,
330  const int &apiLevel = REPO_NODE_API_LEVEL_1);
331 
340  static TransformationNode makeTransformationNode(
341  const std::vector<std::vector<float>> &transMatrix = TransformationNode::identityMat(),
342  const std::string &name = "<transformation>",
343  const std::vector<repoUUID> &parents = std::vector<repoUUID>(),
344  const int &apiLevel = REPO_NODE_API_LEVEL_1);
345  };
346  } //namespace model
347  } //namespace core
348 } //namespace repo
Definition: repo_node_reference.h:38
Definition: repo_node_revision.h:49
Definition: repo_node_map.h:27
Definition: repo_connection_pool_mongo.h:32
Definition: repo_bson_factory.h:44
Definition: repo_node_camera.h:41
Definition: repo_node_material.h:43
static std::vector< std::vector< float > > identityMat()
Definition: repo_node_transformation.cpp:73
Definition: repo_node_utils.h:67
Definition: repo_node_transformation.h:36
Definition: repo_node_texture.h:38
Definition: repo_bson_project_settings.h:30
Definition: repo_node_mesh.h:62
Definition: repo_bson_role_settings.h:30
Definition: repo_bson.h:53
Definition: repo_node_utils.h:48
Definition: repo_bson_role.h:45
Definition: repo_node_metadata.h:35
Definition: repo_bson_user.h:69