Commit 20bdb812 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[MERGE]

parents 342bb1e7 2a010852
......@@ -294,13 +294,20 @@ add_custom_target( fontsDirectoryConfiguration
)
#---------- online help -------------
#---------- OpenWalnut help -------------
ADD_CUSTOM_TARGET( onlineHelp
ALL
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/gui/qt4/OpenWalnutHelp.html ${PROJECT_BINARY_DIR}/share/OpenWalnut
COMMENT "Copy online help"
)
#---------- About OpenWalnut -------------
ADD_CUSTOM_TARGET( aboutOpenWalnut
ALL
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/gui/qt4/OpenWalnutAbout.html ${PROJECT_BINARY_DIR}/share/OpenWalnut
COMMENT "Copy about page"
)
#---------- shell scripts -------------
IF( CMAKE_GENERATOR MATCHES "Visual Studio" )
add_custom_target( binDirectoryConfiguration
......
......@@ -22,4 +22,24 @@
//
//---------------------------------------------------------------------------
#include <fstream>
#include "WIOTools.h"
#include "exceptions/WFileNotFound.h"
std::string wiotools::getStringFromFile( const std::string& filename )
{
std::ifstream input( filename.c_str() );
if ( !input.is_open() )
{
throw WFileNotFound( std::string( "The file \"" ) + filename +
std::string( "\" does not exist." ) );
}
std::string buf;
std::string line;
while( std::getline( input, line ) )
{
buf += line;
}
return buf;
}
......@@ -34,6 +34,8 @@
#include <boost/filesystem.hpp>
#include "WExportCommon.h"
/**
* Namespaces for several tools we may need while doing IO
*/
......@@ -124,5 +126,13 @@ namespace wiotools
// 3. file names like "/tmp/pansen" or "C:\pansen" are platform dependent
return std::string( std::tmpnam( NULL ) );
}
/**
* Get the contens of a file as a string.
* \param filename
* \return the file content in as string.
*/
std::string OWCOMMON_EXPORT getStringFromFile( const std::string& filename );
} // end of namespace
#endif // WIOTOOLS_H
......@@ -25,22 +25,24 @@
#ifndef WGRIDREGULAR3D_H
#define WGRIDREGULAR3D_H
#include <vector>
#include <utility>
#include <vector>
#include <boost/array.hpp>
#include <boost/shared_ptr.hpp>
#include <osg/Matrix>
#include <osg/Vec3>
#include "../common/math/WMatrix.h"
#include "../common/math/WMatrix4x4.h"
#include "../common/math/WPosition.h"
#include "../common/math/WVector3D.h"
#include "../common/WBoundingBox.h"
#include "WGridTransformOrtho.h"
#include "../common/WCondition.h"
#include "WExportDataHandler.h"
#include "WGrid.h"
#include "WGridTransformOrtho.h"
/**
* A grid that has parallelepiped cells which all have the same proportion. I.e.
......@@ -504,6 +506,58 @@ private:
WGridTransformOrtho const m_transform;
};
/**
* Convinience function returning all offsets per axis.
* 0 : xAxis, 1 : yAxis, 2 : zAxis
* \param grid The grid having the information.
* \note Implementing this as NonMemberNonFriend was intentional.
* \return Array of number of samples per axis.
*/
inline boost::array< double, 3 > getOffsets( boost::shared_ptr< const WGridRegular3D > grid )
{
boost::array< double, 3 > result = { { grid->getOffsetX(), grid->getOffsetY(), grid->getOffsetZ() } }; // NOLINT curly braces
return result;
}
/**
* Convinience function returning all number coords per axis.
* 0 : xAxis, 1 : yAxis, 2 : zAxis
* \param grid The grid having the information.
* \note Implementing this as NonMemberNonFriend was intentional.
* \return Array of number of samples per axis.
*/
inline boost::array< unsigned int, 3 > getNbCoords( boost::shared_ptr< const WGridRegular3D > grid )
{
boost::array< unsigned int, 3 > result = { { grid->getNbCoordsX(), grid->getNbCoordsY(), grid->getNbCoordsZ() } }; // NOLINT curly braces
return result;
}
/**
* Convinience function returning all axis directions.
* 0 : xAxis, 1 : yAxis, 2 : zAxis
* \param grid The grid having the information.
* \note Implementing this as NonMemberNonFriend was intentional.
* \return The direction of each axis as array
*/
inline boost::array< WVector3D, 3 > getDirections( boost::shared_ptr< const WGridRegular3D > grid )
{
boost::array< WVector3D, 3 > result = { { grid->getDirectionX(), grid->getDirectionY(), grid->getDirectionZ() } }; // NOLINT curly braces
return result;
}
/**
* Convinience function returning all axis unit directions.
* 0 : xAxis, 1 : yAxis, 2 : zAxis
* \param grid The grid having the information.
* \note Implementing this as NonMemberNonFriend was intentional.
* \return The direction of each axis as array
*/
inline boost::array< WVector3D, 3 > getUnitDirections( boost::shared_ptr< const WGridRegular3D > grid )
{
boost::array< WVector3D, 3 > result = { { grid->getUnitDirectionX(), grid->getUnitDirectionY(), grid->getUnitDirectionZ() } }; // NOLINT curly braces
return result;
}
inline unsigned int WGridRegular3D::getNbCoordsX() const
{
return m_nbPosX;
......
......@@ -72,6 +72,21 @@ public:
TS_ASSERT_EQUALS( grid.size(), 27 );
}
/**
* Each convinience function just assembles the three values into an boost array.
*/
void testConvinienceFunctions( void )
{
boost::shared_ptr< WGridRegular3D > grid( new WGridRegular3D( 3, 3, 3 ) );
boost::array< unsigned int, 3 > expectedNbCoords = { { 3, 3, 3 } }; // NOLINT curly braces
TS_ASSERT_EQUALS( expectedNbCoords, getNbCoords( grid ) );
boost::array< double, 3 > expectedOffsets = { { 1.0, 1.0, 1.0 } }; // NOLINT curly braces
TS_ASSERT_EQUALS( expectedOffsets, getOffsets( grid ) );
boost::array< WVector3D, 3 > expectedDirections = { { WVector3D( 1.0, 0.0, 0.0 ), WVector3D( 0.0, 1.0, 0.0 ), WVector3D( 0.0, 0.0, 1.0 ) } }; // NOLINT curly braces line length
TS_ASSERT_EQUALS( expectedDirections, getDirections( grid ) );
TS_ASSERT_EQUALS( expectedDirections, getUnitDirections( grid ) );
}
/**
* After instantiation there should be the right vectors, matrix and origin.
*/
......
<h1>OpenWalnut</h1>
Copyright 2009-2011 OpenWalnut community, BSV@Uni-Leipzig, and
CNCF@MPI-CBS. For more information see
<a href="http://www.openwalnut.org/copying">http://www.openwalnut.org/copying</a>.<br><br>
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under the terms of the GNU Lesser General Public License.
You should have received a copy of the GNU Lesser General Public License
along with OpenWalnut. If not, see
&lt;<a href="http://www.gnu.org/licenses">http://www.gnu.org/licenses</a>&gt;.<br>
<h4>Contact</h4>
Website: <a href="http://www.openwalnut.org">http://www.openwalnut.org</a><br>
Email: <a href="mailto:contact@openwalnut.org">contact@openwalnut.org</a>
<h4>Contributors up to version 1.2:</h4>
<i>(in alphabetical order, current administrators in bold font)</i><br>
Dirk Albrecht, <b>Sebastian Eichelbaum</b>, Robert Frohl, <b>Mathias Goldau</b>, Christian Heine,
Mario Hlawitschka, Sebastian Kiunke, Robin Ledig, Cornelius Mueller,
Andre Reichenbach, <b>Ralph Schurade</b>, Marcus Stuber, <b>Alexander Wiebel</b>.<br>
<br><br>
<i>Thank you for using OpenWalnut!</i>
\ No newline at end of file
......@@ -45,9 +45,9 @@
#include "../../common/WColor.h"
#include "../../common/WPreferences.h"
#include "../../common/WIOTools.h"
#include "../../common/WProjectFileIO.h"
#include "../../common/WPathHelper.h"
#include "../../common/exceptions/WFileNotFound.h"
#include "../../dataHandler/WDataSetFibers.h"
#include "../../dataHandler/WDataSetSingle.h"
#include "../../dataHandler/WEEG2.h"
......@@ -723,39 +723,19 @@ void WMainWindow::openAboutQtDialog()
{
QMessageBox::aboutQt( this, "About Qt" );
}
void WMainWindow::openAboutDialog()
{
QMessageBox::about( this, "About OpenWalnut",
"OpenWalnut ( http://www.openwalnut.org )\n\n"
"Copyright 2009-2010 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS. "
"For more information see http://www.openwalnut.org/copying.\n\n"
"This program comes with ABSOLUTELY NO WARRANTY. "
"This is free software, and you are welcome to redistribute it "
"under the terms of the GNU Lesser General Public License. "
"You should have received a copy of the GNU Lesser General Public License "
"along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.\n"
"\n"
"Thank you for using OpenWalnut." );
std::string filename( WPathHelper::getAppPath().file_string() + "/../share/OpenWalnut/OpenWalnutAbout.html" );
std::string content = wiotools::getStringFromFile( filename );
QMessageBox::about( this, "About OpenWalnut", content.c_str() );
}
void WMainWindow::openOpenWalnutHelpDialog()
{
std::string filename( WPathHelper::getAppPath().file_string() + "/../share/OpenWalnut/OpenWalnutHelp.html" );
std::ifstream input( filename.c_str() );
if ( !input.is_open() )
{
throw WFileNotFound( std::string( "The project file \"" ) + filename +
std::string( "\" does not exist." ) );
}
std::string buf;
std::string line;
while( std::getline( input, line ) )
{
buf += line;
}
QMessageBox::information( this, "OpenWalnut Help", buf.c_str() );
std::string content = wiotools::getStringFromFile( filename );
QMessageBox::information( this, "OpenWalnut Help", content.c_str() );
}
void WMainWindow::setPresetViewLeft()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment