diff --git a/CMakeLists.txt b/CMakeLists.txt index fba8fd543c5e3b08574b0e7b29f2356b3e75898f..e85e030914f16a4f017af71db0a176646cb0b798 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -322,7 +322,7 @@ message(STATUS " Info support (-DENABLE_INFO) : ${_INFO}\n" " Graphical interface (-DENABLE_GUI) : ${_UI}\n" " OpenGL support (-DENABLE_GFX) : ${_OPENGL}\n" - " OpenGL via Mesa (-DUSE_MESA) : ${_USE_MESA}\n" + " OpenGL via Mesa (-DUSE_MESA) : ${_USE_MESA}\n" " Image Processing support (-DENABLE_IMG) : ${_IMG}\n" " Shader support (-DUSE_SHADER) : ${_SHADER}\n" " Numpy support (-DUSE_NUMPY) : ${_NUMPY}\n" @@ -333,6 +333,9 @@ message(STATUS " Compound Lib (-DCOMPOUND_LIB) : ${_COMP_LIB}\n" " TMAlign and TMScore (-DCOMPILE_TMTOOLS) : ${_TM_TOOLS}\n" " Static Libraries (-DENABLE_STATIC) : ${ENABLE_STATIC}\n" - " Debian-style 'libexec' (-DDEBIAN_STYLE_LIBEXEC) : ${_DEBIAN_STYLE_LIBEXEC}\n" - " Hidden object visibility (-DHIDDEN_VISIBILITY) : ${_HIDDEN_VIS}") + " Debian-style 'libexec' (-DDEBIAN_STYLE_LIBEXEC) : ${_DEBIAN_STYLE_LIBEXEC}") +if (CMAKE_COMPILER_IS_GNUCXX) + message(STATUS + " Hidden object visibility (-DHIDDEN_VISIBILITY) : ${_HIDDEN_VIS}") +endif() diff --git a/cmake_support/OST.cmake b/cmake_support/OST.cmake index 70305fbb0142eccdf605611d1e68f702cd0bd756..902619dd345b360595f97de19053c7393e09dcb8 100644 --- a/cmake_support/OST.cmake +++ b/cmake_support/OST.cmake @@ -69,7 +69,6 @@ endmacro() # content changed. #------------------------------------------------------------------------------- macro(copy_if_different FROM_DIR TO_DIR FILES TARGETS TARGET) - set(ADD_TARGETS "") foreach(SRC ${FILES}) set(SRCFILE ${SRC}) if("${FROM_DIR}" STREQUAL "" OR "${FROM_DIR}" STREQUAL "./") @@ -86,14 +85,8 @@ macro(copy_if_different FROM_DIR TO_DIR FILES TARGETS TARGET) file(MAKE_DIRECTORY ${TO_DIR}) add_custom_command(TARGET "${TARGET}" PRE_BUILD DEPENDS ${FROM} - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${FROM} ${TO} - COMMENT "" - ) - list(APPEND ADD_TARGETS ${TO}) + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${FROM} ${TO}) endforeach() - if (TARGETS) - set(${TARGETS} ${ADD_TARGETS}) - endif() endmacro() #------------------------------------------------------------------------------- @@ -101,11 +94,14 @@ endmacro() #------------------------------------------------------------------------------- macro(stage_headers HEADERS HEADER_INSTALL_DIR TARGET SUB) set(FROM_DIR "./") + set(_HDR_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${SUB}") + foreach(_HDR ${HEADERS}) + list(APPEND _ABS_HEADER_NAMES ${_HDR_SOURCE_DIR}/${_HDR}) + endforeach() # introduce a helper target to make sure the headers are staged before # building the library string(REPLACE "/" "_" _SUB_NO_SLASH "${SUB}") string(REPLACE "${PREFIX}_" "" _TARGET "${TARGET}") - #message("target before: ${TARGET} after: ${_TARGET}") set(_TARGET_NAME ${_TARGET}_${_SUB_NO_SLASH}_headers) set(_SUB ${SUB}) if (NOT _SUB) @@ -113,12 +109,10 @@ macro(stage_headers HEADERS HEADER_INSTALL_DIR TARGET SUB) endif() add_custom_target("${_TARGET_NAME}" COMMENT "") set(HEADER_DIR "${HEADER_STAGE_PATH}/${HEADER_INSTALL_DIR}") - copy_if_different("${FROM_DIR}" "${HEADER_DIR}" - "${HEADERS}" "" + copy_if_different("" "${HEADER_DIR}" + "${_ABS_HEADER_NAMES}" "" "${_TARGET_NAME}") - add_dependencies("${TARGET}" "${_TARGET_NAME}") - set_target_properties("${_TARGET_NAME}" PROPERTIES - EchoString "Staging headers ${TARGET}") + add_dependencies(${TARGET} ${_TARGET_NAME}) endmacro() #------------------------------------------------------------------------------- @@ -269,7 +263,7 @@ macro(module) install(FILES ${_ABS_HEADER_NAMES} DESTINATION "include/${_HEADER_OUTPUT_DIR}/${_DIR}") set(_HDR_STAGE_DIR "${_HEADER_OUTPUT_DIR}/${_DIR}") - stage_headers("${_ABS_HEADER_NAMES}" "${_HDR_STAGE_DIR}" + stage_headers("${_HEADERS}" "${_HDR_STAGE_DIR}" "${_LIB_NAME}" "${_DIR}") set(_HEADERS) else() @@ -287,7 +281,7 @@ macro(module) install(FILES ${_ABS_HEADER_NAMES} DESTINATION "include/${_HEADER_OUTPUT_DIR}") set(_HDR_STAGE_DIR "${_HEADER_OUTPUT_DIR}") - stage_headers("${_ABS_HEADER_NAMES}" "${_HDR_STAGE_DIR}" + stage_headers("${_HEADERS}" "${_HDR_STAGE_DIR}" "${_LIB_NAME}" "") endif() endif() @@ -415,7 +409,7 @@ macro(script) if (NOT _ARG_INPUT) message(FATAL_ERROR "script() can only substitute when INPUT is present.") endif() - substitute(IN_FILE ${_INPUT} OUT_FILE ${_ARG_NAME} + substitute(IN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/${_INPUT}" OUT_FILE ${_ARG_NAME} DICT ${_ARG_SUBSTITUTE}) endif() install(FILES ${_ARG_NAME} DESTINATION ${_ARG_OUTPUT_DIR} @@ -501,9 +495,9 @@ macro(pymod) return() endif() if (_ARG_OUTPUT_DIR) - set(PYMOD_DIR "openstructure/${_ARG_OUTPUT_DIR}") + set(PYMOD_DIR "python${PYTHON_VERSION}/site-packages/${_ARG_OUTPUT_DIR}") else() - set(PYMOD_DIR "openstructure/${_ARG_PREFIX}/${_ARG_NAME}") + set(PYMOD_DIR "python${PYTHON_VERSION}/site-packages/${_ARG_PREFIX}/${_ARG_NAME}") endif() set(_LIB_NAME ${_ARG_PREFIX}_${_ARG_NAME}) set(PYMOD_STAGE_DIR "${LIB_STAGE_PATH}/${PYMOD_DIR}") @@ -600,7 +594,12 @@ macro(pymod) if (_ARG_UI) add_dependencies("${_LIB_NAME}_pymod" "${_LIB_NAME}_ui"}) endif() - copy_if_different("./" "${PYMOD_STAGE_DIR}" "${_PY_FILES}" "TARGETS" + set(_ABS_PY_FILES) + set(_PY_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") + foreach(_PY ${_PY_FILES}) + list(APPEND _ABS_PY_FILES "${_PY_SOURCE_DIR}/${_PY}") + endforeach() + copy_if_different("./" "${PYMOD_STAGE_DIR}" "${_ABS_PY_FILES}" "TARGETS" "${_LIB_NAME}_pymod") add_dependencies("_${_LIB_NAME}" "${_LIB_NAME}_pymod") compile_py_files(_${_LIB_NAME} ${PYMOD_STAGE_DIR} ${_PY_FILES}) diff --git a/deployment/CMakeLists.txt b/deployment/CMakeLists.txt index 96945a7a51098cc736114b57998297735b3ad3d6..1a55585477a522275cc23467e5a91f5e99fb984c 100644 --- a/deployment/CMakeLists.txt +++ b/deployment/CMakeLists.txt @@ -3,6 +3,6 @@ include(Deployment) set(SUBST_DIC OST_VERSION="${OST_VERSION}") add_custom_target(deploymnt ALL) -substitute(IN_FILE README.html.in OUT_FILE README.html +substitute(IN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/README.html.in OUT_FILE README.html DICT ${SUBST_DIC}) add_subdirectory(win) diff --git a/deployment/macos/deps.py b/deployment/macos/deps.py index 2693db881eac8a5c648019ae79d56c46846aa43a..91ef55c9ada53c569dcf76fde350f57f8161f9e6 100644 --- a/deployment/macos/deps.py +++ b/deployment/macos/deps.py @@ -27,7 +27,7 @@ def _deps_for_lib(lib, pool, recursive=True): return def collect_deps(stage_dir, components, binaries, libexec_binaries, - site_packages, site_packages_dir): + site_packages, site_packages_dir, libexec_path='openstructure'): """ Collect the dependencies for the given components and returns a list of frameworks/libraries that the component depends on. @@ -239,7 +239,8 @@ def make_standalone(stage_dir, outdir, no_includes, force_no_rpath=False, # when running in non-gui mode, we are most likely missing the boost # python library. Let's add it to the list of dependencies by # inspecting "_ost_base.so". - _deps_for_lib(os.path.join(stage_dir, 'lib/openstructure/ost/_ost_base.so'), + pymod_dir='lib/python%d.%d/site-packages' % sys.version_info[0:2] + _deps_for_lib(os.path.join(stage_dir, pymod_dir, 'ost/_ost_base.so'), deps, recursive=False) print 'copying dependencies' copy_deps(deps, outdir) @@ -249,8 +250,8 @@ def make_standalone(stage_dir, outdir, no_includes, force_no_rpath=False, print 'copying binaries' copy_binaries(stage_dir, outdir, binaries, scripts, 'bin') print 'copying pymod' - shutil.copytree(os.path.join(stage_dir, 'lib/openstructure'), - os.path.join(outdir, 'lib/openstructure')) + shutil.copytree(os.path.join(stage_dir,pymod_dir), + os.path.join(outdir, pymod_dir)) copied_py_framework=False non_std_python=False if os.path.exists(os.path.join(outdir, 'lib/Python.framework')): @@ -310,9 +311,9 @@ def make_standalone(stage_dir, outdir, no_includes, force_no_rpath=False, for sp in SITE_PACKAGES: src=get_python_module_path(sp) if os.path.isdir(src): - shutil.copytree(src, os.path.join(outdir, 'lib/openstructure', sp)) + shutil.copytree(src, os.path.join(outdir, pymod_dir, sp)) else: - shutil.copy(src, os.path.join(outdir, 'lib/openstructure', sp)) + shutil.copy(src, os.path.join(outdir, pymod_dir, sp)) print 'updating link commands of python shared objects' os.path.walk(os.path.join(outdir, 'lib'), update_pymod_shared_objects, diff --git a/deployment/macos/pack.py b/deployment/macos/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..d849446be5d0f2e01d2ff27bed4c958cf5e7d16d --- /dev/null +++ b/deployment/macos/pack.py @@ -0,0 +1,357 @@ +""" +deploy.py helps you package your code into a standalone application. + +for now, MacOS X and Linux are supported... +""" +import os +import subprocess +import shutil +import sys +import glob + +def _lib_name(component): + return 'lib%s.dylib' % component + +def _deps_for_lib(lib, pool, recursive=True): + if lib in pool: + return + otool=subprocess.Popen(['otool', '-L', lib], stdout=subprocess.PIPE) + output=otool.communicate()[0] + lines=output.split('\n')[1:] + for line in lines: + d=line.split(' ')[0].strip() + if len(d)>0: + if d==lib: + continue + if d not in pool: + if d.startswith('/System') or d.startswith('/usr/lib'): + continue + if recursive: + _deps_for_lib(d, pool) + pool.add(d) + return + +def collect_deps(stage_dir, components, binaries, libexec_binaries, + site_packages, site_packages_dir, libexec_path='openstructure'): + """ + Collect the dependencies for the given components and returns a list of + frameworks/libraries that the component depends on. + """ + pool=set() + for component in components: + lib_name=os.path.abspath(os.path.join(stage_dir, 'lib', + _lib_name(component))) + if not os.path.exists(lib_name): + print 'WARNING:', lib_name, 'does not exist' + if lib_name not in pool: + _deps_for_lib(lib_name, pool) + pool.add(lib_name) + for bin in binaries: + bin_name=os.path.abspath(os.path.join(stage_dir, 'bin', + bin)) + if not os.path.exists(bin_name): + print 'WARNING:', bin_name, 'does not exist' + continue + if bin_name not in pool: + _deps_for_lib(bin_name, pool) + for bin in libexec_binaries: + bin_name=os.path.abspath(os.path.join(stage_dir, 'libexec', libexec_path, + bin)) + if not os.path.exists(bin_name): + print 'WARNING:', bin_name, 'does not exist' + continue + if bin_name not in pool: + _deps_for_lib(bin_name, pool) + for site_package in site_packages: + full_path=get_python_module_path(site_package) + print full_path + if not os.path.exists(full_path): + print 'WARNING:', site_package, 'does not exists' + continue + if os.path.isdir(full_path): + for so_file in glob.glob(os.path.join(full_path, '*.so')): + _deps_for_lib(so_file, pool) + return pool + +LIBEXEC_SCRIPTS=['ost_config'] +LIBEXEC_BINARIES=[] +GUI_LIBEXEC_BINARIES=['gosty'] +BINARIES=['ldt', 'chemdict_tool', 'tmalign', 'tmscore'] +GUI_BINARIES=[] +GUI_COMPONENTS=['gfx', 'gui', 'info'] +COMPONENTS=['mol', 'geom', 'conop', 'seq_alg', 'seq', + 'img', 'img_alg', 'io', 'db', 'base'] +GUI_SCRIPTS=['dng'] +SCRIPTS=['ost'] +CHANGE_ID_RPATH='install_name_tool -id @rpath/%s %s' +CHANGE_ID='install_name_tool -id @rpath/%s %s' +CHANGE_LOAD_CMD_RPATH='install_name_tool -change %s @rpath/%s %s' +CHANGE_LOAD_CMD='install_name_tool -change %s @executable_path/%s %s' +ADD_RPATH='install_name_tool -add_rpath %s %s 2> /dev/null' +SITE_PACKAGES=[] +GUI_SITE_PACKAGES=['sip.so', 'sipconfig.py', 'sipdistutils.py', 'PyQt4'] +REMOVE_HEADERS='rm -rf `find %s/lib -type d -name Headers`' +REMOVE_CURRENT='rm -rf `find %s/lib -type d -name Current`' +# collect libs of non-standard libraries/frameworks we depend on + +def copy_binaries(stage_dir, outdir, binary_names, scripts, bin_dir, + append_bin=True): + + exe_path=os.path.abspath(os.path.join(outdir, bin_dir)) + for binary_name in binary_names: + if append_bin: + bin_name=os.path.join(stage_dir, bin_dir, binary_name) + else: + bin_name=os.path.join(stage_dir, binary_name) + if not os.path.exists(bin_name): + print 'WARNING:', binary_name, 'does not exist' + continue + dst_name=os.path.join(outdir, bin_dir, os.path.basename(bin_name)) + shutil.copy(bin_name, dst_name) + update_load_commands(dst_name, True, exe_path) + for script in scripts: + shutil.copy(os.path.join(stage_dir, bin_dir, script), + os.path.join(outdir,bin_dir, script)) + +def split_framework_components(abs_path): + """ + Splits the path pointing to a dynamic library within a framework + + '/System/Frameworks/A.framework/Versions/4/A' => + ['/System/Frameworks/A.framework', 'Versions/4/A'] + """ + parts=abs_path.split('/') + for i, s in enumerate(parts): + if s.endswith('.framework'): + lead=os.path.join('/', *parts[:i+1]) + trail=os.path.join(*parts[i+1:]) + return lead, trail + +def change_id(id, lib): + os.chmod(lib, 0666) + os.system(CHANGE_ID_RPATH % (id,lib)) + os.chmod(lib, 0444) + +def update_load_commands(lib, exe, exe_path): + direct_deps=set() + _deps_for_lib(lib, direct_deps, recursive=False) + os.chmod(lib, 0666) + for direct_dep in direct_deps: + if direct_dep.endswith('.dylib'): + new_name=os.path.basename(direct_dep) + os.system(CHANGE_LOAD_CMD_RPATH % (direct_dep, new_name, lib)) + else: + assert direct_dep.find('.framework/')>=0 + framework_path, rel_path=split_framework_components(direct_dep) + framework_name=os.path.basename(framework_path) + new_name=os.path.join(framework_name, rel_path) + os.system(CHANGE_LOAD_CMD_RPATH % (direct_dep, new_name, lib)) + if exe: + os.chmod(lib, 0555) + else: + os.chmod(lib, 0444) + +def copy_deps(dependencies, outdir): + exe_path=os.path.join(outdir, 'bin') + for dep in dependencies: + if dep.endswith('.dylib'): + dst_name=os.path.join(outdir, 'lib', os.path.basename(dep)) + if not os.path.exists(dep): + continue + if os.path.exists(dst_name): + continue + shutil.copy(dep, dst_name) + change_id(os.path.basename(dep), dst_name) + update_load_commands(dst_name, False, exe_path) + else: + assert dep.find('.framework/')>=0 + framework_path, rel_path=split_framework_components(dep) + framework_name=os.path.basename(framework_path) + dst_name=os.path.join(outdir, 'lib', framework_name) + shutil.copytree(framework_path, dst_name) + change_id(os.path.join(dst_name, rel_path), + os.path.join(dst_name, rel_path)) + os.unlink(os.path.join(dst_name, os.path.splitext(framework_name)[0])) + update_load_commands(os.path.join(dst_name, rel_path), False, + exe_path) + +def update_pymod_shared_objects(lib_path, path, files): + exe_path=os.path.abspath(os.path.join(lib_path, '../bin')) + for f in files: + if not os.path.exists(os.path.join(path, f)): + continue + base, ext=os.path.splitext(f) + if ext=='.so': + path_to_lib_path=os.path.relpath(lib_path, path) + abs_name=os.path.join(path, f) + os.system(ADD_RPATH % (path_to_lib_path, abs_name)) + update_load_commands(abs_name, False, exe_path) + elif ext in ('.pyc', '.pyo'): + os.unlink(os.path.join(path, f)) + +def merge_tree(src, dst): + """ + Similar to shutil.copytree, but does not complain when the destination + directory already exists. + """ + names = os.listdir(src) + if not os.path.exists(dst): + os.makedirs(dst) + errors = [] + for name in names: + srcname = os.path.join(src, name) + dstname = os.path.join(dst, name) + try: + if os.path.islink(srcname): + linkto = os.readlink(srcname) + os.symlink(linkto, dstname) + elif os.path.isdir(srcname): + merge_tree(srcname, dstname) + else: + shutil.copy2(srcname, dstname) + except (IOError, os.error), why: + errors.append((srcname, dstname, str(why))) + except shutil.Error, err: + errors.extend(err.args[0]) + try: + shutil.copystat(src, dst) + except OSError, why: + if WindowsError is not None and isinstance(why, WindowsError): + # Copying file access times may fail on Windows + pass + else: + errors.extend((src, dst, str(why))) + if errors: + raise shutil.Error, errors + +def get_site_package_dir(): + """ + Get site-package directory of this python installation. This assumes + that ost was linked against the same version of Python (which is a very + reasonable thing to do, as this script is most likely run with ost). + """ + for p in sys.path: + pattern='/site-packages' + index=p.find(pattern) + if index>=0: + return p[:index+len(pattern)] + raise RuntimeError("Couldn't determine site-packages location") + +def get_python_module_path(module): + for path in sys.path: + full_path=os.path.join(path, module) + if os.path.exists(full_path): + return full_path + return None + + +def get_python_home(): + """ + Derive Python home by looking at the location of the os module + """ + return os.path.dirname(sys.modules['os'].__file__) + + +class Package(object): + def __init__(self, name, root_dir, binaries=[], scripts=[], + modules=[], libraries=[], libexec_dir=None, libexec_scripts=[]): + self.root_dir=root_dir + self.name=name + self.binaries=binaries + self.scripts=scripts + self.libraries=libraries + self.libexec_dir=libexec_dir + self.libexec_scripts=libexec_scripts + self.pymod_dir=os.path.join('lib', 'python%d.%d' % sys.version_info[0:2], + 'site-packages') + self.modules=modules + self.libexec_binaries=[] + self.site_packages=[] + self.site_packages_dir='' + def status(self, message): + print '%s: %s' % (self.name, message) + + def _prepare_output_dir(self, output_dir): + """ + Prepares the output directory structure, including lib, bin and an optional + libexec directory. + """ + #if os.path.exists(output_dir): + # shutil.rmtree(output_dir) + if not os.path.exists(output_dir): + os.makedirs(output_dir) + if not os.path.exists(os.path.join(output_dir, 'bin')): + os.makedirs(os.path.join(output_dir, 'bin')) + if not os.path.exists(os.path.join(output_dir, 'lib')): + os.makedirs(os.path.join(output_dir, 'lib')) + if self.libexec_dir: + out_exec_dir=os.path.join(output_dir, 'libexec', self.libexec_dir) + if not os.path.exists(out_exec_dir): + print 'making...', out_exec_dir + os.makedirs(out_exec_dir) + def _copy_site_packages(self, output_dir): + for sp in SITE_PACKAGES: + src=get_python_module_path(sp) + if os.path.isdir(src): + merge_tree(src, os.path.joini(output_dir, self.pymod_dir, sp)) + else: + shutil.copy(src, os.path.join(output_dir, self.pymod_dir, sp)) + print 'updating link commands of python shared objects' + os.path.walk(os.path.join(output_dir, 'lib'), + update_pymod_shared_objects, + os.path.join(output_dir, 'lib')) + + def ship(self, output_dir): + self._prepare_output_dir(output_dir) + if os.path.exists(os.path.join(self.root_dir, 'share')): + self.status('copying shared data files') + merge_tree(os.path.join(self.root_dir, 'share'), + os.path.join(output_dir, 'share')) + self.status('collecting dependencies') + deps=collect_deps(self.root_dir, self.libraries, self.binaries, + self.libexec_binaries, self.site_packages, + self.site_packages_dir) + # when running in non-gui mode, we are most likely missing the boost + # python library. Let's add it to the list of dependencies by + # inspecting "_ost_base.so". + pymod_dir='lib/python%d.%d/site-packages' % sys.version_info[0:2] + _deps_for_lib(os.path.join(self.root_dir, pymod_dir, 'ost/_ost_base.so'), + deps, recursive=False) + self.status('copying dependencies') + copy_deps(deps, output_dir) + if self.libexec_dir: + self.status('copying libexec binaries') + copy_binaries(self.root_dir, output_dir, self.libexec_binaries, + self.libexec_scripts, + os.path.join('libexec', self.libexec_dir)) + self.status('copying binaries') + copy_binaries(self.root_dir, output_dir, self.binaries, + self.scripts, 'bin') + self.status('copying pymod') + merge_tree(os.path.join(self.root_dir,self.pymod_dir), + os.path.join(output_dir, self.pymod_dir)) + self._copy_site_packages(output_dir) + +class OpenStructure(Package): + def __init__(self, stage_dir, minimal=True): + libs=['ost_mol', 'ost_geom', 'ost_conop', 'ost_seq_alg', + 'ost_io', 'ost_db', 'ost_base', 'ost_seq', 'ost_mol_alg'] + super(OpenStructure, self).__init__('OpenStructure', stage_dir, + binaries=['ldt', 'chemdict_tool'], + libexec_scripts=['ost_config'], + scripts=['ost'], + libraries=libs, + libexec_dir='openstructure') + +class Qmean(Package): + def __init__(self, stage_dir): + super(Qmean, self).__init__('Qmean', stage_dir, + scripts=['qmean'], + libexec_scripts=['qmean_script.py'], + libexec_dir='qmean', + libraries=['qmean']) +ost=OpenStructure('../../stage') +qmean=Qmean('../../../../../qmean/stage') +ost.ship('qmean') +qmean.ship('qmean') + diff --git a/doc/conf/conf.py b/doc/conf/conf.py index b2d284a53bf8f2843ea9a25b8b0828af9ccc2865..e87782b4c33be7d3f95160d365b9f600743470ad 100644 --- a/doc/conf/conf.py +++ b/doc/conf/conf.py @@ -13,13 +13,12 @@ import sys, os -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. +site_packs='python%d.%d/site-packages' % sys.version_info[0:2] sys.path.append(os.path.join(os.path.abspath('../..'), - 'stage/lib/openstructure')) + 'stage/lib', site_packs)) sys.path.append(os.path.join(os.path.abspath('../..'), - 'stage/lib64/openstructure')) + 'stage/lib64', site_packs)) +print site_packs import ost # -- General configuration ----------------------------------------------------- diff --git a/examples/code_fragments/dokk/ligand.py b/examples/code_fragments/dokk/ligand.py index 4fc297ebc0f961e1e7e13db2bd43f18b8fd8cdcf..2683aaddb139c60ea561964057774079c4c72cb7 100644 --- a/examples/code_fragments/dokk/ligand.py +++ b/examples/code_fragments/dokk/ligand.py @@ -100,7 +100,7 @@ class Ligand: shift_vec = geom.Vec3(float(self.config.start["POSX"]), float(self.config.start["POSY"]), float(self.config.start["POSZ"])) - transf = mol.Transform() + transf = geom.Transform() transf.SetTrans(shift_vec) edi.SetTransform(transf.GetMatrix()) self.RotateAxis(geom.Vec3(1,0,0), float(self.config.start["ROTX"])) @@ -123,4 +123,4 @@ class Ligand: if dot>0: vec-=dot*p.GetNormal() return vec - return vec \ No newline at end of file + return vec diff --git a/examples/code_fragments/dokk/spnav_input.py b/examples/code_fragments/dokk/spnav_input.py index e51798578ed9842c8d4a75ec8b22481d997fa426..6f1a9de953ef00196588011c823b3cfe5744096a 100644 --- a/examples/code_fragments/dokk/spnav_input.py +++ b/examples/code_fragments/dokk/spnav_input.py @@ -39,7 +39,7 @@ class SpnavInputDevice(QtCore.QObject): def InputChanged(self, tx,ty,tz,rx,ry,rz): if (not self._lock_input) and (self.level is not None): ligand = self.level.ligand - transf = mol.Transform() + transf = geom.Transform() if(self.trans): delta = geom.Vec3 ((tx/480.0)*self._trans_factor, (ty/480.0)*self._trans_factor, (-tz/480.0)*self._trans_factor) transf.SetTrans(delta) diff --git a/modules/geom/pymod/CMakeLists.txt b/modules/geom/pymod/CMakeLists.txt index f79aeac4c2f9c8c127e28b0071c0ef502ba0ac38..5988cc95b1235d1b578e74b738469d002d3b2f0b 100644 --- a/modules/geom/pymod/CMakeLists.txt +++ b/modules/geom/pymod/CMakeLists.txt @@ -14,6 +14,7 @@ set(OST_GEOM_PYMOD_SOURCES export_composite2_op.cc export_composite3_op.cc export_quat.cc + export_transform.cc ) if (NOT ENABLE_STATIC) diff --git a/modules/mol/base/pymod/export_transform.cc b/modules/geom/pymod/export_transform.cc similarity index 91% rename from modules/mol/base/pymod/export_transform.cc rename to modules/geom/pymod/export_transform.cc index 1dc8bdc16bb6df0ba9f55693ebd0866da449400e..b2f921246bd2b6bedc90fa786aaa58f58b045ac5 100644 --- a/modules/mol/base/pymod/export_transform.cc +++ b/modules/geom/pymod/export_transform.cc @@ -18,14 +18,10 @@ //------------------------------------------------------------------------------ #include <boost/python.hpp> -#include <ost/mol/transform.hh> -#if(OST_INFO_ENABLED) -#include <ost/info/info.hh> -#endif +#include <ost/geom/transform.hh> using namespace boost::python; -using namespace ost; -using namespace ost::mol; +using namespace geom; void export_Transform() { @@ -56,8 +52,4 @@ void export_Transform() .def("ApplyZAxisTranslation",&Transform::ApplyZAxisTranslation) .def("ApplyAxisRotation",&Transform::ApplyAxisRotation) ; -#if(OST_INFO_ENABLED) - def("TransformToInfo", &TransformToInfo); - def("TransformFromInfo", &TransformFromInfo); -#endif } diff --git a/modules/geom/pymod/wrap_geom.cc b/modules/geom/pymod/wrap_geom.cc index 76bb7930057165463a426f60e133f15314b00618..14df2fa8b1fc2dbcff97f1f9913ca2861bc584e7 100644 --- a/modules/geom/pymod/wrap_geom.cc +++ b/modules/geom/pymod/wrap_geom.cc @@ -35,6 +35,7 @@ extern void export_Composite3(); extern void export_Composite2_op(); extern void export_Composite3_op(); extern void export_Quat(); +extern void export_Transform(); namespace details { #if (defined(OST_STATIC_PROPERTY_WORKAROUND)) @@ -64,6 +65,7 @@ BOOST_PYTHON_MODULE(_ost_geom) export_Composite2_op(); export_Composite3_op(); export_Quat(); + export_Transform(); #if (defined(OST_STATIC_PROPERTY_WORKAROUND)) // workaround for a problem with boost python and python 2.6.3/4 diff --git a/modules/geom/src/CMakeLists.txt b/modules/geom/src/CMakeLists.txt index b20b7d2439b5f58f2d5e2f936513fb4cda16dd8d..40f33282a196138eda009046a886606702360a9f 100644 --- a/modules/geom/src/CMakeLists.txt +++ b/modules/geom/src/CMakeLists.txt @@ -25,7 +25,7 @@ composite3_op.hh aligned_cuboid.hh vec_mat_predicates.hh quat.hh - +transform.hh point_cloud.hh module_config.hh ) @@ -43,6 +43,7 @@ composite3.cc composite2_op.cc composite3_op.cc quat.cc +transform.cc aligned_cuboid.cc point_cloud.cc ) diff --git a/modules/geom/src/geom.hh b/modules/geom/src/geom.hh index 138e8da92f7e78a45051f0123a4e6301c5ad9a6f..2bf028ab5b825a8a9eb100ba1c4d35e27626a640 100644 --- a/modules/geom/src/geom.hh +++ b/modules/geom/src/geom.hh @@ -29,5 +29,6 @@ #include "composite_op.hh" #include "quat.hh" #include "aligned_cuboid.hh" +#include "transform.hh" #endif diff --git a/modules/mol/base/src/transform.cc b/modules/geom/src/transform.cc similarity index 78% rename from modules/mol/base/src/transform.cc rename to modules/geom/src/transform.cc index ba1e59258299ca1f6011ddc1ebe1582aafba222b..d2a07f6ab0a701d0194bdcd1a4d300f039017f1f 100644 --- a/modules/mol/base/src/transform.cc +++ b/modules/geom/src/transform.cc @@ -18,18 +18,13 @@ //------------------------------------------------------------------------------ #include <ost/config.hh> -#if(OST_INFO_ENABLED) -#include <ost/info/info.hh> -#include <ost/info/geom_info_conversion.hh> -#endif #include <ost/log.hh> -#include "transform.hh" - -namespace ost { -using namespace geom; +#include "transform.hh" +#include "vecmat3_op.hh" +#include "vecmat4_op.hh" -namespace mol { +namespace geom { Transform::Transform(): rot_(Mat3(1,0,0, 0,1,0, 0,0,1)), @@ -207,7 +202,7 @@ void Transform::update_tm() try { itm_ = Invert(tm_); } catch (GeomException& e) { - LOG_WARNING("caught GeomException in Transform::update_tm: " << e.what()); + std::cerr << "caught GeomException in Transform::update_tm: " << e.what() << std::endl; itm_=geom::Mat4(); } } @@ -221,36 +216,4 @@ void Transform::update_components() trans_[2] = tm_(3,2); } -#if(OST_INFO_ENABLED) -Transform TransformFromInfo(const info::InfoGroup& group) -{ - if (!group.HasItem("center")) { - throw info::InfoError("Error while loading transform from info: " - "Group does not contain a center element"); - } - if (!group.HasGroup("rotation")) { - throw info::InfoError("Error while loading transform from info: " - "Group does not contain a rotation element"); - } - if (!group.HasItem("translation")) { - throw info::InfoError("Error while loading transform from info: " - "Group does not contain a translation element"); - } - Transform tf; - tf.SetCenter(group.GetItem("center").AsVector()); - tf.SetTrans(group.GetItem("translation").AsVector()); - tf.SetRot(info::Mat3FromInfo(group.GetGroup("rotation"))); - return tf; -} - -void TransformToInfo(const Transform& transform, info::InfoGroup& group) -{ - Transform tf; - group.CreateItem("center", transform.GetCenter()); - group.CreateItem("translation", transform.GetTrans()); - info::InfoGroup rot=group.CreateGroup("rotation"); - info::Mat3ToInfo(transform.GetRot(), rot); -} -#endif - -}} // ns +} // ns diff --git a/modules/geom/src/transform.hh b/modules/geom/src/transform.hh new file mode 100644 index 0000000000000000000000000000000000000000..997f763950d7f94a7f7c6df35ea11f210b40847d --- /dev/null +++ b/modules/geom/src/transform.hh @@ -0,0 +1,100 @@ +//------------------------------------------------------------------------------ +// This file is part of the OpenStructure project <www.openstructure.org> +// +// Copyright (C) 2008-2011 by the OpenStructure authors +// +// This library is free software; you can redistribute it and/or modify it under +// the terms of the GNU Lesser General Public License as published by the Free +// Software Foundation; either version 3.0 of the License, or (at your option) +// any later version. +// This library is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +// details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this library; if not, write to the Free Software Foundation, Inc., +// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +//------------------------------------------------------------------------------ +#ifndef OST_GEOM_TRANSFORM_HH +#define OST_GEOM_TRANSFORM_HH + +/* + Author: Ansgar Philippsen +*/ + +#include <ost/config.hh> + +#include "module_config.hh" +#include "vec3.hh" +#include "vec4.hh" +#include "mat3.hh" +#include "mat.hh" +#include "aligned_cuboid.hh" + +namespace geom { + +/// \brief basic and essential transformation class, including translation, +/// rotation and center of rotation +class DLLEXPORT_OST_GEOM Transform { +public: + Transform(); + + /// \brief retrieve transformation matrix + Mat4 GetMatrix() const {return tm_;} + /// \brief retrieve transposed transformation matrix + Mat4 GetTransposedMatrix() const {return ttm_;} + /// \brief retrieve inverted transformation matrix + Mat4 GetInvertedMatrix() const {return itm_;} + + /// \brief set center of rotation + void SetCenter(const Vec3& c); + /// \brief retrieve center of rotation + Vec3 GetCenter() const; + + // directly set tm, messing up rot/trans/cen ! + void SetMatrix(const Mat4& m); + + /// \name rotation + //@{ + /// \brief rotate around x-axis + void ApplyXAxisRotation(float delta); + void ApplyYAxisRotation(float delta); + void ApplyZAxisRotation(float delta); + void ApplyAxisRotation(float delta, const Vec3& axis); + + Mat3 GetXAxisRotation(float delta); + Mat3 GetYAxisRotation(float delta); + Mat3 GetZAxisRotation(float delta); + + Mat3 GetRot() const; + void SetRot(const Mat3& r); + //@} + /// \brief translation + //@{ + void ApplyXAxisTranslation(float delta); + void ApplyYAxisTranslation(float delta); + void ApplyZAxisTranslation(float delta); + void SetTrans(const Vec3& t); + Vec3 GetTrans() const; + //@} + + Vec3 Apply(const Vec3& v) const; + Vec4 Apply(const Vec4& v) const; + AlignedCuboid Apply(const AlignedCuboid& c) const; + +private: + Mat3 rot_; + Vec3 trans_; + Vec3 cen_; + Mat4 tm_; + Mat4 ttm_; + Mat4 itm_; + + void update_tm(); + void update_components(); +}; + +} // ns + +#endif diff --git a/modules/geom/tests/CMakeLists.txt b/modules/geom/tests/CMakeLists.txt index 027a167490b6256249a53a4cf1e569a237f3c8af..e4056c27878386828af14e91f2c56ee40e1566a6 100644 --- a/modules/geom/tests/CMakeLists.txt +++ b/modules/geom/tests/CMakeLists.txt @@ -11,6 +11,7 @@ set(GEOM_UNITTESTS test_vec2.cc test_vec3.cc test_vec4.cc + test_transform.cc tests.cc test_geom.py ) diff --git a/modules/mol/base/tests/test_transform.cc b/modules/geom/tests/test_transform.cc similarity index 92% rename from modules/mol/base/tests/test_transform.cc rename to modules/geom/tests/test_transform.cc index 5c950acc5a170448290be09dde71d76fad5e8e66..5f4a543fd8ecfa21c3a3ac78a0a4b88d24ee36f9 100644 --- a/modules/mol/base/tests/test_transform.cc +++ b/modules/geom/tests/test_transform.cc @@ -22,14 +22,11 @@ #define BOOST_TEST_DYN_LINK #include <boost/test/unit_test.hpp> #include <boost/test/auto_unit_test.hpp> -#include <ost/mol/mol.hh> -#include <ost/mol/transform.hh> #include <ost/geom/geom.hh> -using namespace ost; -using namespace ost::mol; +using namespace geom; -BOOST_AUTO_TEST_SUITE( mol_base ); +BOOST_AUTO_TEST_SUITE( geom_base ); BOOST_AUTO_TEST_CASE(test_transform) { diff --git a/modules/gfx/pymod/CMakeLists.txt b/modules/gfx/pymod/CMakeLists.txt index a3d8b251dda72f07f6e7394ad4fb3d0996fb4bd4..0ee14167c4f19232a7e4ecbdda746ab6c1b6a2a9 100644 --- a/modules/gfx/pymod/CMakeLists.txt +++ b/modules/gfx/pymod/CMakeLists.txt @@ -26,7 +26,7 @@ pymod(NAME gfx CPP ${OST_GFX_PYMOD_SOURCES} PY __init__.py py_gfx_obj.py) set(GRADIENT_FILE gradients.xml ) -copy_if_different("./" "${STAGE_DIR}/share/openstructure/scene" +copy_if_different("${CMAKE_CURRENT_SOURCE_DIR}" "${STAGE_DIR}/share/openstructure/scene" "${GRADIENT_FILE}" "PRESET GRADIENTS" _ost_gfx) install(FILES ${GRADIENT_FILE} DESTINATION "share/openstructure/scene") \ No newline at end of file diff --git a/modules/gfx/pymod/export_scene.cc b/modules/gfx/pymod/export_scene.cc index 18728c2cf3feee60f5727efffd5a61c098f4151b..39d1fde6bde504a407dea60247b7cadf01fb5b8a 100644 --- a/modules/gfx/pymod/export_scene.cc +++ b/modules/gfx/pymod/export_scene.cc @@ -60,7 +60,7 @@ geom::AlignedCuboid scene_get_bb2(Scene* scene, bool use_tf) return scene->GetBoundingBox(use_tf); } -geom::AlignedCuboid scene_get_bb3(Scene* scene, const mol::Transform& tf) +geom::AlignedCuboid scene_get_bb3(Scene* scene, const geom::Transform& tf) { return scene->GetBoundingBox(tf); } diff --git a/modules/gfx/src/CMakeLists.txt b/modules/gfx/src/CMakeLists.txt index 7a92969a95edb65706c9ecf012960c48eeae932e..57cf1601f715667068611be5abaa0559efaf7165 100644 --- a/modules/gfx/src/CMakeLists.txt +++ b/modules/gfx/src/CMakeLists.txt @@ -269,7 +269,7 @@ if (USE_SHADER) shader/material_toon1.glsl shader/material_toon2.glsl ) - copy_if_different("./" "${SHARED_DATA_PATH}/shader" "${SHADER_FILES}" + copy_if_different("${CMAKE_CURRENT_SOURCE_DIR}" "${SHARED_DATA_PATH}/shader" "${SHADER_FILES}" "SHADER_TARGETS" ost_gfx) install(FILES ${SHADER_FILES} DESTINATION "share/openstructure/shader") endif(USE_SHADER) @@ -277,7 +277,7 @@ set(TEXTURE_FILES test_texture.png glyph_texture.png ) -copy_if_different("./" "${SHARED_DATA_PATH}/textures" "${TEXTURE_FILES}" +copy_if_different("${CMAKE_CURRENT_SOURCE_DIR}" "${SHARED_DATA_PATH}/textures" "${TEXTURE_FILES}" "TEXTURE_TARGETS" ost_gfx) install(FILES ${TEXTURE_FILES} DESTINATION "share/openstructure/textures") diff --git a/modules/gfx/src/entity.cc b/modules/gfx/src/entity.cc index 3aec22fe5eaee632938be7b74ba4bc97342db774..df1ad6bfc08fc8b9b7d421653eca750d7f0469cd 100644 --- a/modules/gfx/src/entity.cc +++ b/modules/gfx/src/entity.cc @@ -231,7 +231,7 @@ void Entity::Rebuild() // update center in transformation geom::Vec3 center=this->GetCenter(); - Transform tf=this->GetTF(); + geom::Transform tf=this->GetTF(); tf.SetCenter(center); tf.SetTrans(center+GetTF().GetTrans()-GetTF().GetCenter()); this->SetTF(tf); diff --git a/modules/gfx/src/gfx_object.cc b/modules/gfx/src/gfx_object.cc index d527ceffabf5b805535a0dc1c796cd74b82ab19b..f7e3b06a5af9a5b1962156db728b4556e331c98c 100644 --- a/modules/gfx/src/gfx_object.cc +++ b/modules/gfx/src/gfx_object.cc @@ -400,7 +400,7 @@ geom::AlignedCuboid GfxObj::GetBoundingBox(bool use_tf) const } void GfxObj::ProcessLimits(geom::Vec3& minc, geom::Vec3& maxc, - const mol::Transform& tf) const + const geom::Transform& tf) const { try { geom::AlignedCuboid coord_limits=tf.Apply(this->GetBoundingBox(true)); @@ -476,13 +476,13 @@ void GfxObj::OnInput(const InputEvent& e) } } -const mol::Transform& GfxObj::GetTF() const +const geom::Transform& GfxObj::GetTF() const { return transform_; } -void GfxObj::SetTF(const mol::Transform& tf) +void GfxObj::SetTF(const geom::Transform& tf) { transform_=tf; } diff --git a/modules/gfx/src/gfx_object.hh b/modules/gfx/src/gfx_object.hh index 8809e1046fe10d15c410bc51f86545cc1bc32cf1..fc906c35c9fdb7c563417c6785e5023d2dabe594 100644 --- a/modules/gfx/src/gfx_object.hh +++ b/modules/gfx/src/gfx_object.hh @@ -33,7 +33,7 @@ #include <ost/config.hh> #include <ost/gfx/module_config.hh> -#include <ost/mol/transform.hh> +#include <ost/geom/transform.hh> #include "gfx_object_fw.hh" #include "gfx_object_base.hh" @@ -123,7 +123,7 @@ public: will be adjusted based on the Cuboid returned by GetBoundingBox(true) */ virtual void ProcessLimits(geom::Vec3& minc, geom::Vec3& maxc, - const mol::Transform& tf) const; + const geom::Transform& tf) const; // implemented in derived classes for the actual GL rendering /* @@ -168,9 +168,9 @@ public: void Clear(); /// \brief get transform - const mol::Transform& GetTF() const; + const geom::Transform& GetTF() const; /// \brief set transform - void SetTF(const mol::Transform& tf); + void SetTF(const geom::Transform& tf); // add a label at the given position void AddLabel(const String& s, const geom::Vec3& pos, const Color& col, float psize); @@ -225,7 +225,7 @@ public: RenderMode::Type render_mode_; unsigned int debug_flags_; - mol::Transform transform_; + geom::Transform transform_; bool rebuild_; bool refresh_; float line_width_; diff --git a/modules/gfx/src/impl/entity_detail.cc b/modules/gfx/src/impl/entity_detail.cc index 02e40b2138edee1e989c80a6680fee04fedbc897..407654cfcfa514cc379a240ac1a68bc6d131a077 100644 --- a/modules/gfx/src/impl/entity_detail.cc +++ b/modules/gfx/src/impl/entity_detail.cc @@ -57,7 +57,7 @@ void DoRenderBlur(BondEntryList& bl, float bf1, float bf2) { // add blur for this particular orientation! // don't use vertex array, but on-the-fly oriented and z-sorted quads - mol::Transform tf = Scene::Instance().GetTransform(); + geom::Transform tf = Scene::Instance().GetTransform(); std::vector<BlurQuadEntry> bql; for (BondEntryList::iterator it=bl.begin(); it!=bl.end();++it) { diff --git a/modules/gfx/src/impl/scene_fx.cc b/modules/gfx/src/impl/scene_fx.cc index 8979d96441fc5367ec6cf223266654949683bee4..de0000484bf41a13d91220a312e54013ac643922 100644 --- a/modules/gfx/src/impl/scene_fx.cc +++ b/modules/gfx/src/impl/scene_fx.cc @@ -406,7 +406,7 @@ void SceneFX::prep_shadow_map() #endif // modelview transform for the lightsource pov - mol::Transform ltrans(Scene::Instance().GetTransform()); + geom::Transform ltrans(Scene::Instance().GetTransform()); ltrans.SetRot(Scene::Instance().GetLightRot()*ltrans.GetRot()); // calculate encompassing box for ortho projection diff --git a/modules/gfx/src/map_iso.cc b/modules/gfx/src/map_iso.cc index 5dbd4d3907c57964a3b21c0d9183e3e1917ccf2e..7a2c5160c435badb6bd25267759c6fd9a119ebed 100644 --- a/modules/gfx/src/map_iso.cc +++ b/modules/gfx/src/map_iso.cc @@ -86,7 +86,7 @@ MapIso::MapIso(const String& name, const img::MapHandle& mh, SetMatDiff(Color(1,1,1)); SetMatSpec(Color(0.1,0.1,0.1)); SetMatShin(32); - mol::Transform tf=this->GetTF(); + geom::Transform tf=this->GetTF(); tf.SetCenter(this->GetCenter()); tf.SetTrans(this->GetCenter()); this->SetTF(tf); diff --git a/modules/gfx/src/povray.hh b/modules/gfx/src/povray.hh index b647420a148964a96a26abe3b73b264b74316116..c8ef79461b8380c9c870d547fe1f6e26b180d0eb 100644 --- a/modules/gfx/src/povray.hh +++ b/modules/gfx/src/povray.hh @@ -26,7 +26,7 @@ #include <string> #include <fstream> -#include <ost/mol/transform.hh> +#include <ost/geom/transform.hh> #include "color.hh" @@ -63,7 +63,7 @@ public: public: bool use_tf; - mol::Transform tf; + geom::Transform tf; private: std::string pov_file_; diff --git a/modules/gfx/src/prim_list.cc b/modules/gfx/src/prim_list.cc index b531ba2796a597b8e8eb9d171c6a49d9d87a1e42..e07820e6bc6c15af276b8a7012baa21b00545eb3 100644 --- a/modules/gfx/src/prim_list.cc +++ b/modules/gfx/src/prim_list.cc @@ -65,12 +65,12 @@ geom::AlignedCuboid PrimList::GetBoundingBox() const geom::Vec3 maxc(-std::numeric_limits<float>::max(), -std::numeric_limits<float>::max(), -std::numeric_limits<float>::max()); - ProcessLimits(minc,maxc,mol::Transform()); + ProcessLimits(minc,maxc,geom::Transform()); return geom::AlignedCuboid(minc,maxc); } void PrimList::ProcessLimits(geom::Vec3& minc, geom::Vec3& maxc, - const mol::Transform& tf) const + const geom::Transform& tf) const { for(SpherePrimList::const_iterator it=points_.begin();it!=points_.end();++it) { geom::Vec3 tpos = tf.Apply(it->position); diff --git a/modules/gfx/src/prim_list.hh b/modules/gfx/src/prim_list.hh index 395e53e2ad22ce359b37281caead22cad1a423e9..afc999a7febc930495d2f7620c7795295293be42 100644 --- a/modules/gfx/src/prim_list.hh +++ b/modules/gfx/src/prim_list.hh @@ -64,7 +64,7 @@ class DLLEXPORT_OST_GFX PrimList: public GfxObj virtual geom::AlignedCuboid GetBoundingBox() const; virtual void ProcessLimits(geom::Vec3& minc, geom::Vec3& maxc, - const mol::Transform& tf) const; + const geom::Transform& tf) const; /// \brief get center virtual geom::Vec3 GetCenter() const; diff --git a/modules/gfx/src/scene.cc b/modules/gfx/src/scene.cc index fde6ad665d0ce3537bf9c97d5e3d26d1055bb62a..2650eea5b09f5169bee74a9e984437573619aa3c 100644 --- a/modules/gfx/src/scene.cc +++ b/modules/gfx/src/scene.cc @@ -699,13 +699,13 @@ float Scene::GetDefaultTextSize() namespace { -void draw_lightdir(const Vec3& ldir, const mol::Transform& tf) +void draw_lightdir(const Vec3& ldir, const geom::Transform& tf) { glPushAttrib(GL_ENABLE_BIT); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); - mol::Transform tmpt(tf); + geom::Transform tmpt(tf); tmpt.SetRot(Mat3::Identity()); glMultMatrix(tmpt.GetTransposedMatrix().Data()); glDisable(GL_NORMALIZE); @@ -1216,7 +1216,7 @@ namespace { class BBCalc: public GfxNodeVisitor { public: - BBCalc(const geom::Vec3& mmin, const geom::Vec3& mmax, const mol::Transform& tf): + BBCalc(const geom::Vec3& mmin, const geom::Vec3& mmax, const geom::Transform& tf): minc(mmin),maxc(mmax),tf(tf),valid(false) {} bool VisitNode(GfxNode* node, const Stack& st) { @@ -1235,7 +1235,7 @@ public: } Vec3 minc,maxc; - mol::Transform tf; + geom::Transform tf; bool valid; }; @@ -1243,10 +1243,10 @@ public: geom::AlignedCuboid Scene::GetBoundingBox(bool use_tf) const { - return GetBoundingBox(use_tf ? transform_ : mol::Transform()); + return GetBoundingBox(use_tf ? transform_ : geom::Transform()); } -geom::AlignedCuboid Scene::GetBoundingBox(const mol::Transform& tf) const +geom::AlignedCuboid Scene::GetBoundingBox(const geom::Transform& tf) const { BBCalc bbcalc(Vec3(std::numeric_limits<float>::max(), std::numeric_limits<float>::max(), @@ -1264,12 +1264,12 @@ geom::AlignedCuboid Scene::GetBoundingBox(const mol::Transform& tf) const return geom::AlignedCuboid(geom::Vec3(),geom::Vec3()); } -mol::Transform Scene::GetTransform() const +geom::Transform Scene::GetTransform() const { return transform_; } -void Scene::SetTransform(const mol::Transform& t) +void Scene::SetTransform(const geom::Transform& t) { transform_=t; this->RequestRedraw(); @@ -1721,7 +1721,7 @@ public: } } Vec3 minc,maxc; - mol::Transform transform; + geom::Transform transform; bool valid; }; diff --git a/modules/gfx/src/scene.hh b/modules/gfx/src/scene.hh index 62630ced64dd95afd7b36957e2a97d6f35a3ba61..4edc6663770bbdb3c047382f04e925474bd06baf 100644 --- a/modules/gfx/src/scene.hh +++ b/modules/gfx/src/scene.hh @@ -30,7 +30,7 @@ #include <boost/shared_array.hpp> #include <ost/gfx/module_config.hh> -#include <ost/mol/transform.hh> +#include <ost/geom/transform.hh> #include <ost/mol/atom_handle.hh> #include "gl_include.hh" @@ -84,7 +84,7 @@ class DLLEXPORT_OST_GFX Scene { // refactoring of the scene it into a management // and a view part struct SceneViewStackEntry { - mol::Transform transform; + geom::Transform transform; float fov; float znear,zfar; }; @@ -363,13 +363,13 @@ class DLLEXPORT_OST_GFX Scene { geom::AlignedCuboid GetBoundingBox(bool use_tf=true) const; /// \brief return bounding box of with a given transform - geom::AlignedCuboid GetBoundingBox(const mol::Transform& tf) const; + geom::AlignedCuboid GetBoundingBox(const geom::Transform& tf) const; /// \brief get full underlying transformation - mol::Transform GetTransform() const; + geom::Transform GetTransform() const; /// \brief set transform - void SetTransform(const mol::Transform& t); + void SetTransform(const geom::Transform& t); /// \brief returns a compact, internal representation of the scene orientation geom::Mat4 GetRTC() const; @@ -513,7 +513,7 @@ private: mutable GfxNodeP root_node_; // mutable is slightly hackish SceneObserverList observers_; - mol::Transform transform_; // overall modelview transformation + geom::Transform transform_; // overall modelview transformation bool gl_init_; diff --git a/modules/gui/pymod/CMakeLists.txt b/modules/gui/pymod/CMakeLists.txt index cf4ea93cd6db34bc3764c2132c0836266f2ddc9c..4ac7f7cfe75a5fe6a0e843a4389e64e02e8228ed 100644 --- a/modules/gui/pymod/CMakeLists.txt +++ b/modules/gui/pymod/CMakeLists.txt @@ -105,7 +105,7 @@ set(PRESET_FILES scene/presets.xml scene/loaders.xml ) -copy_if_different("./" "${STAGE_DIR}/share/openstructure/scene" +copy_if_different("${CMAKE_CURRENT_SOURCE_DIR}" "${STAGE_DIR}/share/openstructure/scene" "${PRESET_FILES}" "IMMUTABLE_FILES" _ost_gui) install(FILES ${PRESET_FILES} DESTINATION "share/openstructure/scene") @@ -115,7 +115,7 @@ set(INSPECTOR_ICONS scene/icons/render_icon.png scene/icons/tool_icon.png ) -copy_if_different("./" "${STAGE_DIR}/share/openstructure/scene/icons" +copy_if_different("${CMAKE_CURRENT_SOURCE_DIR}" "${STAGE_DIR}/share/openstructure/scene/icons" "${INSPECTOR_ICONS}" "ICONS_FOR_INSPECTOR" _ost_gui) install(FILES ${INSPECTOR_ICONS} DESTINATION "share/openstructure/scene/icons") diff --git a/modules/gui/share/CMakeLists.txt b/modules/gui/share/CMakeLists.txt index 816af7f807240d1d363ada12768a7d9d6c8f1f37..de3daf8d83caa584ae0cd072ae6aeefb8ffa4b2e 100644 --- a/modules/gui/share/CMakeLists.txt +++ b/modules/gui/share/CMakeLists.txt @@ -23,11 +23,11 @@ set(GUI_IMAGES ) add_custom_target(scene_icons ALL) -copy_if_different("./" "${STAGE_DIR}/share/openstructure/gui/icons" +copy_if_different("${CMAKE_CURRENT_SOURCE_DIR}" "${STAGE_DIR}/share/openstructure/gui/icons" "${GUI_ICONS}" "ICONS_FOR_GUI" scene_icons) install(FILES ${GUI_ICONS} DESTINATION "share/openstructure/gui/icons") add_custom_target(gui_images ALL) -copy_if_different("./" "${STAGE_DIR}/share/openstructure/gui/images" +copy_if_different("${CMAKE_CURRENT_SOURCE_DIR}" "${STAGE_DIR}/share/openstructure/gui/images" "${GUI_IMAGES}" "IMAGES_FOR_GUI" gui_images) install(FILES ${GUI_IMAGES} DESTINATION "share/openstructure/gui/images") \ No newline at end of file diff --git a/modules/gui/src/dock_widget.cc b/modules/gui/src/dock_widget.cc index 9ba553ca55d551e6c669150cf222e7e9967df800..53b7d7ea70f32d44f965a0f1d65de3029ebc3c1a 100644 --- a/modules/gui/src/dock_widget.cc +++ b/modules/gui/src/dock_widget.cc @@ -35,4 +35,4 @@ void DockWidget::closeEvent(QCloseEvent* e) emit OnClose(this); } -}} // ns \ No newline at end of file +}} // ns diff --git a/modules/gui/src/gosty.cc b/modules/gui/src/gosty.cc index 49750b9dca33c65e927d52dad461d5973b96fc80..670c454c1886f0c1c2013954d3996a38060781b6 100644 --- a/modules/gui/src/gosty.cc +++ b/modules/gui/src/gosty.cc @@ -108,13 +108,20 @@ String get_ost_root() void setup_python_search_path(const String& root, PythonInterpreter& pi) { + std::stringstream site_pkgs; + site_pkgs << "python" << PY_MAJOR_VERSION << "." << PY_MINOR_VERSION; #ifdef _MSC_VER - pi.AppendModulePath(QString::fromStdString(root+"\\lib\\openstructure")); + pi.AppendModulePath(QString::fromStdString(root+"\\lib\\"+site_pkgs.str() + +"\\site-packages")); #else # if (defined(__ppc64__) || defined(__x86_64__)) && !defined(__APPLE__) - pi.AppendModulePath(QString::fromStdString(root+"/lib64/openstructure")); + pi.AppendModulePath(QString::fromStdString(root+"/lib64/"+ + site_pkgs.str()+ + "site-packages")); # else - pi.AppendModulePath(QString::fromStdString(root+"/lib/openstructure")); + pi.AppendModulePath(QString::fromStdString(root+"/lib/"+ + site_pkgs.str()+ + "/site-packages")); # endif #endif pi.AppendModulePath("."); diff --git a/modules/gui/src/tools/map_tool.cc b/modules/gui/src/tools/map_tool.cc index e16895621fabc2ca32c2797dd395a00fc8b936af..96e622a3d39b914a37f6e2c87a9ec0ddcfeb72ee 100644 --- a/modules/gui/src/tools/map_tool.cc +++ b/modules/gui/src/tools/map_tool.cc @@ -56,7 +56,7 @@ void MapTool::MouseMove(const MouseEvent& event) gfx::Scene::Instance().StatusMessage(s.str()); } } else if(gfx::MapSlab* ms = dynamic_cast<gfx::MapSlab*>(np.get())) { - mol::Transform tf = gfx::Scene::Instance().GetTransform(); + geom::Transform tf = gfx::Scene::Instance().GetTransform(); geom::Plane plane = ms->GetPlane(); if(event.GetButtons()==MouseEvent::LeftButton) { if (event.IsShiftPressed()) { diff --git a/modules/img/alg/pymod/wrap_alg.cc b/modules/img/alg/pymod/wrap_alg.cc index c141fe11310076374194677f601e98a1929eb446..7185f34021a1b70e7f6a8f380896ec7feeafcdc6 100644 --- a/modules/img/alg/pymod/wrap_alg.cc +++ b/modules/img/alg/pymod/wrap_alg.cc @@ -54,7 +54,7 @@ using namespace ost; using namespace ost::img; -using namespace ost::img::alg; +//using namespace ost::img::alg; using namespace boost::python; // fw decl @@ -63,11 +63,8 @@ void export_Normalizer(); void export_Transcendentals(); void export_Polar(); -using namespace ost::img; -using namespace ost::img::alg; - namespace { -list get_histo_bins(const Histogram& hist) { +list get_histo_bins(const alg::Histogram& hist) { list result; const std::vector<int>& bins = hist.GetBins(); for(std::vector<int>::const_iterator it=bins.begin();it!=bins.end();++it) { @@ -76,32 +73,32 @@ list get_histo_bins(const Histogram& hist) { return result; } -void frac_shift0(FractionalShift* s) +void frac_shift0(alg::FractionalShift* s) { s->SetShift(); } -void frac_shift1(FractionalShift* s, Real sx) +void frac_shift1(alg::FractionalShift* s, Real sx) { s->SetShift(sx); } -void frac_shift2(FractionalShift* s, Real sx, Real sy) +void frac_shift2(alg::FractionalShift* s, Real sx, Real sy) { s->SetShift(sx,sy); } -void frac_shift3(FractionalShift* s, Real sx, Real sy, Real sz) +void frac_shift3(alg::FractionalShift* s, Real sx, Real sy, Real sz) { s->SetShift(sx,sy,sz); } -void frac_shift4(FractionalShift* s, const Vec2& v) +void frac_shift4(alg::FractionalShift* s, const Vec2& v) { s->SetShift(v); } -void frac_shift5(FractionalShift* s, const Vec3& v) +void frac_shift5(alg::FractionalShift* s, const Vec3& v) { s->SetShift(v); } @@ -109,7 +106,7 @@ void frac_shift5(FractionalShift* s, const Vec3& v) Real real_spatial_cross_correlation_1(const ConstImageHandle& image1, const ConstImageHandle& image2) { - return RealSpatialCrossCorrelation(image1,image2); + return alg::RealSpatialCrossCorrelation(image1,image2); } @@ -117,94 +114,94 @@ Real real_spatial_cross_correlation_2(const ConstImageHandle& image1, const ConstImageHandle& image2, const Extent& extent) { - return RealSpatialCrossCorrelation(image1,image2,extent); + return alg::RealSpatialCrossCorrelation(image1,image2,extent); } } //anon ns BOOST_PYTHON_MODULE(_ost_img_alg) { - class_<AutoCorrelate, bases<ConstModOPAlgorithm> >("AutoCorrelate",init<>()); + class_<alg::AutoCorrelate, bases<ConstModOPAlgorithm> >("AutoCorrelate",init<>()); - class_<Clear,bases<ConstModIPAlgorithm> >("Clear", init<>()); + class_<alg::Clear,bases<ConstModIPAlgorithm> >("Clear", init<>()); - class_<Conj,bases<ConstModIPAlgorithm> >("Conj", init<>()); + class_<alg::Conj,bases<ConstModIPAlgorithm> >("Conj", init<>()); - class_<ExplicitConvolute,bases<ConstModOPAlgorithm> >("ExplicitConvolute", init<const ConstImageHandle&,optional<bool> >()); + class_<alg::ExplicitConvolute,bases<ConstModOPAlgorithm> >("ExplicitConvolute", init<const ConstImageHandle&,optional<bool> >()); - class_<ExplicitCorrelate,bases<ConstModOPAlgorithm> >("ExplicitCorrelate", init<const ConstImageHandle&>()); + class_<alg::ExplicitCorrelate,bases<ConstModOPAlgorithm> >("ExplicitCorrelate", init<const ConstImageHandle&>()); - class_<CrossCorrelate,bases<ConstModIPAlgorithm> >("CrossCorrelate", init<const ConstImageHandle&>()); + class_<alg::CrossCorrelate,bases<ConstModIPAlgorithm> >("CrossCorrelate", init<const ConstImageHandle&>()); - class_<DFT,bases<ConstModOPAlgorithm> >("DFT", init<>()); + class_<alg::DFT,bases<ConstModOPAlgorithm> >("DFT", init<>()); - class_<FFT,bases<ConstModOPAlgorithm> >("FFT", init<>()); + class_<alg::FFT,bases<ConstModOPAlgorithm> >("FFT", init<>()); - class_<PowerSpectrum,bases<ConstModOPAlgorithm> >("PowerSpectrum",init<>()); + class_<alg::PowerSpectrum,bases<ConstModOPAlgorithm> >("PowerSpectrum",init<>()); - class_<Fill,bases<ConstModIPAlgorithm> >("Fill", init<const Complex&>()) + class_<alg::Fill,bases<ConstModIPAlgorithm> >("Fill", init<const Complex&>()) .def(init<Real>()) ; - class_<Threshold,bases<ConstModIPAlgorithm> >("Threshold", init<const Complex&>()) + class_<alg::Threshold,bases<ConstModIPAlgorithm> >("Threshold", init<const Complex&>()) .def(init<Real>()) ; - class_<DensitySlice,bases<ConstModIPAlgorithm> >("DensitySlice", + class_<alg::DensitySlice,bases<ConstModIPAlgorithm> >("DensitySlice", init<const Complex&,const Complex&>()) .def(init<Real,Real>()) ; - class_<ClipMinMax,bases<ConstModIPAlgorithm> >("ClipMinMax", + class_<alg::ClipMinMax,bases<ConstModIPAlgorithm> >("ClipMinMax", init<const Complex&,const Complex&>()) .def(init<Real,Real>()) ; - class_<Histogram, bases<NonModAlgorithm> >("Histogram", init<int,Real,Real>() ) + class_<alg::Histogram, bases<NonModAlgorithm> >("Histogram", init<int,Real,Real>() ) .def("GetBins",get_histo_bins) ; - class_<Negate,bases<ConstModIPAlgorithm> >("Negate", init<>()); - - class_<Stat, bases<NonModAlgorithm> >("Stat", init<>() ) - .def("GetMean",&Stat::GetMean) - .def("SetMean",&Stat::SetMean) - .def("GetMinimum",&Stat::GetMinimum) - .def("GetMinimumPosition",&Stat::GetMinimumPosition) - .def("SetMinimum",&Stat::SetMinimum) - .def("GetMaximum",&Stat::GetMaximum) - .def("GetMaximumPosition",&Stat::GetMaximumPosition) - .def("SetMaximum",&Stat::SetMaximum) - .def("GetSum",&Stat::GetSum) - .def("GetRootMeanSquare",&Stat::GetRootMeanSquare) - .def("GetSkewness",&Stat::GetSkewness) - .def("GetKurtosis",&Stat::GetKurtosis) - .def("GetVariance",&Stat::GetVariance) - .def("SetVariance",&Stat::SetVariance) - .def("GetStandardDeviation",&Stat::GetStandardDeviation) - .def("SetStandardDeviation",&Stat::SetStandardDeviation) - .def("GetCenterOfMass",&Stat::GetCenterOfMass) + class_<alg::Negate,bases<ConstModIPAlgorithm> >("Negate", init<>()); + + class_<alg::Stat, bases<NonModAlgorithm> >("Stat", init<>() ) + .def("GetMean",&alg::Stat::GetMean) + .def("SetMean",&alg::Stat::SetMean) + .def("GetMinimum",&alg::Stat::GetMinimum) + .def("GetMinimumPosition",&alg::Stat::GetMinimumPosition) + .def("SetMinimum",&alg::Stat::SetMinimum) + .def("GetMaximum",&alg::Stat::GetMaximum) + .def("GetMaximumPosition",&alg::Stat::GetMaximumPosition) + .def("SetMaximum",&alg::Stat::SetMaximum) + .def("GetSum",&alg::Stat::GetSum) + .def("GetRootMeanSquare",&alg::Stat::GetRootMeanSquare) + .def("GetSkewness",&alg::Stat::GetSkewness) + .def("GetKurtosis",&alg::Stat::GetKurtosis) + .def("GetVariance",&alg::Stat::GetVariance) + .def("SetVariance",&alg::Stat::SetVariance) + .def("GetStandardDeviation",&alg::Stat::GetStandardDeviation) + .def("SetStandardDeviation",&alg::Stat::SetStandardDeviation) + .def("GetCenterOfMass",&alg::Stat::GetCenterOfMass) .def(self_ns::str(self)) ; - class_<StatMinMax, bases<NonModAlgorithm> >("StatMinMax", init<>() ) - .def("GetMinimum",&StatMinMax::GetMinimum) - .def("GetMinimumPosition",&StatMinMax::GetMinimumPosition) - .def("SetMinimum",&StatMinMax::SetMinimum) - .def("GetMaximum",&StatMinMax::GetMaximum) - .def("GetMaximumPosition",&StatMinMax::GetMaximumPosition) - .def("SetMaximum",&StatMinMax::SetMaximum) + class_<alg::StatMinMax, bases<NonModAlgorithm> >("StatMinMax", init<>() ) + .def("GetMinimum",&alg::StatMinMax::GetMinimum) + .def("GetMinimumPosition",&alg::StatMinMax::GetMinimumPosition) + .def("SetMinimum",&alg::StatMinMax::SetMinimum) + .def("GetMaximum",&alg::StatMinMax::GetMaximum) + .def("GetMaximumPosition",&alg::StatMinMax::GetMaximumPosition) + .def("SetMaximum",&alg::StatMinMax::SetMaximum) .def(self_ns::str(self)) ; - class_<Randomize,bases<ConstModIPAlgorithm> >("Randomize", init<>()); + class_<alg::Randomize,bases<ConstModIPAlgorithm> >("Randomize", init<>()); - class_<MaskImage, bases<ConstModIPAlgorithm> >("MaskImage",init<const MaskPtr&,optional<bool> >()) + class_<alg::MaskImage, bases<ConstModIPAlgorithm> >("MaskImage",init<const MaskPtr&,optional<bool> >()) ; - class_<SmoothMaskImage, bases<ModIPAlgorithm> >("SmoothMaskImage",init<const MaskPtr&, Real, optional<bool> >()) + class_<alg::SmoothMaskImage, bases<ModIPAlgorithm> >("SmoothMaskImage",init<const MaskPtr&, Real, optional<bool> >()) ; - class_<LocalSigmaThreshold, bases<ConstModOPAlgorithm> >("LocalSigmaThreshold", init<int,Real>() ); + class_<alg::LocalSigmaThreshold, bases<ConstModOPAlgorithm> >("LocalSigmaThreshold", init<int,Real>() ); export_Filter(); export_Normalizer(); @@ -212,34 +209,34 @@ BOOST_PYTHON_MODULE(_ost_img_alg) export_Transcendentals(); - class_<Transformation>("Transformation", init<>()) + class_<alg::Transformation>("Transformation", init<>()) .def(init<const Mat4&>()) .def(init<const Mat4&, const Mat4&>()) ; - class_<Rotate2D, bases<Transformation> >("Rotate2D", init<Real>() ); - class_<Rotate2D90, bases<Transformation> >("Rotate2D90", init<int>() ); - class_<Scale, bases<Transformation> >("Scale", init<Real>() ); - class_<Translate, bases<Transformation> >("Translate", init<const Vec3&>() ); + class_<alg::Rotate2D, bases<alg::Transformation> >("Rotate2D", init<Real>() ); + class_<alg::Rotate2D90, bases<alg::Transformation> >("Rotate2D90", init<int>() ); + class_<alg::Scale, bases<alg::Transformation> >("Scale", init<Real>() ); + class_<alg::Translate, bases<alg::Transformation> >("Translate", init<const Vec3&>() ); - class_<Transform,bases<ConstModOPAlgorithm> >("Transform",init<>()) - .def(init<const Transformation&, optional<const Vec3&> >()) + class_<alg::Transform,bases<ConstModOPAlgorithm> >("Transform",init<>()) + .def(init<const alg::Transformation&, optional<const Vec3&> >()) ; - class_<Shift,bases<ConstModOPAlgorithm> >("Shift",init<>()) + class_<alg::Shift,bases<ConstModOPAlgorithm> >("Shift",init<>()) .def(init<const Point&>()) ; - class_<Mirror,bases<ConstModOPAlgorithm> >("Mirror",init<>()) + class_<alg::Mirror,bases<ConstModOPAlgorithm> >("Mirror",init<>()) .def(init<int>()) ; - class_<DiscreteShrink, bases<ConstModOPAlgorithm> >("DiscreteShrink",init<optional<const Size&> >()) - .def("SetBlocksize",&DiscreteShrink::SetBlocksize) - .def("GetBlocksize",&DiscreteShrink::GetBlocksize) + class_<alg::DiscreteShrink, bases<ConstModOPAlgorithm> >("DiscreteShrink",init<optional<const Size&> >()) + .def("SetBlocksize",&alg::DiscreteShrink::SetBlocksize) + .def("GetBlocksize",&alg::DiscreteShrink::GetBlocksize) ; - class_<FractionalShift, bases<ModIPAlgorithm> >("FractionalShift", init<optional <Real,Real,Real> >() ) + class_<alg::FractionalShift, bases<ModIPAlgorithm> >("FractionalShift", init<optional <Real,Real,Real> >() ) .def(init<const Vec3&>()) .def("SetShift",frac_shift0) .def("SetShift",frac_shift1) @@ -247,22 +244,22 @@ BOOST_PYTHON_MODULE(_ost_img_alg) .def("SetShift",frac_shift3) .def("SetShift",frac_shift4) .def("SetShift",frac_shift5) - .def("GetShift",&FractionalShift::GetShift) + .def("GetShift",&alg::FractionalShift::GetShift) ; - class_<LineAverage, bases<ConstModOPAlgorithm> >("LineAverage", init<>() ) + class_<alg::LineAverage, bases<ConstModOPAlgorithm> >("LineAverage", init<>() ) .def(init<unsigned int>()) - .def("GetGeometry",&LineAverage::GetGeometry) - .def("SetGeometry",&LineAverage::SetGeometry) + .def("GetGeometry",&alg::LineAverage::GetGeometry) + .def("SetGeometry",&alg::LineAverage::SetGeometry) ; def("RealSpatialCrossCorrelation",real_spatial_cross_correlation_1); def("RealSpatialCrossCorrelation",real_spatial_cross_correlation_2); - class_<HighestPeakSearch3D, bases<NonModAlgorithm> >("HighestPeakSearch3D" ,init<int,int,Real>()) + class_<alg::HighestPeakSearch3D, bases<NonModAlgorithm> >("HighestPeakSearch3D" ,init<int,int,Real>()) .def(init<int,int>()) .def(init<int>()) .def(init<>()) - .def("GetPeakList",&HighestPeakSearch3D::GetPeakList) - .def("ClearPeakList",&HighestPeakSearch3D::ClearPeakList) + .def("GetPeakList",&alg::HighestPeakSearch3D::GetPeakList) + .def("ClearPeakList",&alg::HighestPeakSearch3D::ClearPeakList) ; } diff --git a/modules/img/alg/tests/test_transform.cc b/modules/img/alg/tests/test_transform.cc index 2721c3369d73805d7ec99675f08d085e74210d01..62a12549d8e66ea390c61ca8535f474d348d8af0 100644 --- a/modules/img/alg/tests/test_transform.cc +++ b/modules/img/alg/tests/test_transform.cc @@ -33,21 +33,20 @@ namespace { using namespace ost::img; -using namespace ost::img::alg; void test() { alg::Randomize rnd; - Transform transform; + alg::Transform transform; } void test_point() { Point p0(3,-2,1); Point p1a(9,-6,3); - Point p1b(Scale(3.0).Apply(p0)); + Point p1b(alg::Scale(3.0).Apply(p0)); Point p2a(Point(2,3,1)); - Point p2b=Rotate2D(M_PI_2).Apply(p0); + Point p2b=alg::Rotate2D(M_PI_2).Apply(p0); std::ostringstream msg; msg << p1a << " != " << p1b; @@ -61,9 +60,9 @@ void test_extent() { Extent e0(Point(0,0),Point(2,3)); Extent e1a(Point(-1,-1),Point(7,10)); - Extent e1b=Scale(3.0).Apply(e0); + Extent e1b=alg::Scale(3.0).Apply(e0); Extent e2a(Point(-3,0),Point(0,2)); - Extent e2b=Rotate2D(M_PI_2).Apply(e0); + Extent e2b=alg::Rotate2D(M_PI_2).Apply(e0); std::ostringstream msg; msg << e1a << " != " << e1b; @@ -74,10 +73,10 @@ void test_extent() e0=Extent(Point(-3,-2),Size(8,10)); e1a=Extent(Point(-10,-7),Size(24,30)); - e1b=Scale(3.0).Apply(e0); + e1b=alg::Scale(3.0).Apply(e0); e2a=Extent(Point(-7,-3),Size(10,8)); - e2b=Rotate2D(M_PI_2).Apply(e0); + e2b=alg::Rotate2D(M_PI_2).Apply(e0); msg.str(""); msg << e1a << " != " << e1b; diff --git a/modules/info/pymod/wrap_info.cc b/modules/info/pymod/wrap_info.cc index 4af9741d63430f0964b415d83410641ab9d54762..cf15c736d937cccbd6f910e3646aba3c8448d97a 100644 --- a/modules/info/pymod/wrap_info.cc +++ b/modules/info/pymod/wrap_info.cc @@ -314,4 +314,8 @@ BOOST_PYTHON_MODULE(_ost_info) class_<VerboseInfoVisitor, bases<InfoVisitor> >("VerboseInfoVisitor",init<>()) ; + + def("TransformToInfo", &TransformToInfo); + def("TransformFromInfo", &TransformFromInfo); + } diff --git a/modules/info/src/geom_info_conversion.cc b/modules/info/src/geom_info_conversion.cc index 8c7681be583ed4464f1e6460dcf32a3e541aa4c9..8e5711904bb103d9ce0237b051e7c799bb0071e9 100644 --- a/modules/info/src/geom_info_conversion.cc +++ b/modules/info/src/geom_info_conversion.cc @@ -80,4 +80,35 @@ geom::Mat4 Mat4FromInfo(const InfoGroup& group) return mat; } -}} +geom::Transform TransformFromInfo(const InfoGroup& group) +{ + if (!group.HasItem("center")) { + throw InfoError("Error while loading transform from info: " + "Group does not contain a center element"); + } + if (!group.HasGroup("rotation")) { + throw InfoError("Error while loading transform from info: " + "Group does not contain a rotation element"); + } + if (!group.HasItem("translation")) { + throw InfoError("Error while loading transform from info: " + "Group does not contain a translation element"); + } + geom::Transform tf; + tf.SetCenter(group.GetItem("center").AsVector()); + tf.SetTrans(group.GetItem("translation").AsVector()); + tf.SetRot(Mat3FromInfo(group.GetGroup("rotation"))); + return tf; +} + +void TransformToInfo(const geom::Transform& transform, InfoGroup& group) +{ + geom::Transform tf; + group.CreateItem("center", transform.GetCenter()); + group.CreateItem("translation", transform.GetTrans()); + InfoGroup rot=group.CreateGroup("rotation"); + Mat3ToInfo(transform.GetRot(), rot); +} + +}} // ns + diff --git a/modules/info/src/geom_info_conversion.hh b/modules/info/src/geom_info_conversion.hh index cb06e05ebeefa521ae05daab60c28c8f551663f4..bab90abec02b82cfbf701a75dcd258db88b9bbaa 100644 --- a/modules/info/src/geom_info_conversion.hh +++ b/modules/info/src/geom_info_conversion.hh @@ -53,6 +53,15 @@ void DLLEXPORT_OST_INFO Mat4ToInfo(const geom::Mat4& mat, InfoGroup& group); ///\brief load Mat4 from info geom::Mat4 DLLEXPORT_OST_INFO Mat4FromInfo(const InfoGroup& group); + +/// \brief read transformation from info group +/// \relates Transform +geom::Transform DLLEXPORT_OST_INFO TransformFromInfo(const info::InfoGroup& group); +/// \brief store transformation in info group +/// \relates Transform +void DLLEXPORT_OST_INFO TransformToInfo(const geom::Transform& transform, + info::InfoGroup& group); + //@} }} diff --git a/modules/mol/alg/src/CMakeLists.txt b/modules/mol/alg/src/CMakeLists.txt index 146717ace4972b697c0ce160206b67749c029f2e..b91dd1e42a5f975e29a192666d847e1c56b33115 100644 --- a/modules/mol/alg/src/CMakeLists.txt +++ b/modules/mol/alg/src/CMakeLists.txt @@ -48,12 +48,12 @@ module(NAME mol_alg SOURCES ${OST_MOL_ALG_SOURCES} DEPENDS_ON ${MOL_ALG_DEPS} LINK ${BOOST_PROGRAM_OPTIONS}) -copy_if_different("." "${STAGE_DIR}/share/openstructure" +copy_if_different("${CMAKE_CURRENT_SOURCE_DIR}" "${STAGE_DIR}/share/openstructure" "atom_scattering_properties.txt" "ATOM_SCATTERING_PROPS" "ost_mol_alg") install(FILES "atom_scattering_properties.txt" DESTINATION "share/openstructure/") -copy_if_different("." "${STAGE_DIR}/share/openstructure" +copy_if_different("${CMAKE_CURRENT_SOURCE_DIR}" "${STAGE_DIR}/share/openstructure" "stereo_chemical_props.txt" "STEREO_CHEMICAL_PROPS" "ost_mol_alg") install(FILES "stereo_chemical_props.txt" DESTINATION "share/openstructure/") diff --git a/modules/mol/alg/src/lddt.cc b/modules/mol/alg/src/lddt.cc index 2142989048973aaec76da73470c078e69e212c16..fdd70d953c802f7319611071b57ca1e30a2b5c32 100644 --- a/modules/mol/alg/src/lddt.cc +++ b/modules/mol/alg/src/lddt.cc @@ -283,6 +283,7 @@ int main (int argc, char **argv) EntityView v=model.CreateFullView(); boost::filesystem::path pathstring(files[i]); + #if BOOST_FILESYSTEM_VERSION==3 || BOOST_VERSION<103400 String filestring=pathstring.string(); #else diff --git a/modules/mol/base/pymod/CMakeLists.txt b/modules/mol/base/pymod/CMakeLists.txt index 6e158771aa0c9e3b2608203469f9b3afc65e5708..3f514b2b8afba9e8f95473898b9649da2b3afcb7 100644 --- a/modules/mol/base/pymod/CMakeLists.txt +++ b/modules/mol/base/pymod/CMakeLists.txt @@ -18,7 +18,6 @@ export_bounding_box.cc export_query_view_wrapper.cc export_torsion.cc export_visitor.cc -export_transform.cc wrap_mol.cc export_entity_property_mapper.cc ) diff --git a/modules/mol/base/pymod/__init__.py b/modules/mol/base/pymod/__init__.py index 8eb77fa6d3055f6259d7d1aa4c31ccffb9da7098..c51905578ce1f422598c5769f2717f69c4039e0f 100644 --- a/modules/mol/base/pymod/__init__.py +++ b/modules/mol/base/pymod/__init__.py @@ -20,6 +20,17 @@ from _ost_mol import * import ost.geom as _geom from ost.mol import alg +__transform_warning_flag=True + +def Transform(tf=None): + from ost import LogWarning + if __transform_warning_flag: + LogWarning("mol.Transform is deprecated, please use geom.Transform instead") + __transform_warning_flag=False + if tf: + return _geom.Transform(tf) + else: + return _geom.Transform() def MergeCoordGroups(*coord_groups): """ diff --git a/modules/mol/base/pymod/wrap_mol.cc b/modules/mol/base/pymod/wrap_mol.cc index 31cf8165b463460f346fc6d1ec820ceb317edb65..0c1281ad8f9b490790e32902e0f8822e559be33b 100644 --- a/modules/mol/base/pymod/wrap_mol.cc +++ b/modules/mol/base/pymod/wrap_mol.cc @@ -42,7 +42,6 @@ void export_PropertyID(); void export_BoundingBox(); void export_QueryViewWrapper(); void export_EntityPropertyMapper(); -void export_Transform(); BOOST_PYTHON_MODULE(_ost_mol) { @@ -71,5 +70,4 @@ BOOST_PYTHON_MODULE(_ost_mol) export_BoundingBox(); export_QueryViewWrapper(); export_EntityPropertyMapper(); - export_Transform(); } diff --git a/modules/mol/base/src/CMakeLists.txt b/modules/mol/base/src/CMakeLists.txt index 7c92f9f45ca67bef9452a829ef6e6de6e933c5ff..8bb7187ebe9d229fe4aad338a71e53674e22ae3f 100644 --- a/modules/mol/base/src/CMakeLists.txt +++ b/modules/mol/base/src/CMakeLists.txt @@ -31,7 +31,6 @@ residue_view.cc surface_builder.cc surface_handle.cc torsion_handle.cc -transform.cc query_view_wrapper.cc view_op.cc coord_source.cc @@ -87,13 +86,13 @@ surface_builder.hh surface_handle.hh surface_prop.hh torsion_handle.hh -transform.hh query_view_wrapper.hh view_op.hh view_type_fw.hh view_op.hh xcs_editor.hh bounding_box.hh +transform.hh module_config.hh) foreach(_impl_src ${OST_MOL_IMPL_SOURCES}) diff --git a/modules/mol/base/src/coord_group.cc b/modules/mol/base/src/coord_group.cc index 4fe6677ee7da3981ee2bc3f9b48f2c26599820e4..5af231a559b8e07db90f6ec34d539aa238ed63ea 100644 --- a/modules/mol/base/src/coord_group.cc +++ b/modules/mol/base/src/coord_group.cc @@ -19,9 +19,10 @@ #include <ost/invalid_handle.hh> #include <ost/integrity_error.hh> #include <ost/log.hh> -#include <ost/mol/in_mem_coord_source.hh> -#include <ost/mol/view_op.hh> -#include <ost/mol/mol.hh> +#include <ost/geom/transform.hh> +#include "in_mem_coord_source.hh" +#include "view_op.hh" +#include "mol.hh" #include "coord_group.hh" @@ -255,7 +256,7 @@ CoordGroupHandle CoordGroupHandle::Filter(const EntityView& selected, int first, return filtered_cg; } -void CoordGroupHandle::ApplyTransform(const mol::Transform& tf) +void CoordGroupHandle::ApplyTransform(const geom::Transform& tf) { this->CheckValidity(); if (source_->IsMutable()) { diff --git a/modules/mol/base/src/coord_group.hh b/modules/mol/base/src/coord_group.hh index 74fffcb6c45d47f2e0f0e3c469e5174a07a31cab..623f745efbb3bc37411d93279ee99baa5c5fb7f5 100644 --- a/modules/mol/base/src/coord_group.hh +++ b/modules/mol/base/src/coord_group.hh @@ -28,9 +28,12 @@ #include "atom_handle.hh" #include "coord_source.hh" -namespace ost { namespace mol { +namespace geom { + // we should really have fw headers... + class Transform; +} -class Transform; +namespace ost { namespace mol { /// \brief coordinate group, for trajectories and such class DLLEXPORT_OST_MOL CoordGroupHandle { @@ -109,7 +112,7 @@ public: CoordGroupHandle Filter(const EntityView& selected,int first=0,int last=-1) const; /// \brief apply in-place transform to each coordinate in each frame - void ApplyTransform(const Transform& tf); + void ApplyTransform(const geom::Transform& tf); private: diff --git a/modules/mol/base/src/coord_source.cc b/modules/mol/base/src/coord_source.cc index 06b7864b7a831fa2fe8d0e144765b6bff2094b9e..fa58ce041c963aaac3dbf522be37533fb33e0b4a 100644 --- a/modules/mol/base/src/coord_source.cc +++ b/modules/mol/base/src/coord_source.cc @@ -21,10 +21,10 @@ Author: Marco Biasini */ #include <ost/log.hh> +#include <ost/geom/transform.hh> #include "atom_handle.hh" #include "xcs_editor.hh" #include "in_mem_coord_source.hh" -#include "transform.hh" #include "coord_source.hh" namespace ost { namespace mol { @@ -165,7 +165,7 @@ geom::Vec3 CoordSource::GetAtomPos(uint frame, AtomHandle atom) const return geom::Vec3(); } -void CoordSource::ApplyTransform(const Transform& tf) +void CoordSource::ApplyTransform(const geom::Transform& tf) { if(!mutable_) return; size_t frame_count=GetFrameCount(); diff --git a/modules/mol/base/src/coord_source.hh b/modules/mol/base/src/coord_source.hh index a33162abc4e14a95a94e1414aa90401cb47bd0af..3f83e5a3e19800956364a2c679d38660412d0736 100644 --- a/modules/mol/base/src/coord_source.hh +++ b/modules/mol/base/src/coord_source.hh @@ -27,11 +27,14 @@ #include <ost/mol/coord_frame.hh> #include <ost/mol/entity_handle.hh> +namespace geom { + // we should really have fw headers... + class Transform; +} namespace ost { namespace mol { class CoordSource; -class Transform; typedef boost::shared_ptr<CoordSource> CoordSourcePtr; @@ -82,7 +85,7 @@ public: virtual void AddFrame(const std::vector<geom::Vec3>& coords,const geom::Vec3& cell_size,const geom::Vec3& cell_angles) = 0; virtual void InsertFrame(int pos, const std::vector<geom::Vec3>& coords) = 0; - void ApplyTransform(const Transform& tf); + void ApplyTransform(const geom::Transform& tf); protected: void SetMutable(bool flag); diff --git a/modules/mol/base/src/entity_handle.hh b/modules/mol/base/src/entity_handle.hh index 67b2a847e4ab4050d9dfd9043e9fa3ab46ae0bd6..2783b404b75b11a1e31127017d8461b740752cf5 100644 --- a/modules/mol/base/src/entity_handle.hh +++ b/modules/mol/base/src/entity_handle.hh @@ -20,7 +20,6 @@ #define OST_ENTITY_HANDLE_HH #include <ost/mol/module_config.hh> -#include <ost/mol/transform.hh> #include "impl/entity_impl_fw.hh" #include "entity_visitor_fw.hh" diff --git a/modules/mol/base/src/impl/entity_impl.hh b/modules/mol/base/src/impl/entity_impl.hh index d1d1ca050f30a7fdee8d7ab5d64bf417ee183dc8..ccbf85b449cdf035493096c73157a485dc9baea8 100644 --- a/modules/mol/base/src/impl/entity_impl.hh +++ b/modules/mol/base/src/impl/entity_impl.hh @@ -31,7 +31,6 @@ #include <ost/mol/entity_view.hh> -#include <ost/mol/transform.hh> #include <ost/mol/residue_prop.hh> #include <ost/mol/impl/atom_impl_fw.hh> #include <ost/mol/impl/residue_impl_fw.hh> diff --git a/modules/mol/base/src/transform.hh b/modules/mol/base/src/transform.hh index f9c59f6f5095256795b90e105d8067f20f1e6772..a3cad4c8ba2b2976644b7957f07a23ab735a3241 100644 --- a/modules/mol/base/src/transform.hh +++ b/modules/mol/base/src/transform.hh @@ -1,104 +1,6 @@ -//------------------------------------------------------------------------------ -// This file is part of the OpenStructure project <www.openstructure.org> -// -// Copyright (C) 2008-2011 by the OpenStructure authors -// -// This library is free software; you can redistribute it and/or modify it under -// the terms of the GNU Lesser General Public License as published by the Free -// Software Foundation; either version 3.0 of the License, or (at your option) -// any later version. -// This library is distributed in the hope that it will be useful, but WITHOUT -// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more -// details. -// -// You should have received a copy of the GNU Lesser General Public License -// along with this library; if not, write to the Free Software Foundation, Inc., -// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -//------------------------------------------------------------------------------ -#ifndef OST_MOL_BASE_TRANSFORM_HH -#define OST_MOL_BASE_TRANSFORM_HH - -/* - Author: Ansgar Philippsen -*/ - -#include <ost/config.hh> -#include <ost/geom/geom.hh> -#if(OST_INFO_ENABLED) -#include <ost/info/info_fw.hh> -#endif -#include <ost/mol/module_config.hh> +#include <ost/geom/transform.hh> namespace ost { namespace mol { - -/// \brief basic and essential transformation class, including translation, -/// rotation and center of rotation -class DLLEXPORT_OST_MOL Transform { -public: - Transform(); - - geom::Mat4 GetMatrix() const {return tm_;} - geom::Mat4 GetTransposedMatrix() const {return ttm_;} - geom::Mat4 GetInvertedMatrix() const {return itm_;} - - void SetCenter(const geom::Vec3& c); - geom::Vec3 GetCenter() const; - - // directly set tm, messing up rot/trans/cen ! - void SetMatrix(const geom::Mat4& m); - - /// \name rotation - //@{ - /// \brief rotate around x-axis - void ApplyXAxisRotation(float delta); - void ApplyYAxisRotation(float delta); - void ApplyZAxisRotation(float delta); - void ApplyAxisRotation(float delta, const geom::Vec3& axis); - - geom::Mat3 GetXAxisRotation(float delta); - geom::Mat3 GetYAxisRotation(float delta); - geom::Mat3 GetZAxisRotation(float delta); - - geom::Mat3 GetRot() const; - void SetRot(const geom::Mat3& r); - //@} - /// \brief translation - //@{ - void ApplyXAxisTranslation(float delta); - void ApplyYAxisTranslation(float delta); - void ApplyZAxisTranslation(float delta); - void SetTrans(const geom::Vec3& t); - geom::Vec3 GetTrans() const; - //@} - - geom::Vec3 Apply(const geom::Vec3& v) const; - geom::Vec4 Apply(const geom::Vec4& v) const; - geom::AlignedCuboid Apply(const geom::AlignedCuboid& c) const; - -private: - geom::Mat3 rot_; - geom::Vec3 trans_; - geom::Vec3 cen_; - geom::Mat4 tm_; - geom::Mat4 ttm_; - geom::Mat4 itm_; - - void update_tm(); - void update_components(); -}; - - - -#if(OST_INFO_ENABLED) -/// \brief read transformation from info group -/// \relates Transform -Transform DLLEXPORT_OST_MOL TransformFromInfo(const info::InfoGroup& group); -/// \brief store transformation in info group -/// \relates Transform -void DLLEXPORT_OST_MOL TransformToInfo(const Transform& transform, - info::InfoGroup& group); -#endif -}} // ns - -#endif +#warning mol::Transform is deprecated, use geom::Transform instead + typedef geom::Transform Transform; +}} diff --git a/modules/mol/base/tests/CMakeLists.txt b/modules/mol/base/tests/CMakeLists.txt index c29dc6adfe3d5ec1bbe2e85a5a587940b35848c2..5085b0b10b257fab18361001a1cb7a55b796769d 100644 --- a/modules/mol/base/tests/CMakeLists.txt +++ b/modules/mol/base/tests/CMakeLists.txt @@ -10,7 +10,6 @@ set(OST_MOL_BASE_UNIT_TESTS test_query.cc test_surface.cc test_residue.cc - test_transform.cc test_view.cc test_view_op.cc tests.cc diff --git a/modules/mol/base/tests/test_coord_group.cc b/modules/mol/base/tests/test_coord_group.cc index 3c0cdc18fbe5fe139c930d0e7f54ad26cb5941ea..a26f2e2bd7dcfb296a62922792408e4b4c2c4b97 100644 --- a/modules/mol/base/tests/test_coord_group.cc +++ b/modules/mol/base/tests/test_coord_group.cc @@ -81,7 +81,7 @@ BOOST_AUTO_TEST_CASE(coord_group) BOOST_CHECK(ac.GetPos()==geom::Vec3(-17,-18,-19)); BOOST_CHECK(ad.GetPos()==geom::Vec3(9,10,11)); - Transform tf; + geom::Transform tf; tf.ApplyXAxisRotation(17.0); tf.ApplyYAxisRotation(-135.0); tf.ApplyZAxisRotation(234.0); diff --git a/modules/mol/base/tests/test_entity.cc b/modules/mol/base/tests/test_entity.cc index 46a4de626f41d8a37c57c8b0292ab2e7605dca2b..d8ecd8f3b9a9007e84549d6b4a20e302a1a5fe67 100644 --- a/modules/mol/base/tests/test_entity.cc +++ b/modules/mol/base/tests/test_entity.cc @@ -181,7 +181,7 @@ BOOST_AUTO_TEST_CASE(transformation) BOOST_CHECK(eh.IsTransformationIdentity()==true); - Transform trans; + geom::Transform trans; trans.ApplyZAxisRotation(90.0); geom::Mat4 mat = trans.GetMatrix(); @@ -203,7 +203,7 @@ BOOST_AUTO_TEST_CASE(transformation) CHECK_TRANSFORMED_ATOM_POSITION(atom3,tr_atom3); CHECK_ORIGINAL_ATOM_POSITION(atom3,orig_atom3); - Transform trans2; + geom::Transform trans2; trans2.ApplyXAxisTranslation(3.5); geom::Mat4 mat2 = trans2.GetMatrix(); diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 0b6b429a45beebc7c2233d65218dba89fa86f32d..12b81a310b570f6888852d04864af183022ce4f3 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -33,13 +33,13 @@ if (NOT ENABLE_STATIC) set(INIT_SCRIPTS init_cl.py ) - + set(SPD "${LIB_DIR}/python${PYTHON_VERSION}/site-packages") if (ENABLE_GUI) list(APPEND INIT_SCRIPTS init.py) endif() - copy_if_different("./" "${STAGE_DIR}/${LIB_DIR}/openstructure" + copy_if_different("${CMAKE_CURRENT_SOURCE_DIR}" "${STAGE_DIR}/${SPD}" "${INIT_SCRIPTS}" "python init scripts" ost_scripts) - install(FILES ${INIT_SCRIPTS} DESTINATION "${LIB_DIR}/openstructure") + install(FILES ${INIT_SCRIPTS} DESTINATION "${SPD}") endif() diff --git a/scripts/init_cl.py b/scripts/init_cl.py index 09b38ed9785b1075acbdc5dbfe8de8e1d14d21f3..d4a14df4cd339872dc62c2de5898b04f07e75c76 100644 --- a/scripts/init_cl.py +++ b/scripts/init_cl.py @@ -26,10 +26,11 @@ parser.add_option("-v", "--verbosity_level", action="store", type="int", dest="v parser.disable_interspersed_args() (options, args) = parser.parse_args() +_site_packs='python%d.%d/site-packages' % sys.version_info[0:2] if platform.machine()=='x86_64': - sys.path.insert(0, os.getenv('DNG_ROOT')+'/lib64/openstructure') + sys.path.insert(0, os.path.join(os.getenv('DNG_ROOT'), 'lib64', _site_packs)) else: - sys.path.insert(0,os.getenv('DNG_ROOT')+'/lib/openstructure') + sys.path.insert(0,os.path.join(os.getenv('DNG_ROOT'), 'lib', _site_packs)) from ost import * import ost diff --git a/scripts/ost.in b/scripts/ost.in index 90c74f045e5ceff238b207c3043046d96546c57f..407daed10f8d2b6fed92f1724c9c4b369bef0244 100755 --- a/scripts/ost.in +++ b/scripts/ost.in @@ -31,6 +31,6 @@ BIN_DIR=`dirname "$SCRIPT_NAME"` source $BIN_DIR/../@LIBEXEC_PATH@/ost_config -$pyexec $interactive "$DNG_ROOT/@LIBDIR@/openstructure/init_cl.py" $opts +$pyexec $interactive "$DNG_ROOT/@LIBDIR@/python@PYTHON_VERSION@/site-packages/init_cl.py" $opts RC=$? exit $RC diff --git a/scripts/ost_config.in b/scripts/ost_config.in index faaae8e264e655496fe35471dc0bb685c6a6f59b..5894bdb12c62241d556e04fb909eb9f83a17c5ef 100644 --- a/scripts/ost_config.in +++ b/scripts/ost_config.in @@ -24,7 +24,7 @@ export DNG_ROOT=`cd "$BIN_DIR/..";pwd` export DNG_BINDIR="$DNG_ROOT/bin" export DNG_LIBDIR="$DNG_ROOT/@LIBDIR@" -export DNG_INITDIR="$DNG_LIBDIR/openstructure" +export DNG_INITDIR="$DNG_LIBDIR/python@PYTHON_VERSION@/site-packages" export PATH="$DNG_BINDIR:${PATH}" export DYLD_FRAMEWORK_PATH="$DNG_LIBDIR:${DYLD_FRAMEWORK_PATH}"