00001
00002
00003
00004
00005
00006
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00029
00030 #ifndef OPERATORS_H
00031 # define OPERATORS_H
00032
00033 # include <vector>
00034 # include <iostream>
00035 # include "../view_map/Interface1D.h"
00036 # include "Predicates1D.h"
00037 # include "Predicates0D.h"
00038 # include "../view_map/ViewMap.h"
00039 # include "Chain.h"
00040 # include "ChainingIterators.h"
00041 # include "../system/TimeStamp.h"
00042 # include "StrokeShader.h"
00043
00050 class LIB_STROKE_EXPORT Operators {
00051
00052 public:
00053
00054 typedef vector<Interface1D*> I1DContainer;
00055 typedef vector<Stroke*> StrokesContainer;
00056
00057
00058
00059
00060
00062
00067 static void select(UnaryPredicate1D& pred);
00068
00086 static void chain(ViewEdgeInternal::ViewEdgeIterator& it,
00087 UnaryPredicate1D& pred,
00088 UnaryFunction1D<void>& modifier);
00089
00106 static void chain(ViewEdgeInternal::ViewEdgeIterator& it,
00107 UnaryPredicate1D& pred);
00108
00129 static void bidirectionalChain(ChainingIterator& it, UnaryPredicate1D& pred);
00130
00152 static void bidirectionalChain(ChainingIterator& it);
00153
00173 static void sequentialSplit(UnaryPredicate0D& startingPred, UnaryPredicate0D& stoppingPred,
00174 float sampling = 0.f);
00175
00188 static void sequentialSplit(UnaryPredicate0D& pred,
00189 float sampling = 0.f);
00190
00209 static void recursiveSplit(UnaryFunction0D<double>& func, UnaryPredicate1D& pred, float sampling = 0);
00210
00241 static void recursiveSplit(UnaryFunction0D<double>& func, UnaryPredicate0D& pred0d, UnaryPredicate1D& pred, float sampling = 0);
00242
00248 static void sort(BinaryPredicate1D& pred);
00249
00259 static void create(UnaryPredicate1D& pred, vector<StrokeShader*> shaders);
00260
00261
00262
00263
00265
00266 static ViewEdge* getViewEdgeFromIndex(unsigned i) {
00267 return dynamic_cast<ViewEdge*>(_current_view_edges_set[i]);
00268 }
00269
00270 static Chain* getChainFromIndex(unsigned i) {
00271 return dynamic_cast<Chain*>(_current_chains_set[i]);
00272 }
00273
00274 static Stroke* getStrokeFromIndex(unsigned i) {
00275 return _current_strokes_set[i];
00276 }
00277
00278 static unsigned getViewEdgesSize() {
00279 return _current_view_edges_set.size();
00280 }
00281
00282 static unsigned getChainsSize() {
00283 return _current_chains_set.size();
00284 }
00285
00286 static unsigned getStrokesSize() {
00287 return _current_strokes_set.size();
00288 }
00289
00290
00291
00292
00294
00295 static StrokesContainer* getStrokesSet() {
00296 return &_current_strokes_set;
00297 }
00298
00299 static void reset();
00300
00301 private:
00302
00303 Operators() {}
00304
00305 static I1DContainer _current_view_edges_set;
00306 static I1DContainer _current_chains_set;
00307 static I1DContainer* _current_set;
00308 static StrokesContainer _current_strokes_set;
00309 };
00310
00311 #endif // OPERATORS_H