react-native-scanbot-sdk
Version:
Scanbot Document and Barcode Scanner SDK React Native Plugin for Android and iOS
120 lines (107 loc) • 3.1 kB
text/typescript
/// Auto-generated with ScanbotSDKCodegenV3. Modifications will be overwritten.
/// Generated from core/schemas/Geometry.yaml
import { ToJsonConfiguration } from '../../utils/json/JsonSerializationTypes';
import { DeepPartial, PartiallyConstructible, Point } from '../../utils/utils';
/**
Represents a line segment in 2D space.
*/
export class LineSegmentInt extends PartiallyConstructible {
/**
Start point of the segment.
*/
public readonly start: Point;
/**
End point of the segment.
*/
public readonly end: Point;
/** @param source {@displayType `DeepPartial<LineSegmentInt>`} */
public constructor(source: DeepPartial<LineSegmentInt> = {}) {
super();
if (source.start !== undefined) {
this.start = { x: source.start.x, y: source.start.y };
} else {
throw new Error('start must be present in constructor argument');
}
if (source.end !== undefined) {
this.end = { x: source.end.x, y: source.end.y };
} else {
throw new Error('end must be present in constructor argument');
}
}
public serialize(
config: ToJsonConfiguration = new ToJsonConfiguration()
): DeepPartial<LineSegmentInt> {
return {
start: this.start,
end: this.end,
};
}
}
/**
Represents a line segment in 2D space.
*/
export class LineSegmentFloat extends PartiallyConstructible {
/**
Start point of the segment.
*/
public readonly start: Point;
/**
End point of the segment.
*/
public readonly end: Point;
/** @param source {@displayType `DeepPartial<LineSegmentFloat>`} */
public constructor(source: DeepPartial<LineSegmentFloat> = {}) {
super();
if (source.start !== undefined) {
this.start = { x: source.start.x, y: source.start.y };
} else {
throw new Error('start must be present in constructor argument');
}
if (source.end !== undefined) {
this.end = { x: source.end.x, y: source.end.y };
} else {
throw new Error('end must be present in constructor argument');
}
}
public serialize(
config: ToJsonConfiguration = new ToJsonConfiguration()
): DeepPartial<LineSegmentFloat> {
return {
start: this.start,
end: this.end,
};
}
}
/**
Aspect ratio is the ratio of the width to the height of an image or screen.
*/
export class AspectRatio extends PartiallyConstructible {
/**
Width component of the aspect ratio.
Default is 1.0
*/
public readonly width: number = 1.0;
/**
Height component of the aspect ratio.
Default is 1.0
*/
public readonly height: number = 1.0;
/** @param source {@displayType `DeepPartial<AspectRatio>`} */
public constructor(source: DeepPartial<AspectRatio> = {}) {
super();
if (source.width !== undefined) {
this.width = source.width;
}
if (source.height !== undefined) {
this.height = source.height;
}
}
public serialize(
config: ToJsonConfiguration = new ToJsonConfiguration()
): DeepPartial<AspectRatio> {
return {
width: this.width,
height: this.height,
};
}
}