Commit 4f319dac authored by Mathias Goldau's avatar Mathias Goldau

[MERGE]

parents eab22470 35ffc879
......@@ -5,15 +5,15 @@
Hello User! New to OpenWalnut? Have a look at <a href="http://www.openwalnut.org">http://www.openwalnut.org</a>!
We provide
<ul>
<li> user-/video documentation
<li> user-/video documentation,
<li> programming tutorials
<li> and the newest information
<li> and the latest information on OpenWalnut.
</ul>
Do you have problems using OpenWalnut? Do not hesitate to ask:
<ul>
<li><a href="mailto:openwalnut@lists.informatik.uni-leipzig.de">Mailing List</a>
<li><a href="mailto:openwalnut@lists.informatik.uni-leipzig.de">Mailing list</a>
<li>IRC Chat on irc.freenode.net in #ow
</ul>
Found a Bug? Do you have ideas for improvement? Please <a href="http://www.openwalnut.org/projects/openwalnut/wiki/Contribute">report</a> these issues! We can improve OpenWalnut only with your help and ideas.
Found a bug? Do you have ideas for improvements? Please <a href="http://www.openwalnut.org/projects/openwalnut/wiki/Contribute">report</a> these issues! We can improve OpenWalnut only with your help and ideas.
<br><br>
<i>Thank you for using OpenWalnut!</i>
......@@ -406,6 +406,17 @@ public:
*/
virtual bool set( T value, bool suppressNotification = false );
/**
* Sets the specified value as recommended value. The difference to \ref set is simple. If some value was set using the method \ref set
* earlier, the \ref setRecommendedValue call is ignored. This is very useful in modules, where incoming data yields some useful default values
* but you do not want to overwrite a user-value which might have been set.
*
* \param value the new value to set if the user did not yet set the value
*
* \return true if value has been set successfully.
*/
virtual bool setRecommendedValue( T value );
protected:
/**
......@@ -439,13 +450,19 @@ protected:
boost::shared_ptr< ConstraintContainerType > m_constraints;
private:
/**
* This is true, if the user did not set a value until now using \ref set.
*/
bool m_notYetSet;
};
template < typename T >
WPropertyVariable< T >::WPropertyVariable( std::string name, std::string description, const T& initial ):
WFlag< T >( new WCondition(), initial ),
WPropertyBase( name, description ),
m_constraints( new ConstraintContainerType() )
m_constraints( new ConstraintContainerType() ),
m_notYetSet( true )
{
updateType();
......@@ -458,7 +475,8 @@ template < typename T >
WPropertyVariable< T >::WPropertyVariable( std::string name, std::string description, const T& initial, boost::shared_ptr< WCondition > condition ):
WFlag< T >( condition, initial ),
WPropertyBase( name, description ),
m_constraints( new ConstraintContainerType() )
m_constraints( new ConstraintContainerType() ),
m_notYetSet( true )
{
updateType();
......@@ -472,7 +490,8 @@ WPropertyVariable< T >::WPropertyVariable( std::string name, std::string descrip
PropertyChangeNotifierType notifier ):
WFlag< T >( new WCondition(), initial ),
WPropertyBase( name, description ),
m_constraints( new ConstraintContainerType() )
m_constraints( new ConstraintContainerType() ),
m_notYetSet( true )
{
updateType();
......@@ -492,7 +511,8 @@ WPropertyVariable< T >::WPropertyVariable( std::string name, std::string descrip
PropertyChangeNotifierType notifier ):
WFlag< T >( condition, initial ),
WPropertyBase( name, description ),
m_constraints( new ConstraintContainerType() )
m_constraints( new ConstraintContainerType() ),
m_notYetSet( true )
{
updateType();
......@@ -511,7 +531,8 @@ template < typename T >
WPropertyVariable< T >::WPropertyVariable( const WPropertyVariable< T >& from ):
WFlag< T >( from ),
WPropertyBase( from ),
m_constraints( new ConstraintContainerType() )
m_constraints( new ConstraintContainerType() ),
m_notYetSet( from.m_notYetSet )
{
// copy the constraints
......@@ -584,7 +605,7 @@ bool WPropertyVariable< T >::setAsString( std::string value )
{
// use the helper class which can handle different kinds of properties for us
PROPERTY_TYPE_HELPER::WStringConversion< T > h = PROPERTY_TYPE_HELPER::WStringConversion< T >();
return WFlag< T >::set( h.create( WFlag< T >::get(), value ) );
return set( h.create( WFlag< T >::get(), value ) );
}
catch( const boost::bad_lexical_cast &e )
{
......@@ -610,7 +631,7 @@ bool WPropertyVariable< T >::set( boost::shared_ptr< WPropertyBase > value )
boost::shared_ptr< WPropertyVariable< T > > v = boost::shared_dynamic_cast< WPropertyVariable< T > >( value );
if( v )
{
return WFlag< T >::set( v->get() );
return set( v->get() );
}
else
{
......@@ -621,9 +642,26 @@ bool WPropertyVariable< T >::set( boost::shared_ptr< WPropertyBase > value )
template < typename T >
bool WPropertyVariable< T >::set( T value, bool suppressNotification )
{
m_notYetSet = false;
return WFlag< T >::set( value, suppressNotification );
}
template < typename T >
bool WPropertyVariable< T >::setRecommendedValue( T value )
{
// NOTE: well this is quite problematic when used multi-threaded ...
if( m_notYetSet )
{
bool ret = set( value );
m_notYetSet = true;
return ret;
}
else
{
return false;
}
}
template < typename T >
bool WPropertyVariable< T >::ensureValidity( T newValidValue, bool suppressNotification )
{
......
......@@ -196,29 +196,16 @@ osg::Vec3 WTriangleMesh::getVertex( size_t index ) const
osg::Vec4 WTriangleMesh::getVertColor( size_t index ) const
{
WAssert( index < m_countVerts, "get vertex: index out of range" );
WAssert( index < m_countVerts, "get vertex color: index out of range" );
return ( *m_vertColors )[index];
}
WPosition WTriangleMesh::getVertexAsPosition( size_t index ) const
{
WAssert( index < m_countVerts, "get vertex as position: index out of range" );
return WPosition( ( *m_verts )[index][0], ( *m_verts )[index][1], ( *m_verts )[index][2] );
}
WPosition WTriangleMesh::getNormalAsPosition( size_t index ) const
WVector3d WTriangleMesh::getNormal( size_t index ) const
{
WAssert( index < m_countVerts, "get vertex as position: index out of range" );
WAssert( index < m_countVerts, "get normal as position: index out of range" );
return WPosition( ( *m_vertNormals )[index][0], ( *m_vertNormals )[index][1], ( *m_vertNormals )[index][2] );
}
WPosition WTriangleMesh::getVertexAsPosition( size_t triangleIndex, size_t vertNum )
{
WAssert( triangleIndex < m_countTriangles, "get vertex as position: index out of range" );
osg::Vec3 v = getTriVert( triangleIndex, vertNum );
return WPosition( v[0], v[1], v[2] );
}
void WTriangleMesh::removeVertex( size_t index )
{
WAssert( index < m_countVerts, "remove vertex: index out of range" );
......@@ -382,13 +369,13 @@ void WTriangleMesh::doLoopSubD()
osg::Vec3* newVertexPositions = new osg::Vec3[m_numTriVerts];
//std::cout << "loop subdivision pass 1" << std::endl;
//std::cout << "Loop subdivision pass 1" << std::endl;
for( size_t i = 0; i < m_numTriVerts; ++i )
{
newVertexPositions[i] = loopCalcNewPosition( i );
}
//std::cout << "loop subdivision pass 2" << std::endl;
//std::cout << "Loop subdivision pass 2" << std::endl;
for( size_t i = 0; i < m_numTriFaces; ++i )
{
loopInsertCenterTriangle( i );
......@@ -397,13 +384,13 @@ void WTriangleMesh::doLoopSubD()
std::vector< size_t >v;
m_vertexIsInTriangle.resize( ( *m_verts ).size(), v );
//std::cout << "loop subdivision pass 3" << std::endl;
//std::cout << "Loop subdivision pass 3" << std::endl;
for( size_t i = 0; i < m_numTriFaces; ++i )
{
loopInsertCornerTriangles( i );
}
//std::cout << "loop subdivision pass 4" << std::endl;
//std::cout << "Loop subdivision pass 4" << std::endl;
for( size_t i = 0; i < m_numTriVerts; ++i )
{
( *m_verts )[i] = newVertexPositions[i];
......
......@@ -213,7 +213,7 @@ public:
*
* \return vertex array
*/
osg::ref_ptr< const osg::Vec3Array >getVertexArray() const;
osg::ref_ptr< const osg::Vec3Array > getVertexArray() const;
/**
* Returns a reference pointer to the texture coordinate array.
......@@ -235,14 +235,14 @@ public:
* \param forceRecalc
* \return pointer to the vertex normal array
*/
osg::ref_ptr< osg::Vec3Array >getVertexNormalArray( bool forceRecalc = false );
osg::ref_ptr< osg::Vec3Array > getVertexNormalArray( bool forceRecalc = false );
/**
* getter
*
* \return pointer to the vertex color array
*/
osg::ref_ptr< osg::Vec4Array >getVertexColorArray();
osg::ref_ptr< osg::Vec4Array > getVertexColorArray();
/**
* Returns a const reference to the vertex ids of the triangles.
......@@ -257,7 +257,7 @@ public:
* \param forceRecalc
* \return pointer to the triangle normal array
*/
osg::ref_ptr< osg::Vec3Array >getTriangleNormalArray( bool forceRecalc = false );
osg::ref_ptr< osg::Vec3Array > getTriangleNormalArray( bool forceRecalc = false );
/**
......@@ -285,30 +285,13 @@ public:
*/
osg::Vec3 getTriVert( size_t triId, size_t vertNum );
/**
* getter
*
* \param index
* \return vertex
*/
WPosition getVertexAsPosition( size_t index ) const;
/**
* getter
*
* \param index
* \return normal
*/
WPosition getNormalAsPosition( size_t index ) const;
/**
* getter
*
* \param triangleIndex
* \param vertNum
* \return vertex
*/
WPosition getVertexAsPosition( size_t triangleIndex, size_t vertNum );
WVector3d getNormal( size_t index ) const;
/**
* getter
......
......@@ -134,7 +134,7 @@ void WMExportGeometry::writeFile()
std::stringstream points;
for( size_t i = 0; i < mesh->vertSize(); ++i )
{
WPosition pos = mesh->getVertexAsPosition( i );
WPosition pos = mesh->getVertex( i );
points << "" << pos[0] << " " << pos[1] << " " << pos[2];
if( i < mesh->vertSize() - 1 )
{
......
......@@ -246,7 +246,7 @@ void WMIsosurfaceRaytracer::moduleMain()
m_isoValue->setMin( dataSet->getTexture()->minimum()->get() );
m_isoValue->setMax( dataSet->getTexture()->scale()->get() + dataSet->getTexture()->minimum()->get() );
m_isoValue->set( dataSet->getTexture()->minimum()->get() + ( 0.5 * dataSet->getTexture()->scale()->get() ) );
m_isoValue->setRecommendedValue( dataSet->getTexture()->minimum()->get() + ( 0.5 * dataSet->getTexture()->scale()->get() ) );
// First, grab the grid
boost::shared_ptr< WGridRegular3D > grid = boost::shared_dynamic_cast< WGridRegular3D >( dataSet->getGrid() );
......
......@@ -290,7 +290,7 @@ bool WMSplineSurface::save() const
// dataFile << "POINTS " << m_triMesh->vertSize() << " float\n";
// for( size_t i = 0; i < m_triMesh->vertSize(); ++i )
// {
// point = m_triMesh->getVertexAsPosition( i );
// point = m_triMesh->getVertex( i );
// if( !( myIsfinite( point[0] ) && myIsfinite( point[1] ) && myIsfinite( point[2] ) ) )
// {
// WLogger::getLogger()->addLogMessage( "Will not write file from data that contains NAN or INF.", "Marching Cubes", LL_ERROR );
......
......@@ -193,7 +193,7 @@ void WMWebglSupport::colorTriMeshGray()
for( size_t i = 0; i < m_triMesh->vertSize(); ++i )
{
// get vertex position
WPosition pos = m_triMesh->getVertexAsPosition( i );
WPosition pos = m_triMesh->getVertex( i );
// get color value for that vertex from texture
//double value = m_datasetScalar->interpolate( pos, &success );
......@@ -218,7 +218,7 @@ void WMWebglSupport::colorTriMeshRGB()
for( size_t i = 0; i < m_triMesh->vertSize(); ++i )
{
// get vertex position
WPosition pos = m_triMesh->getVertexAsPosition( i );
WPosition pos = m_triMesh->getVertex( i );
// get color value for that vertex from texture
WVector3d value = m_datasetVector->interpolate( pos, &success );
......
......@@ -182,7 +182,7 @@ bool WMWriteMesh::saveVTKASCII() const
dataFile << "POINTS " << m_triMesh->vertSize() << " float\n";
for( size_t i = 0; i < m_triMesh->vertSize(); ++i )
{
point = m_triMesh->getVertexAsPosition( i );
point = m_triMesh->getVertex( i );
if( !( myIsfinite( point[0] ) && myIsfinite( point[1] ) && myIsfinite( point[2] ) ) )
{
WLogger::getLogger()->addLogMessage( "Will not write file from data that contains NAN or INF.", "Write Mesh", LL_ERROR );
......@@ -257,7 +257,7 @@ bool WMWriteMesh::saveJson() const
WPosition point;
for( size_t i = 0; i < m_triMesh->vertSize() - 1; ++i )
{
point = m_triMesh->getVertexAsPosition( i );
point = m_triMesh->getVertex( i );
if( !( myIsfinite( point[0] ) && myIsfinite( point[1] ) && myIsfinite( point[2] ) ) )
{
WLogger::getLogger()->addLogMessage( "Will not write file from data that contains NAN or INF.", "Write Mesh", LL_ERROR );
......@@ -265,14 +265,14 @@ bool WMWriteMesh::saveJson() const
}
dataFile << point[0] << "," << point[1] << "," << point[2] << ",";
}
point = m_triMesh->getVertexAsPosition( m_triMesh->vertSize() - 1 );
point = m_triMesh->getVertex( m_triMesh->vertSize() - 1 );
dataFile << point[0] << "," << point[1] << "," << point[2] << "],\n";
dataFile << ( " \"normals\" : [" );
WPosition normal;
for( size_t i = 0; i < m_triMesh->vertSize() - 1; ++i )
{
normal = m_triMesh->getNormalAsPosition( i );
normal = m_triMesh->getNormal( i );
if( !( myIsfinite( normal[0] ) && myIsfinite( normal[1] ) && myIsfinite( normal[2] ) ) )
{
WLogger::getLogger()->addLogMessage( "Will not write file from data that contains NAN or INF.", "Write Mesh", LL_ERROR );
......@@ -280,7 +280,7 @@ bool WMWriteMesh::saveJson() const
}
dataFile << normal[0] << "," << normal[1] << "," << normal[2] << ",";
}
normal = m_triMesh->getNormalAsPosition( m_triMesh->vertSize() - 1 );
normal = m_triMesh->getNormal( m_triMesh->vertSize() - 1 );
dataFile << normal[0] << "," << normal[1] << "," << normal[2] << "],\n";
dataFile << ( " \"indices\" : [" );
......
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