Orfeo Toolbox  3.16
otbGeometriesSource.cxx
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ORFEO Toolbox
4  Language: C++
5  Date: $Date$
6  Version: $Revision$
7 
8 
9  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
10  See OTBCopyright.txt for details.
11 
12 
13  This software is distributed WITHOUT ANY WARRANTY; without even
14  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  PURPOSE. See the above copyright notices for more information.
16 
17 =========================================================================*/
18 
19 /*===========================================================================*/
20 /*===============================[ Includes ]================================*/
21 /*===========================================================================*/
22 #include "otbGeometriesSource.h"
23 #include "otbGeometriesSet.h"
24 
25 /*===========================================================================*/
26 /*==============================[ other stuff ]==============================*/
27 /*===========================================================================*/
28 
30 {
32  // The following line has for side effect to set of DataSource with the wrong
33  // type as default value instead of a plain nil
34  // smartpointer... => NO
35  // Superclass::SetNthOutput(0, 0);
36 
37  // Moreover, the default, and correct, value will be set in DoAllocateOutputs if
38  // nothing is set by then => nothing more to do.
39 }
40 
41 /*virtual*/
43 {
44 }
45 
46 /*virtual*/
48 {
49  return static_cast<GeometriesSet*> (Superclass::GetOutput(0));
50 }
51 
52 /*virtual*/
54 {
55  return static_cast<GeometriesSet*> (Superclass::GetOutput(idx));
56 }
57 
58 /*virtual*/
59 void otb::GeometriesSource::SetOutput(OutputGeometriesType* output, unsigned int idx/* = 0 */)
60 {
61  Superclass::SetNthOutput(idx, output);
62 }
63 
64 /*virtual*/
66 {
67  // The default behaviour is to prepare a in-memory OGR datasource in case
68  // filters are piped.
69  // In the filter is meant to produce a file, use SetOutput, or the New(string)
70  // function to built the GeometriesSource and filters
71  if (!GetOutput() || !GetOutput()->IsSet())
72  {
73  GeometriesSet::Pointer gs = GeometriesSet::New(); // in-memory DataSource
74  assert(gs);
75  this->SetOutput(gs);
78  }
79 }
80 
81 /*virtual*/
83 {
84  DoAllocateOutputs();
85  Superclass::PrepareOutputs();
86 }

Generated at Sun May 19 2013 00:26:00 for Orfeo Toolbox with doxygen 1.8.3.1