-
Notifications
You must be signed in to change notification settings - Fork 5
/
piweb-1-5.d.ts
7745 lines (7586 loc) · 260 KB
/
piweb-1-5.d.ts
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
declare module "internal/buffer_reader" {
export class BufferReader {
_data: Buffer;
_currentPosition: number;
constructor(stream: Buffer);
readBool(): boolean;
readByte(): number;
readUInt16(): number;
readInt16(): number;
readInt32(): number;
readUInt32(): number;
readDouble(): number;
readDate(): Date;
readGuid(): string;
readString(): string;
readBinary(): Buffer;
readTimeStamp(): Date;
}
}
declare module "internal/buffer_writer" {
export class BufferWriter {
private _data;
private _initialBufferSize;
private _currentPosition;
constructor(initialSize?: number);
writeBool(bool: boolean): void;
writeByte(byte: number): void;
writeUInt32(uint: number): void;
writeDouble(double: number): void;
writeString(value: string): void;
writeSizedBinary(data: Buffer, length?: number): void;
writeRawBinary(data: Buffer, length?: number): void;
writeSizeAt(index: number): void;
getData(): Buffer;
getLength(): number;
private _reserve(count);
}
}
declare module "internal/drawing_broker" {
export function execOnRender(plotContext: any): Buffer;
}
declare module "internal/multimap" {
/**
* @author Jordan Luyke <[email protected]>
*/
export interface IMultiMap<K, V> {
clear(): void;
containsKey(key: K): boolean;
containsValue(value: V): boolean;
containsEntry(key: K, value: V): boolean;
delete(key: K, value?: V): boolean;
entries: MultiMapEntry<K, V>[];
get(key: K): Iterable<V>;
keys(): Iterable<K>;
values(): Iterable<V>;
put(key: K, value: V): MultiMapEntry<K, V>[];
}
export class MultiMap<K, V> implements IMultiMap<K, V> {
private _entries;
clear(): void;
containsKey(key: K): boolean;
containsValue(value: V): boolean;
containsEntry(key: K, value: V): boolean;
delete(key: K, value?: V): boolean;
readonly entries: MultiMapEntry<K, V>[];
get(key: K): Iterable<V>;
keys(): Iterable<K>;
values(): Iterable<V>;
put(key: K, value: V): MultiMapEntry<K, V>[];
}
export class MultiMapEntry<K, V> {
readonly key: K;
readonly value: V;
constructor(key: K, value: V);
}
}
declare module "internal/regex_tools" {
export function wildcardToRegex(wildcard: string): RegExp;
export function escapeRegex(str: string): string;
}
declare module "internal/serializable" {
import { BufferWriter } from 'internal/buffer_writer';
export interface Serializable {
serialize(target: BufferWriter): void;
}
}
declare module "internal/string_tools" {
export function bytesToHex(bytes: Uint8Array): string;
export function hexToBytes(hex: string): Buffer;
export function bytesToGuid(bytes: Uint8Array): string;
export function splitString(str: string, delims: string): string[];
}
declare module "internal/synchronization_scopes" {
export function resetToleranceToken(): void;
export function checkToleranceToken(token: any): boolean;
export function getToleranceToken(): any;
}
declare module "internal/tooltip_broker" {
export let drawingHighlights: {
buffer: Buffer;
};
export function getDrawingTooltips(): Buffer;
}
declare module "piweb/environment" {
/**
* ## Introduction
*
* The `piweb.environment` module provides information about the element and its properties, as well as global settings.
* It also contains classes that are used by the functions of the `piweb.format` module.
*
* ```TypeScript
* import * as piweb from 'piweb';
* import environment = piweb.environment;
* ```
*
* @see [format](format.html)
* @module environment
*/ /**
* @preferred
*/ /** */
import { Point, Size } from "piweb/drawing/geometry/basics";
export type LengthUnit = "mm" | "inch";
export type AngleUnit = "degreeDecimal" | "degreeMinuteSecond" | "radian";
/**
* Base interface for region info.
*/
export interface RegionInfoDescription {
/**
* Gets the name or ISO 3166 two-letter country/region code.
*/
readonly name: string;
}
/**
* Interface for region info.
*/
export interface IRegionInfo extends RegionInfoDescription {
/**
* Gets the two-letter code defined in ISO 3166 for the country/region.
*/
readonly twoLetterISORegionName: string;
/**
* Gets the three-letter code defined in ISO 3166 for the country/region.
*/
readonly threeLetterISORegionName: string;
}
/**
* Base interface for culture info.
*/
export interface CultureInfoDescription {
/**
* Gets the name of the culture in the format `languagecode2-country/regioncode2`.
*/
readonly name: string;
}
/**
* Interface for culture info.
*/
export interface ICultureInfo extends CultureInfoDescription {
/**
* Gets the ISO 639-1 two-letter code for the language of the culture.
*/
readonly twoLetterISOLanguageName: string;
/**
* Gets the ISO 639-2 three-letter code for the language of the culture.
*/
readonly threeLetterISOLanguageName: string;
}
/**
* Interface for time zone info.
*/
export interface ITimeZoneInfo {
/**
* Gets the name of the timezone.
*/
readonly name: string;
/**
* Gets the standard offset of the timezone in hours.
*/
readonly baseUtcOffset: number;
/**
* Returns the offset of the timezone at the specified date in hours.
* @param date The date at which the offset should be calculated. This takes daylight saving time etc. into account.
*/
getUtcOffset(time: Date): number;
}
/**
* Contains the identifiers of a specific culture. PiWeb can use these information to provide localization and correct formatting of numbers and dates.
*/
export class CultureInfo implements ICultureInfo {
/**
* Gets the culture in which the host application was started.
*/
static readonly currentCulture: ICultureInfo;
/**
* Gets the invariant culture.
*/
static readonly invariantCulture: ICultureInfo;
/**
* Gets the name of the culture in the format `languagecode2-country/regioncode2`.
*/
readonly name: string;
/**
* Gets the ISO 639-1 two-letter code for the language of the culture.
*/
readonly twoLetterISOLanguageName: string;
/**
* Gets the ISO 639-2 three-letter code for the language of the culture.
*/
readonly threeLetterISOLanguageName: string;
/**
* Initializes a new instance of the [[CultureInfo]] class.
* @param name The name of the culture.
*/
constructor(name: string);
}
/**
* Contains the identifiers of a specific country or region.
*/
export class RegionInfo implements IRegionInfo {
/**
* Gets the region in which the host application was started.
*/
static readonly currentRegion: IRegionInfo;
/**
* Gets the name or ISO 3166 two-letter country/region code.
*/
readonly name: string;
/**
* Gets the two-letter code defined in ISO 3166 for the country/region.
*/
readonly twoLetterISORegionName: string;
/**
* Gets the three-letter code defined in ISO 3166 for the country/region.
*/
readonly threeLetterISORegionName: string;
/**
* Initializes a new instance of the [[RegionInfo]] class.
* @param name The name of the region.
*/
constructor(name: string);
}
/**
* Contains information about a specific timezone.
*/
export class TimeZoneInfo implements ITimeZoneInfo {
/**
* Gets the timezone in which the host application was started.
*/
static readonly localTimeZone: ITimeZoneInfo;
/**
* Gets the name of the timezone.
*/
readonly name: string;
/**
* Gets the standard offset of the timezone in hours.
*/
readonly baseUtcOffset: number;
/**
* Initializes a new instance of the [[TimeZoneInfo]] class.
* @param name The name of the time zone.
*/
constructor(name: string);
/**
* Returns the offset of the timezone at the specified date in hours.
* @param date The date at which the offset should be calculated. This takes daylight saving time etc. into account.
*/
getUtcOffset(date: Date): any;
}
/**
* If `true`, the plot is rendered by PiWeb Designer, otherwise it's rendered by PiWeb Monitor. Some very complex elements don't render
* their complete content while in design mode, to guarantee a smooth and fluent editing in PiWeb Designer.
* @host
*/
export function isDesignMode(): boolean;
/**
* Returns the current size of the element in **millimeters**.
* @host
*/
export function getSize(): Size;
/**
* Returns the position of the element on the report page in **millimeters**.
* @host
*/
export function getLocation(): Point;
/**
* If the extensions defined multiple toolbox entries in the `package.json` manifest file, this property can be used to find out which entry the user picked.
* The returned value is the property name used as toolbox entry id in the manifest.
* @host
*/
export const toolboxItemName: string;
/**
* Gets the name of the hosting PiWeb client.
* @host
*/
export const clientString: string;
/**
* Gets the version of the hosting PiWeb client.
* @host
*/
export const clientVersion: string;
/**
* Gets the semantic version of the plot extension API that is used to host the plot.
* @host
*/
export const apiVersion: string;
/**
* Returns prefered display unit of length. This can be configured in the settings menu of Piweb Designer and PiWeb Monitor.
* @host
*/
export function getLengthUnit(): LengthUnit;
/**
* Returns prefered display unit of angles. This can be configured in the settings menu of Piweb Designer and PiWeb Monitor.
* @host
*/
export function getAngleUnit(): AngleUnit;
/**
* Returns prefered number of decimal places of displayed values. This can be configured in the settings menu of Piweb Designer and PiWeb Monitor.
* Use this only as a fallback value in case no prefered number of decimal places is configured for the displayed characteristic by attribute K2022.
* @host
*/
export function getDecimalPlaces(): number;
export type LimitUsageReference = "nominal" | "middleOfTolerance";
export type LimitType = "tolerance" | "warning" | "control" | "scrap";
export class LimitsConfiguration {
constructor(tolerance: LimitConfiguration, warning: LimitConfiguration, control: LimitConfiguration, scrap: LimitConfiguration, yellowLimitType: LimitType, redLimitType: LimitType, limitUsageReference: LimitUsageReference);
readonly toleranceLimitConfiguration: LimitConfiguration;
readonly warningLimitConfiguration: LimitConfiguration;
readonly controlLimitConfiguration: LimitConfiguration;
readonly scrapLimitConfiguration: LimitConfiguration;
readonly yellowLimitConfiguration: LimitConfiguration;
readonly redLimitConfiguration: LimitConfiguration;
readonly limitUsageReference: LimitUsageReference;
getLimitConfiguration(type: LimitType): LimitConfiguration;
}
export class LimitConfiguration {
constructor(type: LimitType, toleranceFactor: number | undefined, name: string, priority: number);
readonly type: LimitType;
readonly toleranceFactor: number | undefined;
readonly name: string;
readonly priority: number;
}
/**
* Returns the limit configuration that can be specified for a report.
* @host
*/
export function getLimitsConfiguration(): LimitsConfiguration;
}
declare module "piweb/events" {
/**
* An enumeration of supported events
*/
export type PiWebEvents = "load" | "render" | "dataBindingChanged" | "dataChanged" | "prepareRender";
/**
* Call this function to specify a callback for a specific event.
* @param name The name of the event.
* @param callback The callback function.
*/
export function on(name: PiWebEvents, callback: Function): void;
/**
* @private
*/
export function emit(name: PiWebEvents): boolean;
}
declare module "piweb/expressions" {
/**
* The possible simple return types of an expression.
*/
export type SimpleExpressionData = string | number | Date | undefined;
/**
* The possible array return types of an expression.
*/
export interface ExpressionDataArray extends Array<SimpleExpressionData | ExpressionDataArray> {
}
/**
* The cumulated possible return types of an expression.
*/
export type ExpressionDataType = SimpleExpressionData | ExpressionDataArray;
/**
* Evaluates the specified expression and returns the result untyped.
* @host
*/
export function evaluate(expression: string): ExpressionDataType;
/**
* Evaluates the specified expression and returns the result as `string` or `undefined`, in case the result can't be converted into a `string` representation.
* @param expression The expression to evaluate.
* @host
*/
export function evaluateAsString(expression: string): string | undefined;
/**
* Evaluates the specified expression and returns the result as `number` or `undefined`, in case the result can't be converted into a `number` representation.
* @param expression The expression to evaluate.
* @host
*/
export function evaluateAsNumber(expression: string): number | undefined;
/**
* Evaluates the specified expression and returns the result as `date` or `undefined`, in case the result can't be converted into a `date` representation.
* @param expression The expression to evaluate.
* @host
*/
export function evaluateAsDate(expression: string): Date | undefined;
/**
* Evaluates the specified expression and returns the result as `array` or `undefined`, in case the result wasn't an `array` of any kind.
* @param expression The expression to evaluate.
* @host
*/
export function evaluateAsArray(expression: string): ExpressionDataArray | undefined;
}
declare module "piweb/format" {
/**
* ## Introduction
*
* In many cases you'll want to create text output with numeric content, dates or time. On the other hand, you might want to parse numeric- or datetime values from files.
* To ensure the correct formatting, you can use the `piweb.format` module.
*
* ```TypeScript
* import * as piweb from 'piweb';
* import drawing = piweb.format;
* ```
*
* @module format
*/ /**
* @preferred
*/ /** */
import { CultureInfoDescription } from "piweb/environment";
/**
* When parsing a date without a specified time zone, the `DateKind` parameter determines which time zone the date has.
*
* **`assumeLocal`**
*
* The represented time will be interpreted as local time.
*
* **`assumeUTC`**
*
* The represented time will be interpreted as UTC.
*
*/
export type DateKind = "assumeUtc" | "assumeLocal";
/**
* Converts the specified value to its string representation using the specified format string and the culture specific format information.
* @param value The number to format.
* @param formatString The format string that tells how to format the number.
* Please refer to the [.Net number format specification](https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-numeric-format-strings)
* for a complete list of possible format strings.
* @param culture The culture to use for formatting. The function will use the invariant culture by default.
*/
export function formatNumber(value: number, formatString: string, culture?: CultureInfoDescription): string;
/**
* Converts the specified string representation of a number in a specified culture specific format to its `number` equivalent. The function will
* return NaN in case parsing wasn't possible.
* @param str The string to parse.
* @param culture The culture to use for parsing. The function will use the invariant culture by default.
* @host
*/
export function parseNumber(str: string, culture?: CultureInfoDescription): number;
/**
* Converts the specified date to its string representation using the specified format string and the culture specific format information.
* @param date The date to format.
* @param offsetHours The number of hours about which to offset the date.
* @param format The format string that tells how to format the date.
* Please refer to the [.Net date and time format specification](https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings)
* for a complete list of possible format strings.
* @param culture
* @host
*/
export function formatDate(date: Date, offsetHours?: number, format?: string, culture?: CultureInfoDescription): string;
/**
* Converts the specified string to its `Date` equivalent by using culture specific format information and formatting style.
* @param str The string to parse
* @param culture The culture to use for parsing. The function will use the invariant culture by default.
* @param dateKind The date kind to use for parsing.
* @host
*/
export function parseDate(str: string, culture?: CultureInfoDescription, dateKind?: DateKind): Date;
/**
* Converts the specified string to its `Date` equivalent by using culture specific format information and formatting style.
* @param str The string to parse
* @param format The format string that tells how to interpret the date.
* Please refer to the [.Net date and time format specification](https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings)
* for a complete list of possible format strings.
* @param culture The culture to use for parsing. The function will use the invariant culture by default.
* @param dateKind The date kind to use for parsing.
* @host
*/
export function parseDateExact(str: string, format?: string, culture?: CultureInfoDescription, dateKind?: DateKind): Date;
}
declare module "piweb" {
/**
* ## Index
*
* ### Package definition
*
* For a complete description of the PiWeb custom-plot extension format, please refer to the [package](package.html) chapter.
*
* ### Modules
*
* The PiWeb plot extension API has a root module named `piweb` which encapsulates all child modules. The following child modules are available:
*
* | Module | Description |
* |-------------------------|--------------------------------------------|
* | [**`data`**](data.html) | Access the databinding of the plot element |
* | [**`drawing`**](drawing.html) | Draw the content of the plot extension element|
* | [**`environment`**](environment.html) | Access settings of the PiWeb host application|
* | [**`events`**](events.html) | React to events emitted by the PiWeb host application|
* | [**`expressions`**](expressions.html) | Evaluate system variable expressions|
* | [**`format`**](format.html) | Read and write localized data|
* | [**`logger`**](logger.html) | Write entries into the piweb log|
* | [**`properties`**](properties.html) | Access the plot extension elements property grid |
* | [**`resources`**](resources.html) | Access resources that are located in the extension package |
* | [**`tooltips`**](tooltips.html) | Create tooltip content for the PiWeb Monitor info mode |
* @module Index
*/ /**
* @preferred
*/ /** */
import * as drawing from "piweb/drawing";
export { drawing };
import * as data from "piweb/data";
export { data };
import * as logger from 'piweb/logger';
export { logger };
import * as tooltips from 'piweb/tooltips';
export { tooltips };
import * as resources from 'piweb/resources';
export { resources };
import * as events from 'piweb/events';
export { events };
import * as properties from 'piweb/properties';
export { properties };
import * as environment from "piweb/environment";
export { environment };
import * as format from "piweb/format";
export { format };
import * as expressions from "piweb/expressions";
export { expressions };
}
declare module "piweb/logger" {
/**
* Generates a log message with the `debug` log level.
* @param format The format string that shall be logged.
* @param param The parameters of the format string.
* @host
*/
export function debug(format: any, ...param: any[]): void;
/**
* Generates a log message with the `info` log level.
* @param format The format string that shall be logged.
* @param param The parameters of the format string.
* @host
*/
export function info(format: any, ...param: any[]): void;
/**
* Generates a log message with the `warning` log level.
* @param format The format string that shall be logged.
* @param param The parameters of the format string.
* @host
*/
export function warn(format: any, ...param: any[]): void;
/**
* Generates a log message with the `error` log level.
* @param format The format string that shall be logged.
* @param param The parameters of the format string.
* @host
*/
export function error(format: any, ...param: any[]): void;
}
declare module "piweb/properties" {
/**
* ## Introduction
*
* The properties you define in the `package.json` file can be accessed with the `piweb.properties` module. To enable type checking, there is one function for each available datatype.
*
* Definition of a property in the `package.json` file:
*
* ```
* {
* "name": "myplot",
* ...
* "piweb_extension": {
* ...
* "propertygrid": {
* "categories": {
* "general": {
* "name": "General",
* "priority": 0
* }
* },
* "entries": {
* "myproperty": {
* "name": "Do it right",
* "description": "Determines whether to do it right",
* "type": "boolean",
* "default_value": false,
* "category": "general"
* }
* }
* }
* }
* }
* ```
*
*
* For a complete reference of the package format, including the definition of properties, please read the chapter '[package definition](package.html#package-structure-extensions-propertygrid)'.
*
* <hr>
*
* Access the property in your script:
*
* ```TypeScript
* import * as piweb from 'piweb';
* import properties = piweb.properties;
*
* properties.getBooleanProperty('myPropertyName')
* ```
*
* @see [package definition](package.html#package-structure-extensions-propertygrid)
* @module properties
*/ /**
* @preferred
*/ /** */
import { Color, Brush, Pen, Font } from "piweb/drawing";
/**
* Returns the value of the property with the name `id` as a boolean.
* @param id The name of the property.
* @host
*/
export function getBooleanProperty(id: string): boolean;
/**
* Returns the value of the property with the name `id` as a string.
* @param id The name of the property.
* @host
*/
export function getStringProperty(id: string): string;
/**
* Returns the value of the property with the name `id` as an integral number.
* @param id The name of the property.
* @host
*/
export function getIntegerProperty(id: string): number;
/**
* Returns the value of the property with the name `id` as a floating point number.
* @param id The name of the property.
* @host
*/
export function getDoubleProperty(id: string): number;
/**
* Returns the value of the property with the name `id` as a color.
* @param id The name of the property.
* @host
*/
export function getColorProperty(id: string): Color;
/**
* Returns the value of the property with the name `id` as an array of colors.
* @param id The name of the property.
* @host
*/
export function getColorSchemeProperty(id: string): Color[];
/**
* Returns the value of the property with the name `id` as a brush.
* @param id The name of the property.
* @host
*/
export function getBrushProperty(id: string): Brush;
/**
* Returns the value of the property with the name `id` as a pen.
* @param id The name of the property.
* @host
*/
export function getPenProperty(id: string): Pen;
/**
* Returns the value of the property with the name `id` as a font.
* @param id The name of the property.
* @host
*/
export function getFontProperty(id: string): Font;
/**
* Returns the value of the property with the name `id` as an enumerated string.
* @param id The name of the property.
* @host
*/
export function getEnumProperty(id: string): string;
}
declare module "piweb/tooltips" {
/**
* ## Introduction
*
* PiWeb Monitor has a feature we call `info mode`. While the info mode is active, or while the CTRL key is pressed, the point or geometry that is next to the mouse cursor
* is highlighted and can be clicked to show a tooltip for the point or geometry. Tooltips usually contain information about the measurement or characteristic that is
* displayed at this point or region of the plot:
*
* <img src="media://infomode.png">
*
* The plot extension API allows you add your own tooltips to a plot:
*
* ```TypeScript
* import * as piweb from 'piweb';
*
* piweb.events.on("render", render);
*
* function render(context: piweb.drawing.DrawingContext) {
* piweb.tooltips.placeTooltip(context, [0,0], new Tooltip("myTooltipText"));
*
* ...
* }
* ```
*
* You can also add predefined information for certain entities to a tooltip, which will look exactly like the built in tooltips you find on many plots in PiWeb:
*
* ```TypeScript
* import * as piweb from 'piweb';
*
* piweb.events.on("render", render);
*
* function render(context: piweb.drawing.DrawingContext) {
* const tooltip = new Tooltip();
*
* tooltip.addMeasurementValueInformations(value);
*
* piweb.tooltips.placeTooltip(context, [0,0], tooltip );
*
* ...
* }
* ```
*
* For more complex geometries than a single point, it's possible to create a highlight geometry with the [[DrawingContext.placeHighlight|placeHighlight]] function of the [[DrawingContext]].
*
* @module tooltips
*/ /**
* @preferred
*/ /** */
import { BufferWriter } from 'internal/buffer_writer';
import { Serializable } from 'internal/serializable';
import { InspectionPlanItem } from 'piweb/data/inspection';
import { Attribute } from 'piweb/data/attributes';
import { MeasurementValue, Measurement } from 'piweb/data/measurements';
import { DrawingContext, Drawing } from 'piweb/drawing/drawing';
import { PointDescription } from 'piweb/drawing/geometry/basics';
import { Defect } from 'piweb/data/defect';
import { VolumeDirection } from 'piweb/data/volume';
import { Bitmap } from 'piweb/drawing/image/bitmap';
/**
* Places a simple tooltip on the plot.
*/
export function placeTooltip(drawingContext: DrawingContext, position: PointDescription, tooltip: Tooltip): void;
/**
* Represents the content of a tooltip overlay.
*/
export class Tooltip implements Serializable {
/**
* @private
*/
private readonly _contentLines;
/**
* Initializes a new instance of the [[Tooltip]] class.
* @param content The primary content of the tooltip. When specifying a measurement value or an inspection plan item, PiWeb will generate a generic tooltip for the entity.
*/
constructor(content?: string | MeasurementValue | InspectionPlanItem | Measurement);
/**
* Adds a new line to the tooltip.
* @param text The content of the tooltip line.
*/
addText(text: string): void;
/**
* Adds a new collapsable line to the tooltip.
* @param text The content of the tooltip line.
* @param className The group to which the line belongs.
*/
addCollapsableText(text: string, className: string): void;
/**
* Adds a fallback text line to the tooltip.
* @param text Content of the fallback text line.
*/
addFallbackText(text: string): void;
/**
* Generates a generic tooltip for the specified inspection plan item and adds the lines to the current tooltip.
* @param characteristic The inspection plan item.
*/
addCharacteristicInformations(characteristic: InspectionPlanItem): void;
/**
* Generates a generic tooltip for the specified inspection plan item and adds the lines to the current tooltip.
* @param part The inspection plan item.
* @version 1.3
*/
addPartInformations(part: InspectionPlanItem): void;
/**
* Generates a generic tooltip for the specified measurement and adds the lines to the current tooltip.
* @param measurement The measurement.
* @version 1.3
*/
addMeasurementInformations(measurement: Measurement): void;
/**
* Generates a generic tooltip for the specified measurement value and adds the lines to the current tooltip.
* @param value The measurement value.
*/
addMeasurementValueInformations(value: MeasurementValue): void;
/**
* Generates a tooltip for the specified image and adds the lines to the current tooltip.
* @param name The title of the image.
* @param image The image.
* @version 1.3
*/
addImageInformations(name: string, image: Bitmap): void;
/**
* Generates a tooltip for the specified drawing and adds the lines to the current tooltip.
* @param name The title of the drawing.
* @param image The drawing.
* @version 1.3
*/
addDrawingInformations(name: string, drawing: Drawing): void;
/**
* Generates a generic tooltip for the specified defect and adds the lines to the current tooltip.
* @param defect The defect.
* @param image The image on which the defect is displayed.
* @param direction The direction in which the defect is projected onto the image.
* @version 1.3
*/
addDefectInformations(defect: Defect, image?: Bitmap, direction?: VolumeDirection): void;
/**
* @private
*/
serialize(target: BufferWriter): void;
}
/**
* @private
*/
export namespace knownClassNames {
/**
* Class of tooltip lines which represent quick navigation
**/
const navigation = "NAVIGATELINE";
/**
* Class of measurement tooltip lines
**/
const measurement = "Measurement";
/**
* Class of measurement value count tooltip lines
**/
const measurementValuesCount = "MeasurementValuesCount";
/**
* Class of characterisitc tooltip lines
**/
const characteristic = "Characteristic";
/**
* Class of audit function tooltip lines
**/
const auditFunction = "AuditFunction";
/**
* Class of tolerance limit tooltip lines
**/
const toleranceLimits = "Tolerance";
/**
* Class of warning limit tooltip lines
**/
const warningLimits = "Warning";
/**
* Class of control limit tooltip lines
**/
const controlLimits = "ControlLimits";
/**
* Class of scrap limit tooltip lines
**/
const scrapLimits = "ScrapLimits";
/**
* Class of actual value tooltip lines
**/
const actualValue = "ActualValue";
/**
* Class of nominal value tooltip lines
**/
const nominalValue = "NominalValue";
/**
* Class of tolerance Usage tooltip lines
**/
const toleranceUsage = "ToleranceUsage";
/**
* Class of CAD position tooltip lines
**/
const cadPosition = "CadPosition";
/**
* Returns the class of any given attribute.
**/
function getAttributeClassName(attribute: Attribute | number): string;
}
}
declare module "piweb/data/attributes" {
/**
* @module data
*/ /** */
import { BufferReader } from 'internal/buffer_reader';
import { Iter } from 'iter';
export type AttributeType = "string" | "integer" | "float" | "date" | "catalog";
/**
* @private
*/
export const enum AttributeTypeId {
String = 0,
Integer = 1,
Float = 2,
Date = 3,
Catalog = 4,
}
/**
* @private
*/
export function mapAttributeType(attributeType: AttributeTypeId): AttributeType;
export type AttributeValue = string | number | Date;
/**
* An attribute stores additional information about an arbitrary entity. Entities with attributes are parts, characteristics, measurements,
* measured values and catalog entries. An attribute is identified by its key. To get information about the type and usage of an attribute,
* use the Key to get the AttributeDefinition from the [[Configuration]].
*/
export class Attribute {
constructor(key: number, type: AttributeType, value: AttributeValue);
/**
* An unsigned 16 bit integer that identifies the attributes definition.
*/
key: number;
/**
* The datatype of the attributes value.
*/
type: AttributeType;
/**
* The actual value of the attribute. Refer to the type to get the datatype.
*/
value: AttributeValue;
}
/**
* An attribute item has a collection of attributes. The collection contains only attributes that actually have a value, so the number
* of attributes is usually lower than the number of attribute definitions that refer to the entity type of the attribute item.
*/
export interface IAttributeItem {
/**
* Gets a collection of attributes that are associated to this item.
* @see [[Attribute]]
*/
readonly attributes: AttributeCollection;
}
/**
* Describes an accessible collection of attributes, that is attached to an item that implements [[IAttributeItem]]. The collection offers a wide range of helper
* functions to allow a type safe access to the attributes values. You can iterate over the collection with a for ... of loop.
*/
export class AttributeCollection {
readonly _attributes: Map<number, Attribute>;
constructor(attributes: Iterable<Attribute>);
/**
* Returns an iterator over all attributes.
*/
[Symbol.iterator](): Iterator<Attribute>;
/**
* Returns an iter over all attributes.
*/
iter(): Iter<Attribute>;
/**
* Gets the number of attributes stored in the collection.
*/
readonly length: number;
/**
* Gets an iterator over the available keys in the collection.
*/
readonly keys: Iter<number>;
/**
* Returns the attribute with the specified key, or `undefined` in case there is no attribute with this key.
* @param key The key of the attribute.
*/
getAttribute(key: number): Attribute | undefined;
/**
* Returns the value of the attribute with the specified key, or `undefined` in case there is no attribute with this key.
* @param key The key of the attribute.