DGtal
0.6.devel
Main Page
Related Pages
Modules
Namespaces
Data Structures
Examples
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
src
DGtal
geometry
curves
GreedySegmentation.h
1
17
#pragma once
18
31
#if defined(GreedySegmentation_RECURSES)
32
#error Recursive header files inclusion detected in GreedySegmentation.h
33
#else // defined(GreedySegmentation_RECURSES)
34
35
#define GreedySegmentation_RECURSES
36
37
#if !defined GreedySegmentation_h
38
39
#define GreedySegmentation_h
40
42
// Inclusions
43
#include <iostream>
44
#include "DGtal/base/Common.h"
45
#include "DGtal/geometry/curves/CForwardSegmentComputer.h"
46
48
49
namespace
DGtal
50
{
51
53
// template class GreedySegmentation
147
template
<
typename
TSegmentComputer>
148
class
GreedySegmentation
149
{
150
151
public
:
152
153
BOOST_CONCEPT_ASSERT
((
CForwardSegmentComputer<TSegmentComputer>
) );
154
typedef
TSegmentComputer
SegmentComputer
;
155
typedef
typename
SegmentComputer::ConstIterator
ConstIterator
;
156
157
// ----------------------- Standard services ------------------------------
158
public
:
159
160
161
163
// template class SegmentComputerIterator
168
class
SegmentComputerIterator
169
{
170
171
// ------------------------- inner Types -----------------------
172
173
public
:
174
typedef
typename
GreedySegmentation::SegmentComputer
SegmentComputer
;
175
typedef
typename
SegmentComputer::ConstIterator
ConstIterator
;
176
177
// ------------------------- data -----------------------
178
private
:
179
183
const
GreedySegmentation<TSegmentComputer>
*
myS
;
184
188
SegmentComputer
mySegmentComputer
;
189
193
bool
myFlagIsValid
;
194
200
bool
myFlagIntersectNext
;
201
207
bool
myFlagIntersectPrevious
;
208
212
bool
myFlagIsLast
;
213
214
215
216
// ------------------------- Standard services -----------------------
217
public
:
218
friend
class
GreedySegmentation
<TSegmentComputer>;
219
220
221
231
SegmentComputerIterator
(
const
GreedySegmentation<TSegmentComputer>
*aSegmentation,
232
const
TSegmentComputer& aSegmentComputer,
233
const
bool
& aFlag );
234
235
240
SegmentComputerIterator
(
const
SegmentComputerIterator
& aOther );
241
247
SegmentComputerIterator
&
operator=
(
const
SegmentComputerIterator
& aOther );
248
252
~SegmentComputerIterator
();
253
258
bool
isValid
()
const
{
return
myFlagIsValid
; }
259
260
// ------------------------- iteration services -------------------------
261
public
:
262
266
const
SegmentComputer
&
operator*
()
const
;
267
268
272
SegmentComputer
get
()
const
;
273
274
278
const
SegmentComputer
*
operator->
()
const
;
279
286
SegmentComputerIterator
&
operator++
();
287
293
void
next
();
294
295
302
bool
operator==
(
const
SegmentComputerIterator
& aOther )
const
;
303
310
bool
operator!=
(
const
SegmentComputerIterator
& aOther )
const
;
311
312
// ----------------------- accessors --------------------------------------
313
318
bool
intersectNext
()
const
;
319
324
bool
intersectPrevious
()
const
;
325
329
const
ConstIterator
begin
()
const
;
330
334
const
ConstIterator
end
()
const
;
335
336
// ----------------------- hidden services --------------------------------------
337
338
private
:
339
346
void
longestSegment
(
const
ConstIterator
& it);
347
356
bool
doesIntersectNext
(
const
ConstIterator
& it,
357
const
ConstIterator
& itb,
const
ConstIterator
& ite);
358
bool
doesIntersectNext
(
const
ConstIterator
& it,
359
const
ConstIterator
& itb,
const
ConstIterator
& ite,
IteratorType
);
360
bool
doesIntersectNext
(
const
ConstIterator
& it,
361
const
ConstIterator
& itb,
const
ConstIterator
& ite,
CirculatorType
);
362
370
bool
doesIntersectNext
(
const
ConstIterator
& it);
371
372
373
};
374
375
376
// ----------------------- Interface --------------------------------------
377
public
:
378
384
GreedySegmentation
() {};
385
392
GreedySegmentation
(
const
ConstIterator& itb,
393
const
ConstIterator& ite,
394
const
SegmentComputer
& aSegmentComputer);
395
403
void
setSubRange
(
const
ConstIterator& itb,
404
const
ConstIterator& ite);
405
406
412
void
setMode
(
const
std::string& aMode);
413
414
418
~GreedySegmentation
();
419
424
typename
GreedySegmentation::SegmentComputerIterator
begin
()
const
;
425
430
typename
GreedySegmentation::SegmentComputerIterator
end
()
const
;
431
432
437
void
selfDisplay
( std::ostream & out )
const
;
438
443
bool
isValid
()
const
;
444
445
// ------------------------- Protected Datas ------------------------------
446
private
:
447
// ------------------------- Private Datas --------------------------------
448
private
:
449
453
ConstIterator
myBegin
;
454
458
ConstIterator
myEnd
;
459
463
ConstIterator
myStart
;
464
468
ConstIterator
myStop
;
469
473
std::string
myMode
;
474
478
SegmentComputer
mySegmentComputer
;
479
480
// ------------------------- Hidden services ------------------------------
481
482
483
private
:
484
489
GreedySegmentation
(
const
GreedySegmentation
& other );
490
496
GreedySegmentation
&
operator=
(
const
GreedySegmentation
& other );
497
498
// ------------------------- Internals ------------------------------------
499
private
:
500
501
};
// end of class GreedySegmentation
502
503
510
template
<
typename
SegmentComputer>
511
std::ostream&
512
operator<< ( std::ostream & out, const GreedySegmentation<SegmentComputer> & object );
513
514
}
// namespace DGtal
515
516
518
// Includes inline functions.
519
#include "DGtal/geometry/curves/GreedySegmentation.ih"
520
521
// //
523
524
#endif // !defined GreedySegmentation_h
525
526
#undef GreedySegmentation_RECURSES
527
#endif // else defined(GreedySegmentation_RECURSES)
Generated on Wed Dec 19 2012 19:10:25 for DGtal by
1.8.1.1