Skip to content
Snippets Groups Projects
Commit b3be5cca authored by Ansgar Philippsen's avatar Ansgar Philippsen
Browse files

added fix transform interface to entity and xcs editor

parent b2ca8ebd
Branches
Tags
No related merge requests found
......@@ -197,6 +197,7 @@ void export_Entity()
.add_property("transform",&EntityHandle::GetTransform,&EntityHandle::SetTransform)
.def("HasTransform",&EntityHandle::HasTransform)
.def("ClearTransform",&EntityHandle::ClearTransform)
.def("FixTransform",&EntityHandle::FixTransform)
.def("EditXCS", &EntityHandle::EditXCS, arg("mode")=UNBUFFERED_EDIT)
.def("EditICS", &EntityHandle::EditICS, arg("mode")=UNBUFFERED_EDIT)
.def("RequestXCSEditor", &depr_request_xcs_editor, arg("mode")=UNBUFFERED_EDIT)
......
......@@ -295,6 +295,12 @@ void EntityHandle::ClearTransform()
Impl()->ClearTransform();
}
void EntityHandle::FixTransform()
{
this->CheckValidity();
Impl()->FixTransform();
}
ResidueHandle EntityHandle::FindResidue(const String& chain_name,
const ResNum& residue) const {
this->CheckValidity();
......
......@@ -279,6 +279,8 @@ public:
bool HasTransform() const;
/// \brief remove transform
void ClearTransform();
/// \brief write transformed pos to orig, and the clear tf
void FixTransform();
/// \brief get complete list of residues
/// \sa #ResiduesBegin, #ResiduesEnd
......
......@@ -748,8 +748,20 @@ void EntityImpl::SetTransform(const geom::Transform& tf)
void EntityImpl::ClearTransform()
{
has_transform_=false;
SetTransform(geom::Transform());
has_transform_=false;
}
void EntityImpl::FixTransform()
{
if(!has_transform_) return;
for(AtomImplMap::iterator it = atom_map_.begin();it!=atom_map_.end();++it) {
it->second->OriginalPos()=it->second->TransformedPos();
}
transform_=geom::Transform();
has_transform_=false;
this->UpdateTransformedPos();
this->MarkOrganizerDirty();
}
void EntityImpl::AttachObserver(const EntityObserverPtr& o)
......
......@@ -151,6 +151,7 @@ public:
const geom::Transform& GetTransform() const {return transform_;}
bool HasTransform() const {return has_transform_;}
void ClearTransform();
void FixTransform();
void AttachObserver(const EntityObserverPtr& o);
void DetachObserver(const EntityObserverPtr& o);
......
......@@ -205,6 +205,11 @@ void XCSEditor::SetTransform(const geom::Transform& transform)
this->Update();
}
void XCSEditor::FixTransform()
{
ent_.Impl()->FixTransform();
}
void XCSEditor::Update()
{
if (GetMode()==UNBUFFERED_EDIT) {
......
......@@ -104,6 +104,9 @@ public:
void SetTransform(const geom::Mat4& transform);
void SetTransform(const geom::Transform& transform);
/// \brief set transformed pos to new original pos
void FixTransform();
/// \brief immediately update internal coordinate system
void UpdateICS();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment