vsg  1.1.0
VulkanSceneGraph library
TileDatabase.h
1 #pragma once
2 
3 /* <editor-fold desc="MIT License">
4 
5 Copyright(c) 2022 Robert Osfield
6 
7 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8 
9 The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10 
11 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12 
13 </editor-fold> */
14 
15 #include <vsg/app/EllipsoidModel.h>
16 #include <vsg/io/ReaderWriter.h>
17 #include <vsg/nodes/Node.h>
18 #include <vsg/state/DescriptorSetLayout.h>
19 #include <vsg/state/PipelineLayout.h>
20 #include <vsg/state/Sampler.h>
21 #include <vsg/utils/ShaderSet.h>
22 
23 namespace vsg
24 {
25 
27  class VSG_DECLSPEC TileDatabaseSettings : public Inherit<Object, TileDatabaseSettings>
28  {
29  public:
30  // read/write of TileReader settings
31  void read(Input& input) override;
32  void write(Output& output) const override;
33 
34  // defaults for readymap
35  dbox extents = {{-180.0, -90.0, 0.0}, {180.0, 90.0, 1.0}};
36  uint32_t noX = 2;
37  uint32_t noY = 1;
38  uint32_t maxLevel = 22;
39  bool originTopLeft = true;
40  double lodTransitionScreenHeightRatio = 0.25;
41 
42  std::string projection;
43  ref_ptr<EllipsoidModel> ellipsoidModel = EllipsoidModel::create();
44 
45  Path imageLayer;
46  Path terrainLayer;
47  uint32_t mipmapLevelsHint = 16;
48 
50  bool lighting = true;
51 
54  };
55  VSG_type_name(vsg::TileDatabaseSettings);
56 
59  class VSG_DECLSPEC TileDatabase : public Inherit<Node, TileDatabase>
60  {
61  public:
63  ref_ptr<Node> child;
64 
65  template<class N, class V>
66  static void t_traverse(N& node, V& visitor)
67  {
68  if (node.child) node.child->accept(visitor);
69  }
70 
71  void traverse(Visitor& visitor) override { t_traverse(*this, visitor); }
72  void traverse(ConstVisitor& visitor) const override { t_traverse(*this, visitor); }
73  void traverse(RecordTraversal& visitor) const override { t_traverse(*this, visitor); }
74 
75  // read/write of TileReader settings
76  void read(Input& input) override;
77  void write(Output& output) const override;
78 
79  bool readDatabase(ref_ptr<const Options> options);
80  };
81  VSG_type_name(vsg::TileDatabase);
82 
84  extern VSG_DECLSPEC std::string_view find_field(const std::string& source, const std::string_view& start_match, const std::string_view& end_match);
85 
87  extern VSG_DECLSPEC void replace(std::string& source, const std::string_view& match, const std::string_view& replacement);
88 
94  extern VSG_DECLSPEC ref_ptr<TileDatabaseSettings> createBingMapsSettings(const std::string& imagerySet, const std::string& culture, const std::string& key, ref_ptr<const Options> options);
95 
97  extern VSG_DECLSPEC ref_ptr<TileDatabaseSettings> createOpenStreetMapSettings(ref_ptr<const Options> options);
98 
99 } // namespace vsg
Definition: ConstVisitor.h:147
Definition: Inherit.h:28
Definition: Input.h:44
Definition: Output.h:41
Definition: Path.h:32
RecordTraversal traverses a scene graph doing view frustum culling and invoking state/commands to rec...
Definition: RecordTraversal.h:61
TileDatabaseSettings provides the settings used by vsg::TileDatabase and vsg::tile ReaderWriter to gu...
Definition: TileDatabase.h:28
ref_ptr< ShaderSet > shaderSet
optional shaderSet to use for setting up shaders, if left null use vsg::createTileShaderSet().
Definition: TileDatabase.h:53
Definition: TileDatabase.h:60
Definition: Visitor.h:147
Definition: ref_ptr.h:22