18 #ifndef PRTX_ENCODEOPTIONS_H_ 19 #define PRTX_ENCODEOPTIONS_H_ 22 #include "prtx/AnnotationBuilder.h" 23 #include "prtx/EncoderInfoBuilder.h" 24 #include "prtx/EncoderFactory.h" 30 # pragma warning(push) 31 # pragma warning (disable : 4251 4231 4275 4660) 46 std::wstring description;
52 const wchar_t* description;
60 : mItems(&items[0], &items[N])
73 StringEnum(
const StringEnum& base,
const int (&itemsToKeep)[N]) {
74 init(base.beginItems(), base.endItems(), itemsToKeep, N);
77 void addItem(
int id,
const wchar_t* value,
const wchar_t* description);
78 bool removeItem(
int id);
81 void addItems(
const StringEnum& base,
const int (&itemsToKeep)[N]) {
82 addItems(base.beginItems(), base.endItems(), itemsToKeep, N);
84 void removeAllItems();
86 int getIdByValue(
const std::wstring& value)
const;
87 int getIdByValue(
const wchar_t* value)
const;
88 const std::wstring& getValueById(
int id)
const;
89 const wchar_t* getCValueById(
int id)
const;
90 const std::wstring& operator[](
int id)
const;
92 typedef std::vector<Item>::const_iterator ItemConstIter;
94 ItemConstIter beginItems()
const {
95 return mItems.begin();
98 ItemConstIter endItems()
const {
103 void init(
const PodItem* items);
104 void init(ItemConstIter itemsBegin, ItemConstIter itemsEnd,
const int* itemsToKeep,
size_t numItemsToKeep);
105 void addItems(ItemConstIter itemsBegin, ItemConstIter itemsEnd,
const int* itemsToKeep,
size_t numItemsToKeep);
106 void updateIdEqualsIndex();
109 std::vector<Item> mItems;
126 namespace Annotations {
129 const std::wstring
ORDER = L
"@Order";
130 const std::wstring
LABEL = L
"@Label";
131 const std::wstring
GROUP = L
"@Group";
133 const std::wstring
RANGE = L
"@Range";
172 template<
typename Opt>
173 class AnnotationAdder;
193 void setLabel(
const std::wstring& optionKey,
const std::wstring& label);
198 void setDescription(
const std::wstring& optionKey,
const std::wstring& desc);
203 void setOrder(
const std::wstring& optionKey,
const double& order);
208 void setGroup(
const std::wstring& optionKey,
const std::wstring& groupName,
const double& order);
213 void setRange(
const std::wstring& optionKey,
double min,
double max);
218 void setEnumerants(
const std::wstring& optionKey,
const StringEnum& items);
223 void flagAsPoint2D(
const std::wstring& optionKey);
228 void flagAsPoint3D(
const std::wstring& optionKey);
233 void flagAsPerLayer(
const std::wstring& optionKey,
const std::wstring& layerDefault);
238 void flagAsPerLayer(
const std::wstring& optionKey,
const double& layerDefault);
243 void flagAsPerLayer(
const std::wstring& optionKey,
const bool& layerDefault);
248 void flagAsPerLayer(
const std::wstring& optionKey,
const int32_t& layerDefault);
253 void flagAsHidden(
const std::wstring& optionKey);
258 void flagAsMandatory(
const std::wstring& optionKey);
268 : mAnnotator(annotator), mOptionKey(optionKey) {}
276 mAnnotator.setLabel(mOptionKey, label);
281 mAnnotator.setDescription(mOptionKey, desc);
286 mAnnotator.setOrder(mOptionKey, order);
290 OptionAnnotator& setGroup(
const std::wstring& name,
const double& order) {
291 mAnnotator.setGroup(mOptionKey, name, order);
296 mAnnotator.flagAsPoint2D(mOptionKey);
301 mAnnotator.flagAsPoint3D(mOptionKey);
306 mAnnotator.flagAsHidden(mOptionKey);
311 mAnnotator.flagAsMandatory(mOptionKey);
315 template<
typename T>
OptionAnnotator& flagAsPerLayer(
const T& layerDefault) {
316 mAnnotator.flagAsPerLayer(mOptionKey, layerDefault);
321 mAnnotator.setRange(mOptionKey, min, max);
326 mAnnotator.setEnumerants(mOptionKey, items);
332 const std::wstring& mOptionKey;
347 # pragma warning(pop) Definition: EncodeOptions.h:265
Definition: AnnotationBuilder.h:41
Definition: EncodeOptions.h:43
const std::wstring HIDDEN
Hides the option in the UI.
Definition: EncodeOptions.h:137
Definition: EncoderInfoBuilder.h:48
const std::wstring ORDER
Defines a semantic ordering of the option (one double parameter).
Definition: EncodeOptions.h:129
const std::wstring PERLAYER
Assigns each value of an array option to a layer. Only for array options.
Definition: EncodeOptions.h:136
Definition: EncodeOptions.h:167
The Procedural Runtime eXtension namespace. The prtx namespace contains the tools to extend the Proce...
Definition: AnnotationBuilder.h:35
Definition: EncodeOptions.h:49
const std::wstring MANDATORY
Makes the initial shape attribute mandatory.
Definition: EncodeOptions.h:138
const std::wstring LABEL
Defines a (UI) label for the option (one string parameter).
Definition: EncodeOptions.h:130
const std::wstring POINT2D
Declares an option to be interpreted as a 2D point. Only for array options.
Definition: EncodeOptions.h:134
const std::wstring DESCRIPTION
Adds a description for the option (e.g. for tooltips) (one string parameter).
Definition: EncodeOptions.h:132
Definition: EncodeOptions.h:41
const std::wstring POINT3D
Declares an option to be interpreted as a 3D point. Only for array options.
Definition: EncodeOptions.h:135
const std::wstring GROUP
Defines a (UI) group for the option (one string parameter, one double parameter). ...
Definition: EncodeOptions.h:131
const std::wstring RANGE
Defines a value range for the option (two double parameters).
Definition: EncodeOptions.h:133
const Object * init(const wchar_t *const *prtPlugins, size_t prtPluginsCount, LogLevel logLevel, Status *stat=nullptr)