-
Notifications
You must be signed in to change notification settings - Fork 2
/
properties.cs
2922 lines (2307 loc) · 92.7 KB
/
properties.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Yocto-Visualization, a free application to visualize Yoctopuce Sensors.
*
* all widgets customizable properties are described here
* feel free to remove/modify/add more.
*
*
* Prefix describe the widget
* Name must match the widget properties
* example:
* GaugeFormProperties contains
* SolidGauge_Uses360Mode which matches the SolidGauge's Uses360Mode properties
*
* Some properties might have an index
* example
* for graphs
* Graphs_series0 is the first series
* ....
* Graphs_series3 is the fourth series
* if you need a fifth series, just create a Graphs_series4 properties
*
*
* - - - - - - - - - License information: - - - - - - - - -
*
* Copyright (C) 2017 and beyond by Yoctopuce Sarl, Switzerland.
*
* Yoctopuce Sarl (hereafter Licensor) grants to you a perpetual
* non-exclusive license to use, modify, copy and integrate this
* file into your software for the sole purpose of interfacing
* with Yoctopuce products.
*
* You may reproduce and distribute copies of this file in
* source or object form, as long as the sole purpose of this
* code is to interface with Yoctopuce products. You must retain
* this notice in the distributed source file.
*
* You should refer to Yoctopuce General Terms and Conditions
* for additional information regarding your rights and
* obligations.
*
* THE SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT
* WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
* WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO
* EVENT SHALL LICENSOR BE LIABLE FOR ANY INCIDENTAL, SPECIAL,
* INDIRECT OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA,
* COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY OR
* SERVICES, ANY CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT
* LIMITED TO ANY DEFENSE THEREOF), ANY CLAIMS FOR INDEMNITY OR
* CONTRIBUTION, OR OTHER SIMILAR COSTS, WHETHER ASSERTED ON THE
* BASIS OF CONTRACT, TORT (INCLUDING NEGLIGENCE), BREACH OF
* WARRANTY, OR OTHERWISE.
*/
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using System.Xml;
using YDataRendering;
using YColors;
using System.Drawing.Design;
using System.Drawing.Text;
using System.Collections.Generic;
using System.Globalization;
namespace YoctoVisualisation
{
//****************************
// Solid gauge
//****************************
public static class GenericHints
{
public const string DevConfAffected = " Changing this value will affect the device configuration.";
public const string CheckSensor = "If the sensor you want to use is connected, but not listed or listed as OFFLINE, check USB / Network configuration in the global configuration.";
public const string AnnotationGraph = "Annotation text. Use \\n for carriage returns. Some variables are available: $DAY$ $MONTH$ $YEAR$ for date, $HOUR$ $MINUTE$ $SECOND$ for time, $AVGVALUE1$ $MINVALUE1$ $MAXVALUE1$ $NAME1$ $UNIT1$ for first series data, $AVGVALUE2$ $MINVALUE2$ $MAXVALUE2$ $NAME2$ $UNIT2$ for second series data and so on";
public const string Annotation = "Annotation text. Use \\n for carriage returns. Some variables are available: $DAY$ $MONTH$ $YEAR$ for date, $HOUR$ $MINUTE$ $SECOND$ for time, $AVGVALUE$ $MINVALUE$ $MAXVALUE$ $NAME$ $UNIT$ for sensor related data.";
}
public static class TypeDescription
{
public static string[] AllowedValues { get { return null; } }
}
public static class sensorFreqTypeDescription
{
static string[] _AllowedValues = new string[] { "25/s", "10/s", "5/s", "4/s","3/s","2/s","1/s",
"60/m","30/m","12/m","6/m","4/m","3/m","2/m","1/m",
"30/h","12/h","6/h","4/h","3/h","2/h","1/h"};
public static string[] AllowedValues { get { return _AllowedValues; } }
}
public static class yAxisDescription
{
static List<string> _AllowedValues = new List<string>();
static yAxisDescription()
{
int yaxiscount = 0;
foreach (var p in typeof(GraphFormProperties).GetProperties())
if (p.Name.StartsWith("Graph_yAxes")) yaxiscount++;
for (int i=0;i< yaxiscount;i++)
switch(i)
{
case 0: _AllowedValues.Add("1rst Y axis"); break;
case 1: _AllowedValues.Add("2nd Y axis"); break;
case 2: _AllowedValues.Add("3rd Y axis"); break;
default: _AllowedValues.Add((i+1).ToString()+"th Y axis"); break;
}
}
public static string[] AllowedValues { get { return _AllowedValues.ToArray(); } }
}
public static class AlarmTestTypeDescription
{
static string[] _AllowedValues = new string[] { "Disabled", ">", ">=", "=", "<=", "<" };
public static string[] AllowedValues { get { return _AllowedValues; } }
}
public static class fontNameTypeDescription
{
static string[] _AllowedValues ;
static fontNameTypeDescription()
{
InstalledFontCollection _fontsCollection = new InstalledFontCollection();
_AllowedValues = new string[_fontsCollection.Families.Length];
int i = 0;
foreach (FontFamily font in _fontsCollection.Families)
_AllowedValues[i++]=font.Name;
}
public static string[] AllowedValues { get { return _AllowedValues; } }
}
public static class sensorPrecisionTypeDescription
{
static string[] _AllowedValues = new string[] { "0", "0.1", "0.12", "0.123" };
public static string[] AllowedValues { get { return _AllowedValues; } }
}
public static class sensorDataTypeDescription
{
static string[] _AllowedValues = new string[] { "Avg values", "Min values", "Max values" };
public static string[] AllowedValues { get { return _AllowedValues; } }
}
public class GaugeFormProperties : GenericProperties
{
public GaugeFormProperties(XmlNode initData, Form owner) : base(initData, owner)
{ PropagateDataSourceChange(); }
private void PropagateDataSourceChange()
{
((gaugeForm)ownerForm).SourceChanged(_DataSource_source);
foreach (var p in this.GetType().GetProperties())
{
string name = p.Name;
if (name.StartsWith("DataSource_AlarmSection"))
{
// setBrowsableProperty(p.Name, IsDataSourceAssigned()); does not work :-(
((AlarmSection)(p.GetValue(this, null))).setDataSource(_DataSource_source);
}
}
}
private CustomYSensor _DataSource_source = sensorsManager.getNullSensor();
[
DisplayName("Sensor"),
CategoryAttribute("Data source"),
ParamCategorySummaryAttribute("sensorDescription"),
PreExpandedCategoryAttribute(true),
ChangeCausesParentRefreshAttribute(true),
DescriptionAttribute("Yoctopuce sensor feeding the gauge. ")]
public CustomYSensor DataSource_source
{
get { return _DataSource_source; }
set
{
_DataSource_source = value;
PropagateDataSourceChange();
}
}
public string sensorDescription
{
get
{
return _DataSource_source is NullYSensor ? "none" : _DataSource_source.get_friendlyName();
}
}
public bool isSensorReadOnly { get { return _DataSource_source.isReadOnly; } }
[DisplayName("Sensor freq"),
CategoryAttribute("Data source"),
NotSavedInXMLAttribute(true),
IsReadonlyCallAttribute("isSensorReadOnly"),
ParamExtraDescription(typeof(sensorFreqTypeDescription)),
DescriptionAttribute("Sensor data acquisition frequency."+ GenericHints.DevConfAffected)]
public string DataSource_freq
{
get { return _DataSource_source.get_frequency(); }
set { _DataSource_source.set_frequency(value); }
}
private string _DataSource_precision = "0.1";
[
DisplayName("Precision"),
CategoryAttribute("Data source"),
DescriptionAttribute("How many digits shown after the decimal point"),
ParamExtraDescription(typeof(sensorPrecisionTypeDescription))]
public string DataSource_precision
{
get { return _DataSource_precision; }
set { _DataSource_precision = value; }
}
private AlarmSection _DataSource_AlarmSection0 = new AlarmSection(0);
[
DisplayName("Sensor value alarm 1"),
NotSavedInXMLAttribute(true),
ReadOnlyAttribute(true),
CategoryAttribute("Data source"),
DescriptionAttribute("Alarm 1 for this data source, expand for more.")]
public AlarmSection DataSource_AlarmSection0
{
get { return _DataSource_AlarmSection0; }
set { _DataSource_AlarmSection0 = value; }
}
private AlarmSection _DataSource_AlarmSection1 = new AlarmSection(1);
[
DisplayName("Sensor value alarm 2"),
CategoryAttribute("Data source"),
ReadOnlyAttribute(true),
NotSavedInXMLAttribute(true),
DescriptionAttribute("Alarm 2 for this data source, expand for more.")]
public AlarmSection DataSource_AlarmSection1
{
get { return _DataSource_AlarmSection1; }
set { _DataSource_AlarmSection1 = value; }
}
private double _SolidGauge_min = 0;
[DisplayName("Minimum value"),
CategoryAttribute("Values range"),
DescriptionAttribute("Minimum value displayable by the gauge.")]
public double SolidGauge_min
{
get { return _SolidGauge_min; }
set { _SolidGauge_min = value; }
}
private double _SolidGauge_max = 100;
[DisplayName("Maximum value"),
CategoryAttribute("Values range"),
DescriptionAttribute("Maximum value displayable by the gauge.")]
public double SolidGauge_max
{
get { return _SolidGauge_max; }
set { _SolidGauge_max = value; }
}
private bool _SolidGauge_showMinMax = true;
[DisplayName("show min/max"),
CategoryAttribute("Values range"),
DescriptionAttribute("Show the min / max values.")]
public bool SolidGauge_showMinMax
{
get { return _SolidGauge_showMinMax; }
set { _SolidGauge_showMinMax = value; }
}
private YColor _SolidGauge_color1 = YColor.fromColor(Color.LightGreen);
[DisplayName("Min Color"),
CategoryAttribute("Values range"),
DescriptionAttribute("Color for minimum value.")]
public YColor SolidGauge_color1
{
get { return _SolidGauge_color1; }
set { _SolidGauge_color1 = value; }
}
private YColor _SolidGauge_color2 = YColor.fromColor( Color.Red);
[DisplayName("Max color"),
CategoryAttribute("Values range"),
DescriptionAttribute("Color for maximum value.")]
public YColor SolidGauge_color2
{
get { return _SolidGauge_color2; }
set { _SolidGauge_color2 = value; }
}
private FontDescription _SolidGauge_font = new FontDescription("Arial", 20, YColor.fromColor(Color.Black), false, true);
[DisplayName("Unit Font"),
CategoryAttribute("Fonts"),
ReadOnlyAttribute(true),
DescriptionAttribute("Font for displaying the value/status indicator")]
public FontDescription SolidGauge_font
{
get { return _SolidGauge_font; }
set { _SolidGauge_font = value; }
}
private FontDescription _SolidGauge_minMaxFont = new FontDescription("Arial", 10, YColor.fromColor(Color.Black), false, true);
[DisplayName("Min Max Font"),
CategoryAttribute("Fonts"),
ReadOnlyAttribute(true),
DescriptionAttribute("Font for displaying min/max values")]
public FontDescription SolidGauge_minMaxFont
{
get { return _SolidGauge_minMaxFont; }
set { _SolidGauge_minMaxFont = value; }
}
// ***************************************************************
private YSolidGauge.DisplayMode _SolidGauge_displayMode = YSolidGauge.DisplayMode.DISPLAY90;
[DisplayName("Display mode"),
CategoryAttribute("Dial"),
DescriptionAttribute("Dial general shape")]
public YSolidGauge.DisplayMode SolidGauge_displayMode
{
get { return _SolidGauge_displayMode; }
set { _SolidGauge_displayMode = value; }
}
private YColor _SolidGauge_borderColor = YColor.fromColor(Color.Black);
[DisplayName("Border color"),
CategoryAttribute("Dial"),
DescriptionAttribute("Dial border color." )]
public YColor SolidGauge_borderColor
{
get { return _SolidGauge_borderColor; }
set { _SolidGauge_borderColor = value; }
}
private double _SolidGauge_borderThickness = 2;
[DisplayName("Border thickness "),
CategoryAttribute("Dial"),
DescriptionAttribute("Thickness of the dial border")]
public double SolidGauge_borderThickness
{
get { return _SolidGauge_borderThickness; }
set { _SolidGauge_borderThickness = value; }
}
private YColor _SolidGauge_backgroundColor1 = YColor.FromArgb(255, 240, 240, 240);
[DisplayName("Background color 1"),
CategoryAttribute("Dial"),
DescriptionAttribute("Dial background gradient color 1." )]
public YColor SolidGauge_backgroundColor1
{
get { return _SolidGauge_backgroundColor1; }
set { _SolidGauge_backgroundColor1 = value; }
}
private YColor _SolidGauge_backgroundColor2 = YColor.FromArgb(255, 200, 200, 200);
[DisplayName("Background color 2"),
CategoryAttribute("Dial"),
DescriptionAttribute("Dial background gradient color 2." )]
public YColor SolidGauge_backgroundColor2
{
get { return _SolidGauge_backgroundColor2; }
set { _SolidGauge_backgroundColor2 = value; }
}
private double _SolidGauge_thickness = 25;
[DisplayName("Dial thickness (%) "),
CategoryAttribute("Dial"),
DescriptionAttribute("Thickness of the dial, in percentage relative to radius")]
public double SolidGauge_thickness
{
get { return _SolidGauge_thickness; }
set { _SolidGauge_thickness = value; }
}
private double _SolidGauge_maxSpeed = 1;
[DisplayName("Max speed (%) "),
CategoryAttribute("Dial"),
DescriptionAttribute("Maximum speed of the dial in percentage relative to Max-Min. This is meant to limit \"teleporting\" effects.")]
public double SolidGauge_maxSpeed
{
get { return _SolidGauge_maxSpeed; }
set { _SolidGauge_maxSpeed = value; }
}
public override bool IsDataSourceAssigned()
{
return !(_DataSource_source is NullYSensor);
}
private AnnotationPanelDescription _annotationPanels0 = new AnnotationPanelDescription(
GenericPanel.HorizontalAlignPos.CENTER, GenericPanel.VerticalAlignPos.BOTTOM,0, false,"$NAME$",
YColor.FromArgb(0, 127, 127, 127), YColor.FromArgb(0, 127, 127, 127),
10.0, YColor.FromArgb(255, 0, 0, 0));
[
DisplayName("Annotation 1"),
CategoryAttribute("Annotations"),
ReadOnlyAttribute(true),
DescriptionAttribute("Customizable text panels")]
public AnnotationPanelDescription SolidGauge_annotationPanels0
{
get { return _annotationPanels0; }
set { _annotationPanels0 = value; }
}
private AnnotationPanelDescription _annotationPanels1 = new AnnotationPanelDescription(
GenericPanel.HorizontalAlignPos.LEFT, GenericPanel.VerticalAlignPos.TOP,0, true, "$HOUR$:$MINUTE$",
YColor.FromArgb(255, 255, 255, 255), YColor.FromArgb(255, 0, 0, 0),
8.0, YColor.FromArgb(255, 0, 0, 0));
[
DisplayName("Annotation 2"),
CategoryAttribute("Annotations"),
ReadOnlyAttribute(true),
DescriptionAttribute("Customizable text panels")]
public AnnotationPanelDescription SolidGauge_annotationPanels1
{
get { return _annotationPanels1; }
set { _annotationPanels1 = value; }
}
}
//****************************
// angular gauge
//****************************
public class AngularGaugeFormProperties : GenericProperties
{
public AngularGaugeFormProperties(XmlNode initData, Form owner) : base(initData, owner)
{ PropagateDataSourceChange();
}
public void PropagateDataSourceChange()
{
((angularGaugeForm)ownerForm).SourceChanged(_DataSource_source);
foreach (var p in this.GetType().GetProperties())
{
string name = p.Name;
if (name.StartsWith("DataSource_AlarmSection"))
{
// setBrowsableProperty(p.Name, IsDataSourceAssigned()); does not work :-(
((AlarmSection)(p.GetValue(this, null))).setDataSource(_DataSource_source);
}
}
}
public override bool IsDataSourceAssigned()
{
return !(_DataSource_source is NullYSensor);
}
private CustomYSensor _DataSource_source = sensorsManager.getNullSensor();
[
DisplayName("Sensor"),
CategoryAttribute("Data source"),
ParamCategorySummaryAttribute("sensorDescription"),
PreExpandedCategoryAttribute(true),
ChangeCausesParentRefreshAttribute(true),
DescriptionAttribute("Yoctopuce sensor feeding the gauge. "+GenericHints.CheckSensor)]
public CustomYSensor DataSource_source
{
get { return _DataSource_source; }
set
{
_DataSource_source = value;
PropagateDataSourceChange();
}
}
public string sensorDescription
{
get
{
return _DataSource_source is NullYSensor ? "none" : _DataSource_source.get_friendlyName();
}
}
public bool isSensorReadOnly { get { return _DataSource_source.isReadOnly; } }
[DisplayName("Sensor freq"),
CategoryAttribute("Data source"),
NotSavedInXMLAttribute(true),
IsReadonlyCallAttribute("isSensorReadOnly"),
DescriptionAttribute("Sensor data acquisition frequency." + GenericHints.DevConfAffected),
ParamExtraDescription(typeof(sensorFreqTypeDescription))]
public string DataSource_freq
{
get { return _DataSource_source.get_frequency(); }
set { _DataSource_source.set_frequency(value); }
}
private AlarmSection _DataSource_AlarmSection0 = new AlarmSection(0);
[
DisplayName("Sensor value alarm 1"),
NotSavedInXMLAttribute(true),
ReadOnlyAttribute(true),
CategoryAttribute("Data source"),
DescriptionAttribute("Alarm 1 for this data source, expand for more.")]
public AlarmSection DataSource_AlarmSection0
{
get { return _DataSource_AlarmSection0; }
set { _DataSource_AlarmSection0 = value; }
}
private AlarmSection _DataSource_AlarmSection1 = new AlarmSection(1);
[
DisplayName("Sensor value alarm 2"),
CategoryAttribute("Data source"),
NotSavedInXMLAttribute(true),
ReadOnlyAttribute(true),
DescriptionAttribute("Alarm 2 for this data source, expand for more.")]
public AlarmSection DataSource_AlarmSection1
{
get { return _DataSource_AlarmSection1; }
set { _DataSource_AlarmSection1 = value; }
}
private double _AngularGauge_min = 0;
[DisplayName("Minimum value"),
CategoryAttribute("Gauge gradations"),
DescriptionAttribute("Minimum value displayable by the gauge.")]
public double AngularGauge_min
{
get { return _AngularGauge_min; }
set { _AngularGauge_min = value; }
}
private double _AngularGauge_max = 100;
[DisplayName("Maximum value"),
CategoryAttribute("Gauge gradations"),
DescriptionAttribute("Maximum value displayable by the gauge.")]
public double AngularGauge_max
{
get { return _AngularGauge_max; }
set { _AngularGauge_max = value; }
}
private double _AngularGauge_unitFactor = 1;
[DisplayName("Unit factor"),
CategoryAttribute("Gauge gradations"),
DescriptionAttribute("Data will be divided by this value before being displayed, this allows simpler gradation marks.")]
public double AngularGauge_unitFactor
{
get { return _AngularGauge_unitFactor; }
set { _AngularGauge_unitFactor = value; }
}
private double _AngularGauge_graduation = 10;
[DisplayName("Main gradation steps"),
CategoryAttribute("Gauge gradations"),
DescriptionAttribute("Difference between two consecutive main gradation marks")]
public double AngularGauge_graduation
{
get { return _AngularGauge_graduation; }
set { _AngularGauge_graduation = value; }
}
private double _AngularGauge_graduationSize = 10;
[DisplayName("Main gradation size (%)"),
CategoryAttribute("Gauge gradations"),
DescriptionAttribute("Main gradation marks size in percent, relative to dial radius")]
public double AngularGauge_graduationSize
{
get { return _AngularGauge_graduationSize; }
set { _AngularGauge_graduationSize = value; }
}
private double _AngularGauge_graduationOuterRadiusSize = 98;
[DisplayName("Main gradation radius (%)"),
CategoryAttribute("Gauge gradations"),
DescriptionAttribute("Main gradation marks outer radius in percent, relative to dial radius")]
public double AngularGauge_graduationOuterRadiusSize
{
get { return _AngularGauge_graduationOuterRadiusSize; }
set { _AngularGauge_graduationOuterRadiusSize = value; }
}
private double _AngularGauge_graduationThickness = 2;
[DisplayName("Main gradation thickness"),
CategoryAttribute("Gauge gradations"),
DescriptionAttribute("Main gradation marks thickness")]
public double AngularGauge_graduationThickness
{
get { return _AngularGauge_graduationThickness; }
set { _AngularGauge_graduationThickness = value; }
}
private YColor _AngularGauge_graduationColor = YColor.fromColor(Color.Black);
[DisplayName("Main gradation color"),
CategoryAttribute("Gauge gradations"),
DescriptionAttribute("Main gradation marks color." )]
public YColor AngularGauge_graduationColor
{
get { return _AngularGauge_graduationColor; }
set { _AngularGauge_graduationColor = value; }
}
private FontDescription _AngularGauge_graduationFont = new FontDescription("Arial", 20, YColor.fromColor(Color.Black), false, true);
[DisplayName("Main gradation font"),
CategoryAttribute("Gauge gradations"),
ReadOnlyAttribute(true),
DescriptionAttribute("Font used for gradation labels")]
public FontDescription AngularGauge_graduationFont
{
get { return _AngularGauge_graduationFont; }
set { _AngularGauge_graduationFont = value; }
}
private int _AngularGauge_subgraduationCount = 5;
[DisplayName("Sub-gradation count"),
CategoryAttribute("Gauge gradations"),
DescriptionAttribute("How many sub-gradation (+1) marks between two consecutive main graduation marks")]
public int AngularGauge_subgraduationCount
{
get { return _AngularGauge_subgraduationCount; }
set { _AngularGauge_subgraduationCount = value; }
}
private double _AngularGauge_subgraduationSize = 5;
[DisplayName("Sub-gradation size (%)"),
CategoryAttribute("Gauge gradations"),
DescriptionAttribute("Sub-gradation marks size in percent, relative to dial radius")]
public double AngularGauge_subgraduationSize
{
get { return _AngularGauge_subgraduationSize; }
set { _AngularGauge_subgraduationSize = value; }
}
private double _AngularGauge_subgraduationThickness = 1;
[DisplayName("Sub-gradation thickness"),
CategoryAttribute("Gauge gradations"),
DescriptionAttribute("Sub-gradation marks thickness")]
public double AngularGauge_subgraduationThickness
{
get { return _AngularGauge_subgraduationThickness; }
set { _AngularGauge_subgraduationThickness = value; }
}
private YColor _AngularGauge_subgraduationColor = YColor.fromColor(Color.Black);
[DisplayName("Sub-gradation color"),
CategoryAttribute("Gauge gradations"),
DescriptionAttribute("Sub-gradation marks color." )]
public YColor AngularGauge_subgraduationColor
{
get { return _AngularGauge_subgraduationColor; }
set { _AngularGauge_subgraduationColor = value; }
}
private YColor _AngularGauge_needleColor = YColor.fromColor(Color.Red);
[DisplayName("Needle color"),
CategoryAttribute("Needle"),
DescriptionAttribute("Needle filling color." )]
public YColor AngularGauge_needleColor
{
get { return _AngularGauge_needleColor; }
set { _AngularGauge_needleColor = value; }
}
private YColor _AngularGauge_needleContourColor = YColor.fromColor(Color.DarkRed);
[DisplayName("Needle contour color"),
CategoryAttribute("Needle"),
DescriptionAttribute("Needle contour color." )]
public YColor AngularGauge_needleContourColor
{
get { return _AngularGauge_needleContourColor; }
set { _AngularGauge_needleContourColor = value; }
}
private double _AngularGauge_needleContourThickness = 1;
[DisplayName("Needle contour thickness"),
CategoryAttribute("Needle"),
DescriptionAttribute("Thickness of the needle contour")]
public double AngularGauge_needleContourThickness
{
get { return _AngularGauge_needleContourThickness; }
set { _AngularGauge_needleContourThickness = value; }
}
private double _AngularGauge_needleLength1 = 90;
[DisplayName("Needle main size (%)"),
CategoryAttribute("Needle"),
DescriptionAttribute("Length of the needle part pointing to gradations, in % relative to radius")]
public double AngularGauge_needleLength1
{
get { return _AngularGauge_needleLength1; }
set { _AngularGauge_needleLength1 = value; }
}
private double _AngularGauge_needleLength2 = 15;
[DisplayName("Needle foot size (%)"),
CategoryAttribute("Needle"),
DescriptionAttribute("Length of the needle part not pointing to gradations, in % relative to radius")]
public double AngularGauge_needleLength2
{
get { return _AngularGauge_needleLength2; }
set { _AngularGauge_needleLength2 = value; }
}
private double _AngularGauge_needleWidth = 5;
[DisplayName("Needle width (%)"),
CategoryAttribute("Needle"),
DescriptionAttribute("Width of the needle, in % relative to radius")]
public double AngularGauge_needleWidth
{
get { return _AngularGauge_needleWidth; }
set { _AngularGauge_needleWidth = value; }
}
private double _AngularGauge_needleMaxSpeed = 0.5;
[DisplayName("Needle max speed (%)"),
CategoryAttribute("Needle"),
DescriptionAttribute("Needle Maximum speed, in % relative to (max-min). This is meant to limit \"teleporting\" effects.")]
public double AngularGauge_needleMaxSpeed
{
get { return _AngularGauge_needleMaxSpeed; }
set { _AngularGauge_needleMaxSpeed = value; }
}
private FontDescription _AngularGauge_unitFont = new FontDescription("Arial", 24, YColor.fromColor(Color.DarkGray), false, true);
[DisplayName("Unit Line Font"),
CategoryAttribute("Text lines"),
ReadOnlyAttribute(true),
DescriptionAttribute("Font used in the text line describing unit")]
public FontDescription AngularGauge_unitFont
{
get { return _AngularGauge_unitFont; }
set { _AngularGauge_unitFont = value; }
}
private FontDescription _AngularGauge_statusFont = new FontDescription("Arial", 24, YColor.fromColor(Color.DarkGray), false, true);
[DisplayName("Status Line Font"),
ReadOnlyAttribute(true),
CategoryAttribute("Text lines"),
DescriptionAttribute("Font used in the text line gauge status")]
public FontDescription AngularGauge_statusFont
{
get { return _AngularGauge_statusFont; }
set { _AngularGauge_statusFont = value; }
}
private YColor _AngularGauge_borderColor = YColor.fromColor(Color.Black);
[DisplayName("Border color"),
CategoryAttribute("Dial"),
DescriptionAttribute("Dial border color." )]
public YColor AngularGauge_borderColor
{
get { return _AngularGauge_borderColor; }
set { _AngularGauge_borderColor = value; }
}
private double _AngularGauge_borderThickness = 5;
[DisplayName("Border thickness "),
CategoryAttribute("Dial"),
DescriptionAttribute("Thickness of the dial border")]
public double AngularGauge_borderThickness
{
get { return _AngularGauge_borderThickness; }
set { _AngularGauge_borderThickness = value; }
}
private YColor _AngularGauge_backgroundColor1 = YColor.FromArgb(255, 240, 240, 240);
[DisplayName("Background color 1"),
CategoryAttribute("Dial"),
DescriptionAttribute("Dial background gradient color 1." )]
public YColor AngularGauge_backgroundColor1
{
get { return _AngularGauge_backgroundColor1; }
set { _AngularGauge_backgroundColor1 = value; }
}
private YColor _AngularGauge_backgroundColor2 = YColor.FromArgb(255, 200, 200, 200);
[DisplayName("Background color 2"),
CategoryAttribute("Dial"),
DescriptionAttribute("Dial background gradient color 2." )]
public YColor AngularGauge_backgroundColor2
{
get { return _AngularGauge_backgroundColor2; }
set { _AngularGauge_backgroundColor2 = value; }
}
private AngularZoneDescription _AngularGauge_zones0 = new AngularZoneDescription(0, 50, YColor.fromColor(Color.LightGreen));
[DisplayName("Zone 1"),
CategoryAttribute("Zones"),
ReadOnlyAttribute(true),
DescriptionAttribute("Zone 1 parameters")]
public AngularZoneDescription AngularGauge_zones0
{
get { return _AngularGauge_zones0; }
set { _AngularGauge_zones0 = value; }
}
private AngularZoneDescription _AngularGauge_zones1 = new AngularZoneDescription(50, 80, YColor.fromColor(Color.Yellow));
[DisplayName("Zone 2"),
CategoryAttribute("Zones"),
ReadOnlyAttribute(true),
DescriptionAttribute("Zone 2 parameters")]
public AngularZoneDescription AngularGauge_zones1
{
get { return _AngularGauge_zones1; }
set { _AngularGauge_zones1 = value; }
}
private AngularZoneDescription _AngularGauge_zones2 = new AngularZoneDescription(80, 100, YColor.fromColor(Color.Red));
[DisplayName("Zone 3"),
CategoryAttribute("Zones"),
ReadOnlyAttribute(true),
DescriptionAttribute("Zone 3 parameters")]
public AngularZoneDescription AngularGauge_zones2
{
get { return _AngularGauge_zones2; }
set { _AngularGauge_zones2 = value; }
}
private AnnotationPanelDescription _annotationPanels0 = new AnnotationPanelDescription(
GenericPanel.HorizontalAlignPos.CENTER, GenericPanel.VerticalAlignPos.CENTER,-15, true, "$NAME$",
YColor.FromArgb(0, 127, 127, 127), YColor.FromArgb(0, 127, 127, 127),
8.0, YColor.FromArgb(255, 127, 127, 127));
[
DisplayName("Annotation 1"),
CategoryAttribute("Annotations"),
ReadOnlyAttribute(true),
DescriptionAttribute("Customizable text panels")]
public AnnotationPanelDescription AngularGauge_annotationPanels0
{
get { return _annotationPanels0; }
set { _annotationPanels0 = value; }
}
private AnnotationPanelDescription _annotationPanels1 = new AnnotationPanelDescription(
GenericPanel.HorizontalAlignPos.CENTER, GenericPanel.VerticalAlignPos.BOTTOM,0, false, "$HOUR$:$MINUTE$",
YColor.FromArgb(255, 255, 255, 255), YColor.FromArgb(255, 127, 127, 127),
12.0, YColor.FromArgb(255, 0, 0, 0));
[
DisplayName("Annotation 2"),
CategoryAttribute("Annotations"),
ReadOnlyAttribute(true),
DescriptionAttribute("Customizable text panels")]
public AnnotationPanelDescription AngularGauge_annotationPanels1
{
get { return _annotationPanels1; }
set { _annotationPanels1 = value; }
}
}
public class ZoneDescription
{
double _min;
double _max;
bool _visible = false;
YColor _color;
public ZoneDescription(double min, double max, YColor color)
{
_min = min;
_max = max;
_color = color;
}
public string summary
{
get { return _visible ? _min.ToString()+".."+ _max.ToString() : "Disabled"; }
}
[DisplayName("Visible"),
ChangeCausesParentRefreshAttribute(true),
DescriptionAttribute("Zone visibility." )]
public bool visible { get { return _visible; } set { _visible = value; } }
[DisplayName("Minimum value"),
ChangeCausesParentRefreshAttribute(true),
DescriptionAttribute("Zone minimum value")]
public double min { get { return _min; } set { _min = value; } }
[DisplayName("Maximum value"),
ChangeCausesParentRefreshAttribute(true),
DescriptionAttribute("Zone maximum value")]
public double max { get { return _max; } set { _max = value; } }
[DisplayName("Color"),
DescriptionAttribute("Zone color")]
public YColor color { get { return _color; } set { _color = value; } }