gx
chenyc
2025-06-12 7b72ac13a83764a662159d4a49b7fffb90476ecb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { isValidNumber } from '../utils/index';
import { IBoundingBox } from './BoundingBox';
import { Box } from './Box';
import { IRect } from './Rect';
 
export class LabeledBox extends Box {
  public static assertIsValidLabeledBox(box: any, callee: string) {
    Box.assertIsValidBox(box, callee);
    if (!isValidNumber(box.label)) {
      throw new Error(`${callee} - expected property label (${box.label}) to be a number`);
    }
  }
 
  private _label: number;
 
  constructor(box: IBoundingBox | IRect | any, label: number) {
    super(box);
    this._label = label;
  }
 
  public get label(): number { return this._label; }
}