diff --git a/src/rofi/include/rofi/connector.hpp b/src/rofi/include/rofi/connector.hpp index c9308c5f262139cf309b26d19abcdd1aa86e6126..84dc476a49d23b18e746acf01692019717972795 100644 --- a/src/rofi/include/rofi/connector.hpp +++ b/src/rofi/include/rofi/connector.hpp @@ -29,11 +29,11 @@ class Connector : public ObjectBase friend class VoxelGraph; protected: std::pair<voxel_weak_ptr, voxel_weak_ptr> connection = std::pair(voxel_weak_ptr(), voxel_weak_ptr()); - std::pair<enum class side, enum class side> voxel_side = std::pair(side::undefined, side::undefined); + std::pair<side, side> voxel_side = std::pair(side::undefined, side::undefined); - virtual void connectVoxel(enum class side s, voxel_weak_ptr voxel); + virtual void connectVoxel(side s, voxel_weak_ptr voxel); virtual void disconnectVoxel(voxel_weak_ptr voxel); - virtual void disconnectVoxel(enum class side s); + virtual void disconnectVoxel(side s); Connector(const Connector &other); Connector(const Connector &&other); @@ -58,9 +58,9 @@ public: node_ptr getNode() { return node; } voxel_weak_ptr getOppositeConnection(); - voxel_weak_ptr getOppositeConnection(enum class side s); + voxel_weak_ptr getOppositeConnection(side s); const std::pair<voxel_weak_ptr, voxel_weak_ptr> &getConnection() { return connection; } - const std::pair<enum class side, enum class side> &getVoxelSide() { return voxel_side; } + const std::pair<side, side> &getVoxelSide() { return voxel_side; } voxel_weak_ptr getModuleLink() const; virtual const connector_type getType(voxel_weak_ptr) const = 0; @@ -113,7 +113,7 @@ class RotationConnector : public Connector bool is_head; std::pair<connector_weak_ptr, connector_weak_ptr> bound_connectors = std::pair(connector_weak_ptr(), connector_weak_ptr()); - enum class connector_type semantic_type = connector_type::empty; + connector_type semantic_type = connector_type::empty; float neg_rotation_limit = -90.0f; float pos_rotation_limit = 90.0f; float current_rotation = 0.0f; @@ -133,7 +133,7 @@ public: static std::shared_ptr<RotationConnector> copy(std::shared_ptr<RotationConnector> other_rotation_connector); - const enum class connector_type getType(voxel_weak_ptr from_voxel) const override + const connector_type getType(voxel_weak_ptr from_voxel) const override { if (connection.first.expired()) return connector_type::rotation; @@ -202,8 +202,8 @@ public: void setRotationAxis(glm::vec3 _rotation_axis) { rotation_axis = _rotation_axis; } }; -enum class side vec_to_enum(glm::vec3 local_direction); -glm::vec3 enum_to_vec(enum class side s); +side vec_to_enum(glm::vec3 local_direction); +glm::vec3 enum_to_vec(side s); cardinal degree_to_cardinal(float degree_angle); float cardinal_to_degree(cardinal orientation); diff --git a/src/rofi/include/rofi/voxel.hpp b/src/rofi/include/rofi/voxel.hpp index 04d66dc45f41c40fe27313e89eb0ba4243d48b3e..b9106beafcb4e057a9e0ae58e410ee1bacb4af48 100644 --- a/src/rofi/include/rofi/voxel.hpp +++ b/src/rofi/include/rofi/voxel.hpp @@ -12,7 +12,7 @@ namespace rofi { class Connector; -enum class side vec_to_enum(glm::vec3 local_direction); +side vec_to_enum(glm::vec3 local_direction); using connector_weak_ptr = std::weak_ptr<Connector>; @@ -22,7 +22,7 @@ using voxel_ptr = std::shared_ptr<Voxel>; class Voxel : public ObjectBase { using enum connector_type; - std::map<const enum class side, std::map<const enum class rofi::connector_type, bool>> slots = { + std::map<const side, std::map<const rofi::connector_type, bool>> slots = { {side::x_pos, {{fixed, true}, {open, true}, {rotation, true}, {shared_rotation, true}}}, {side::x_neg, {{fixed, true}, {open, true}, {rotation, true}, {shared_rotation, true}}}, {side::y_pos, {{fixed, true}, {open, true}, {rotation, true}, {shared_rotation, true}}}, @@ -33,21 +33,21 @@ class Voxel : public ObjectBase protected: node_ptr node; - std::map<enum class side, connector_weak_ptr> connections; + std::map<side, connector_weak_ptr> connections; friend class VoxelGraph; - void connectConnection(enum class side s, connector_weak_ptr connector); - void disconnectConnection(enum class side s); + void connectConnection(side s, connector_weak_ptr connector); + void disconnectConnection(side s); void disconnectConnection(connector_weak_ptr connector); - const std::map<enum class side, connector_weak_ptr> &getConnections() { return connections; } + const std::map<side, connector_weak_ptr> &getConnections() { return connections; } - void restrictSlotsRotation(const enum class side s, connector_weak_ptr connector); - void restrictSlotsSharedRotation(const enum class side s); + void restrictSlotsRotation(const side s, connector_weak_ptr connector); + void restrictSlotsSharedRotation(const side s); - void releaseSlotsRotation(const enum class side s, connector_weak_ptr connector); - void releaseSlotsSharedRotation(const enum class side s); + void releaseSlotsRotation(const side s, connector_weak_ptr connector); + void releaseSlotsSharedRotation(const side s); Voxel(const Voxel &other); Voxel(const Voxel &&other); @@ -64,36 +64,36 @@ public: virtual ~Voxel() = default; node_ptr getNode() const { return node; } - bool isConnectedAt(enum class side s) const { return connections.contains(s); } + bool isConnectedAt(side s) const { return connections.contains(s); } bool isConnectedAt(glm::vec3 side_direction) const { return isConnectedAt(vec_to_enum(side_direction)); } side getSideWithConnector(connector_weak_ptr connector) const; - connector_weak_ptr getConnectorAt(enum class side s) const; + connector_weak_ptr getConnectorAt(side s) const; connector_weak_ptr getConnectorAt(glm::vec3 side_direction) const { return getConnectorAt(vec_to_enum(side_direction)); }; connector_weak_ptr getOppositeConnector(connector_weak_ptr connector) const; connector_weak_ptr getSharedConnector() const; connector_weak_ptr getRotationConnector() const; - voxel_weak_ptr getVoxelAt(enum class side s) const; + voxel_weak_ptr getVoxelAt(side s) const; voxel_weak_ptr getVoxelAt(glm::vec3 side_direction) const { return getVoxelAt(vec_to_enum(side_direction)); } bool hasNoConnections() const { return connections.empty(); } bool hasSharedRotation() const; bool hasRotationConnector() const; - bool slotCompatible(const enum class side s, const connector_type type) const; + bool slotCompatible(const side s, const connector_type type) const; bool slotCompatible(const glm::vec3 side_direction, const connector_type type) const { return slotCompatible(vec_to_enum(side_direction), type); } - void restrictSlots(const enum class side s, connector_weak_ptr connector); - void releaseSlots(const enum class side s, connector_weak_ptr connector); + void restrictSlots(const side s, connector_weak_ptr connector); + void releaseSlots(const side s, connector_weak_ptr connector); }; class ModuleLink : public Voxel { using enum connector_type; - std::map<const enum class side, std::map<const enum class rofi::connector_type, bool>> slots = { + std::map<const side, std::map<const rofi::connector_type, bool>> slots = { {side::x_pos, {{fixed, false}, {open, false}, {rotation, false}, {shared_rotation, false}}}, {side::x_neg, {{fixed, false}, {open, false}, {rotation, false}, {shared_rotation, false}}}, {side::y_pos, {{fixed, false}, {open, false}, {rotation, false}, {shared_rotation, false}}}, @@ -120,7 +120,7 @@ public: class PadBoard : public Voxel { using enum connector_type; - std::map<const enum class side, std::map<const enum class rofi::connector_type, bool>> slots = { + std::map<const side, std::map<const rofi::connector_type, bool>> slots = { {side::x_pos, {{fixed, false}, {open, false}, {rotation, false}, {shared_rotation, false}}}, {side::x_neg, {{fixed, false}, {open, false}, {rotation, false}, {shared_rotation, false}}}, {side::y_pos, {{fixed, false}, {open, true}, {rotation, false}, {shared_rotation, false}}}, diff --git a/src/rofi/include/rofi/voxel_graph.hpp b/src/rofi/include/rofi/voxel_graph.hpp index bde705b43baa9e969afdd125689b7b7ef0176280..6eaa86ab8808502a3cb1acb0330c908cf2b8dce0 100644 --- a/src/rofi/include/rofi/voxel_graph.hpp +++ b/src/rofi/include/rofi/voxel_graph.hpp @@ -56,9 +56,9 @@ public: voxel_ptr addVoxel(node_ptr node); voxel_ptr addModuleLink(node_ptr node); voxel_ptr addPadBoard(node_ptr node); - connector_ptr addConnector(node_ptr node, enum class connector_type t); - connector_ptr addConnector(node_ptr node, enum class connector_type t, glm::vec3 rotation_axis); - connector_ptr addConnector(node_ptr node, enum class connector_type t, glm::vec3 rotation_axis, glm::vec3 highlight_direction); + connector_ptr addConnector(node_ptr node, connector_type t); + connector_ptr addConnector(node_ptr node, connector_type t, glm::vec3 rotation_axis); + connector_ptr addConnector(node_ptr node, connector_type t, glm::vec3 rotation_axis, glm::vec3 highlight_direction); void removeVoxel(voxel_ptr voxel); void removeConnector(connector_ptr connector); @@ -86,7 +86,7 @@ public: }; // NOTE: now only by position, no rotation taken into account -enum class side in_proximity(connector_ptr connector, voxel_ptr voxel); +side in_proximity(connector_ptr connector, voxel_ptr voxel); } diff --git a/src/rofi/src/connector.cpp b/src/rofi/src/connector.cpp index 7327354a6e47277e74bd5d548257f5e7ffd92c7e..cf6d6c36bc984e6da47463707eb2fe0dcb9ad26e 100644 --- a/src/rofi/src/connector.cpp +++ b/src/rofi/src/connector.cpp @@ -127,7 +127,7 @@ voxel_weak_ptr Connector::getModuleLink() const return connection.first; } -void Connector::connectVoxel(enum class side s, voxel_weak_ptr voxel) +void Connector::connectVoxel(side s, voxel_weak_ptr voxel) { ASSUMPTION(!isFull()); @@ -355,7 +355,7 @@ std::shared_ptr<SharedRotationConnector> SharedRotationConnector::copy(std::shar return std::shared_ptr<SharedRotationConnector>{ new SharedRotationConnector(*other_shared_rotation_connector) }; } -enum class side vec_to_enum(glm::vec3 local_direction) +side vec_to_enum(glm::vec3 local_direction) { using enum side; float epsilon = 0.0001f; diff --git a/src/rofi/src/voxel_graph.cpp b/src/rofi/src/voxel_graph.cpp index 284a9f19b37eefb33798944f51daab7e24ae2e97..b024b278a80f9c10fb85c95d3e246eadb7ad3710 100644 --- a/src/rofi/src/voxel_graph.cpp +++ b/src/rofi/src/voxel_graph.cpp @@ -256,7 +256,7 @@ connector_ptr VoxelGraph::addConnector(node_ptr node, connector_type t) return connections.back(); } -connector_ptr VoxelGraph::addConnector(node_ptr node, enum class connector_type t, glm::vec3 rotation_axis) +connector_ptr VoxelGraph::addConnector(node_ptr node, connector_type t, glm::vec3 rotation_axis) { using enum connector_type; ASSUMPTION(t == shared_rotation); @@ -266,7 +266,7 @@ connector_ptr VoxelGraph::addConnector(node_ptr node, enum class connector_type return connections.back(); } -connector_ptr VoxelGraph::addConnector(node_ptr node, enum class connector_type t, glm::vec3 rotation_axis, glm::vec3 highlight_direction) +connector_ptr VoxelGraph::addConnector(node_ptr node, connector_type t, glm::vec3 rotation_axis, glm::vec3 highlight_direction) { using enum connector_type; ASSUMPTION(t == rotation); @@ -503,7 +503,7 @@ void VoxelGraph::joinImplicit() } } -enum class side in_proximity(connector_ptr connector, voxel_ptr voxel) +side in_proximity(connector_ptr connector, voxel_ptr voxel) { // TO DO: adjust for rotations auto con_position = connector->getNode()->getPositionWorld();