FixedPolygonTool.h #pragma once #include <vector> #include <gdiplus.h> #include…
- User
FixedPolygonTool.h
#pragma once #include #include <gdiplus.h> #include <gdiplusinit.h> #include
enum class ToolState { Active, Completed, FinalPolygon };
enum class ToolsType { Polygon, Line, Fixed };
class FixedPolygonTool {
codeToolState getToolState(int frameNumber, ToolsType toolType = ToolsType::Polygon);};
struct PolygonParams { ToolState toolState; std::vector<std::pair<Gdiplus::Point, Gdiplus::Point>> PolygonToolStartEndPoint; }; std::map<int, PolygonParams> m_polygonParams_map;
FixedPolygonTool.cpp
#include "FixedPolygonTool.h"
ToolState FixedPolygonTool::getToolState(int frameNumber, ToolsType toolType) { return m_polygonParams_map[frameNumber].toolState; }
InvokeFunctions.cpp
#include #include "InvokeFunction.h"
void InvokeFunction::EnterSVelPointEdit() { std::cout << "EnterSVelPointEdit method invoked" << std::endl; }
void InvokeFunction::EnterEVelPointEdit() { std::cout << "EnterEVelPointEdit method invoked" << std::endl; } void InvokeFunction::EncoderInc() { std::cout << "EncoderInc method called" << std::endl; }
MethodHolder.h
#pragma once #include #include #include #include #include "InvokeFunction.h" #include "FixedPolygonTool.h"
class MethodHolder {
public: typedef void(*FunctionPointer)();
//using MethodPointer = std::function<void(int,ToolsType)>;
codestatic MethodHolder* GetInstance() { if (!instance) { instance = new MethodHolder(); } return instance; } //void InvokeMethod(const std::string& methodName); void InvokeMethod(const std::string& methodName,int frameNumber, ToolsType toolType); void RegisterMethod(const std::string& methodName, FunctionPointer methodPtr);private: MethodHolder() {} static MethodHolder* instance; MethodHolder(const MethodHolder&) = delete; MethodHolder& operator=(const MethodHolder&) = delete;
codestd::map<std::string, FunctionPointer> MethodMap;};
MethodHolder.cpp
#include "MethodHolder.h"
MethodHolder* MethodHolder::instance = nullptr;
void MethodHolder::InvokeMethod(const std::string& methodName) { auto it = MethodMap.find(methodName); if (it != MethodMap.end()) { it->second(); } else { std::cout << "Method not found: " << methodName << std::endl; } }
- Assistant
- Assistant
It seems like your message was incomplete. If you have any further questions or if there's a specific part of the implementation you'd like more detail about, please let me know!