]> Creatis software - cpPlugins.git/blob - plugins/GenericFilters/JoinBoundingBoxes.cxx
73f390bde5e71b635afbeb5144c709ee68b048f9
[cpPlugins.git] / plugins / GenericFilters / JoinBoundingBoxes.cxx
1 #include <GenericFilters/JoinBoundingBoxes.h>
2 #include <cpPlugins/BaseObjects/DataObject.h>
3 #include <cpInstances/BoundingBox.h>
4
5 // -------------------------------------------------------------------------
6 cpPluginsGenericFilters::JoinBoundingBoxes::
7 JoinBoundingBoxes( )
8   : Superclass( )
9 {
10   this->_ConfigureInput( "Inputs", true, true );
11   this->_ConfigureOutput< cpInstances::BoundingBox >( "Output" );
12 }
13
14 // -------------------------------------------------------------------------
15 cpPluginsGenericFilters::JoinBoundingBoxes::
16 ~JoinBoundingBoxes( )
17 {
18 }
19
20 // -------------------------------------------------------------------------
21 void cpPluginsGenericFilters::JoinBoundingBoxes::
22 _GenerateData( )
23 {
24   typedef cpPlugins::BaseObjects::DataObject _TDO;
25   typedef cpInstances::BoundingBox _TBB;
26
27   auto out = dynamic_cast< _TBB* >( this->GetOutput( "Output" ) );
28   unsigned int nInputs = this->GetInputSize( "Inputs" );
29   for( unsigned int i = 0; i < nInputs; ++i )
30   {
31     auto in = dynamic_cast< _TDO* >( this->GetInput( "Inputs", i ) );
32     if( i > 0 )
33     {
34       _TBB::Pointer bb = _TBB::New( );
35       bb->SetDataObject( in );
36       out->Blend( bb );
37     }
38     else
39       out->SetDataObject( in );
40
41   } // rof
42 }
43
44 // eof - $RCSfile$