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