progress scene builder

This commit is contained in:
IDONTSUDO 2024-06-25 12:43:41 +03:00
parent 0a4eea19c5
commit 50d0c4c12b
64 changed files with 858 additions and 1315 deletions

View file

@ -8,6 +8,7 @@ import {
InstanceType,
SceneSimpleObject,
} from "../../../core/model/robossembler_assets";
import { Result } from "../../../core/helper/result";
export enum RobossemblerFiles {
robossemblerAssets = "robossembler_assets.json",
@ -137,19 +138,11 @@ export class CameraViewModel extends BaseSceneItemModel {
};
}
validate(cameraLinksNames: string[]) {
if (cameraLinksNames.filter((el) => this.cameraLink === el).isNotEmpty()) {
return { cameraLink: "the name for the camera is not unique" };
}
validate(): Result<string, CameraViewModel> {
if (this.cameraLink.isEmpty()) {
return { cameraLink: "is empty" };
}
if (this.topicImage.isEmpty()) {
return { topicImage: "is empty" };
}
if (this.topicCameraInfo.isEmpty()) {
return { topicCameraInfo: "is empty" };
return Result.error("cameraLink is empty");
}
return Result.ok(this);
}
mapPerspectiveCamera(htmlSceneWidth: number, htmlSceneHeight: number) {

View file

@ -0,0 +1,4 @@
export interface SceneModel {
_id: string;
name: string;
}

View file

@ -0,0 +1,17 @@
import { Result } from "../../../core/helper/result";
export class SceneViewModel {
name: string;
constructor(name: string) {
this.name = name;
}
static empty() {
return new SceneViewModel("");
}
valid = (): Result<string,SceneViewModel> => {
if (this.name.isEmpty()) {
return Result.error("name is empty");
}
return Result.ok(this);
};
}