OmniSciDB  c1a53651b2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RenderGroupAnalyzer.h
Go to the documentation of this file.
1 /*
2  * Copyright 2022 HEAVY.AI, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <cstdlib>
20 #include <iostream>
21 #include <memory>
22 #include <mutex>
23 #include <string>
24 #include <utility>
25 
26 // Some builds of boost::geometry require iostream, but don't explicitly include it.
27 // Placing in own section to ensure it's included after iostream.
28 #include <boost/geometry/index/rtree.hpp>
29 
30 namespace Catalog_Namespace {
31 class Catalog;
32 }
33 
34 namespace import_export {
35 
37  public:
38  RenderGroupAnalyzer() : _rtree(std::make_unique<RTree>()), _numRenderGroups(0) {}
40  const std::string& tableName,
41  const std::string& geoColumnBaseName);
42  int insertBoundsAndReturnRenderGroup(const std::vector<double>& bounds);
43 
44  private:
45  using Point = boost::geometry::model::point<double, 2, boost::geometry::cs::cartesian>;
46  using BoundingBox = boost::geometry::model::box<Point>;
47  using Node = std::pair<BoundingBox, int>;
48  using RTree =
49  boost::geometry::index::rtree<Node, boost::geometry::index::quadratic<16>>;
50  std::unique_ptr<RTree> _rtree;
51  std::mutex _rtreeMutex;
53 };
54 
55 } // namespace import_export
std::string cat(Ts &&...args)
class for a per-database catalog. also includes metadata for the current database and the current use...
Definition: Catalog.h:132
std::pair< BoundingBox, int > Node
boost::geometry::index::rtree< Node, boost::geometry::index::quadratic< 16 >> RTree
void seedFromExistingTableContents(const Catalog_Namespace::Catalog &cat, const std::string &tableName, const std::string &geoColumnBaseName)
boost::geometry::model::box< Point > BoundingBox
int insertBoundsAndReturnRenderGroup(const std::vector< double > &bounds)
boost::geometry::model::point< double, 2, boost::geometry::cs::cartesian > Point