Cogs.Core
TerrainProviderFunctions.h
1#pragma once
2#include "Bridge/Bridge.h"
3#include "Bridge/FieldFunctions.h"
4#include "../../Terrain/Source/CogsTerrainBase.h"
5#include "Utilities/Strings.h"
6
7#include <glm/glm.hpp>
8
9#if defined( _WIN32 )
10 #ifdef COGSCORE_TERRAINPROVIDER_BUILD
11 #define COGSCORE_TERRAINPROVIDER_API __declspec(dllexport)
12 #else
13 #define COGSCORE_TERRAINPROVIDER_API __declspec(dllimport)
14 #endif
15#else
16 #define COGSCORE_TERRAINPROVIDER_API
17#endif
18
19namespace Cogs::Core {
20 class Context;
21}
22
23namespace Cogs::Core::TerrainProvider
24{
25
26 class COGSCORE_TERRAINPROVIDER_API IRasterSource
27 {
28 public:
29 enum struct ErrorCode
30 {
31 NoError,
32 Done,
33 FailedToOpenDiskCache,
34 FailedToCreateDiskCache,
35 MismatchedDiskCache,
36 NoHTTPService
37 };
38
39 virtual ~IRasterSource();
40
41 virtual Cogs::RasterSourceParameters getParameters() const = 0;
42
43 virtual ErrorCode getErrorCode() const = 0;
44
45 uint64_t id() const { return uint64_t(this); }
46
47 };
48
49 enum struct MimeType
50 {
51 None,
52 Png,
53 Gif,
54 Jpeg,
55 Tiff,
56 F32,
57 RGBA8,
58 XML
59 };
60
61 MimeType parseMimeType(size_t textHash);
62 MimeType parseMimeType(StringView text);
63 Cogs::Core::StringRef mimeTypeString(MimeType mimeType);
64
65
66#if 0
67
68 struct Layer
69 {
70 StringRef name;
71 StringRef style;
72 unsigned minLevel = 0u;
73 unsigned maxLevel = ~0u;
74 std::vector<std::pair<StringRef, StringRef>> additionalArgs;
75 };
76
77 struct RasterSourceConfig
78 {
79 enum struct Kind
80 {
81 None,
82 Dummy,
83 ConstantFloat,
84 WMS,
85 WCS,
86 GeoTiff
87 } kind = Kind::None;
88 unsigned numThreads = 4;
89 StringRef cacheKey = NoString;
90
91 struct Misc {
92 std::vector<Layer> layers;
93 StringRef name = NoString;
94 float noData = std::numeric_limits<float>::quiet_NaN();
95 float floatValue = 0.f; // Constant elevation for FloatRasterSource
96 TextureFormat textureFormat = TextureFormat::Unknown;
97 MimeType mimeType = MimeType::None;
98 bool isElevation = true;
99 bool rowFirst = false;
100 bool showErrorTile = false;
101 } misc;
102 struct CoordSys coordSys;
103 struct HTTP {
104 StringRef baseUrl = NoString;
105 StringRef username = NoString;
106 StringRef password = NoString;
107 } http;
108 struct {
109 std::string path;
110 } file;
111 struct WMS {
112 WMSVersion version = WMSVersion::v1_1_0;
113 std::vector<StringRef> layers;
114 std::vector<StringRef> styles;
115 } wms;
116 struct WCS {
117 StringRef layer = NoString;
118 } wcs;
119 };
120#endif
121
122 class COGSCORE_TERRAINPROVIDER_API IRasterSource;
123
124 COGSCORE_TERRAINPROVIDER_API IRasterSource* open(Cogs::Core::Context* context, const char* path);
125
126 //COGSCORE_TERRAINPROVIDER_API IRasterSource* rasterSourceFactory(Context* context, RasterSourceConfig* conf);
127
128 //COGSCORE_TERRAINPROVIDER_API IRasterSource* createGeoTiffRasterSource(Context* context, const char* path, unsigned tilesize=256);
129}
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Definition: Context.h:83
Provides a weakly referenced view over the contents of a string.
Definition: StringView.h:24
Contains the Engine, Renderer, resource managers and other systems needed to run Cogs....
@ CoordSys
Simple coordinate system where X axis is red, Y axis is green and Z axis is blue.