rasdaman complete source
tiler.hh
Go to the documentation of this file.
1 /*
2 * This file is part of rasdaman community.
3 *
4 * Rasdaman community is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * Rasdaman community is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
18 rasdaman GmbH.
19 *
20 * For more information please see <http://www.rasdaman.org>
21 * or contact Peter Baumann via <baumann@rasdaman.com>.
22 */
23 
24 #ifndef _D_TILER_
25 #define _D_TILER_
26 
27 #include "raslib/minterval.hh"
28 #include <vector>
29 #include <utility>
30 //#include<pair>
31 
32 class Tile;
33 class PersTile;
34 class TransTile;
35 
36 typedef std::pair<r_Range,r_Range> RangePair;
37 typedef std::pair<const r_Range,const r_Range> ConstRangePair;
38 
42 class r_Tiler
43 {
44 public:
45  r_Tiler(std::vector<r_Minterval>& sourceDomains, const std::vector<r_Minterval>& targetDomains);
46  /*
47  sourceDomains will be splitted.
48  targetDomains will not be touched.
49  */
50 
51  void split();
52  /*
53  will split the source domains.
54  */
55 
56  void removeCoveredDomains();
57  /*
58  removes those splited domains which are covered by target domains.
59  */
60 
61  void removeDoubleDomains();
62  /*
63  removes those splited domains which are covered by other splited domains.
64  */
65 
66  void mergeDomains();
67  /*
68  tries to merge splited domains into larger domains.
69  */
70 
71  std::vector<r_Minterval> getTiledDomains() const;
72  /*
73  returns the computed domains. you must call split() first.
74  */
75 
76  std::vector<Tile*> generateTiles(const std::vector<Tile*>& sourceTiles) const;
77  /*
78  uses the previously computed tiled domains to generate the output.
79  call split, removeCoveredDomains, removeDoubleDomains, mergeDomains first!
80  memory must be freed by the caller!
81  */
82 
83 private:
84 
85  std::vector<r_Minterval> splitMinterval(const r_Minterval& sourceDomain, std::vector<RangePair>& splitDimensions);
86 
87  std::vector<RangePair> computeSplitDimensions(const r_Minterval& sourceDomain) const;
88 
89  std::vector<r_Minterval> splitedDomains;
90 
91  std::vector<r_Minterval> sourceDomains;
92 
93  std::vector<r_Minterval> targetDomains;
94 };
95 #endif
96 
Definition: tiler.hh:42
void mergeDomains()
void split()
std::pair< const r_Range, const r_Range > ConstRangePair
Definition: tiler.hh:37
std::vector< r_Minterval > getTiledDomains() const
r_Tiler(std::vector< r_Minterval > &sourceDomains, const std::vector< r_Minterval > &targetDomains)
Definition: tile.hh:80
void removeCoveredDomains()
std::pair< r_Range, r_Range > RangePair
Definition: tiler.hh:34
void removeDoubleDomains()
Definition: minterval.hh:249
std::vector< Tile * > generateTiles(const std::vector< Tile * > &sourceTiles) const