Skip to content
Snippets Groups Projects
Commit 4bbce493 authored by marco's avatar marco
Browse files

add handle parameter to CreateEntityFromView

If the handle is valid, the atoms, residues, chains, bonds an torsions
are added to the handle instead of creating a new one. Useful to merge two entity handles into one.

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@1765 5a81b35b-ba03-0410-adc8-b2c5c5119f08
parent 9060d1ef
Branches
Tags
No related merge requests found
......@@ -157,7 +157,8 @@ void export_EntityView()
def("CreateViewFromAtoms", create_view_1);
def("CreateViewFromAtoms", create_view_2);
def("CreateEntityFromView", &CreateEntityFromView);
def("CreateEntityFromView", &CreateEntityFromView,
arg("handle")=EntityHandle());
class_<EntityViewList>("EntityViewList", init<>())
.def(vector_indexing_suite<EntityViewList>())
;
......
......@@ -389,13 +389,16 @@ private:
}
EntityHandle CreateEntityFromView(const EntityView& view,
bool include_exlusive_atoms)
bool include_exlusive_atoms,
EntityHandle handle)
{
Profile create_time("mol::CreateEntityFromView");
EntityHandle ent=CreateEntity();
Replicator replicator(ent.Impl(), view, include_exlusive_atoms);
TorsionAdder adder(replicator, ent.Impl(), view);
return ent;
if (!handle.IsValid()) {
handle=CreateEntity();
}
Replicator replicator(handle.Impl(), view, include_exlusive_atoms);
TorsionAdder adder(replicator, handle.Impl(), view);
return handle;
}
}} // ns
......@@ -26,7 +26,7 @@
#include <ost/mol/view_type_fw.hh>
#include <ost/mol/handle_type_fw.hh>
#include <ost/integrity_error.hh>
#include <ost/mol/entity_handle.hh>
namespace ost { namespace mol {
......@@ -87,8 +87,12 @@ CompareViews(const EntityView& view1, const EntityView& view2);
/// \param view is the view to be converted to a handle
/// \param include_exlusive_atoms if true, atoms that are part of an exclusive
/// bond will also be included in the new entity handle.
EntityHandle DLLEXPORT_OST_MOL CreateEntityFromView(const EntityView& view,
bool include_exlusive_atoms);
/// \param handle If invalid a new entity will be created. If valid, the atoms,
/// residues, chains, bonds and torsions will be added to handle. This is
/// useful to combine several entities into one.
EntityHandle DLLEXPORT_OST_MOL
CreateEntityFromView(const EntityView& view, bool include_exlusive_atoms,
EntityHandle handle=EntityHandle());
}} // ns
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment