From 73239df52b1074314b0ccb5135085d690719aa51 Mon Sep 17 00:00:00 2001
From: juergen <juergen@5a81b35b-ba03-0410-adc8-b2c5c5119f08>
Date: Thu, 25 Mar 2010 12:22:01 +0000
Subject: [PATCH] -updating bundling script for windows -adding GetAtomList to
 chainhandles and enabling .atoms property -fixing already defined getprop in
 windows in entitity_view

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@1886 5a81b35b-ba03-0410-adc8-b2c5c5119f08
---
 deployment/win/create_archive.bat       | 33 ++++++++++++++-----------
 modules/gfx/src/impl/entity_renderer.hh |  4 +++
 modules/mol/base/pymod/export_chain.cc  |  2 ++
 modules/mol/base/src/chain_handle.cc    |  8 ++++++
 modules/mol/base/src/chain_handle.hh    | 13 ++++++++--
 modules/mol/base/src/entity_view.cc     |  2 ++
 6 files changed, 45 insertions(+), 17 deletions(-)

diff --git a/deployment/win/create_archive.bat b/deployment/win/create_archive.bat
index 98f7aeb44..06902f502 100644
--- a/deployment/win/create_archive.bat
+++ b/deployment/win/create_archive.bat
@@ -2,20 +2,23 @@
 REM create a zip archive for deployment on windows
 REM no regisrty entries
 REM no PATHs will be changed except in the DNG session
-if exist openstructure rmdir /S /Q openstructure 
-if exist OpenStructure_WIN32.zip del OpenStructure_WIN32.zip
-REM dir /S openstructure
-mkdir openstructure\share\openstructure\examples
-mkdir openstructure\lib\site-packages
-mkdir openstructure\bin
-xcopy  /E /I ..\..\examples openstructure\share\openstructure\examples
-xcopy  /E /I ..\..\stage\share openstructure\share\
+set inst_dir=openstructure1.0.0a1_1885
+set archive_name=OpenStructureWin32
+if exist "%inst_dir%" rmdir /S /Q "%inst_dir%" 
+if exist %archive_name%.zip del %archive_name%.zip*.*
+REM dir /S %inst_dir%
+mkdir "%inst_dir%\share\openstructure\examples"
+mkdir "%inst_dir%\lib\site-packages"
+mkdir "%inst_dir%\bin"
+xcopy  /E /I ..\..\examples "%inst_dir%\share\openstructure\examples"
+xcopy  /E /I ..\..\stage\share "%inst_dir%\share\"
+REM xcopy  /E /I ..\..\website\html "%inst_dir%\share\doc"
+copy  d:\programs\bin\python.exe "%inst_dir%\bin"
 
-xcopy  /E /I d:\programs\bin openstructure\bin
-REM copy  d:\programs\lib\boost*iostreams*.* d:\programs\lib\boost*unit_test_frame*.* d:\programs\lib\boost*python*.* d:\programs\lib\boost*math*.* d:\programs\lib\boost*system*.* d:\programs\lib\boost*program_options*.* d:\programs\lib\boost*regex*.* d:\programs\lib\_*.* d:\programs\lib\*.py d:\programs\lib\*png*13*.* d:\programs\lib\*zlib*.* d:\programs\lib\*tif*.* d:\programs\lib\py*.* d:\programs\lib\*select*.*  d:\programs\lib\*unicode*.* openstructure\lib
-
-xcopy  /E /I /EXCLUDE:excludes d:\programs\lib openstructure\lib
-xcopy  /E /I ..\..\stage\lib openstructure\lib
-xcopy /E /I ..\..\stage\bin openstructure\bin
+xcopy  /E /I /EXCLUDE:excludes d:\programs\lib "%inst_dir%\lib"
+xcopy  /E /I ..\..\stage\lib "%inst_dir%\lib"
+xcopy /E /I /EXCLUDE:excludes ..\..\stage\bin "%inst_dir%\bin"
 set PATH="c:\Program Files (x86)"\7-Zip\;%PATH%
-7z a -r -tzip OpenStructure_WIN32.zip openstructure > log
\ No newline at end of file
+REM 7z a -r -t7z %archive_name% "%inst_dir%" > log
+REM if exist %archive_name%.7z copy /b 7zS.sfx + config.txt + %archive_name%.7z %archive_name%.exe
+7z a -r -tzip %archive_name% "%inst_dir%" > log
diff --git a/modules/gfx/src/impl/entity_renderer.hh b/modules/gfx/src/impl/entity_renderer.hh
index fe0d54138..3a262d073 100644
--- a/modules/gfx/src/impl/entity_renderer.hh
+++ b/modules/gfx/src/impl/entity_renderer.hh
@@ -23,6 +23,10 @@
   Author: Stefan Scheuber, Marco Biasini
 */
 
