diff --git a/src/Application/Modes/ProjectionMappingMode.cpp b/src/Application/Modes/ProjectionMappingMode.cpp index af5a0f7..c7465d1 100644 --- a/src/Application/Modes/ProjectionMappingMode.cpp +++ b/src/Application/Modes/ProjectionMappingMode.cpp @@ -459,7 +459,7 @@ void ProjectionMappingMode::moveSelection(Application * app, ofVec2f by){ app->getSurfaceManager(), by)); } -void ProjectionMappingMode::createSurface(Application *app, int type){ +void ProjectionMappingMode::createSurface(Application *app, SurfaceType type){ app->getCmdManager()->exec( new AddSurfaceCmd(app->getSurfaceManager(), type)); } diff --git a/src/Application/Modes/ProjectionMappingMode.h b/src/Application/Modes/ProjectionMappingMode.h index 5ae53ac..2ca4214 100644 --- a/src/Application/Modes/ProjectionMappingMode.h +++ b/src/Application/Modes/ProjectionMappingMode.h @@ -61,7 +61,7 @@ class ProjectionMappingMode : public ApplicationBaseMode { void selectNextVertex(Application * app); void selectPrevVertex(Application * app); void moveSelection(Application * app, ofVec2f by); - void createSurface(Application * app, int type); + void createSurface(Application * app, SurfaceType type); private: ProjectionMappingMode(); diff --git a/src/Application/SettingsLoader.cpp b/src/Application/SettingsLoader.cpp index c69f003..a21eec8 100644 --- a/src/Application/SettingsLoader.cpp +++ b/src/Application/SettingsLoader.cpp @@ -54,9 +54,10 @@ bool SettingsLoader::load( for(int i = 0; i < numSurfaces; i++){ if(xmlSettings->tagExists("surface", i)){ - int type = -1; + SurfaceType type = SurfaceType::NONE; if(xmlSettings->attributeExists("surface", "type")){ - type = xmlSettings->getAttribute("surface", "type", 0, i); + type = static_cast( + xmlSettings->getAttribute("surface", "type", 0, i)); } xmlSettings->pushTag("surface", i); @@ -99,7 +100,7 @@ bool SettingsLoader::load( xmlSettings->popTag(); // vertices } - if(type == -1){ + if(type == SurfaceType::NONE){ if(vertexCount == 3){ type = SurfaceType::TRIANGLE_SURFACE; }else if(vertexCount == 4){ diff --git a/src/Commands/AddSurfaceCmd.cpp b/src/Commands/AddSurfaceCmd.cpp index 23fde7f..05b8756 100644 --- a/src/Commands/AddSurfaceCmd.cpp +++ b/src/Commands/AddSurfaceCmd.cpp @@ -3,7 +3,7 @@ namespace ofx { namespace piMapper { -AddSurfaceCmd::AddSurfaceCmd(SurfaceManager * sm, int surfaceType){ +AddSurfaceCmd::AddSurfaceCmd(SurfaceManager * sm, SurfaceType surfaceType){ _surfaceManager = sm; _surfaceType = surfaceType; } diff --git a/src/Commands/AddSurfaceCmd.h b/src/Commands/AddSurfaceCmd.h index cd4497c..a321cfd 100644 --- a/src/Commands/AddSurfaceCmd.h +++ b/src/Commands/AddSurfaceCmd.h @@ -14,13 +14,13 @@ namespace piMapper { class AddSurfaceCmd : public BaseUndoCmd { public: - AddSurfaceCmd(SurfaceManager * sm, int surfaceType); + AddSurfaceCmd(SurfaceManager * sm, SurfaceType surfaceType); void exec(); void undo(); private: SurfaceManager * _surfaceManager; - int _surfaceType; + SurfaceType _surfaceType; }; diff --git a/src/Surfaces/SurfaceFactory.cpp b/src/Surfaces/SurfaceFactory.cpp index 295c43a..1adbba2 100644 --- a/src/Surfaces/SurfaceFactory.cpp +++ b/src/Surfaces/SurfaceFactory.cpp @@ -12,7 +12,7 @@ SurfaceFactory * SurfaceFactory::instance(){ return _instance; } -BaseSurface * SurfaceFactory::createSurface(int type){ +BaseSurface * SurfaceFactory::createSurface(SurfaceType type){ if(type == SurfaceType::TRIANGLE_SURFACE){ return createTriangleSurface(); }else if(type == SurfaceType::QUAD_SURFACE){ diff --git a/src/Surfaces/SurfaceFactory.h b/src/Surfaces/SurfaceFactory.h index 9b49e4f..90b2827 100644 --- a/src/Surfaces/SurfaceFactory.h +++ b/src/Surfaces/SurfaceFactory.h @@ -17,7 +17,7 @@ class SurfaceFactory { static SurfaceFactory * instance(); // Create new surface based on type - BaseSurface * createSurface(int type); + BaseSurface * createSurface(SurfaceType type); private: static SurfaceFactory * _instance; diff --git a/src/Surfaces/SurfaceType.h b/src/Surfaces/SurfaceType.h index 3017629..ae52270 100644 --- a/src/Surfaces/SurfaceType.h +++ b/src/Surfaces/SurfaceType.h @@ -3,13 +3,12 @@ namespace ofx { namespace piMapper { -struct SurfaceType { - enum { - TRIANGLE_SURFACE, - QUAD_SURFACE, - GRID_WARP_SURFACE, - HEXAGON_SURFACE - }; +enum SurfaceType{ + TRIANGLE_SURFACE, + QUAD_SURFACE, + GRID_WARP_SURFACE, + HEXAGON_SURFACE, + NONE }; } // namespace piMapper