ArcGIS Procedural Runtime  3.2.10650
Encoder.h
1 /*
2  COPYRIGHT (c) 2012-2024 Esri R&D Center Zurich
3  TRADE SECRETS: ESRI PROPRIETARY AND CONFIDENTIAL
4  Unpublished material - all rights reserved under the
5  Copyright Laws of the United States and applicable international
6  laws, treaties, and conventions.
7 
8  For additional information, contact:
9  Environmental Systems Research Institute, Inc.
10  Attn: Contracts and Legal Services Department
11  380 New York Street
12  Redlands, California, 92373
13  USA
14 
15  email: contracts@esri.com
16 */
17 
18 #ifndef PRTX_ENCODER_H_
19 #define PRTX_ENCODER_H_
20 
21 #include "prtx/prtx.h"
22 #include "prtx/Content.h"
23 #include "prtx/Log.h"
24 #include "prtx/Extension.h"
25 #include "prtx/GenerateContext.h"
26 
27 #include "prt/AttributeMap.h"
28 #include "prt/InitialShape.h"
29 #include "prt/Callbacks.h"
30 #include "prt/ContentType.h"
31 #include "prt/Status.h"
32 #include "prt/CGAErrorLevel.h"
33 
34 #include <vector>
35 #include <memory>
36 
37 #ifdef _MSC_VER
38 # pragma warning(push)
39 # pragma warning (disable : 4251) // 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
40 #endif
41 
42 
43 namespace prtx {
44 
45 
46 class Encoder;
47 using EncoderPtr = std::shared_ptr<Encoder>;
48 using EncoderPtrVector = std::vector<EncoderPtr>;
49 
55 class PRTX_EXPORTS_API Encoder : public Extension {
56 public:
57  Encoder() = delete;
58 
66  Encoder(
67  const std::wstring& id,
68  const prt::AttributeMap* options,
69  prt::Callbacks* callbacks
70  );
71 
72  virtual ~Encoder() = default;
73 
78  virtual void init(
79  GenerateContext& context
80  );
81 
90  virtual bool validate(
91  GenerateContext& context,
92  size_t initialShapeIndex
93  ) const;
94 
100  virtual void encode(
101  GenerateContext& context,
102  size_t initialShapeIndex
103  );
104 
109  virtual void encode(
110  const prtx::ContentPtrVector& content
111  );
113 
119  virtual void finish(
120  prtx::GenerateContext& context
121  );
122 
126  virtual ExtensionType getExtensionType() const final override {
127  return Extension::ET_ENCODER;
128  }
129 
133  const std::wstring& getID() const;
134 
135 protected:
139  const prt::AttributeMap* getOptions() const;
140 
144  prt::Callbacks* getCallbacks() const;
145 
146 private:
147  std::wstring mID;
148  const prt::AttributeMap* mOptions;
149  prt::Callbacks* mCallbacks;
150 };
151 
152 
158 class PRTX_EXPORTS_API GeometryEncoder : public Encoder {
159 public:
160  GeometryEncoder() = delete;
161  GeometryEncoder(const std::wstring& id, const prt::AttributeMap* options, prt::Callbacks* callbacks) : Encoder(id, options, callbacks) { }
162  virtual ~GeometryEncoder() = default;
163 
169  virtual prt::ContentType getContentType() const final override {
170  return prt::CT_GEOMETRY;
171  }
172 };
173 
174 
180 class PRTX_EXPORTS_API MaterialEncoder : public Encoder {
181 public:
182  MaterialEncoder() = delete;
183  MaterialEncoder(const std::wstring& id, const prt::AttributeMap* options, prt::Callbacks* callbacks) : Encoder(id, options, callbacks) { }
184  virtual ~MaterialEncoder() = default;
185 
191  virtual prt::ContentType getContentType() const final override {
192  return prt::CT_MATERIAL;
193  }
194 };
195 
196 
200 class PRTX_EXPORTS_API TextureEncoder : public Encoder {
201 public:
202  TextureEncoder() = delete;
203  TextureEncoder(const std::wstring& id, const prt::AttributeMap* options, prt::Callbacks* callbacks) : Encoder(id, options, callbacks) { }
204  virtual ~TextureEncoder() = default;
205 
212  return prt::CT_TEXTURE;
213  }
214 };
215 
216 
217 } // namespace prtx
218 
219 
220 #ifdef _MSC_VER
221 # pragma warning(pop)
222 #endif
223 
224 
225 #endif /* PRTX_ENCODER_H_ */
Extension can handle textures.
Definition: ContentType.h:32
virtual prt::ContentType getContentType() const final override
Definition: Encoder.h:169
Extension can handle materials (and potentially also textures).
Definition: ContentType.h:31
ExtensionType
Definition: Extension.h:46
Definition: GenerateContext.h:42
virtual ExtensionType getExtensionType() const final override
Definition: Encoder.h:126
virtual prt::ContentType getContentType() const
Definition: Encoder.h:211
Definition: Encoder.h:55
Extension sub-class is an encoder.
Definition: Extension.h:50
Definition: Extension.h:41
The Procedural Runtime eXtension namespace. The prtx namespace contains the tools to extend the Proce...
Definition: AnnotationBuilder.h:35
ContentType
Definition: ContentType.h:28
Definition: AttributeMap.h:32
virtual prt::ContentType getContentType() const final override
Definition: Encoder.h:191
Extension can handle geometries (and potentially also materials and textures).
Definition: ContentType.h:30
Definition: Encoder.h:200
Definition: Encoder.h:158
Definition: Encoder.h:180
Definition: Callbacks.h:45