00001 //------------------------------------------------------------------------------ 00002 // This file is part of the OpenStructure project <www.openstructure.org> 00003 // 00004 // Copyright (C) 2008-2011 by the OpenStructure authors 00005 // 00006 // This library is free software; you can redistribute it and/or modify it under 00007 // the terms of the GNU Lesser General Public License as published by the Free 00008 // Software Foundation; either version 3.0 of the License, or (at your option) 00009 // any later version. 00010 // This library is distributed in the hope that it will be useful, but WITHOUT 00011 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00012 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00013 // details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public License 00016 // along with this library; if not, write to the Free Software Foundation, Inc., 00017 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00018 //------------------------------------------------------------------------------ 00019 #ifndef OST_COORD_GROUP_HH 00020 #define OST_COORD_GROUP_HH 00021 00022 /* 00023 Author: Ansgar Philippsen, Marco Biasini 00024 */ 00025 00026 #include <vector> 00027 #include <boost/shared_array.hpp> 00028 #include "atom_handle.hh" 00029 #include "coord_source.hh" 00030 00031 namespace geom { 00032 // we should really have fw headers... 00033 class Transform; 00034 } 00035 00036 namespace ost { namespace mol { 00037 00039 class DLLEXPORT_OST_MOL CoordGroupHandle { 00040 public: 00042 CoordGroupHandle(); 00044 CoordGroupHandle(CoordSourcePtr source); 00045 00047 EntityHandle GetEntity() const; 00048 00049 //EntityGroupHandle ExtractFromTo(int start, int end, int step=1); 00050 //EntityGroupHandle ExtractEvery(int step, int start=0); 00051 00053 uint GetAtomCount() const; 00054 00056 uint GetFrameCount() const; 00057 00059 float GetDelta() const; 00060 00062 void SetDelta(float d); 00063 00065 float GetStartTime() const; 00066 00068 void SetStartTime(float t); 00069 00072 void SetFramePositions(uint frame, const std::vector<geom::Vec3>& clist); 00073 00075 geom::Vec3List GetFramePositions(uint frame); 00076 00078 void CopyFrame(uint frame); 00079 00081 void Capture(); 00082 00083 void CaptureInto(int pos); 00084 00086 void Capture(uint frame); 00087 00089 //void AddFrame(const std::vector<geom::Vec3>& clist); 00090 void AddFrame(const geom::Vec3List& clist); 00091 void AddFrame(const geom::Vec3List& clist,const geom::Vec3& cell_size,const geom::Vec3& cell_angles); 00092 00093 void AddFrames(const CoordGroupHandle& cg); 00095 void SetAtomPos(uint frame, AtomHandle atom, const geom::Vec3& pos); 00096 00098 geom::Vec3 GetAtomPos(uint frame, AtomHandle atom) const; 00099 00101 bool IsValid() const; 00102 00104 operator bool() const; 00105 00106 AtomHandleList GetAtomList() const; 00107 CoordFramePtr GetFrame(uint frame) const; 00108 CoordFrame GetFrame2(uint frame); 00109 00112 CoordGroupHandle Filter(const EntityView& selected,int first=0,int last=-1,int stride=1) const; 00113 00115 void ApplyTransform(const geom::Transform& tf); 00116 00117 00118 private: 00119 void CheckValidity() const; 00120 CoordSourcePtr source_; 00121 }; 00122 00123 // factory method 00124 // create with a reference set of atoms and zero frames 00125 DLLEXPORT_OST_MOL CoordGroupHandle CreateCoordGroup(const AtomHandleList& atoms); 00126 00127 }} // ns 00128 00129 #endif