diff --git a/csmapi.i b/csmapi.i index 1cec5ae97687a418fda404134a81e1a3e5d8cf6e..40812d31408e8b97160f2e700740e6c4825b6ce2 100644 --- a/csmapi.i +++ b/csmapi.i @@ -4,6 +4,7 @@ %include "ellipsoid.i" %include "warning.i" %include "isd.i" +%include "model.i" +%include "geometricmodel.i" %include "rastergm.i" %include "plugin.i" -%include "model.i" \ No newline at end of file diff --git a/geometricmodel.i b/geometricmodel.i new file mode 100644 index 0000000000000000000000000000000000000000..37f4e3fbf446fa077c31a4825cc54f5d02109984 --- /dev/null +++ b/geometricmodel.i @@ -0,0 +1,7 @@ +%module(package="csmapi") geometricmodel +%{ + #include "GeometricModel.h" +%} + +%import model.i +%include GeometricModel.h diff --git a/plugin.i b/plugin.i index 590fe179b05e0cff560ad7395a249fa6dc56b4ce..c429c2e28fe3cb1fe6b07fe798dbff415066a919 100644 --- a/plugin.i +++ b/plugin.i @@ -1,16 +1,17 @@ %module(package="csmapi") plugin %{ #include "Plugin.h" + %} %include <std_string.i> %include <std_list.i> -%include typemaps.i -%include Plugin.h - +%include Model.h +%apply SWIGTYPE *DYNAMIC { csm::Model * }; +%include Plugin.h %template(PluginList) std::list<const csm::Plugin*>; %{ @@ -27,3 +28,19 @@ %} +// A general purpose function for dynamic casting of a Model * +%{ +static swig_type_info * +Model_dynamic(void **ptr) { + csm::RasterGM *b; + b = dynamic_cast<csm::RasterGM *>((csm::Model *) *ptr); + if (b) { + *ptr = (void *) b; + return SWIGTYPE_p_csm__RasterGM; + } + return 0; +} +%} + +// Register the above casting function +DYNAMIC_CAST(SWIGTYPE_p_csm__Model, Model_dynamic); diff --git a/rastergm.i b/rastergm.i index 64b658f189b0f1afcd828e901b99a5a6e816cc99..bb121a58d72562f77d141f098c9273ed0b114f3b 100644 --- a/rastergm.i +++ b/rastergm.i @@ -5,4 +5,6 @@ %ignore CSM_RASTER_FAMILY; -%include RasterGM.h \ No newline at end of file +%import model.i +%import geometricmodel.i +%include RasterGM.h diff --git a/tests/test_functional.py b/tests/test_functional.py index 0746b1f646cb93438af391b9daf7cbe3b8dda0f0..e294b7fe4bccea627baa9fef7d8b28d49b6ced18 100644 --- a/tests/test_functional.py +++ b/tests/test_functional.py @@ -43,6 +43,6 @@ def test_isd_to_model_to_ground(isd, plugin): model = plugin.constructModelFromISD(isd, model_name) assert model.getVersion().version() == '0.1.0' - print(dir(model)) - assert False - \ No newline at end of file + image_coord = csmapi.ImageCoord(1,1) + assert hasattr(model, 'imageToGround') + diff --git a/version.i b/version.i index e775da1e5755d60d2c8833b2b17fbce2c6d31a48..f4cc5b132e55fd5c549831cf5d250d78ca9d3dda 100644 --- a/version.i +++ b/version.i @@ -4,4 +4,8 @@ %} %include <std_string.i> + +%rename ("$ignore", fullname=1) csm::Version::print; %include "Version.h" + +