Commit 7cc93444 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[CHANGE #259] colormapper now inserts loaded colormaps at the front but keeps...

[CHANGE #259] colormapper now inserts loaded colormaps at the front but keeps ordering of the newly loaded ones and the current ones.
parent 4e9c2872
...@@ -289,7 +289,7 @@ void WGEColormapping::resetSortIndices() ...@@ -289,7 +289,7 @@ void WGEColormapping::resetSortIndices()
TextureContainerType::ReadTicket r = m_textures.getReadTicket(); TextureContainerType::ReadTicket r = m_textures.getReadTicket();
for( TextureContainerType::ConstIterator iter = r->get().begin(); iter != r->get().end(); ++iter ) for( TextureContainerType::ConstIterator iter = r->get().begin(); iter != r->get().end(); ++iter )
{ {
( *iter )->sortIndex()->set( -1 ); ( *iter )->sortIndex()->set( WGETexture3D::getUnsetSortIndex() );
} }
} }
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#define WGETEXTURE_H #define WGETEXTURE_H
#include <string> #include <string>
#include <limits>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
...@@ -39,6 +40,7 @@ ...@@ -39,6 +40,7 @@
#include "callbacks/WGEFunctorCallback.h" #include "callbacks/WGEFunctorCallback.h"
#include "../common/WBoundingBox.h" #include "../common/WBoundingBox.h"
#include "../common/WProperties.h" #include "../common/WProperties.h"
#include "../common/WPropertyTypes.h"
#include "../common/WPropertyHelper.h" #include "../common/WPropertyHelper.h"
#include "../common/math/linearAlgebra/WLinearAlgebra.h" #include "../common/math/linearAlgebra/WLinearAlgebra.h"
...@@ -102,6 +104,13 @@ public: ...@@ -102,6 +104,13 @@ public:
*/ */
WPropInt sortIndex() const; WPropInt sortIndex() const;
/**
* Get the index used to refer to an unset sort index.
*
* \return the value.
*/
static WPVBaseTypes::PV_INT getUnsetSortIndex();
/** /**
* Get the minimum in the de-scaled value space. The property can be changed. A change affects all colormaps using this texture. But be * Get the minimum in the de-scaled value space. The property can be changed. A change affects all colormaps using this texture. But be
* careful as the texture creating depends on these values. * careful as the texture creating depends on these values.
...@@ -472,7 +481,7 @@ void WGETexture< TextureType >::setupProperties( double scale, double min ) ...@@ -472,7 +481,7 @@ void WGETexture< TextureType >::setupProperties( double scale, double min )
m_sortIdx = m_properties->addProperty( "Sort Index", m_sortIdx = m_properties->addProperty( "Sort Index",
"The index specifies the index in the colormapper, used to restore colormapper sorting on load.", "The index specifies the index in the colormapper, used to restore colormapper sorting on load.",
-1 ); getUnsetSortIndex() );
m_sortIdx->setHidden( true ); m_sortIdx->setHidden( true );
// initialize members // initialize members
...@@ -734,5 +743,11 @@ WBoundingBox WGETexture< TextureType >::getBoundingBox() const ...@@ -734,5 +743,11 @@ WBoundingBox WGETexture< TextureType >::getBoundingBox() const
return WBoundingBox( 0.0, 0.0, 0.0, 1.0, 1.0, 1.0 ); return WBoundingBox( 0.0, 0.0, 0.0, 1.0, 1.0, 1.0 );
} }
template < typename TextureType >
WPVBaseTypes::PV_INT WGETexture< TextureType >::getUnsetSortIndex()
{
return std::numeric_limits< WPVBaseTypes::PV_INT >::max();
}
#endif // WGETEXTURE_H #endif // WGETEXTURE_H
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