diff --git a/contrib/mobile/CMakeLists.txt b/contrib/mobile/CMakeLists.txt index 60a06d3e8ed145eb535587d57cc91ec5ee811a55..3f42cca727b892d6ead61b947b0eb42394cc160d 100644 --- a/contrib/mobile/CMakeLists.txt +++ b/contrib/mobile/CMakeLists.txt @@ -89,9 +89,8 @@ if(ENABLE_BUILD_IOS_EMULATOR OR ENABLE_BUILD_IOS) COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/drawString.h ${CMAKE_CURRENT_BINARY_DIR}/${APPNAME}/${APPNAME}/ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/Trackball.cpp ${CMAKE_CURRENT_BINARY_DIR}/${APPNAME}/${APPNAME}/ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/Trackball.h ${CMAKE_CURRENT_BINARY_DIR}/${APPNAME}/${APPNAME}/ - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/movePosition.h ${CMAKE_CURRENT_BINARY_DIR}/${APPNAME}/${APPNAME}/ - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/iosGModel.h ${CMAKE_CURRENT_BINARY_DIR}/${APPNAME}/${APPNAME}/ - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/iosGModel.cpp ${CMAKE_CURRENT_BINARY_DIR}/${APPNAME}/${APPNAME}/ + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/iosUtils.h ${CMAKE_CURRENT_BINARY_DIR}/${APPNAME}/${APPNAME}/ + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/iosUtils.cpp ${CMAKE_CURRENT_BINARY_DIR}/${APPNAME}/${APPNAME}/ COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/${APPNAME}/${APPNAME}/frameworks/ COMMAND ${CMAKE_COMMAND} -E copy_directory ${GETDP_FRAMEWORK}/ ${CMAKE_CURRENT_BINARY_DIR}/${APPNAME}/${APPNAME}/frameworks/GetDP.framework/ COMMAND ${CMAKE_COMMAND} -E remove ${GMSH_FRAMEWORK}/Headers/gmsh @@ -139,9 +138,8 @@ endif(ENABLE_BUILD_IOS_EMULATOR OR ENABLE_BUILD_IOS) if(ENABLE_BUILD_ANDROID) append_src(drawContext.cpp) - append_src(movePosition.h) append_src(Trackball.cpp) - append_src(androidGModel.cpp) + append_src(androidUtils.cpp) append_src(drawString.cpp) append_src(drawGeom.cpp) append_src(drawMesh.cpp) diff --git a/contrib/mobile/androidGModel.cpp b/contrib/mobile/androidUtils.cpp similarity index 99% rename from contrib/mobile/androidGModel.cpp rename to contrib/mobile/androidUtils.cpp index 0c111ec295afd46994d70c792d2e9b76d8284fed..86e8682db53a4938f22f2413712987f748476179 100644 --- a/contrib/mobile/androidGModel.cpp +++ b/contrib/mobile/androidUtils.cpp @@ -23,7 +23,7 @@ #include <getdp/GetDPConfig.h> #include <getdp/GetDPVersion.h> -#include "androidGModel.h" +#include "androidUtils.h" #include "drawContext.h" extern "C" diff --git a/contrib/mobile/androidGModel.h b/contrib/mobile/androidUtils.h similarity index 90% rename from contrib/mobile/androidGModel.h rename to contrib/mobile/androidUtils.h index 58a6060ee2e759e789aaf554c6d40a91f7a79d78..ffdd1c37b65713e7a5313efe94fae3218ce5df4b 100644 --- a/contrib/mobile/androidGModel.h +++ b/contrib/mobile/androidUtils.h @@ -1,11 +1,13 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ +#ifndef _ANDROID_UTILS_ONELAB_H_ +#define _ANDROID_UTILS_ONELAB_H_ + #include <jni.h> -/* Header for class org_geuz_onelab_Gmsh */ -#ifndef _Included_org_geuz_onelab_Gmsh -#define _Included_org_geuz_onelab_Gmsh void requestRender(); -void getBitmapFromString(const char *text, int textsize, unsigned char **map, int *height, int *width, int *realWidth=NULL); + +void getBitmapFromString(const char *text, int textsize, unsigned char **map, + int *height, int *width, int *realWidth=NULL); + #ifdef __cplusplus extern "C" { #endif @@ -53,4 +55,5 @@ JNIEXPORT jstring JNICALL Java_org_geuz_onelab_Gmsh_getAboutGetDP #ifdef __cplusplus } #endif + #endif diff --git a/contrib/mobile/drawContext.cpp b/contrib/mobile/drawContext.cpp index 4a377ae9bda79f17fe4c39ddbb47278f666509b1..09ecb16c1e45395364c26c0d9fd33ea9adb47c96 100644 --- a/contrib/mobile/drawContext.cpp +++ b/contrib/mobile/drawContext.cpp @@ -17,7 +17,7 @@ #if defined(BUILD_ANDROID) #include <GLES/gl.h> #include <GLES/glext.h> -#include "androidGModel.h" +#include "androidUtils.h" #else // iOS #include <OpenGLES/ES1/gl.h> #include <OpenGLES/ES1/glext.h> diff --git a/contrib/mobile/drawContext.h b/contrib/mobile/drawContext.h index 5768e5406a1a2a6021f0fca6e27ea50f67bd18a3..527b72677563924c5fd7f881dc76df1868401542 100644 --- a/contrib/mobile/drawContext.h +++ b/contrib/mobile/drawContext.h @@ -1,12 +1,56 @@ -#ifndef _DRAW_GMODEL_H_ -#define _DRAW_GMODEL_H_ +#ifndef _DRAW_CONTEXT_H_ +#define _DRAW_CONTEXT_H_ #include <string> #include <gmsh/PView.h> #include <gmsh/PViewOptions.h> -#include "movePosition.h" +class movePosition { + public: + float win[3]; // window coordinates + float wnr[3]; // world coordinates BEFORE rotation + float s[3]; // scaling state when the event was recorded + float t[3]; // translation state when the event was recorded + movePosition() + { + for(int i = 0; i < 3; i++) + win[i] = wnr[i] = s[i] = t[i] = 0.; + } + movePosition(const movePosition &instance) + { + for(int i = 0; i < 3; i++){ + win[i] = instance.win[i]; + wnr[i] = instance.wnr[i]; + s[i] = instance.s[i]; + t[i] = instance.t[i]; + } + } + void set(float scale[3], float translate[3], float vxmax, float vxmin, + float vymin, float vymax, int width, int height, int x, int y) + { + for(int i = 0; i < 3; i++){ + s[i] = scale[i]; + t[i] = translate[i]; + } + win[0] = (float)x; + win[1] = (float)y; + win[2] = 0.; + + wnr[0] = + (vxmin + win[0] / (float)width * (vxmax - vxmin)) / scale[0] - translate[0]; + wnr[1] = + (vymax - win[1] / (float)height * (vymax - vymin)) / scale[1] - translate[1]; + wnr[2] = 0.; + } + void recenter(float scale[3], float translate[3]) const + { + // compute the equivalent translation to apply *after* the scaling so that + // the scaling is done around the point which was clicked: + translate[0] = t[0] * (s[0] / scale[0]) - wnr[0] * (1. - (s[0] / scale[0])); + translate[1] = t[1] * (s[1] / scale[1]) - wnr[1] * (1. - (s[1] / scale[1])); + } +}; class drawContext{ private: diff --git a/contrib/mobile/drawString.h b/contrib/mobile/drawString.h index 4a6184bbfab6ad1e21ef36a69de8841ef7a69ba3..7be9d87db616d7954145fe5db544996de4ccd5b7 100644 --- a/contrib/mobile/drawString.h +++ b/contrib/mobile/drawString.h @@ -1,9 +1,9 @@ #include <string> #if defined(BUILD_ANDROID) -#include "androidGModel.h" +#include "androidUtils.h" #else -#include "iosGModel.h" +#include "iosUtils.h" #endif class drawString diff --git a/contrib/mobile/iOS/Onelab.xcodeproj/project.pbxproj b/contrib/mobile/iOS/Onelab.xcodeproj/project.pbxproj index 19fd3fefbcaaec616de64daa13be8ca08c5d699d..96537bccd07a37b01182c1824d3d3a0446c7936b 100644 --- a/contrib/mobile/iOS/Onelab.xcodeproj/project.pbxproj +++ b/contrib/mobile/iOS/Onelab.xcodeproj/project.pbxproj @@ -45,7 +45,7 @@ 9CE1A65717B0F39D00E5152F /* Utils.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9CE1A65617B0F39D00E5152F /* Utils.mm */; }; 9CE1A65A17B0FB9700E5152F /* iPhoneiPodStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9CE1A65817B0FB9600E5152F /* iPhoneiPodStoryboard.storyboard */; }; 9CE2773B17E197F50076E728 /* Social.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9CE2773917E197DA0076E728 /* Social.framework */; }; - 9CEAE86E17AF824B00813524 /* iosGModel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9CEAE86D17AF824B00813524 /* iosGModel.cpp */; }; + 9CEAE86E17AF824B00813524 /* iosUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9CEAE86D17AF824B00813524 /* iosUtils.cpp */; }; 9CEAE87D17AFD5BB00813524 /* SplitViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9CEAE87C17AFD5BB00813524 /* SplitViewController.mm */; }; 9CEAECC717A91CD20014D229 /* ModelListController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9CEAECC617A91CD20014D229 /* ModelListController.mm */; }; 9CF34DE417C62FC500A3D5E3 /* PostProcessingViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9CF34DE317C62FC500A3D5E3 /* PostProcessingViewController.mm */; }; @@ -82,7 +82,7 @@ 9C96089C1712C7F600E1D4A0 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 9C96089E1712C8EB00E1D4A0 /* emulatorFix.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = emulatorFix.c; sourceTree = "<group>"; usesTabs = 1; }; 9C9608AB1712EF0900E1D4A0 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = en; path = en.lproj/iPadStoryboard.storyboard; sourceTree = "<group>"; }; - 9C99754C17390DEE0036EC24 /* iosGModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iosGModel.h; sourceTree = "<group>"; usesTabs = 1; }; + 9C99754C17390DEE0036EC24 /* iosUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = iosUtils.h; sourceTree = "<group>"; usesTabs = 1; }; 9CB1CD9618DB2D8700110882 /* icon_rotate.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon_rotate.png; sourceTree = "<group>"; }; 9CB1CD9918DC36AC00110882 /* AboutViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AboutViewController.h; sourceTree = "<group>"; }; 9CB1CD9A18DC36AC00110882 /* AboutViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AboutViewController.mm; sourceTree = "<group>"; }; @@ -94,7 +94,6 @@ 9CDCED2217D5C00500B39082 /* Model.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = Model.mm; sourceTree = "<group>"; }; 9CE08E01178AE6BE00A83B4B /* drawContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = drawContext.cpp; sourceTree = "<group>"; usesTabs = 1; }; 9CE08E02178AE6BE00A83B4B /* drawContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = drawContext.h; sourceTree = "<group>"; usesTabs = 1; }; - 9CE08E03178AE6BE00A83B4B /* movePosition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = movePosition.h; sourceTree = "<group>"; usesTabs = 1; }; 9CE08E04178AE6BE00A83B4B /* Trackball.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Trackball.cpp; sourceTree = "<group>"; usesTabs = 1; }; 9CE08E05178AE6BE00A83B4B /* Trackball.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Trackball.h; sourceTree = "<group>"; usesTabs = 1; }; 9CE08E0D178AEB1600A83B4B /* GetDP.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GetDP.framework; path = Onelab/frameworks/GetDP.framework; sourceTree = "<group>"; }; @@ -106,7 +105,7 @@ 9CE1A65617B0F39D00E5152F /* Utils.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = Utils.mm; sourceTree = "<group>"; usesTabs = 1; }; 9CE1A65917B0FB9700E5152F /* en */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = en; path = en.lproj/iPhoneiPodStoryboard.storyboard; sourceTree = "<group>"; }; 9CE2773917E197DA0076E728 /* Social.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Social.framework; path = System/Library/Frameworks/Social.framework; sourceTree = SDKROOT; }; - 9CEAE86D17AF824B00813524 /* iosGModel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = iosGModel.cpp; sourceTree = "<group>"; usesTabs = 1; }; + 9CEAE86D17AF824B00813524 /* iosUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = iosUtils.cpp; sourceTree = "<group>"; usesTabs = 1; }; 9CEAE87B17AFD5BB00813524 /* SplitViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SplitViewController.h; sourceTree = "<group>"; usesTabs = 1; }; 9CEAE87C17AFD5BB00813524 /* SplitViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SplitViewController.mm; sourceTree = "<group>"; usesTabs = 1; }; 9CEAECC517A91CD20014D229 /* ModelListController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ModelListController.h; sourceTree = "<group>"; usesTabs = 1; }; @@ -202,15 +201,14 @@ 9CE1A65817B0FB9600E5152F /* iPhoneiPodStoryboard.storyboard */, 9C9608491712C16300E1D4A0 /* AppDelegate.h */, 9C96084A1712C16300E1D4A0 /* AppDelegate.mm */, - 9C99754C17390DEE0036EC24 /* iosGModel.h */, - 9CEAE86D17AF824B00813524 /* iosGModel.cpp */, + 9C99754C17390DEE0036EC24 /* iosUtils.h */, + 9CEAE86D17AF824B00813524 /* iosUtils.cpp */, 9CE08E02178AE6BE00A83B4B /* drawContext.h */, 9CE08E01178AE6BE00A83B4B /* drawContext.cpp */, 9CC6EBB617BA0A38001CA21A /* drawGeom.cpp */, 9CC6EBB817BA1CC7001CA21A /* drawMesh.cpp */, 9C6A645717A7C3DB00DEDAFC /* drawString.h */, 9C6A645617A7C3DB00DEDAFC /* drawString.cpp */, - 9CE08E03178AE6BE00A83B4B /* movePosition.h */, 9CE08E05178AE6BE00A83B4B /* Trackball.h */, 9CE08E04178AE6BE00A83B4B /* Trackball.cpp */, 9CE1A65517B0F39C00E5152F /* Utils.h */, @@ -336,7 +334,7 @@ 9C95B7F61726C88E00C0CCE2 /* main.mm in Sources */, 9C6A645817A7C3DB00DEDAFC /* drawString.cpp in Sources */, 9CEAECC717A91CD20014D229 /* ModelListController.mm in Sources */, - 9CEAE86E17AF824B00813524 /* iosGModel.cpp in Sources */, + 9CEAE86E17AF824B00813524 /* iosUtils.cpp in Sources */, 9CEAE87D17AFD5BB00813524 /* SplitViewController.mm in Sources */, 9CE1A65717B0F39D00E5152F /* Utils.mm in Sources */, 9CE18C2017B27EDB009BA06E /* Parameter.mm in Sources */, diff --git a/contrib/mobile/iOS/Onelab/ModelViewController.mm b/contrib/mobile/iOS/Onelab/ModelViewController.mm index 4c8aa1631edbb009228ed179d9b62d9cda260108..ea44a84c27c6893acd4920f455c974a17f06cab4 100644 --- a/contrib/mobile/iOS/Onelab/ModelViewController.mm +++ b/contrib/mobile/iOS/Onelab/ModelViewController.mm @@ -3,7 +3,7 @@ #import "ModelViewController.h" #import "drawContext.h" -#import "iosGModel.h" +#import "iosUtils.h" #import "Utils.h" #import "AppDelegate.h" diff --git a/contrib/mobile/iosGModel.cpp b/contrib/mobile/iosUtils.cpp similarity index 94% rename from contrib/mobile/iosGModel.cpp rename to contrib/mobile/iosUtils.cpp index 5237306454d34b08130fc232c6ff589e63360a67..aac9b23f22265a715c8b316ce48c71137620c2ab 100644 --- a/contrib/mobile/iosGModel.cpp +++ b/contrib/mobile/iosUtils.cpp @@ -1,4 +1,4 @@ -#include "iosGModel.h" +#include "iosUtils.h" static void * objc; diff --git a/contrib/mobile/iosGModel.h b/contrib/mobile/iosUtils.h similarity index 92% rename from contrib/mobile/iosGModel.h rename to contrib/mobile/iosUtils.h index 261be38781cfdb168245ef8308a2ec18dc988464..fc2d64db2be28d5ae8c2210b128fb448ecb46c07 100644 --- a/contrib/mobile/iosGModel.h +++ b/contrib/mobile/iosUtils.h @@ -1,5 +1,5 @@ -#ifndef __Onelab__iosGModel__ -#define __Onelab__iosGModel__ +#ifndef _IOS_UTILS_ONELAB_H_ +#define _IOS_UTILS_ONELAB_H_ #include <iostream> #include <string> diff --git a/contrib/mobile/movePosition.h b/contrib/mobile/movePosition.h deleted file mode 100644 index c7402ead429f8dfc4de15b63f4c728cdea2ce272..0000000000000000000000000000000000000000 --- a/contrib/mobile/movePosition.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef _MOVE_POSITION_H_ -#define _MOVE_POSITION_H_ - -class movePosition { - public: - float win[3]; // window coordinates - float wnr[3]; // world coordinates BEFORE rotation - float s[3]; // scaling state when the event was recorded - float t[3]; // translation state when the event was recorded - movePosition() - { - for(int i = 0; i < 3; i++) - win[i] = wnr[i] = s[i] = t[i] = 0.; - } - movePosition(const movePosition &instance) - { - for(int i = 0; i < 3; i++){ - win[i] = instance.win[i]; - wnr[i] = instance.wnr[i]; - s[i] = instance.s[i]; - t[i] = instance.t[i]; - } - } - void set(float scale[3], float translate[3], float vxmax, float vxmin, - float vymin, float vymax, int width, int height, int x, int y) - { - for(int i = 0; i < 3; i++){ - s[i] = scale[i]; - t[i] = translate[i]; - } - win[0] = (float)x; - win[1] = (float)y; - win[2] = 0.; - - wnr[0] = - (vxmin + win[0] / (float)width * (vxmax - vxmin)) / scale[0] - translate[0]; - wnr[1] = - (vymax - win[1] / (float)height * (vymax - vymin)) / scale[1] - translate[1]; - wnr[2] = 0.; - } - void recenter(float scale[3], float translate[3]) const - { - // compute the equivalent translation to apply *after* the scaling so that - // the scaling is done around the point which was clicked: - translate[0] = t[0] * (s[0] / scale[0]) - wnr[0] * (1. - (s[0] / scale[0])); - translate[1] = t[1] * (s[1] / scale[1]) - wnr[1] * (1. - (s[1] / scale[1])); - } -}; - -#endif