vsg 1.1.9
VulkanSceneGraph library
 
Loading...
Searching...
No Matches
TileDatabase.h
1#pragma once
2
3/* <editor-fold desc="MIT License">
4
5Copyright(c) 2022 Robert Osfield
6
7Permission 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
9The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10
11THE 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
23namespace vsg
24{
25
27 class VSG_DECLSPEC TileDatabaseSettings : public Inherit<Object, TileDatabaseSettings>
28 {
29 public:
30 TileDatabaseSettings();
31 TileDatabaseSettings(const TileDatabaseSettings& rhs, const CopyOp& copyop = {});
32
33 // defaults for readymap
34 dbox extents = {{-180.0, -90.0, 0.0}, {180.0, 90.0, 1.0}};
35 uint32_t noX = 2;
36 uint32_t noY = 1;
37 uint32_t maxLevel = 22;
38 bool originTopLeft = true;
39 double lodTransitionScreenHeightRatio = 0.25;
40
41 std::string projection;
42 ref_ptr<EllipsoidModel> ellipsoidModel = EllipsoidModel::create();
43
44 // callback for post processing loading image, detail or terrain layers data after the source data is loaded.
45 using ProcessCallback = std::function<ref_ptr<Data>(ref_ptr<Data>)>;
46
47 Path imageLayer;
48 ProcessCallback imageLayerCallback;
49
50 Path detailLayer;
51 ProcessCallback detailLayerCallback;
52
53 Path elevationLayer;
54 ProcessCallback elevationLayerCallback;
55 double elevationScale = 32868.0;
56 double skirtRatio = 0.02;
57 uint32_t maxTileDimension = 1024;
58
59 uint32_t mipmapLevelsHint = 16;
60
62 bool lighting = true;
63
66
67 public:
68 ref_ptr<Object> clone(const CopyOp& copyop = {}) const override { return TileDatabaseSettings::create(*this, copyop); }
69 int compare(const Object& rhs) const override;
70
71 // read/write of TileReader settings
72 void read(Input& input) override;
73 void write(Output& output) const override;
74 };
75 VSG_type_name(vsg::TileDatabaseSettings);
76
79 class VSG_DECLSPEC TileDatabase : public Inherit<Node, TileDatabase>
80 {
81 public:
82 TileDatabase();
83 TileDatabase(const TileDatabase& rhs, const CopyOp& copyop = {});
84
86 ref_ptr<Node> child;
87
88 public:
89 ref_ptr<Object> clone(const CopyOp& copyop = {}) const override { return TileDatabase::create(*this, copyop); }
90 int compare(const Object& rhs) const override;
91
92 template<class N, class V>
93 static void t_traverse(N& node, V& visitor)
94 {
95 if (node.child) node.child->accept(visitor);
96 }
97
98 void traverse(Visitor& visitor) override { t_traverse(*this, visitor); }
99 void traverse(ConstVisitor& visitor) const override { t_traverse(*this, visitor); }
100 void traverse(RecordTraversal& visitor) const override { t_traverse(*this, visitor); }
101
102 // read/write of TileReader settings
103 void read(Input& input) override;
104 void write(Output& output) const override;
105
106 bool readDatabase(ref_ptr<const Options> options);
107 };
108 VSG_type_name(vsg::TileDatabase);
109
111 extern VSG_DECLSPEC std::string_view find_field(const std::string& source, const std::string_view& start_match, const std::string_view& end_match);
112
114 extern VSG_DECLSPEC void replace(std::string& source, const std::string_view& match, const std::string_view& replacement);
115
121 extern VSG_DECLSPEC ref_ptr<TileDatabaseSettings> createBingMapsSettings(const std::string& imagerySet, const std::string& culture, const std::string& key, ref_ptr<const Options> options);
122
124 extern VSG_DECLSPEC ref_ptr<TileDatabaseSettings> createOpenStreetMapSettings(ref_ptr<const Options> options);
125
126} // namespace vsg
Definition Object.h:42
Definition Input.h:44
Definition Object.h:60
Definition Output.h:41
Definition Path.h:34
int compare(const Object &rhs) const override
compare two objects, return -1 if this object is less than rhs, return 0 if it's equal,...
ref_ptr< Object > clone(const CopyOp &copyop={}) const override
Definition TileDatabase.h:89
TileDatabaseSettings provides the settings used by vsg::TileDatabase and vsg::tile ReaderWriter to gu...
Definition TileDatabase.h:28
int compare(const Object &rhs) const override
compare two objects, return -1 if this object is less than rhs, return 0 if it's equal,...
bool lighting
hint of whether to use flat shaded shaders or with lighting enabled.
Definition TileDatabase.h:62
ref_ptr< ShaderSet > shaderSet
optional shaderSet to use for setting up shaders, if left null use vsg::createTileShaderSet().
Definition TileDatabase.h:65
ref_ptr< Object > clone(const CopyOp &copyop={}) const override
Definition TileDatabase.h:68
Definition Visitor.h:175
Definition ref_ptr.h:22