How to use the vott-ct/lib/js/CanvasTools/Core/RegionData.RegionData function in vott-ct

To help you get started, we’ve selected a few vott-ct examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / VoTT / src / common / mockFactory.ts View on Github external
public static createTestRegionData() {
        const origin = {
            x: randomIntInRange(0, 1024),
            y: randomIntInRange(0, 768),
        };
        const size = {
            width: randomIntInRange(1, 100),
            height: randomIntInRange(1, 100),
        };

        return new RegionData(origin.x, origin.y, size.width, size.height,
            [
                new Point2D(origin.x, origin.y), // Top left
                new Point2D(origin.x + size.width, origin.y), // Top Right
                new Point2D(origin.x, origin.y + size.height), // Bottom Left
                new Point2D(origin.x + size.width, origin.y + size.height), // Bottom Right
            ],
            RegionDataType.Rect);
    }
    /**
github microsoft / VoTT / src / react / components / pages / editorPage / canvasHelpers.ts View on Github external
public static getRegionData(region: IRegion): RegionData {
        return new RegionData(region.boundingBox.left,
            region.boundingBox.top,
            region.boundingBox.width,
            region.boundingBox.height,
            region.points.map((point) =>
                new Point2D(point.x, point.y)),
            this.regionTypeToType(region.type));
    }