vsg 1.1.3
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:
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 Path imageLayer;
45 Path terrainLayer;
46 uint32_t mipmapLevelsHint = 16;
47
49 bool lighting = true;
50
53
54 public:
55 ref_ptr<Object> clone(const CopyOp& copyop = {}) const override { return TileDatabaseSettings::create(*this, copyop); }
56 int compare(const Object& rhs) const override;
57
58 // read/write of TileReader settings
59 void read(Input& input) override;
60 void write(Output& output) const override;
61 };
62 VSG_type_name(vsg::TileDatabaseSettings);
63
66 class VSG_DECLSPEC TileDatabase : public Inherit<Node, TileDatabase>
67 {
68 public:
70 TileDatabase(const TileDatabase& rhs, const CopyOp& copyop = {});
71
73 ref_ptr<Node> child;
74
75 public:
76 ref_ptr<Object> clone(const CopyOp& copyop = {}) const override { return TileDatabase::create(*this, copyop); }
77 int compare(const Object& rhs) const override;
78
79 template<class N, class V>
80 static void t_traverse(N& node, V& visitor)
81 {
82 if (node.child) node.child->accept(visitor);
83 }
84
85 void traverse(Visitor& visitor) override { t_traverse(*this, visitor); }
86 void traverse(ConstVisitor& visitor) const override { t_traverse(*this, visitor); }
87 void traverse(RecordTraversal& visitor) const override { t_traverse(*this, visitor); }
88
89 // read/write of TileReader settings
90 void read(Input& input) override;
91 void write(Output& output) const override;
92
93 bool readDatabase(ref_ptr<const Options> options);
94 };
95 VSG_type_name(vsg::TileDatabase);
96
98 extern VSG_DECLSPEC std::string_view find_field(const std::string& source, const std::string_view& start_match, const std::string_view& end_match);
99
101 extern VSG_DECLSPEC void replace(std::string& source, const std::string_view& match, const std::string_view& replacement);
102
108 extern VSG_DECLSPEC ref_ptr<TileDatabaseSettings> createBingMapsSettings(const std::string& imagerySet, const std::string& culture, const std::string& key, ref_ptr<const Options> options);
109
111 extern VSG_DECLSPEC ref_ptr<TileDatabaseSettings> createOpenStreetMapSettings(ref_ptr<const Options> options);
112
113} // namespace vsg
Definition Object.h:42
Definition Inherit.h:28
Definition Input.h:44
Definition Object.h:60
Definition Output.h:41
Definition Path.h:34
Definition TileDatabase.h:67
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:76
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,...
ref_ptr< ShaderSet > shaderSet
optional shaderSet to use for setting up shaders, if left null use vsg::createTileShaderSet().
Definition TileDatabase.h:52
ref_ptr< Object > clone(const CopyOp &copyop={}) const override
Definition TileDatabase.h:55
Definition Visitor.h:172
Definition ref_ptr.h:22