]> Creatis software - cpPlugins.git/blob - plugins/GenericFilters/JoinBoundingBoxes.cxx
43850723b721acd05f583c3ada61a742d6c5750d
[cpPlugins.git] / plugins / GenericFilters / JoinBoundingBoxes.cxx
1 #include <GenericFilters/JoinBoundingBoxes.h>
2 #include <cpPlugins/BaseObjects/DataObject.h>
3 #include <cpPlugins/DataObjects/BoundingBox.h>
4
5 // -------------------------------------------------------------------------
6 cpPluginsGenericFilters::JoinBoundingBoxes::
7 JoinBoundingBoxes( )
8   : Superclass( )
9 {
10   this->_ConfigureInput( "Input0", true, false );
11   this->_ConfigureInput( "Input1", false, false );
12   this->_ConfigureInput( "Input2", false, false );
13   this->_ConfigureInput( "Input3", false, false );
14   this->_ConfigureInput( "Input4", false, false );
15   this->_ConfigureInput( "Input5", false, false );
16   this->_ConfigureOutput< cpPlugins::DataObjects::BoundingBox >( "Output" );
17 }
18
19 // -------------------------------------------------------------------------
20 cpPluginsGenericFilters::JoinBoundingBoxes::
21 ~JoinBoundingBoxes( )
22 {
23 }
24
25 // -------------------------------------------------------------------------
26 void cpPluginsGenericFilters::JoinBoundingBoxes::
27 _GenerateData( )
28 {
29   typedef cpPlugins::BaseObjects::DataObject _TDO;
30   typedef cpPlugins::DataObjects::BoundingBox _TBB;
31   _TDO* dobjs[ 5 ];
32   
33   auto do0   = dynamic_cast< _TDO* >( this->GetInput( "Input0" ) );
34   dobjs[ 0 ] = dynamic_cast< _TDO* >( this->GetInput( "Input1" ) );
35   dobjs[ 1 ] = dynamic_cast< _TDO* >( this->GetInput( "Input2" ) );
36   dobjs[ 2 ] = dynamic_cast< _TDO* >( this->GetInput( "Input3" ) );
37   dobjs[ 3 ] = dynamic_cast< _TDO* >( this->GetInput( "Input4" ) );
38   dobjs[ 4 ] = dynamic_cast< _TDO* >( this->GetInput( "Input5" ) );
39   auto out = dynamic_cast< _TBB* >( this->GetOutput( "Output" ) );
40
41   out->SetDataObject( do0 );
42   for( unsigned int d = 0; d < 5; ++d )
43   {
44     if( dobjs[ d ] != NULL )
45     {
46       _TBB::Pointer bb = _TBB::New( );
47       bb->SetDataObject( dobjs[ d ] );
48       out->Blend( bb );
49
50     } // fi
51
52   } // rof
53 }
54
55 // eof - $RCSfile$