/usr/include/OTB-5.8/otbVectorDataAdapter.txx is in libotb-dev 5.8.0+dfsg-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | /*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef otbVectorDataAdapterFilter_txx
#define otbVectorDataAdapterFilter_txx
#include "otbVectorDataAdapter.h"
namespace otb
{
/**
* Convert point
*/
template <class TInputVectorData, class TOutputVectorData>
typename VectorDataAdapter<TInputVectorData, TOutputVectorData>::OutputPointType
VectorDataAdapter<TInputVectorData, TOutputVectorData>
::ProcessPoint(InputPointType pointCoord) const
{
OutputPointType point;
point[0] = pointCoord[0];
point[1] = pointCoord[1];
if (OutputPointType::PointDimension == 3)
{
point[2] = pointCoord[2];
}
return point;
}
/**
* Convert line
*/
template <class TInputVectorData, class TOutputVectorData>
typename VectorDataAdapter<TInputVectorData, TOutputVectorData>::OutputLinePointerType
VectorDataAdapter<TInputVectorData, TOutputVectorData>
::ProcessLine(InputLinePointerType line) const
{
typedef typename InputLineType::VertexListType::ConstPointer VertexListConstPointerType;
typedef typename InputLineType::VertexListConstIteratorType VertexListConstIteratorType;
VertexListConstPointerType vertexList = line->GetVertexList();
VertexListConstIteratorType it = vertexList->Begin();
typename OutputLineType::Pointer newLine = OutputLineType::New();
while (it != vertexList->End())
{
typename OutputLineType::VertexType index;
typename InputLineType::VertexType pointCoord = it.Value();
index[0] = pointCoord[0];
index[1] = pointCoord[1];
// fixme handle 2.5D ?
newLine->AddVertex(index);
++it;
}
return newLine;
}
/**
* Convert polygon
*/
template <class TInputVectorData, class TOutputVectorData>
typename VectorDataAdapter<TInputVectorData, TOutputVectorData>::OutputPolygonPointerType
VectorDataAdapter<TInputVectorData, TOutputVectorData>
::ProcessPolygon(InputPolygonPointerType polygon) const
{
typedef typename InputPolygonType::VertexListType::ConstPointer VertexListConstPointerType;
typedef typename InputPolygonType::VertexListConstIteratorType VertexListConstIteratorType;
VertexListConstPointerType vertexList = polygon->GetVertexList();
VertexListConstIteratorType it = vertexList->Begin();
typename OutputPolygonType::Pointer newPolygon = OutputPolygonType::New();
while (it != vertexList->End())
{
typename OutputPolygonType::VertexType index;
typename InputPolygonType::VertexType pointCoord = it.Value();
index[0] = pointCoord[0];
index[1] = pointCoord[1];
// fixme handle 2.5D ?
newPolygon->AddVertex(index);
++it;
}
return newPolygon;
}
/**
* Convert polygon list
*/
template <class TInputVectorData, class TOutputVectorData>
typename VectorDataAdapter<TInputVectorData, TOutputVectorData>::OutputPolygonListPointerType
VectorDataAdapter<TInputVectorData, TOutputVectorData>
::ProcessPolygonList(InputPolygonListPointerType polygonList) const
{
OutputPolygonListPointerType newPolygonList = OutputPolygonListType::New();
for (typename InputPolygonListType::ConstIterator it = polygonList->Begin();
it != polygonList->End(); ++it)
{
newPolygonList->PushBack(this->ProcessPolygon(it.Get()));
}
return newPolygonList;
}
} // end namespace otb
#endif
|