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