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