h o m e d o c u m e n t a t i o n c l a s s h i e r a r c h y

Operators.h

00001 //
00002 //  Filename         : Operators.h
00003 //  Author(s)        : Stephane Grabli, Emmanuel Turquin
00004 //  Purpose          : Class gathering stroke creation algorithms
00005 //  Date of creation : 01/07/2003
00006 //
00008 
00009 
00010 //
00011 //  Copyright (C) : Please refer to the COPYRIGHT file distributed 
00012 //   with this source distribution. 
00013 //
00014 //  This program is free software; you can redistribute it and/or
00015 //  modify it under the terms of the GNU General Public License
00016 //  as published by the Free Software Foundation; either version 2
00017 //  of the License, or (at your option) any later version.
00018 //
00019 //  This program is distributed in the hope that it will be useful,
00020 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00021 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00022 //  GNU General Public License for more details.
00023 //
00024 //  You should have received a copy of the GNU General Public License
00025 //  along with this program; if not, write to the Free Software
00026 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
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   // Operators
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   // Data access
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   // Not exported in Python
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