Skip to content
Snippets Groups Projects
Commit 134a74e8 authored by jay's avatar jay
Browse files

Adds dynamic casting to RasterGM

parent a0ea1a77
Branches
Tags
No related merge requests found
......@@ -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
%module(package="csmapi") geometricmodel
%{
#include "GeometricModel.h"
%}
%import model.i
%include GeometricModel.h
%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);
......@@ -5,4 +5,6 @@
%ignore CSM_RASTER_FAMILY;
%import model.i
%import geometricmodel.i
%include RasterGM.h
......@@ -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
image_coord = csmapi.ImageCoord(1,1)
assert hasattr(model, 'imageToGround')
......@@ -4,4 +4,8 @@
%}
%include <std_string.i>
%rename ("$ignore", fullname=1) csm::Version::print;
%include "Version.h"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment