Rename instruction to pathinstruction

This commit is contained in:
Emma Broman
2021-06-04 15:15:46 +02:00
parent fd9521db41
commit 0b65c798cd
7 changed files with 24 additions and 25 deletions
+2 -2
View File
@@ -29,9 +29,9 @@ set(HEADER_FILES
${CMAKE_CURRENT_SOURCE_DIR}/autonavigationhandler.h
${CMAKE_CURRENT_SOURCE_DIR}/autonavigationmodule.h
${CMAKE_CURRENT_SOURCE_DIR}/helperfunctions.h
${CMAKE_CURRENT_SOURCE_DIR}/instruction.h
${CMAKE_CURRENT_SOURCE_DIR}/path.h
${CMAKE_CURRENT_SOURCE_DIR}/pathcurve.h
${CMAKE_CURRENT_SOURCE_DIR}/pathinstruction.h
${CMAKE_CURRENT_SOURCE_DIR}/rotationinterpolator.h
${CMAKE_CURRENT_SOURCE_DIR}/speedfunction.h
${CMAKE_CURRENT_SOURCE_DIR}/waypoint.h
@@ -46,9 +46,9 @@ set(SOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/autonavigationmodule.cpp
${CMAKE_CURRENT_SOURCE_DIR}/autonavigationmodule_lua.inl
${CMAKE_CURRENT_SOURCE_DIR}/helperfunctions.cpp
${CMAKE_CURRENT_SOURCE_DIR}/instruction.cpp
${CMAKE_CURRENT_SOURCE_DIR}/path.cpp
${CMAKE_CURRENT_SOURCE_DIR}/pathcurve.cpp
${CMAKE_CURRENT_SOURCE_DIR}/pathinstruction.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rotationinterpolator.cpp
${CMAKE_CURRENT_SOURCE_DIR}/speedfunction.cpp
${CMAKE_CURRENT_SOURCE_DIR}/waypoint.cpp
@@ -25,7 +25,7 @@
#include <modules/autonavigation/autonavigationhandler.h>
#include <modules/autonavigation/helperfunctions.h>
#include <modules/autonavigation/instruction.h>
#include <modules/autonavigation/pathinstruction.h>
#include <openspace/engine/globals.h>
#include <openspace/engine/windowdelegate.h>
#include <openspace/interaction/navigationhandler.h>
@@ -256,7 +256,7 @@ void AutoNavigationHandler::updateCamera(double deltaTime) {
}
}
void AutoNavigationHandler::createPath(Instruction& instruction) {
void AutoNavigationHandler::createPath(PathInstruction& instruction) {
clearPath();
// TODO: do this in some initialize function instead
@@ -269,7 +269,7 @@ void AutoNavigationHandler::createPath(Instruction& instruction) {
Waypoint waypointToAdd;
if (waypoints.empty()) {
if (instruction.type == Instruction::Type::Node) {
if (instruction.type == PathInstruction::Type::Node) {
// TODO: allow curves to compute default waypoint instead
waypointToAdd = computeDefaultWaypoint(instruction);
}
@@ -484,7 +484,7 @@ SceneGraphNode* AutoNavigationHandler::findNodeNearTarget(const SceneGraphNode*
// OBS! The desired default waypoint may vary between curve types.
// TODO: let the curves update the default position if no exact position is required
Waypoint AutoNavigationHandler::computeDefaultWaypoint(const Instruction& ins) {
Waypoint AutoNavigationHandler::computeDefaultWaypoint(const PathInstruction& ins) {
const SceneGraphNode* targetNode = sceneGraphNode(ins.nodeIdentifier);
if (!targetNode) {
LERROR(fmt::format("Could not find target node '{}'", ins.nodeIdentifier));
@@ -39,7 +39,7 @@ namespace openspace {
namespace openspace::autonavigation {
struct Waypoint;
struct Instruction;
struct PathInstruction;
struct TargetNodeInstruction;
class AutoNavigationHandler : public properties::PropertyOwner {
@@ -58,7 +58,7 @@ public:
bool hasFinished() const;
void updateCamera(double deltaTime);
void createPath(Instruction& spec);
void createPath(PathInstruction& spec);
void clearPath();
void startPath();
void abortPath();
@@ -73,13 +73,13 @@ public:
std::vector<glm::dvec3> controlPoints();
private:
Waypoint wayPointFromCamera();
Waypoint waypointFromCamera();
void removeRollRotation(CameraPose& pose, double deltaTime);
void addSegment(const Instruction& ins);
void addSegment(const PathInstruction& ins);
SceneGraphNode* findNodeNearTarget(const SceneGraphNode* node);
Waypoint computeDefaultWaypoint(const Instruction& ins);
Waypoint computeDefaultWaypoint(const PathInstruction& ins);
std::vector<SceneGraphNode*> findRelevantNodes();
@@ -59,7 +59,7 @@ double AutoNavigationModule::minValidBoundingSphere() const {
std::vector<documentation::Documentation> AutoNavigationModule::documentations() const {
return {
autonavigation::Instruction::Documentation()
autonavigation::PathInstruction::Documentation()
};
}
@@ -22,7 +22,7 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#include <modules/autonavigation/instruction.h>
#include <modules/autonavigation/pathinstruction.h>
#include <modules/globebrowsing/globebrowsingmodule.h>
#include <modules/globebrowsing/src/renderableglobe.h>
#include <openspace/engine/globals.h>
@@ -145,7 +145,7 @@ int goTo(lua_State* L) {
}
}
Instruction instruction(insDict);
PathInstruction instruction(insDict);
AutoNavigationModule* module = global::moduleEngine->module<AutoNavigationModule>();
module->AutoNavigationHandler().createPath(instruction);
@@ -180,7 +180,7 @@ int goToHeight(lua_State* L) {
}
}
Instruction instruction(insDict);
PathInstruction instruction(insDict);
AutoNavigationModule* module = global::moduleEngine->module<AutoNavigationModule>();
module->AutoNavigationHandler().createPath(instruction);
@@ -235,7 +235,7 @@ int goToGeo(lua_State* L) {
}
}
Instruction instruction(insDict);
PathInstruction instruction(insDict);
AutoNavigationModule* module = global::moduleEngine->module<AutoNavigationModule>();
module->AutoNavigationHandler().createPath(instruction);
@@ -250,7 +250,7 @@ int generatePath(lua_State* L) {
ghoul::Dictionary dictionary;
ghoul::lua::luaDictionaryFromState(L, dictionary);
Instruction instruction(dictionary);
PathInstruction instruction(dictionary);
AutoNavigationModule* module = global::moduleEngine->module<AutoNavigationModule>();
module->AutoNavigationHandler().createPath(instruction);
@@ -22,7 +22,7 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#include <modules/autonavigation/instruction.h>
#include <modules/autonavigation/pathinstruction.h>
#include <modules/autonavigation/helperfunctions.h>
#include <openspace/documentation/verifier.h>
@@ -69,16 +69,16 @@ namespace {
std::optional<ghoul::Dictionary> startState
[[codegen::reference("core_navigation_state")]];
};
#include "instruction_codegen.cpp"
#include "pathinstruction_codegen.cpp"
} // namespace
namespace openspace::autonavigation {
documentation::Documentation Instruction::Documentation() {
documentation::Documentation PathInstruction::Documentation() {
return codegen::doc<Parameters>("autonavigation_pathinstruction");
}
Instruction::Instruction(const ghoul::Dictionary& dictionary) {
PathInstruction::PathInstruction(const ghoul::Dictionary& dictionary) {
const Parameters p = codegen::bake<Parameters>(dictionary);
duration = p.duration;
@@ -91,7 +91,6 @@ Instruction::Instruction(const ghoul::Dictionary& dictionary) {
throw ghoul::RuntimeError("A navigation state is required");
}
using NavigationState = interaction::NavigationHandler::NavigationState;
navigationState = NavigationState(p.navigationState.value());
_waypoints = { Waypoint(navigationState) };
break;
@@ -148,7 +147,7 @@ Instruction::Instruction(const ghoul::Dictionary& dictionary) {
}
}
std::vector<Waypoint> Instruction::waypoints() const {
std::vector<Waypoint> PathInstruction::waypoints() const {
return _waypoints;
}
@@ -31,7 +31,7 @@
namespace openspace::autonavigation {
struct Instruction {
struct PathInstruction {
using NavigationState = interaction::NavigationHandler::NavigationState;
enum class Type {
@@ -39,7 +39,7 @@ struct Instruction {
NavigationState
};
Instruction(const ghoul::Dictionary& dictionary);
PathInstruction(const ghoul::Dictionary& dictionary);
std::vector<Waypoint> waypoints() const;