diff --git a/modules/mol/base/pymod/export_surface.cc b/modules/mol/base/pymod/export_surface.cc index 04d089dfc41442f1a529816655f016a553af33c9..07ff89d1b3641f145d9b584641c90d4dbadbecc8 100644 --- a/modules/mol/base/pymod/export_surface.cc +++ b/modules/mol/base/pymod/export_surface.cc @@ -20,12 +20,13 @@ #include <boost/python/suite/indexing/vector_indexing_suite.hpp> using namespace boost::python; - #include <ost/mol/surface_handle.hh> #include <ost/mol/surface_builder.hh> #include <ost/mol/entity_handle.hh> #include <ost/mol/impl/surface_impl.hh> +#include <ost/export_helper/vector.hh> + using namespace ost; using namespace ost::mol; @@ -47,13 +48,13 @@ void export_Surface() .def_readwrite("Position", &SurfaceVertex::position) .def_readwrite("Normal", &SurfaceVertex::normal) .def_readwrite("Atom", &SurfaceVertex::atom) - ; + ; class_<SurfaceTriIDList>("SurfaceTriIDList", init<>()) .def(vector_indexing_suite<SurfaceTriIDList>()) ; class_<SurfaceVertexList>("SurfaceVertexList", init<>()) .def(vector_indexing_suite<SurfaceVertexList>()) - ; + ; class_<SurfaceHandle>("SurfaceHandle", no_init) .def("Attach",attach1) .def("Attach",attach2) @@ -65,6 +66,11 @@ void export_Surface() .def("IsValid",&SurfaceHandle::IsValid) ; + class_<SurfaceHandleList>("SurfaceHandleList", init<>()) + .def(vector_indexing_suite<SurfaceHandleList>()) + .def(ost::VectorAdditions<SurfaceHandleList>()) + ; + def("CreateSurface",create1); def("BuildSurface",BuildSurface); diff --git a/modules/mol/base/src/surface_handle.cc b/modules/mol/base/src/surface_handle.cc index 6d1e82e643e3ff36d5d2a4d78803bb3ed42eb29a..e1169a3268793c19e0e7da171acf995b59f1fcf9 100644 --- a/modules/mol/base/src/surface_handle.cc +++ b/modules/mol/base/src/surface_handle.cc @@ -88,4 +88,14 @@ void SurfaceHandle::Invert() impl_->Invert(); } +std::ostream& operator<<(std::ostream& os, const SurfaceHandle& surf) +{ + if (surf.IsValid()) { + os << "valid surface"; + } else { + os << "invalid surface"; + } + return os; +} + }} // ns diff --git a/modules/mol/base/src/surface_handle.hh b/modules/mol/base/src/surface_handle.hh index e57b0095a2e869cdf9d3b1eb27839d9df99b6bab..a5e3eed9013a2f69194d6d0a218c73b2d565d514 100644 --- a/modules/mol/base/src/surface_handle.hh +++ b/modules/mol/base/src/surface_handle.hh @@ -72,10 +72,20 @@ public: bool IsValid() const {return impl_;} + bool operator==(const SurfaceHandle& ref) const { return impl_==ref.impl_; } + + bool operator!=(const SurfaceHandle& ref) const { return !this->operator==(ref); } + private: impl::SurfaceImplP impl_; + }; +DLLEXPORT_OST_MOL std::ostream& operator<<(std::ostream& os, + const SurfaceHandle& surf); + +typedef std::vector<SurfaceHandle> SurfaceHandleList; + }} // ns #endif