35 #ifndef __TraceContainerBase_h
36 #define __TraceContainerBase_h
42 #include "vtkProperty.h"
44 #include "QGoGUILibConfigure.h"
46 #include "vtkIntArray.h"
48 #include "vtkMapper.h"
49 #include "vtkDataSet.h"
50 #include "vtkPointData.h"
54 #include "boost/multi_index_container.hpp"
55 #include "boost/multi_index/member.hpp"
56 #include "boost/multi_index/hashed_index.hpp"
57 #include "boost/multi_index/ordered_index.hpp"
58 #include "boost/numeric/conversion/cast.hpp"
59 #include "boost/lexical_cast.hpp"
104 iStructure.ActorXY =
actor[0];
105 iStructure.ActorXZ =
actor[1];
106 iStructure.ActorYZ =
actor[2];
107 iStructure.ActorXYZ =
actor[3];
143 template<
class TContainer >
150 typedef typename MultiIndexContainerType::template index< TraceID >::type::iterator
153 typedef typename MultiIndexContainerType::template index< CollectionID >::type::iterator
156 typedef typename MultiIndexContainerType::template index< Highlighted >::type::iterator
159 typedef typename MultiIndexContainerType::template index< Visible >::type::iterator
186 template<
class TIterator >
187 void Print(TIterator iBegin, TIterator iEnd)
189 TIterator it = iBegin;
194 std::cout <<
"***" << std::endl;
195 std::cout << std::endl;
205 template<
class TIndex >
208 using boost::multi_index::get;
238 template<
class TList >
241 using boost::multi_index::get;
243 typename TList::iterator it = iList.begin();
245 while ( it != iList.end() )
248 m_Container.get< TraceID >().find( static_cast< unsigned int >( *it ) );
258 vtkProperty *tproperty = vtkProperty::New();
259 tproperty->SetColor(id_it->rgba[0], id_it->rgba[1], id_it->rgba[2]);
260 tproperty->SetOpacity(id_it->rgba[3]);
265 bool test2 = id_it->Visible;
269 std::vector< vtkActor * > actor =
275 typedef void (
QGoImageView3D::*ImageViewMember )(
const int &, vtkActor *);
278 if ( id_it->Visible )
288 for (
int i = 0; i < 4; i++ )
312 template<
class TIndex >
314 typename MultiIndexContainerType::template index< TIndex >::type::iterator& iIt,
315 std::vector< vtkActor * > iActors,
316 const bool & iHighlighted,
317 const bool & iVisible)
320 using boost::multi_index::get;
322 if ( iActors.size() == 4 )
327 bool highlighted = iHighlighted;
328 bool visible = iVisible;
334 typedef void (
QGoImageView3D::*ImageViewMember )(
const int &, vtkActor *);
347 for (
int i = 0; i < 4; i++ )
372 bool IsVisible =
false);
399 template<
class TIndex >
401 typename MultiIndexContainerType::template index< TIndex >::type::iterator iIt )
403 using boost::multi_index::get;
432 const unsigned int & iId);
496 const std::map< unsigned int, std::string >& iValues );
507 template<
typename TValue >
509 const std::map< unsigned int, TValue >& iValues )
511 typedef TValue ValueType;
512 typedef typename std::map< unsigned int, ValueType > MapType;
513 typedef typename MapType::const_iterator MapConstIterator;
515 using boost::multi_index::get;
517 if( iColumnName.empty() || iValues.empty() )
523 MapConstIterator it = iValues.begin();
528 temp = boost::numeric_cast<
double >( it->second );
530 catch( boost::numeric::bad_numeric_cast& e )
532 std::cout << e.what() <<std::endl;
536 double min_value = temp;
537 double max_value = temp;
539 while( it != iValues.end() )
542 trace_it = this->
m_Container.get<TraceID>().find( it->first );
544 if( trace_it != this->
m_Container.get<TraceID>().end() )
551 temp = boost::numeric_cast<
double >( it->second );
553 catch( boost::numeric::bad_numeric_cast& e )
555 std::cout << e.what() <<std::endl;
559 if( temp > max_value )
563 if( temp < min_value )
568 trace_it->SetScalarData( iColumnName, temp );
583 const std::map< unsigned int, unsigned int >& iIds );
586 const std::map< unsigned int, std::string >& iValues );
604 const Qt::CheckState& iCheck );
611 const Qt::CheckState& iCheck );
622 const bool& iHighlighted,
623 const bool& iVisible );
634 const unsigned int& oTraceId,
635 Qt::CheckState& oState )
637 using boost::multi_index::get;
639 typedef typename MultiIndexContainerType::template index< TraceID >::type::iterator
641 IteratorType it =
m_Container.get< TraceID >().find(oTraceId);
643 vtkProperty *temp_property = vtkProperty::New();
645 assert ( it !=
m_Container.get< TraceID >().end() );
647 if ( it->Highlighted )
649 temp_property->SetColor(it->rgba[0],
652 temp_property->SetOpacity(it->rgba[3]);
660 it->SetActorProperties( temp_property );
662 temp_property->Delete();
665 bool checked =
false;
666 if ( !it->Highlighted )
668 oState = Qt::Checked;
673 oState = Qt::Unchecked;
685 const unsigned int& oTraceId,
688 using boost::multi_index::get;
690 typedef typename MultiIndexContainerType::template index< TraceID >::type::iterator
692 IteratorType it =
m_Container.get< TraceID >().find(oTraceId);
694 assert ( it !=
m_Container.get< TraceID >().end() );
696 if ( it->Visible != iState )
698 it->SetActorVisibility( iState );
705 #include "TraceContainerBase.txx"
707 #endif // __TraceContainerBase_h