Commit 83efa89a authored by Mathias Goldau's avatar Mathias Goldau
Browse files

[MERGE]

parents 02249f28 ecc40edf
......@@ -64,9 +64,9 @@ and get the URL to our mercurial repository.
Required Dependencies:
----------------------
* Qt4 (>= 4.3)
* Qt4 (>= 4.6)
* OpenSceneGraph (>= 2.8.0)
* Boost (>= 1.39.0)
* Boost (>= 1.42.0)
Compilation on Unix-like systems:
---------------------------------
......
......@@ -31,7 +31,7 @@ PROJECT_NAME = OpenWalnut
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER = 1.1+
PROJECT_NUMBER = 1.2.5
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
......
......@@ -31,7 +31,7 @@ PROJECT_NAME = OpenWalnut
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER = 1.1+
PROJECT_NUMBER = 1.2.5
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
......@@ -1419,7 +1419,7 @@ HIDE_UNDOC_RELATIONS = NO
# toolkit from AT&T and Lucent Bell Labs. The other options in this section
# have no effect if this option is set to NO (the default)
HAVE_DOT = NO
HAVE_DOT = YES
# By default doxygen will write a font called FreeSans.ttf to the output
# directory and reference it in all dot files that doxygen generates. This
......
......@@ -6,11 +6,3 @@ The complete credit,copyright and ownership belongs to the
liberation-fonts project. See license.txt and COPYING as well as
AUTHORS for details.
arial.ttf:
==========
Due to a bug in OpenSceneGraph, we had to add some fonts here.
Especially arial.ttf. It is needed by the OSG Stat Display, where
the font filename cannot be changed. The file arial.ttf is a copy
of liberationSans-Bold.ttf. Sorry for that. Maybe this is fixed
some day.
......@@ -5,5 +5,5 @@
## and project files.
## recommendation list:
recommended = Arbitrary Plane,Coordinate System,Image Extractor,Paint Texture,Arbitrary Rois,Bounding Box,Distance Map Isosurface,Gauss Filtering,HUD,Isosurface,Isosurface Raytracer,LIC,Read Mesh,Voxelizer,Superquadric Glyphs,Triangle Mesh Renderer,Vector Plot,Write NIfTI,Fiber Display,Read Spherical Harmonics,Navigation Slices,Deterministic Tract Clustering using Gaussian Processes,Deterministic Tract to Gaussian Process Converter,Cluster Param Display,Write Tracts,Fiber Resampling,Grid Renderer,Spatial Derivation,Scalar Operator,Vector Operator,Colormapper
recommended = Arbitrary Plane,Coordinate System,Image Extractor,Paint Texture,Arbitrary Rois,Bounding Box,Distance Map Isosurface,Gauss Filtering,HUD,Isosurface,Isosurface Raytracer,LIC,Read Mesh,Voxelizer,Superquadric Glyphs,Triangle Mesh Renderer,Vector Plot,Write NIfTI,Fiber Display,Fiber Display Simple,Read Spherical Harmonics,Navigation Slices,Deterministic Tract Clustering using Gaussian Processes,Deterministic Tract to Gaussian Process Converter,Cluster Param Display,Write Tracts,Fiber Resampling,Grid Renderer,Spatial Derivation,Scalar Operator,Vector Operator,Colormapper
......@@ -36,14 +36,17 @@ IF( ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR} )
MESSAGE( FATAL_ERROR "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there. (you may need to remove CMakeCache.txt" )
ENDIF()
# where to find our utils and cmake modules?
SET( OW_TOOLS_DIR ${PROJECT_SOURCE_DIR}/../tools )
# append search path for FindModules:
LIST( APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../tools/cmake )
LIST( APPEND CMAKE_MODULE_PATH ${OW_TOOLS_DIR}/cmake )
# here, we have certain utilities. For example ASSERT_GE_VERSION which ensures a specific minimum version
INCLUDE( ${CMAKE_MODULE_PATH}/Utils.cmake )
INCLUDE( Utils )
# These scripts contains all the needed tools to setup the build
INCLUDE( ${CMAKE_MODULE_PATH}/BuildUtils.cmake )
INCLUDE( ${CMAKE_MODULE_PATH}/BuildModuleUtils.cmake )
INCLUDE( BuildUtils )
INCLUDE( BuildModuleUtils )
# CMAKE automatism to select static vs. shared building:
IF( NOT CMAKE_GENERATOR MATCHES "Visual Studio" )
......@@ -319,7 +322,7 @@ ENDIF()
# TODO(ebaum): use try_run for this
# Determines the number of cores available on this machine
IF( NOT CMAKE_GENERATOR MATCHES "Visual Studio" )
SET( NUM_CORES_SOURCE_DIR ${CMAKE_MODULE_PATH}/numCores )
SET( NUM_CORES_SOURCE_DIR ${OW_TOOLS_DIR}/cmake/numCores )
SET( NUM_CORES_BINARY_DIR ${PROJECT_BINARY_DIR}/numCores )
SET( NUM_CORES_BINARY ${NUM_CORES_BINARY_DIR}/numCores )
ADD_CUSTOM_TARGET( numCores
......@@ -513,5 +516,5 @@ MARK_AS_ADVANCED( FORCE OPENTHREADS_LIBRARY_DEBUG )
# ---------------------------------------------------------------------------------------------------------------------------------------------------
# for package setup:
INCLUDE( ${CMAKE_MODULE_PATH}/Packaging.cmake )
INCLUDE( Packaging )
......@@ -96,7 +96,7 @@ ADD_CUSTOM_TARGET( core_devdoc
# copy our own resources
IF( NOT OW_PACKAGE_NOCOPY_COREFONTS )
SETUP_RESOURCES( "core" "CORE" )
SETUP_GLOBAL_RESOURCES( "core" "CORE" )
ELSE()
# This is a hack which is quite debian specific. We do this here to avoid font duplicates since the ttf-liberation fonts are already
# available on Debian. If you need to modify this for another packaging thingy, please let me know (ebaum@informatik.uni-leipzig.d). We then
......@@ -106,8 +106,6 @@ ELSE()
COMPONENT "CORE" )
INSTALL( CODE "EXECUTE_PROCESS( COMMAND ${CMAKE_COMMAND} -E make_directory \${CMAKE_INSTALL_PREFIX}/share/openwalnut/fonts )"
COMPONENT "CORE" )
INSTALL( CODE "EXECUTE_PROCESS( COMMAND ${CMAKE_COMMAND} -E create_symlink /usr/share/fonts/truetype/ttf-liberation/LiberationMono-Bold.ttf \${CMAKE_INSTALL_PREFIX}/share/openwalnut/fonts/arial.ttf )"
COMPONENT "CORE" )
INSTALL( CODE "EXECUTE_PROCESS( COMMAND ${CMAKE_COMMAND} -E create_symlink /usr/share/fonts/truetype/ttf-liberation/LiberationMono-Bold.ttf \${CMAKE_INSTALL_PREFIX}/share/openwalnut/fonts/Bold.ttf )"
COMPONENT "CORE" )
INSTALL( CODE "EXECUTE_PROCESS( COMMAND ${CMAKE_COMMAND} -E create_symlink /usr/share/fonts/truetype/ttf-liberation/LiberationMono-Italic.ttf \${CMAKE_INSTALL_PREFIX}/share/openwalnut/fonts/Italic.ttf )"
......
......@@ -68,6 +68,8 @@ namespace defaultColor
static const WColor GREEN( 0.0, 1.0, 0.0, 1.0 ); //!< Default for green
static const WColor RED( 1.0, 0.0, 0.0, 1.0 ); //!< Default for red
static const WColor BLUE( 0.0, 0.0, 1.0, 1.0 ); //!< Default for blue
static const WColor BLACK( 0.0, 0.0, 0.0, 1.0 ); //!< Default for black
static const WColor WHITE( 1.0, 1.0, 1.0, 1.0 ); //!< Default for black
// \endcond
}
......
......@@ -45,7 +45,7 @@ void WCondition::notify()
m_condition.notify_all();
}
boost::signals2::connection WCondition::subscribeSignal( t_ConditionNotifierType notifier )
boost::signals2::connection WCondition::subscribeSignal( t_ConditionNotifierType notifier ) const
{
return signal_ConditionFired.connect( notifier );
}
......
......@@ -82,7 +82,7 @@ public:
*
* \return the connection.
*/
boost::signals2::connection subscribeSignal( t_ConditionNotifierType notifier );
boost::signals2::connection subscribeSignal( t_ConditionNotifierType notifier ) const;
protected:
......@@ -94,7 +94,7 @@ protected:
/**
* Signal getting fired whenever the condition fires.
*/
t_ConditionSignalType signal_ConditionFired;
mutable t_ConditionSignalType signal_ConditionFired;
/**
* The condition.
......
......@@ -37,33 +37,6 @@
*/
namespace wlimits
{
/**
* Maximum sample size per axis for image
* data like MRI, CT, funcMRI and dwMRI.
*/
static const unsigned int MAX_IMAGE_DIMENSION = 256;
/**
* Maximum number of channels for a certain modality.
*/
static const unsigned int MAX_RECORDING_CHANNELS = 1024;
/**
* Maximum number of samples of a recording.
* (2^32)-1 this is often equal to UINT_MAX
*/
static const unsigned int MAX_RECORDING_SAMPLES = 4294967295U;
/**
* Maximum number of segments of a recording.
*/
static const unsigned int MAX_RECORDING_SEGMENTS = 128;
/**
* Maximum samplimg frequency of a recording.
*/
static const unsigned int MAX_RECORDING_SAMPLING_FREQUENCY = 20000;
static const double MAX_DOUBLE = std::numeric_limits< double >::max(); //!< Maximum double value
static const float MAX_FLOAT = std::numeric_limits< float >::max(); //!< Maximum float value
......@@ -105,12 +78,6 @@ namespace wlimits
* \return True if the value is infinity, false otherwise.
*/
template< typename T > bool isinf( T value );
//! The maximum texture dimension.
static std::size_t const MAX_TEXTURE_DIMENSION = 2048;
//! We support only 8 textures because some known hardware does not support more texture coordinates.
static std::size_t const MAX_NUMBER_OF_TEXTURES = 8;
}
template< typename T > bool wlimits::isnan( T value )
......
......@@ -25,6 +25,7 @@
#include <string>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <boost/tokenizer.hpp>
......@@ -53,9 +54,10 @@ boost::shared_ptr< WPathHelper > WPathHelper::getPathHelper()
return m_instance;
}
void WPathHelper::setAppPath( boost::filesystem::path appPath )
void WPathHelper::setBasePaths( boost::filesystem::path appPath, boost::filesystem::path homePath )
{
m_appPath = appPath;
m_homePath = homePath;
m_sharePath = m_appPath / "../share/openwalnut";
m_docPath = m_appPath / "../share/doc";
m_configPath = m_appPath / "../share/openwalnut";
......@@ -94,6 +96,11 @@ boost::filesystem::path WPathHelper::getModulePath()
return getPathHelper()->m_modulePath;
}
boost::filesystem::path WPathHelper::getHomePath()
{
return getPathHelper()->m_homePath;
}
boost::filesystem::path WPathHelper::getLibPath()
{
return getPathHelper()->m_libPath;
......@@ -120,6 +127,7 @@ std::vector< boost::filesystem::path > WPathHelper::getAllModulePaths()
std::vector< boost::filesystem::path > paths;
// the first element always is the global search path
paths.push_back( getModulePath() );
paths.push_back( getHomePath() / "modules" );
// the environment variable stores the additional paths
std::string additionalPaths( getenv( "OW_MODULE_PATH" ) ? getenv( "OW_MODULE_PATH" ) : "" );
......@@ -133,6 +141,29 @@ std::vector< boost::filesystem::path > WPathHelper::getAllModulePaths()
paths.push_back( boost::filesystem::path( *it ) );
}
// add the additional paths
for( std::vector< boost::filesystem::path >::const_iterator it = getPathHelper()->m_additionalModulePaths.begin();
it != getPathHelper()->m_additionalModulePaths.end();
++it )
{
if( !std::count( paths.begin(), paths.end(), *it ) )
{
paths.push_back( *it );
}
}
return paths;
}
void WPathHelper::addAdditionalModulePath( const boost::filesystem::path& path )
{
if( !std::count( m_additionalModulePaths.begin(), m_additionalModulePaths.end(), path ) )
{
m_additionalModulePaths.push_back( path );
}
}
const std::vector< boost::filesystem::path >& WPathHelper::getAdditionalModulePaths() const
{
return m_additionalModulePaths;
}
......@@ -57,11 +57,13 @@ public:
static boost::shared_ptr< WPathHelper > getPathHelper();
/**
* Set the current application path. This should be called only once.
* Set the current application path. This should be called only once. The home path hereby is NOT the users home. It is an directory, where
* OW can write user specific data. A good default here is to specify USERHOME/.OpenWalnut for example.
*
* \param appPath the application path
* \param homePath the OW home path
*/
void setAppPath( boost::filesystem::path appPath );
void setBasePaths( boost::filesystem::path appPath, boost::filesystem::path homePath );
/**
* The path where the binary file resides in. This is for example /usr/bin.
......@@ -127,13 +129,37 @@ public:
static boost::filesystem::path getModulePath();
/**
* This returns a list of search paths for modules. This list is defined by the environment variable "OW_MODULE_PATH". All of these
* The path to the OW dir in the user's home. This will not be the home dir directly. It is something like $HOME/.OpenWalnut.
*
* \return OW home path
*/
static boost::filesystem::path getHomePath();
/**
* This returns a list of search paths for modules. This list is defined by the environment variable "OW_MODULE_PATH" and the list of additional
* module paths. All of these
* directories CAN contain modules. On startup, they get searched in the specified order.
*
* \return list of search paths for modules
*/
static std::vector< boost::filesystem::path > getAllModulePaths();
/**
* This method adds the given path to the list of module paths. This way, arbitrary paths can be specified to search for modules. Each path
* is searched recursively.
*
* \param path the path to add.
*/
void addAdditionalModulePath( const boost::filesystem::path& path );
/**
* Returns the list of paths added using addAdditionalModulePath. This does NOT contain the paths in OW_MODULE_PATH. Use getAllModulePaths
* for this.
*
* \return the list of additional paths
*/
const std::vector< boost::filesystem::path >& getAdditionalModulePaths() const;
/**
* The path to the OW libs. You normally should not need this.
*
......@@ -202,6 +228,17 @@ private:
*/
boost::filesystem::path m_libPath;
/**
* The path of a user specific OW directory.
*/
boost::filesystem::path m_homePath;
/**
* A list of additional paths to search for modules. This does not contain the paths in the environment variable OW_MODULE_PATH. This method
* is not thread-safe. You should only use it before the module factory loads the modules.
*/
std::vector< boost::filesystem::path > m_additionalModulePaths;
/**
* Singleton instance of WPathHelper.
*/
......
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut 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 of the License, or
// (at your option) any later version.
//
// OpenWalnut 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 OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#include "WRealtimeTimer.h"
WRealtimeTimer::WRealtimeTimer():
WTimer(),
m_timer( osg::Timer() )
{
// initialize
}
WRealtimeTimer::~WRealtimeTimer()
{
// cleanup
}
void WRealtimeTimer::reset()
{
m_timer.setStartTick();
}
double WRealtimeTimer::elapsed() const
{
return m_timer.time_m() / 1000.0;
}
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut 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 of the License, or
// (at your option) any later version.
//
// OpenWalnut 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 OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#ifndef WREALTIMETIMER_H
#define WREALTIMETIMER_H
#include <boost/shared_ptr.hpp>
#include <osg/Timer>
#include "WTimer.h"
#include "WExportCommon.h"
/**
* Realtime timing. Internally, this uses an osg::Timer.
*/
class OWCOMMON_EXPORT WRealtimeTimer: public WTimer
{
public:
/**
* Convenience typedef for a shared_ptr
*/
typedef boost::shared_ptr< WRealtimeTimer > SPtr;
/**
* Convenience typedef for a const shared_ptr.
*/
typedef boost::shared_ptr< const WRealtimeTimer > ConstSPtr;
/**
* Constructs a realtime animation timer.
*/
WRealtimeTimer();
/**
* Destructor.
*/
virtual ~WRealtimeTimer();
/**
* Resets the start-tick.
*/
virtual void reset();
/**
* Returns the elapsed time since the last reset in seconds with milliseconds precision.
*
* \return elapsed time in seconds with millisecond precision.
*/
virtual double elapsed() const;
private:
/**
* The osg timer is used here.
*/
osg::Timer m_timer;
};
#endif // WREALTIMETIMER_H
......@@ -62,6 +62,7 @@ void WTerminalColor::generateControlStrings()
m_colorString = "";
m_colorResetString = "";
// When changing this platform specific ifdefs, please adapt unittest too!
#if defined( __linux__ ) || defined( __APPLE__ )
if( m_enabled && ( m_attrib != Default ) )
{
......
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut 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 of the License, or
// (at your option) any later version.
//
// OpenWalnut 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 OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#include "WTimer.h"
WTimer::WTimer()
{
// initialize
}
WTimer::~WTimer()
{
// cleanup
}
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut 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 of the License, or
// (at your option) any later version.
//
// OpenWalnut 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 OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#ifndef WTIMER_H
#define WTIMER_H
#include <boost/shared_ptr.hpp>
#include "WExportCommon.h"
/**
* Base class for timing. Derive from it to write several timers like a frame-timer or realtime-timer.
*/
class OWCOMMON_EXPORT WTimer // NOLINT - no OWCOMMON_EXPORT does not need an virtual destructor.
{
public:
/**
* Convenience typedef for a shared_ptr
*/
typedef boost::shared_ptr< WTimer > SPtr;
/**
* Convenience typedef for a const shared_ptr.
*/
typedef boost::shared_ptr< const WTimer > ConstSPtr;
/**
* Constructs a animation timer.
*/
WTimer();
/**
* Destructor.
*/
virtual ~WTimer();
/**
* Resets the start-tick.
*/
virtual void reset() = 0;
/**
* Returns the elapsed time since the last reset in seconds with milliseconds precision.
*
* \return elapsed time in seconds with millisecond precision.
*/
virtual double elapsed() const = 0;
private:
};
#endif // WTIMER_H
......@@ -79,6 +79,18 @@ namespace WTypeTraits
// Exclusion of this macro stuff from doxygen:
// \cond HIDDEN_SYMBOLS
// long double is the better choice for these
CREATEPROMOTION( long double, double, long double )
CREATEPROMOTION( long double, float, long double )
CREATEPROMOTION( long double, int64_t, long double )
CREATEPROMOTION( long double, int32_t, long double )
CREATEPROMOTION( long double, int16_t, long double )
CREATEPROMOTION( long double, int8_t, long double )
CREATEPROMOTION( long double, uint64_t, long double )
CREATEPROMOTION( long double, uint32_t, long double )
CREATEPROMOTION( long double, uint16_t, long double )
CREATEPROMOTION( long double, uint8_t, long double )
// double is the better choice for these
CREATEPROMOTION( double, float, double )
CREATEPROMOTION( double, int64_t, double )
......