+
+#if defined(GetProp)
+#undef GetProp
+#endif
 #include <vector>
 
 #include <ost/mol/query_view_wrapper.hh>
diff --git a/modules/mol/base/pymod/export_chain.cc b/modules/mol/base/pymod/export_chain.cc
index dba3791fd..71896935b 100644
--- a/modules/mol/base/pymod/export_chain.cc
+++ b/modules/mol/base/pymod/export_chain.cc
@@ -53,6 +53,8 @@ void export_Chain()
   ;
   generic_prop_def<ChainBase>(chain_base);
   class_<ChainHandle, bases<ChainBase> >("ChainHandle", init<>())
+    .def("GetAtomList", &ChainHandle::GetAtomList)
+    .add_property("atoms", &ChainHandle::GetAtomList)
     .def("GetResidueList", &ChainHandle::GetResidueList)
     .add_property("residues", &ChainHandle::GetResidueList)   
     .add_property("entity", &ChainHandle::GetEntity) 
diff --git a/modules/mol/base/src/chain_handle.cc b/modules/mol/base/src/chain_handle.cc
index 3306f2421..156eca176 100644
--- a/modules/mol/base/src/chain_handle.cc
+++ b/modules/mol/base/src/chain_handle.cc
@@ -92,6 +92,14 @@ AtomHandle ChainHandle::FindAtom(const ResNum& num,
 }
 
 
+AtomHandleList ChainHandle::GetAtomList() const
+{
+  this->CheckValidity();
+  AtomHandleList atoms;
+  std::copy(AtomsBegin(), AtomsEnd(), std::back_inserter(atoms));
+  return atoms;
+}
+
 ResidueHandleList ChainHandle::GetResidueList() const
 {
   ResidueHandleList reslist;
diff --git a/modules/mol/base/src/chain_handle.hh b/modules/mol/base/src/chain_handle.hh
index f2796309b..0faa7ee8f 100644
--- a/modules/mol/base/src/chain_handle.hh
+++ b/modules/mol/base/src/chain_handle.hh
@@ -115,12 +115,21 @@ public:
   ///
   /// \sa EntityHandle::GetResidueCount()
   int GetResidueCount() const;
-
+  
+  /// \brief Retrieve atoms of this chain as a list
+  ///
+  /// The atoms are ordered by atom number in ascending order. If you only
+  /// want to determine the number of atoms, use the dedicated
+  /// \c ChainHandle::GetAtomCount  
+  
+  
+  AtomHandleList GetAtomList() const;
+  
   /// \brief Get residues of this chain as a list
   ///
   /// The residues are ordered by residue number in ascending order. If you only
   /// want to determine the number of residues, use the dedicated
-  /// \c ResidueHandle::GetResidueCount
+  /// \c ChainHandle::GetResidueCount
   ResidueHandleList GetResidueList() const;
 
   /// \brief  Get iterator pointing to begin of residues
diff --git a/modules/mol/base/src/entity_view.cc b/modules/mol/base/src/entity_view.cc
index 16cbc6cc2..00e9585ce 100644
--- a/modules/mol/base/src/entity_view.cc
+++ b/modules/mol/base/src/entity_view.cc
@@ -582,6 +582,7 @@ EntityView EntityView::Copy() const
 ChainView EntityView::AddChain(const ChainView& chain_view,
                                ViewAddFlags flags) 
 {
+  this->CheckValidity();
   ChainView cv;
   if (flags & ViewAddFlag::CHECK_DUPLICATES &&
      (cv=this->FindChain(chain_view.GetHandle()))) {
@@ -623,6 +624,7 @@ AtomViewList EntityView::FindWithin(const geom::Vec3& center, Real radius) const
   // could use some heuristic here to decide whether it is useful
   // to use the FindWithin method of the handle or do a full search of
   // all atoms included in the view.
+  this->CheckValidity();
   AtomHandleList ahl=this->GetHandle().FindWithin(center, radius);
   AtomViewList avl;
   for (AtomHandleList::iterator i=ahl.begin(), e=ahl.end(); i!=e; ++i) {
-- 
GitLab