nx_metadata_sdk  1.0
Metadata SDK
settings_model.h
1 // Copyright 2018-present Network Optix, Inc. Licensed under MPL 2.0: www.mozilla.org/MPL/2.0/
2 
3 #pragma once
4 
5 #include <string>
6 
7 namespace nx {
8 namespace vms_server_plugins {
9 namespace analytics {
10 namespace stub {
11 
12 const std::string kEnginePluginSideSetting{"testPluginSideSpinBox"};
13 
14 const std::string kGenerateEventsSetting{"generateEvents"};
15 const std::string kMotionVisualizationObjectType{"nx.stub.motionVisualization"};
16 
17 const std::string kGenerateCarsSetting{"generateCars"};
18 const std::string kGenerateTrucksSetting{"generateTrucks"};
19 const std::string kGeneratePedestriansSetting{"generatePedestrians"};
20 const std::string kGenerateHumanFacesSetting{"generateHumanFaces"};
21 const std::string kGenerateBicyclesSetting{"generateBicycles"};
22 const std::string kGenerateStonesSetting{"generateStones"};
23 const std::string kGenerateFixedObjectSetting{"generateFixedObject"};
24 const std::string kGenerateCounterSetting{"generateCounter"};
25 const std::string kCounterBoundingBoxSideSizeSetting{"counterBoundingBoxSideSize"};
26 const std::string kCounterXOffsetSetting{"counterXOffset"};
27 const std::string kCounterYOffsetSetting{"counterYOffset"};
28 const std::string kFixedObjectColorSetting{"fixedObjectColor"};
29 const std::string kNoSpecialColorSettingValue{"No special color"};
30 
31 const std::string kDeclareAdditionalEventTypesSetting{"declareAdditionalEventTypesSetting"};
32 
33 const std::string kBlinkingObjectPeriodMsSetting{"blinkingObjectPeriodMs"};
34 const std::string kBlinkingObjectInDedicatedPacketSetting{"blinkingObjectInDedicatedPacket"};
35 
36 const std::string kGenerateObjectsEveryNFramesSetting{"generateObjectsEveryNFrames"};
37 const std::string kNumberOfObjectsToGenerateSetting{"numberOfObjectsToGenerate"};
38 const std::string kGeneratePreviewPacketSetting{"generatePreviewPacket"};
39 const std::string kPreviewImageFileSetting{"previewImageFile"};
40 const std::string kGeneratePreviewAfterNFramesSetting("generatePreviewAfterNFrames");
41 const std::string kThrowPluginDiagnosticEventsFromDeviceAgentSetting{
42  "throwPluginDiagnosticEventsFromDeviceAgent"};
43 
44 const std::string kThrowPluginDiagnosticEventsFromEngineSetting{
45  "throwPluginDiagnosticEventsFromEngine"};
46 const std::string kDisableStreamSelectionSetting{"disableStreamSelection"};
47 const std::string kLeakFramesSetting{"leakFrames"};
48 const std::string kAdditionalFrameProcessingDelayMsSetting{"additionalFrameProcessingDelayMs"};
49 const std::string kOverallMetadataDelayMsSetting{"overallMetadataDelayMs"};
50 
51 static const std::string kRegularSettingsModelOption = "regular";
52 static const std::string kAlternativeSettingsModelOption = "alternative";
53 
54 static const std::string kSettingsModelSettings = "settingsModelComboBox";
55 
56 static const std::string kCitySelector = "languageSelectorSettings";
57 static const std::string kEnglishOption = "English";
58 static const std::string kGermanOption = "German";
59 
60 static const std::string kAlternativeSettingsModel =
61  /*suppress newline*/ 1 + (const char*) R"json("
62 {
63  "type": "Settings",
64  "items": [
65  {
66  "type": "ComboBox",
67  "name": ")json" + kSettingsModelSettings + R"json(",
68  "caption": "Settings model",
69  "defaultValue": ")json" + kRegularSettingsModelOption + R"json(",
70  "range": [
71  ")json" + kRegularSettingsModelOption + R"json(",
72  ")json" + kAlternativeSettingsModelOption + R"json("
73  ]
74  },
75  {
76  "type": "GroupBox",
77  "caption": "Alternative GroupBox",
78  "items": [
79  {
80  "type": "CheckBox",
81  "name": "alternativeCheckBox",
82  "caption": "Alternative CheckBox",
83  "defaultValue": true
84  },
85  {
86  "type": "TextField",
87  "name": "alternativeTextField",
88  "caption": "Alternative TextField",
89  "defaultValue": "alternative text"
90  }
91  ]
92  }
93  ]
94 })json";
95 
96 static const std::string kRegularSettingsModelPart1 = /*suppress newline*/ 1 + R"json(
97 {
98  "type": "Settings",
99  "items": [
100  {
101  "type": "ComboBox",
102  "name": ")json" + kSettingsModelSettings + R"json(",
103  "caption": "Settings model",
104  "defaultValue": ")json" + kRegularSettingsModelOption + R"json(",
105  "range": [
106  ")json" + kRegularSettingsModelOption + R"json(",
107  ")json" + kAlternativeSettingsModelOption + R"json("
108  ]
109  },
110  {
111  "type": "GroupBox",
112  "caption": "Real Stub DeviceAgent settings",
113  "items": [
114  {
115  "type": "GroupBox",
116  "caption": "Object generation settings",
117  "items": [
118  {
119  "type": "CheckBox",
120  "name": ")json" + kGenerateCarsSetting + R"json(",
121  "caption": "Generate cars",
122  "defaultValue": true
123  },
124  {
125  "type": "CheckBox",
126  "name": ")json" + kGenerateTrucksSetting + R"json(",
127  "caption": "Generate trucks",
128  "defaultValue": true
129  },
130  {
131  "type": "CheckBox",
132  "name": ")json" + kGeneratePedestriansSetting + R"json(",
133  "caption": "Generate pedestrians",
134  "defaultValue": true
135  },
136  {
137  "type": "CheckBox",
138  "name": ")json" + kGenerateHumanFacesSetting + R"json(",
139  "caption": "Generate human faces",
140  "defaultValue": true
141  },
142  {
143  "type": "CheckBox",
144  "name": ")json" + kGenerateBicyclesSetting + R"json(",
145  "caption": "Generate bicycles",
146  "defaultValue": true
147  },
148  {
149  "type": "CheckBox",
150  "name": ")json" + kGenerateStonesSetting + R"json(",
151  "caption": "Generate stones",
152  "defaultValue": false
153  },
154  {
155  "type": "CheckBox",
156  "name": ")json" + kGenerateFixedObjectSetting + R"json(",
157  "caption": "Generate fixed object",
158  "description": "Generates a fixed object with coordinates (0.25, 0.25, 0.25, 0.25)",
159  "defaultValue": false
160  },
161  {
162  "type": "ComboBox",
163  "name": ")json" + kFixedObjectColorSetting + R"json(",
164  "caption": "Fixed object color",
165  "range": [
166  ")json" + kNoSpecialColorSettingValue + R"json(",
167  "Magenta", "Blue", "Green", "Yellow", "Cyan", "Purple", "Orange",
168  "Red", "White", "#FFFFC0", "!invalid!", "#NONHEX"
169  ],
170  "defaultValue": ")json" + kNoSpecialColorSettingValue + R"json("
171  },
172  {
173  "type": "CheckBox",
174  "name": ")json" + kGenerateCounterSetting + R"json(",
175  "caption": "Generate counter",
176  "description": "Generates a counter",
177  "defaultValue": false
178  },
179  {
180  "type": "DoubleSpinBox",
181  "caption": "Size of the side of the counter bounding box",
182  "name": ")json" + kCounterBoundingBoxSideSizeSetting + R"json(",
183  "defaultValue": 0.0,
184  "minValue": 0.0,
185  "maxValue": 1.0
186  },
187  {
188  "type": "DoubleSpinBox",
189  "caption": "Counter bounding box X-Offset",
190  "name": ")json" + kCounterXOffsetSetting + R"json(",
191  "defaultValue": 0.0,
192  "minValue": 0.0,
193  "maxValue": 1.0
194  },
195  {
196  "type": "DoubleSpinBox",
197  "caption": "Counter bounding box Y-Offset",
198  "name": ")json" + kCounterYOffsetSetting + R"json(",
199  "defaultValue": 0.0,
200  "minValue": 0.0,
201  "maxValue": 1.0
202  },
203  {
204  "type": "CheckBox",
205  "caption": "Declare additional event types",
206  "name": ")json" + kDeclareAdditionalEventTypesSetting + R"json(",
207  "defaultValue": false
208  },
209  {
210  "type": "SpinBox",
211  "name": ")json" + kBlinkingObjectPeriodMsSetting + R"json(",
212  "caption": "Generate 1-frame BlinkingObject every N ms (if not 0)",
213  "defaultValue": 0,
214  "minValue": 0,
215  "maxValue": 100000
216  },
217  {
218  "type": "CheckBox",
219  "name": ")json" + kBlinkingObjectInDedicatedPacketSetting + R"json(",
220  "caption": "Put BlinkingObject into a dedicated MetadataPacket",
221  "defaultValue": false
222  },
223  {
224  "type": "SpinBox",
225  "name": ")json" + kNumberOfObjectsToGenerateSetting + R"json(",
226  "caption": "Number of objects to generate",
227  "defaultValue": 1,
228  "minValue": 1,
229  "maxValue": 100000
230  },
231  {
232  "type": "SpinBox",
233  "name": ")json" + kGenerateObjectsEveryNFramesSetting + R"json(",
234  "caption": "Generate objects every N frames",
235  "defaultValue": 1,
236  "minValue": 1,
237  "maxValue": 100000
238  },
239  {
240  "type": "CheckBox",
241  "name": ")json" + kGeneratePreviewPacketSetting + R"json(",
242  "caption": "Generate preview packet",
243  "defaultValue": true
244  },
245  {
246  "type": "TextArea",
247  "name": ")json" + kPreviewImageFileSetting + R"json(",
248  "caption": "Preview image file",
249  "description": "Path to an image which should be used as a preview for tracks"
250  },
251  {
252  "type": "SpinBox",
253  "name": ")json" + kGeneratePreviewAfterNFramesSetting + R"json(",
254  "caption": "Generate preview after N frames",
255  "defaultValue": 30,
256  "minValue": 1,
257  "maxValue": 100000
258  },
259  {
260  "type": "SpinBox",
261  "name": ")json" + kOverallMetadataDelayMsSetting + R"json(",
262  "caption": "Overall metadata delay, ms",
263  "defaultValue": 0,
264  "minValue": 0,
265  "maxValue": 1000000000
266  }
267  ]
268  },
269  {
270  "type": "CheckBox",
271  "name": ")json" + kGenerateEventsSetting + R"json(",
272  "caption": "Generate events",
273  "defaultValue": true
274  },
275  {
276  "type": "CheckBox",
277  "name": ")json" + kThrowPluginDiagnosticEventsFromDeviceAgentSetting + R"json(",
278  "caption": "Produce Plugin Diagnostic Events from the DeviceAgent",
279  "defaultValue": false
280  },
281  {
282  "type": "CheckBox",
283  "name": ")json" + kLeakFramesSetting + R"json(",
284  "caption": "Force a memory leak when processing a video frame",
285  "defaultValue": false
286  },
287  {
288  "type": "SpinBox",
289  "name": ")json" + kAdditionalFrameProcessingDelayMsSetting + R"json(",
290  "caption": "Additional frame processing delay, ms",
291  "defaultValue": 0,
292  "minValue": 0,
293  "maxValue": 1000000000
294  }
295  ]
296  },
297  {
298  "type": "GroupBox",
299  "caption": "Example Stub DeviceAgent settings",
300  "items": [
301  {
302  "type": "TextField",
303  "name": "testTextField",
304  "caption": "Device Agent Text Field",
305  "description": "A text field",
306  "defaultValue": "a text"
307  },
308  {
309  "type": "ComboBox",
310  "name": ")json" + kCitySelector + R"json(",
311  "caption": "Cities",
312  "defaultValue": "English",
313  "range": [
314  ")json" + kEnglishOption + R"json(",
315  ")json" + kGermanOption + R"json("
316  ]
317  },)json";
318 
319 static const std::string kEnglishCitiesPart = /*suppress newline*/ 1 + R"json(
320  {
321  "type": "RadioButtonGroup",
322  "name": "testEnglishRadioButtonGroup",
323  "caption": "Choose one",
324  "description": "Choose one option",
325  "defaultValue": "London",
326  "range": [
327  "London",
328  "Liverpool"
329  ]
330  },)json";
331 
332 static const std::string kGermanCitiesPart = /*suppress newline*/ 1 + R"json(
333  {
334  "type": "RadioButtonGroup",
335  "name": "testGermanRadioButtonGroup",
336  "caption": "Choose one",
337  "description": "Choose one option",
338  "defaultValue": "Berlin",
339  "range": [
340  "Berlin",
341  "Nuremberg",
342  "Leipzig"
343  ]
344  },)json";
345 
346 static const std::string kRegularSettingsModelPart2 = /*suppress newline*/ 1 + R"json("
347  {
348  "type": "RadioButtonGroup",
349  "name": "testRadioButtonGroup",
350  "caption": "RadioButton Group",
351  "description": "Choose one option",
352  "defaultValue": "Cs_enodatum",
353  "range": [
354  "K_gowerianus",
355  "K_galilaeii",
356  "S_calloviense",
357  "S_micans",
358  "Cs_enodatum",
359  "K_medea",
360  "K_jason",
361  "K_obductum",
362  "K_posterior"
363  ],
364  "itemCaptions": {
365  "K_gowerianus": "Kepplerites gowerianus",
366  "K_galilaeii": "Kepplerites galilaeii",
367  "S_calloviense": "Sigaloceras calloviense",
368  "S_micans": "Sigaloceras micans",
369  "Cs_enodatum": "Catasigaloceras enodatum",
370  "K_medea": "Kosmoceras medea",
371  "K_jason": "Kosmoceras jason",
372  "K_obductum": "Kosmoceras obductum",
373  "K_posterior": "Kosmoceras posterior"
374  }
375  },
376  {
377  "type": "CheckBoxGroup",
378  "name": "testCheckBoxGroup",
379  "caption": "CheckBox Group",
380  "description": "Choose one or several options",
381  "defaultValue": ["Coleoidea", "Nautiloidea"],
382  "range": [
383  "Coleoidea",
384  "Ammonoidea",
385  "Nautiloidea",
386  "Orthoceratoidea"
387  ],
388  "itemCaptions": {
389  "Coleoidea": "Coleoidea (Bather, 1888)",
390  "Ammonoidea": "Ammonoidea (Zittel, 1884)",
391  "Nautiloidea": "Nautiloidea (Agassiz, 1847)",
392  "Orthoceratoidea": "Orthoceratoidea (M'Coy 1844)"
393  }
394  },
395  {
396  "type": "SpinBox",
397  "caption": "Device Agent SpinBox (plugin side)",
398  "name": "pluginSideTestSpinBox",
399  "defaultValue": 42,
400  "minValue": 0,
401  "maxValue": 100
402  },
403  {
404  "type": "DoubleSpinBox",
405  "caption": "Device Agent DoubleSpinBox",
406  "name": "testDoubleSpinBox",
407  "defaultValue": 3.1415,
408  "minValue": 0.0,
409  "maxValue": 100.0
410  },
411  {
412  "type": "ComboBox",
413  "name": "testComboBox",
414  "caption": "Device Agent ComboBox",
415  "defaultValue": "value2",
416  "range": ["value1", "value2", "value3"],
417  "itemCaptions": {
418  "value1": "Device Agent Value #1",
419  "value2": "Device Agent Value #2",
420  "value3": "Device Agent Value #3"
421  }
422  },
423  {
424  "type": "Separator"
425  },
426  {
427  "type": "CheckBox",
428  "caption": "Device Agent CheckBox",
429  "name": "testCheckBox",
430  "defaultValue": true
431  },
432  {
433  "type": "CheckBox",
434  "caption": "Disabled Device Agent CheckBox",
435  "name": "disabledTestCheckBox",
436  "defaultValue": false,
437  "enabled": false
438  },
439  {
440  "type": "CheckBox",
441  "caption": "Hidden Device Agent CheckBox",
442  "name": "hiddenTestCheckBox",
443  "defaultValue": false,
444  "visible": false
445  }
446  ]
447  }
448  ],)json" R"json(
449  "sections": [
450  {
451  "type": "Section",
452  "caption": "Example",
453  "items": [
454  {
455  "type": "GroupBox",
456  "caption": "Example Stub DeviceAgent settings",
457  "items": [
458  {
459  "type": "TextField",
460  "name": "testTextFieldWithValidation",
461  "caption": "Hexadecimal number text field",
462  "defaultValue": "12ab34cd",
463  "validationRegex": "^[a-f0-9]+$",
464  "validationRegexFlags": "i",
465  "validationErrorMessage": "Text must contain only digits and characters a-f, e.g. 12ab34cd."
466  },
467  {
468  "type": "SpinBox",
469  "caption": "Device Agent SpinBox (plugin side)",
470  "name": "pluginSideTestSpinBox2",
471  "defaultValue": 42,
472  "minValue": 0,
473  "maxValue": 100
474  },
475  {
476  "type": "DoubleSpinBox",
477  "caption": "Device Agent DoubleSpinBox",
478  "name": "testDoubleSpinBox2",
479  "defaultValue": 3.1415,
480  "minValue": 0.0,
481  "maxValue": 100.0
482  },
483  {
484  "type": "ComboBox",
485  "name": "testComboBox2",
486  "caption": "Device Agent ComboBox",
487  "defaultValue": "value2",
488  "range": ["value1", "value2", "value3"]
489  },
490  {
491  "type": "CheckBox",
492  "caption": "Device Agent CheckBox",
493  "name": "testCheckBox2",
494  "defaultValue": true
495  }
496  ]
497  }
498  ],
499  "sections": [
500  {
501  "type": "Section",
502  "caption": "Nested section",
503  "items": [
504  {
505  "type": "GroupBox",
506  "caption": "Nested Section Example",
507  "items": [
508  {
509  "type": "SwitchButton",
510  "caption": "Switch Button",
511  "name": "testSwitch",
512  "description": "Tooltip for the switch button",
513  "defaultValue": false
514  },
515  {
516  "type": "SpinBox",
517  "caption": "SpinBox Parameter",
518  "name": "testSpinBox3",
519  "defaultValue": 42,
520  "minValue": 0,
521  "maxValue": 100
522  },
523  {
524  "type": "DoubleSpinBox",
525  "caption": "DoubleSpinBox Parameter",
526  "name": "testDoubleSpinBox3",
527  "defaultValue": 3.1415,
528  "minValue": 0.0,
529  "maxValue": 100.0
530  },
531  {
532  "type": "ComboBox",
533  "name": "testComboBox3",
534  "caption": "ComboBox Parameter",
535  "defaultValue": "value2",
536  "range": ["value1", "value2", "value3"]
537  },
538  {
539  "type": "CheckBox",
540  "caption": "CheckBox Parameter",
541  "name": "testCheckBox3",
542  "defaultValue": true
543  }
544  ]
545  }
546  ]
547  }
548  ]
549  },
550  {
551  "type": "Section",
552  "caption": "ROI",
553  "items": [
554  {
555  "type": "GroupBox",
556  "caption": "Polygons",
557  "items": [
558  {
559  "type": "PolygonFigure",
560  "name": "excludedArea.figure",
561  "caption": "Excluded area",
562  "useLabelField": false,
563  "maxPoints": 8
564  },
565  {
566  "type": "Repeater",
567  "count": 5,
568  "template": {
569  "type": "GroupBox",
570  "caption": "Polygon #",
571  "filledCheckItems": ["polygon#.figure"],
572  "items": [
573  {
574  "type": "PolygonFigure",
575  "name": "polygon#.figure",
576  "minPoints": 4,
577  "maxPoints": 8
578  },
579  {
580  "type": "SpinBox",
581  "name": "polygon#.threshold",
582  "caption": "Level of detection",
583  "defaultValue": 50,
584  "minValue": 1,
585  "maxValue": 100
586  },
587  {
588  "type": "SpinBox",
589  "name": "polygon#.sensitivity",
590  "caption": "Sensitivity",
591  "defaultValue": 80,
592  "minValue": 1,
593  "maxValue": 100
594  },
595  {
596  "type": "SpinBox",
597  "name": "polygon#.minimumDuration",
598  "caption": "Minimum duration (s)",
599  "defaultValue": 0,
600  "minValue": 0,
601  "maxValue": 5
602  }
603  ]
604  }
605  }
606  ]
607  },
608  {
609  "type": "GroupBox",
610  "caption": "Boxes",
611  "items": [
612  {
613  "type": "Repeater",
614  "count": 5,
615  "template": {
616  "type": "GroupBox",
617  "caption": "Box #",
618  "filledCheckItems": ["box#.figure"],
619  "items": [
620  {
621  "type": "BoxFigure",
622  "name": "box#.figure"
623  },
624  {
625  "type": "SpinBox",
626  "name": "box#.threshold",
627  "caption": "Level of detection",
628  "defaultValue": 50,
629  "minValue": 1,
630  "maxValue": 100
631  },
632  {
633  "type": "SpinBox",
634  "name": "box#.sensitivity",
635  "caption": "Sensitivity",
636  "defaultValue": 80,
637  "minValue": 1,
638  "maxValue": 100
639  },
640  {
641  "type": "SpinBox",
642  "name": "box#.minimumDuration",
643  "caption": "Minimum duration (s)",
644  "defaultValue": 0,
645  "minValue": 0,
646  "maxValue": 5
647  }
648  ]
649  }
650  }
651  ]
652  },
653  {
654  "type": "GroupBox",
655  "caption": "Lines",
656  "items": [
657  {
658  "type": "Repeater",
659  "count": 5,
660  "template": {
661  "type": "GroupBox",
662  "caption": "Line #",
663  "filledCheckItems": ["line#.figure"],
664  "items": [
665  {
666  "type": "LineFigure",
667  "name": "line#.figure"
668  },
669  {
670  "type": "CheckBox",
671  "name": "line#.person",
672  "caption": "Person",
673  "defaultValue": false
674  },
675  {
676  "type": "CheckBox",
677  "name": "line#.vehicle",
678  "caption": "Vehicle",
679  "defaultValue": false
680  },
681  {
682  "type": "CheckBox",
683  "name": "line#.crossing",
684  "caption": "Crossing",
685  "defaultValue": false
686  }
687  ]
688  }
689  }
690  ]
691  },
692  {
693  "type": "GroupBox",
694  "caption": "Polyline",
695  "items": [
696  {
697  "type": "LineFigure",
698  "name": "testPolyLine",
699  "caption": "Polyline",
700  "maxPoints": 8
701  }
702  ]
703  },
704  {
705  "type": "GroupBox",
706  "caption": "Polygon",
707  "items": [
708  {
709  "type": "PolygonFigure",
710  "name": "testPolygon",
711  "caption": "Polygon outside of a repeater",
712  "description": "The points of this polygon are considered as a plugin-side setting",
713  "minPoints": 3,
714  "maxPoints": 8
715  }
716  ]
717  },
718  {
719  "type": "GroupBox",
720  "caption": "Size Constraints",
721  "items": [
722  {
723  "type": "ObjectSizeConstraints",
724  "name": "testSizeConstraints",
725  "caption": "Object size constraints",
726  "description": "Size range an object should fit into to be detected",
727  "defaultValue": {"minimum": [0.1, 0.4], "maximum": [0.2, 0.8]}
728  }
729  ]
730  }
731  ]
732  }
733  ]
734 })json";
735 
736 } // namespace stub
737 } // namespace analytics
738 } // namespace vms_server_plugins
739 } // namespace nx
Definition: apple_utils.h:6