From 4c7b2b39008a27193dd99da38322a8c7d57f7386 Mon Sep 17 00:00:00 2001 From: Tobias Schmidt <tobias.schmidt@unibas.ch> Date: Mon, 10 Jan 2011 17:51:31 +0100 Subject: [PATCH] added SurfaceHandleList --- modules/mol/base/pymod/export_surface.cc | 12 +++++++++--- modules/mol/base/src/surface_handle.cc | 10 ++++++++++ modules/mol/base/src/surface_handle.hh | 10 ++++++++++ 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/modules/mol/base/pymod/export_surface.cc b/modules/mol/base/pymod/export_surface.cc index 04d089dfc..07ff89d1b 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 6d1e82e64..e1169a326 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 e57b0095a..a5e3eed90 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 -- GitLab