21 #ifndef otbMergeLabelObjectFunctor_h
22 #define otbMergeLabelObjectFunctor_h
47 template <
class TLabelObject>
55 typedef typename LabelObjectType::LineType
LineType;
84 typename LineContainerType::const_iterator lit = linesOut1.begin();
85 linesOut2.push_back(*lit);
89 while (lit != linesOut1.end())
99 linesOut2.push_back(mline);
104 linesOut2.push_back(*lit);
113 resp->CopyAllFrom(l1);
114 resp->GetLineContainer() = linesOut2;
125 bool resp = l2.GetIndex()[1] > l1.GetIndex()[1];
126 resp = resp || (l2.GetIndex()[1] == l1.GetIndex()[1] && (l1.GetIndex()[0] < l2.GetIndex()[0]));
135 bool sameRow = l2.GetIndex()[1] == l1.GetIndex()[1];
136 bool leftEndInside = (l2.GetIndex()[0] >= l1.GetIndex()[0] && l2.GetIndex()[0] <= l1.GetIndex()[0] +
static_cast<long>(l1.GetLength()));
137 bool rightEndInside = (l1.GetIndex()[0] >= l2.GetIndex()[0] && l1.GetIndex()[0] <= l2.GetIndex()[0] +
static_cast<long>(l2.GetLength()));
139 return (sameRow && (leftEndInside || rightEndInside));
147 resp.SetIndex(l1.GetIndex());
148 unsigned long length = std::max(l1.GetLength(), l2.GetIndex()[0] + l2.GetLength() - l1.GetIndex()[0]);
149 resp.SetLength(length);
TLabelObject LabelObjectType
LabelObjectType::LineContainerType LineContainerType
LabelObjectType::LineType LineType
LineType::IndexType IndexType
LabelObjectPointerType operator()(const LabelObjectType *l1, const LabelObjectType *l2) const
LabelObjectType::Pointer LabelObjectPointerType
static bool LexicographicalLineCompare(const LineType &l1, const LineType &l2)
static bool LinesOverlap(const LineType &l1, const LineType &l2)
static const LineType MergesLines(const LineType &l1, const LineType &l2)
The "otb" namespace contains all Orfeo Toolbox (OTB) classes.