details preview
This commit is contained in:
parent
81238c5182
commit
0a4eea19c5
39 changed files with 242 additions and 286 deletions
|
@ -6,7 +6,6 @@ export const ArrayExtensions = () => {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if ([].equals === undefined) {
|
if ([].equals === undefined) {
|
||||||
// eslint-disable-next-line no-extend-native
|
|
||||||
Array.prototype.equals = function (array, strict = true) {
|
Array.prototype.equals = function (array, strict = true) {
|
||||||
if (!array) return false;
|
if (!array) return false;
|
||||||
|
|
||||||
|
@ -27,7 +26,6 @@ export const ArrayExtensions = () => {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if ([].lastElement === undefined) {
|
if ([].lastElement === undefined) {
|
||||||
// eslint-disable-next-line no-extend-native
|
|
||||||
Array.prototype.lastElement = function () {
|
Array.prototype.lastElement = function () {
|
||||||
const instanceCheck = this;
|
const instanceCheck = this;
|
||||||
if (instanceCheck === undefined) {
|
if (instanceCheck === undefined) {
|
||||||
|
@ -39,7 +37,6 @@ export const ArrayExtensions = () => {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if ([].isEmpty === undefined) {
|
if ([].isEmpty === undefined) {
|
||||||
// eslint-disable-next-line no-extend-native
|
|
||||||
Array.prototype.isEmpty = function () {
|
Array.prototype.isEmpty = function () {
|
||||||
return this.length === 0;
|
return this.length === 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
export const StringExtensions = () => {
|
export const StringExtensions = () => {
|
||||||
if ("".isEmpty === undefined) {
|
if ("".isEmpty === undefined) {
|
||||||
// eslint-disable-next-line no-extend-native
|
|
||||||
String.prototype.isEmpty = function () {
|
String.prototype.isEmpty = function () {
|
||||||
return this.length === 0;
|
return this.length === 0;
|
||||||
};
|
};
|
||||||
|
@ -11,7 +10,6 @@ export const StringExtensions = () => {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if ("".isNotEmpty === undefined) {
|
if ("".isNotEmpty === undefined) {
|
||||||
// eslint-disable-next-line no-extend-native
|
|
||||||
String.prototype.isNotEmpty = function () {
|
String.prototype.isNotEmpty = function () {
|
||||||
return this.length !== 0;
|
return this.length !== 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,7 +9,7 @@ export interface Parts {
|
||||||
name: string;
|
name: string;
|
||||||
part_path: string;
|
part_path: string;
|
||||||
material_path: string;
|
material_path: string;
|
||||||
httpUrl?: string;
|
stlUrl?: string;
|
||||||
}
|
}
|
||||||
export class RobossemblerAssetsNetworkMapperScenario extends CallbackStrategyWithEmpty {
|
export class RobossemblerAssetsNetworkMapperScenario extends CallbackStrategyWithEmpty {
|
||||||
call = async (): ResponseBase => (await new SearchManyDataBaseModelUseCase<IProjectModel>(ProjectDBModel).call({ isActive: true }, 'is dont active projects')).map((projectModel) => {
|
call = async (): ResponseBase => (await new SearchManyDataBaseModelUseCase<IProjectModel>(ProjectDBModel).call({ isActive: true }, 'is dont active projects')).map((projectModel) => {
|
||||||
|
@ -22,8 +22,7 @@ export class RobossemblerAssetsNetworkMapperScenario extends CallbackStrategyWit
|
||||||
).map((model) => {
|
).map((model) => {
|
||||||
|
|
||||||
model.map((el) => {
|
model.map((el) => {
|
||||||
el.httpUrl = address + '/' + rootDir.match(new RegExp(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gm))[0] + '/assets/libs/objects/' + el.name + '.glb'
|
el.stlUrl = address + '/' + rootDir.match(new RegExp(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gm))[0] + '/assets/' + el.part_path
|
||||||
// server/build/public/0ddbb777-8002-4424-a3b0-d869783cca97/assets/libs/objects/planet_gear.glb
|
|
||||||
return el
|
return el
|
||||||
})
|
})
|
||||||
return Result.ok(model);
|
return Result.ok(model);
|
||||||
|
|
34
ui/package-lock.json
generated
34
ui/package-lock.json
generated
|
@ -50,6 +50,7 @@
|
||||||
"sass": "^1.66.1",
|
"sass": "^1.66.1",
|
||||||
"serve": "^14.2.1",
|
"serve": "^14.2.1",
|
||||||
"socket.io-client": "^4.7.2",
|
"socket.io-client": "^4.7.2",
|
||||||
|
"source-map-loader": "^5.0.0",
|
||||||
"styled-components": "^6.1.8",
|
"styled-components": "^6.1.8",
|
||||||
"three": "^0.165.0",
|
"three": "^0.165.0",
|
||||||
"three-stdlib": "^2.28.9",
|
"three-stdlib": "^2.28.9",
|
||||||
|
@ -14874,6 +14875,26 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/react-scripts/node_modules/source-map-loader": {
|
||||||
|
"version": "3.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/source-map-loader/-/source-map-loader-3.0.2.tgz",
|
||||||
|
"integrity": "sha512-BokxPoLjyl3iOrgkWaakaxqnelAJSS+0V+De0kKIq6lyWrXuiPgYTGp6z3iHmqljKAaLXwZa+ctD8GccRJeVvg==",
|
||||||
|
"dependencies": {
|
||||||
|
"abab": "^2.0.5",
|
||||||
|
"iconv-lite": "^0.6.3",
|
||||||
|
"source-map-js": "^1.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 12.13.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/webpack"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"webpack": "^5.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/read-cache": {
|
"node_modules/read-cache": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz",
|
||||||
|
@ -15994,23 +16015,22 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/source-map-loader": {
|
"node_modules/source-map-loader": {
|
||||||
"version": "3.0.2",
|
"version": "5.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/source-map-loader/-/source-map-loader-3.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/source-map-loader/-/source-map-loader-5.0.0.tgz",
|
||||||
"integrity": "sha512-BokxPoLjyl3iOrgkWaakaxqnelAJSS+0V+De0kKIq6lyWrXuiPgYTGp6z3iHmqljKAaLXwZa+ctD8GccRJeVvg==",
|
"integrity": "sha512-k2Dur7CbSLcAH73sBcIkV5xjPV4SzqO1NJ7+XaQl8if3VODDUj3FNchNGpqgJSKbvUfJuhVdv8K2Eu8/TNl2eA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"abab": "^2.0.5",
|
|
||||||
"iconv-lite": "^0.6.3",
|
"iconv-lite": "^0.6.3",
|
||||||
"source-map-js": "^1.0.1"
|
"source-map-js": "^1.0.2"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 12.13.0"
|
"node": ">= 18.12.0"
|
||||||
},
|
},
|
||||||
"funding": {
|
"funding": {
|
||||||
"type": "opencollective",
|
"type": "opencollective",
|
||||||
"url": "https://opencollective.com/webpack"
|
"url": "https://opencollective.com/webpack"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"webpack": "^5.0.0"
|
"webpack": "^5.72.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/source-map-support": {
|
"node_modules/source-map-support": {
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
"sass": "^1.66.1",
|
"sass": "^1.66.1",
|
||||||
"serve": "^14.2.1",
|
"serve": "^14.2.1",
|
||||||
"socket.io-client": "^4.7.2",
|
"socket.io-client": "^4.7.2",
|
||||||
|
"source-map-loader": "^5.0.0",
|
||||||
"styled-components": "^6.1.8",
|
"styled-components": "^6.1.8",
|
||||||
"three": "^0.165.0",
|
"three": "^0.165.0",
|
||||||
"three-stdlib": "^2.28.9",
|
"three-stdlib": "^2.28.9",
|
||||||
|
@ -59,7 +60,7 @@
|
||||||
"xml-formatter": "^3.6.2"
|
"xml-formatter": "^3.6.2"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "GENERATE_SOURCEMAP=false && react-scripts start",
|
"dev": "react-scripts start",
|
||||||
"build": "react-scripts build",
|
"build": "react-scripts build",
|
||||||
"test": "react-scripts test",
|
"test": "react-scripts test",
|
||||||
"eject": "react-scripts eject",
|
"eject": "react-scripts eject",
|
||||||
|
@ -67,9 +68,7 @@
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"extends": [
|
"extends": [
|
||||||
"react-app",
|
"react-app" ]
|
||||||
"react-app/jest"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"browserslist": {
|
"browserslist": {
|
||||||
"production": [
|
"production": [
|
||||||
|
|
|
@ -3,7 +3,6 @@ import { Result } from "../helper/result";
|
||||||
/* eslint-disable @typescript-eslint/no-this-alias */
|
/* eslint-disable @typescript-eslint/no-this-alias */
|
||||||
export const ArrayExtensions = () => {
|
export const ArrayExtensions = () => {
|
||||||
if ([].equals === undefined) {
|
if ([].equals === undefined) {
|
||||||
// eslint-disable-next-line no-extend-native
|
|
||||||
Array.prototype.equals = function (array, strict = true) {
|
Array.prototype.equals = function (array, strict = true) {
|
||||||
if (!array) return false;
|
if (!array) return false;
|
||||||
|
|
||||||
|
@ -24,7 +23,6 @@ export const ArrayExtensions = () => {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if ([].lastElement === undefined) {
|
if ([].lastElement === undefined) {
|
||||||
// eslint-disable-next-line no-extend-native
|
|
||||||
Array.prototype.lastElement = function () {
|
Array.prototype.lastElement = function () {
|
||||||
const instanceCheck = this;
|
const instanceCheck = this;
|
||||||
if (instanceCheck === undefined) {
|
if (instanceCheck === undefined) {
|
||||||
|
@ -36,31 +34,26 @@ export const ArrayExtensions = () => {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if ([].isEmpty === undefined) {
|
if ([].isEmpty === undefined) {
|
||||||
// eslint-disable-next-line no-extend-native
|
|
||||||
Array.prototype.isEmpty = function () {
|
Array.prototype.isEmpty = function () {
|
||||||
return this.length === 0;
|
return this.length === 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if ([].isNotEmpty === undefined) {
|
if ([].isNotEmpty === undefined) {
|
||||||
// eslint-disable-next-line no-extend-native
|
|
||||||
Array.prototype.isNotEmpty = function () {
|
Array.prototype.isNotEmpty = function () {
|
||||||
return this.length !== 0;
|
return this.length !== 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if ([].hasIncludeElement === undefined) {
|
if ([].hasIncludeElement === undefined) {
|
||||||
// eslint-disable-next-line no-extend-native
|
|
||||||
Array.prototype.hasIncludeElement = function (element) {
|
Array.prototype.hasIncludeElement = function (element) {
|
||||||
return this.indexOf(element) !== -1;
|
return this.indexOf(element) !== -1;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if ([].repeat === undefined) {
|
if ([].repeat === undefined) {
|
||||||
// eslint-disable-next-line no-extend-native
|
|
||||||
Array.prototype.repeat = function (quantity) {
|
Array.prototype.repeat = function (quantity) {
|
||||||
return Array(quantity).fill(this).flat(1);
|
return Array(quantity).fill(this).flat(1);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if ([].rFind === undefined) {
|
if ([].rFind === undefined) {
|
||||||
// eslint-disable-next-line no-extend-native
|
|
||||||
Array.prototype.rFind = function (predicate) {
|
Array.prototype.rFind = function (predicate) {
|
||||||
const result = this.find(predicate as any);
|
const result = this.find(predicate as any);
|
||||||
if (result === undefined) {
|
if (result === undefined) {
|
||||||
|
@ -70,7 +63,6 @@ export const ArrayExtensions = () => {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if ([].maxLength === undefined) {
|
if ([].maxLength === undefined) {
|
||||||
// eslint-disable-next-line no-extend-native
|
|
||||||
Array.prototype.maxLength = function (length) {
|
Array.prototype.maxLength = function (length) {
|
||||||
if (this.length > length) {
|
if (this.length > length) {
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -42,6 +42,7 @@ declare global {
|
||||||
isEqualMany(str: string[]): boolean;
|
isEqualMany(str: string[]): boolean;
|
||||||
hasPattern(pattern: string): boolean;
|
hasPattern(pattern: string): boolean;
|
||||||
hasNoPattern(pattern: string): boolean;
|
hasNoPattern(pattern: string): boolean;
|
||||||
|
divideByIndex(index: number): string[]
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Map<K, V> {
|
interface Map<K, V> {
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
export const MapExtensions = () => {
|
export const MapExtensions = () => {
|
||||||
if (Map.prototype.addValueOrMakeCallback === undefined) {
|
if (Map.prototype.addValueOrMakeCallback === undefined) {
|
||||||
// eslint-disable-next-line no-extend-native
|
|
||||||
Map.prototype.addValueOrMakeCallback = function (key, value, fn) {
|
Map.prototype.addValueOrMakeCallback = function (key, value, fn) {
|
||||||
if (this.has(key)) {
|
if (this.has(key)) {
|
||||||
this.set(key, value);
|
this.set(key, value);
|
||||||
|
@ -12,7 +11,6 @@ export const MapExtensions = () => {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (Map.prototype.getKeyFromValueIsExists === undefined) {
|
if (Map.prototype.getKeyFromValueIsExists === undefined) {
|
||||||
// eslint-disable-next-line no-extend-native
|
|
||||||
Map.prototype.getKeyFromValueIsExists = function (value) {
|
Map.prototype.getKeyFromValueIsExists = function (value) {
|
||||||
let result;
|
let result;
|
||||||
this.forEach((el, key) => {
|
this.forEach((el, key) => {
|
||||||
|
@ -24,7 +22,6 @@ export const MapExtensions = () => {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (Map.prototype.overrideValue === undefined) {
|
if (Map.prototype.overrideValue === undefined) {
|
||||||
// eslint-disable-next-line no-extend-native
|
|
||||||
Map.prototype.overrideValue = function (key, value) {
|
Map.prototype.overrideValue = function (key, value) {
|
||||||
const result = this.get(key);
|
const result = this.get(key);
|
||||||
|
|
||||||
|
@ -32,7 +29,6 @@ export const MapExtensions = () => {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (Map.prototype.keysToJson === undefined) {
|
if (Map.prototype.keysToJson === undefined) {
|
||||||
// eslint-disable-next-line no-extend-native
|
|
||||||
Map.prototype.keysToJson = function () {
|
Map.prototype.keysToJson = function () {
|
||||||
const result: any[] = [];
|
const result: any[] = [];
|
||||||
this.forEach((el) => result.push(el));
|
this.forEach((el) => result.push(el));
|
||||||
|
@ -40,13 +36,11 @@ export const MapExtensions = () => {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (Map.prototype.toArray === undefined) {
|
if (Map.prototype.toArray === undefined) {
|
||||||
// eslint-disable-next-line no-extend-native
|
|
||||||
Map.prototype.toArray = function () {
|
Map.prototype.toArray = function () {
|
||||||
return Array.from(this.values());
|
return Array.from(this.values());
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (Map.prototype.getPredicateValue === undefined) {
|
if (Map.prototype.getPredicateValue === undefined) {
|
||||||
// eslint-disable-next-line no-extend-native
|
|
||||||
Map.prototype.getPredicateValue = function (callBack) {
|
Map.prototype.getPredicateValue = function (callBack) {
|
||||||
const result: any[] = [];
|
const result: any[] = [];
|
||||||
this.forEach((el, key) => {
|
this.forEach((el, key) => {
|
||||||
|
@ -59,7 +53,6 @@ export const MapExtensions = () => {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (Map.prototype.incrementValue === undefined) {
|
if (Map.prototype.incrementValue === undefined) {
|
||||||
// eslint-disable-next-line no-extend-native
|
|
||||||
Map.prototype.incrementValue = function (key) {
|
Map.prototype.incrementValue = function (key) {
|
||||||
if (this.get(key)) {
|
if (this.get(key)) {
|
||||||
this.set(key, this.get(key) + 1);
|
this.set(key, this.get(key) + 1);
|
||||||
|
|
|
@ -1,45 +1,39 @@
|
||||||
export const NumberExtensions = () => {
|
export const NumberExtensions = () => {
|
||||||
if (Number().fromArray === undefined) {
|
if (Number().fromArray === undefined) {
|
||||||
// eslint-disable-next-line no-extend-native
|
|
||||||
Number.prototype.fromArray = function () {
|
Number.prototype.fromArray = function () {
|
||||||
return Array.from(this.toString()).map((el) => Number(el));
|
return Array.from(this.toString()).map((el) => Number(el));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (Number().toPx === undefined) {
|
if (Number().toPx === undefined) {
|
||||||
// eslint-disable-next-line no-extend-native
|
|
||||||
Number.prototype.toPx = function () {
|
Number.prototype.toPx = function () {
|
||||||
return String(this) + "px";
|
return String(this) + "px";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (Number().unixFromDate === undefined) {
|
if (Number().unixFromDate === undefined) {
|
||||||
// eslint-disable-next-line no-extend-native
|
|
||||||
Number.prototype.unixFromDate = function () {
|
Number.prototype.unixFromDate = function () {
|
||||||
const date = new Date(Number(this) * 1000);
|
const date = new Date(Number(this) * 1000);
|
||||||
return `${date.getUTCFullYear()}.${date.getMonth()}.${date.getDay()} ${date.getHours()}:${date.getMinutes()}`;
|
return `${date.getUTCFullYear()}.${date.getMonth()}.${date.getDay()} ${date.getHours()}:${date.getMinutes()}`;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (Number().isValid === undefined) {
|
if (Number().isValid === undefined) {
|
||||||
// eslint-disable-next-line no-extend-native
|
|
||||||
Number.prototype.isValid = function (str: string) {
|
Number.prototype.isValid = function (str: string) {
|
||||||
return !isNaN(Number(str));
|
return !isNaN(Number(str));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (Number().randRange === undefined) {
|
if (Number().randRange === undefined) {
|
||||||
// eslint-disable-next-line no-extend-native
|
|
||||||
Number.prototype.randRange = function (min, max) {
|
Number.prototype.randRange = function (min, max) {
|
||||||
return Math.random() * (max - min) + min;
|
return Math.random() * (max - min) + min;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (Number().isPositive === undefined) {
|
if (Number().isPositive === undefined) {
|
||||||
// eslint-disable-next-line no-extend-native
|
|
||||||
Number.prototype.isPositive = function () {
|
Number.prototype.isPositive = function () {
|
||||||
return Math.sign(Number(this)) === 1;
|
return Math.sign(Number(this)) === 1;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if(Number().isNegative === undefined){
|
if(Number().isNegative === undefined){
|
||||||
// eslint-disable-next-line no-extend-native
|
|
||||||
Number.prototype.isNegative = function (){
|
Number.prototype.isNegative = function (){
|
||||||
return !this.isPositive()
|
return !this.isPositive()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
/* eslint-disable no-extend-native */
|
/* eslint-disable no-extend-native */
|
||||||
export const StringExtensions = () => {
|
export const StringExtensions = () => {
|
||||||
if ("".isEmpty === undefined) {
|
if ("".isEmpty === undefined) {
|
||||||
// eslint-disable-next-line no-extend-native
|
|
||||||
String.prototype.isEmpty = function () {
|
String.prototype.isEmpty = function () {
|
||||||
return this.length === 0;
|
return this.length === 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if ("".isNotEmpty === undefined) {
|
if ("".isNotEmpty === undefined) {
|
||||||
// eslint-disable-next-line no-extend-native
|
|
||||||
String.prototype.isNotEmpty = function () {
|
String.prototype.isNotEmpty = function () {
|
||||||
return this.length !== 0;
|
return this.length !== 0;
|
||||||
};
|
};
|
||||||
|
@ -46,4 +44,13 @@ export const StringExtensions = () => {
|
||||||
return !this.hasPattern(pattern);
|
return !this.hasPattern(pattern);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
if (''.divideByIndex === undefined) {
|
||||||
|
String.prototype.divideByIndex = function (index) {
|
||||||
|
if (this.at(index) === undefined) {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
|
||||||
|
return [this.slice(0, index), this.slice(index+1, this.length)]
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -40,3 +40,5 @@ export class TypedEvent<T> {
|
||||||
return this.on((e) => te.emit(e));
|
return this.on((e) => te.emit(e));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,37 +1,36 @@
|
||||||
import { Scene, Engine, MeshBuilder, FreeCamera, HemisphericLight, Vector3, SceneLoader } from 'babylonjs';
|
import { Scene, Engine, MeshBuilder, FreeCamera, HemisphericLight, Vector3, SceneLoader } from 'babylonjs';
|
||||||
import { GLTFFileLoader, STLFileLoader } from 'babylonjs-loaders';
|
import { GLTFFileLoader } from 'babylonjs-loaders';
|
||||||
|
|
||||||
|
|
||||||
export class BabylonRepository {
|
export class BabylonRepository {
|
||||||
engine: Engine;
|
engine: Engine;
|
||||||
canvas: HTMLCanvasElement;
|
canvas: HTMLCanvasElement;
|
||||||
scene: Scene;
|
scene: Scene;
|
||||||
|
sceneLoader: SceneLoader
|
||||||
constructor(canvas: HTMLCanvasElement) {
|
constructor(canvas: HTMLCanvasElement) {
|
||||||
|
this.sceneLoader = new SceneLoader();
|
||||||
this.engine = new Engine(canvas, true);
|
this.engine = new Engine(canvas, true);
|
||||||
this.scene = this.CreateScene();
|
this.scene = new Scene(this.engine);
|
||||||
this.engine.runRenderLoop(() => {
|
this.engine.runRenderLoop(() => {
|
||||||
this.scene.render();
|
this.scene.render();
|
||||||
});
|
});
|
||||||
const Camera = new FreeCamera("camera", new Vector3(0, 1, -5), this.scene);
|
this.scene.createDefaultCameraOrLight(true, true, true);
|
||||||
Camera.attachControl();
|
new HemisphericLight("hemiLight", new Vector3(0, 1, 0));
|
||||||
const light = new HemisphericLight("light", new Vector3(0, 1, 0), this.scene);
|
|
||||||
light.intensity = 0.5;
|
|
||||||
//3D Object
|
|
||||||
// const ground = MeshBuilder.CreateGround("ground", { width: 10, height: 10 }, this.scene);
|
|
||||||
// const sphereball = MeshBuilder.CreateSphere("sphereball", { diameter: 1 }, this.scene);
|
|
||||||
// sphereball.position = new Vector3(0, 1, 0)
|
|
||||||
|
|
||||||
SceneLoader.RegisterPlugin(new GLTFFileLoader())
|
SceneLoader.RegisterPlugin(new GLTFFileLoader())
|
||||||
SceneLoader.RegisterPlugin(new STLFileLoader());
|
SceneLoader.ImportMeshAsync("",
|
||||||
|
"http://localhost:4001/1dfc4e1a-9c1a-4fa2-96b2-19c86acb6ea4/assets/libs/objects/",
|
||||||
|
"sol_gear.glb", this.scene)
|
||||||
|
|
||||||
}
|
}
|
||||||
CreateScene(): Scene {
|
deleteAllObjectsScene = () => this.scene.meshes.forEach((el) => this.scene.removeMesh(el, true))
|
||||||
const scene = new Scene(this.engine);
|
|
||||||
return scene;
|
|
||||||
}
|
|
||||||
load = (url: string) => {
|
|
||||||
|
|
||||||
SceneLoader.LoadAssetContainer(url)
|
loadHttp = (url: string) => {
|
||||||
|
const divide = url.divideByIndex(url.lastIndexOf('/'))
|
||||||
|
|
||||||
|
SceneLoader.ImportMeshAsync("",
|
||||||
|
`${divide.at(0)}/`,
|
||||||
|
`${divide.at(1)}`, this.scene).then((frame) => {
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -20,9 +20,7 @@ import {
|
||||||
CameraHelper,
|
CameraHelper,
|
||||||
Quaternion,
|
Quaternion,
|
||||||
MeshBasicMaterial,
|
MeshBasicMaterial,
|
||||||
PlaneGeometry,
|
|
||||||
BoxGeometry,
|
BoxGeometry,
|
||||||
AxesHelper,
|
|
||||||
MeshStandardMaterial
|
MeshStandardMaterial
|
||||||
} from "three";
|
} from "three";
|
||||||
import { TypedEvent } from "../helper/typed_event";
|
import { TypedEvent } from "../helper/typed_event";
|
||||||
|
@ -37,8 +35,9 @@ import { SceneMode } from "../../features/scene_manager/model/scene_view";
|
||||||
import { throttle } from "../helper/throttle";
|
import { throttle } from "../helper/throttle";
|
||||||
import { Asset, InstanceRgbCamera, RobossemblerAssets, SceneSimpleObject } from "../model/robossembler_assets";
|
import { Asset, InstanceRgbCamera, RobossemblerAssets, SceneSimpleObject } from "../model/robossembler_assets";
|
||||||
import { LoadingManager } from 'three';
|
import { LoadingManager } from 'three';
|
||||||
import URDFLoader, { URDFLink } from 'urdf-loader';
|
|
||||||
import { UrdfTransforms, coordsToQuaternion } from "../../features/simulations/tranforms_model";
|
import { UrdfTransforms, coordsToQuaternion } from "../../features/simulations/tranforms_model";
|
||||||
|
import URDFLoader, { URDFLink } from 'urdf-loader';
|
||||||
|
|
||||||
|
|
||||||
Object3D.DEFAULT_UP = new Vector3(0, 0, 1);
|
Object3D.DEFAULT_UP = new Vector3(0, 0, 1);
|
||||||
|
|
||||||
|
@ -46,6 +45,7 @@ export enum UserData {
|
||||||
selectedObject = "selected_object",
|
selectedObject = "selected_object",
|
||||||
cameraInitialization = "camera_initialization",
|
cameraInitialization = "camera_initialization",
|
||||||
objectForMagnetism = "object_for_magnetism",
|
objectForMagnetism = "object_for_magnetism",
|
||||||
|
loadObject = 'load_object'
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IEventDraggingChange {
|
interface IEventDraggingChange {
|
||||||
|
@ -104,16 +104,26 @@ export class CoreThreeRepository extends TypedEvent<BaseSceneItemModel> {
|
||||||
|
|
||||||
this.scene.add(this.transformControls);
|
this.scene.add(this.transformControls);
|
||||||
this.orbitControls = new OrbitControls(this.camera, this.htmlCanvasRef);
|
this.orbitControls = new OrbitControls(this.camera, this.htmlCanvasRef);
|
||||||
this.scene.background = new Color("black");
|
this.scene.background = new Color("white");
|
||||||
|
|
||||||
this.init();
|
this.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
deleteAllObjectsScene = () => {
|
||||||
|
|
||||||
|
|
||||||
|
this.getAllSceneNameModels().forEach((el) => this.scene.remove(this.scene.getObjectByName(el) as Object3D<Object3DEventMap>))
|
||||||
|
}
|
||||||
|
|
||||||
drawPoint(point: Vector3): Mesh<BoxGeometry, MeshBasicMaterial, Object3DEventMap> {
|
drawPoint(point: Vector3): Mesh<BoxGeometry, MeshBasicMaterial, Object3DEventMap> {
|
||||||
var cube = new Mesh(new BoxGeometry(0.5, 0.5, 0.5), new MeshBasicMaterial({ color: 0x0095dd }));
|
var cube = new Mesh(new BoxGeometry(0.5, 0.5, 0.5), new MeshBasicMaterial({ color: 0x0095dd }));
|
||||||
cube.position.add(point);
|
cube.position.add(point);
|
||||||
this.scene.add(cube);
|
this.scene.add(cube);
|
||||||
return cube;
|
return cube;
|
||||||
}
|
}
|
||||||
|
getCenterPoint = (object: Object3D<Object3DEventMap>) => object.getWorldPosition(new Box3().setFromObject(object).getCenter(object.position));
|
||||||
|
|
||||||
|
|
||||||
makeCube(inc: number, vector?: Vector3, color?: string, size?: number) {
|
makeCube(inc: number, vector?: Vector3, color?: string, size?: number) {
|
||||||
const cube = new Mesh(
|
const cube = new Mesh(
|
||||||
new BoxGeometry(size ?? 10, size ?? 10, size ?? 10),
|
new BoxGeometry(size ?? 10, size ?? 10, size ?? 10),
|
||||||
|
@ -128,6 +138,7 @@ export class CoreThreeRepository extends TypedEvent<BaseSceneItemModel> {
|
||||||
}
|
}
|
||||||
this.scene.add(cube);
|
this.scene.add(cube);
|
||||||
}
|
}
|
||||||
|
|
||||||
makePoint(vector?: Vector3, color?: string, size?: number) {
|
makePoint(vector?: Vector3, color?: string, size?: number) {
|
||||||
const cube = new Mesh(
|
const cube = new Mesh(
|
||||||
new BoxGeometry(size ?? 10, size ?? 10, size ?? 10),
|
new BoxGeometry(size ?? 10, size ?? 10, size ?? 10),
|
||||||
|
@ -152,7 +163,6 @@ export class CoreThreeRepository extends TypedEvent<BaseSceneItemModel> {
|
||||||
robot => {
|
robot => {
|
||||||
|
|
||||||
this.scene.add(robot)
|
this.scene.add(robot)
|
||||||
console.log(robot)
|
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
this.sceneFrame = robot.frames
|
this.sceneFrame = robot.frames
|
||||||
|
|
||||||
|
@ -188,14 +198,18 @@ export class CoreThreeRepository extends TypedEvent<BaseSceneItemModel> {
|
||||||
new Quaternion(0, 0, 0, 0)
|
new Quaternion(0, 0, 0, 0)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
load(path: string, name: string, loadCallback?: Function) {
|
loadHttpAndPreview(path: string, name: string, loadCallback?: Function) {
|
||||||
|
|
||||||
this.loader(
|
this.loader(
|
||||||
'http://localhost:4001/1dfc4e1a-9c1a-4fa2-96b2-19c86acb6ea4/assets/libs/objects/untitled.glb',
|
path,
|
||||||
loadCallback ? loadCallback : () => { },
|
() => {
|
||||||
|
// this.fitCameraToCenteredObject([name])
|
||||||
|
// this.scene.getObjectByName(name)
|
||||||
|
},
|
||||||
name,
|
name,
|
||||||
|
new Vector3(0, 0, 0)
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setTransformMode(mode?: SceneMode) {
|
setTransformMode(mode?: SceneMode) {
|
||||||
|
@ -324,6 +338,7 @@ export class CoreThreeRepository extends TypedEvent<BaseSceneItemModel> {
|
||||||
floor.userData = {};
|
floor.userData = {};
|
||||||
floor.userData[UserData.cameraInitialization] = true;
|
floor.userData[UserData.cameraInitialization] = true;
|
||||||
floor.up.copy(new Vector3(0, 0, 1))
|
floor.up.copy(new Vector3(0, 0, 1))
|
||||||
|
|
||||||
this.scene.add(floor);
|
this.scene.add(floor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,7 +366,6 @@ export class CoreThreeRepository extends TypedEvent<BaseSceneItemModel> {
|
||||||
|
|
||||||
loader(url: string, callBack: Function, name: string, position?: Vector3, quaternion?: Quaternion) {
|
loader(url: string, callBack: Function, name: string, position?: Vector3, quaternion?: Quaternion) {
|
||||||
const ext = url.split(/\./g).pop()!.toLowerCase();
|
const ext = url.split(/\./g).pop()!.toLowerCase();
|
||||||
|
|
||||||
switch (ext) {
|
switch (ext) {
|
||||||
case "gltf":
|
case "gltf":
|
||||||
case "glb":
|
case "glb":
|
||||||
|
@ -359,7 +373,7 @@ export class CoreThreeRepository extends TypedEvent<BaseSceneItemModel> {
|
||||||
url,
|
url,
|
||||||
(result) => {
|
(result) => {
|
||||||
this.scene.add(result.scene)
|
this.scene.add(result.scene)
|
||||||
|
callBack()
|
||||||
},
|
},
|
||||||
(err) => { }
|
(err) => { }
|
||||||
);
|
);
|
||||||
|
@ -378,6 +392,7 @@ export class CoreThreeRepository extends TypedEvent<BaseSceneItemModel> {
|
||||||
|
|
||||||
this.emit(new StaticAssetItemModel(el.name, el.position, el.quaternion));
|
this.emit(new StaticAssetItemModel(el.name, el.position, el.quaternion));
|
||||||
this.scene.add(el);
|
this.scene.add(el);
|
||||||
|
callBack()
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
(err) => { }
|
(err) => { }
|
||||||
|
@ -396,6 +411,7 @@ export class CoreThreeRepository extends TypedEvent<BaseSceneItemModel> {
|
||||||
this.stlLoader.load(
|
this.stlLoader.load(
|
||||||
url,
|
url,
|
||||||
(result) => {
|
(result) => {
|
||||||
|
|
||||||
const material = new MeshStandardMaterial({
|
const material = new MeshStandardMaterial({
|
||||||
color: 'red',
|
color: 'red',
|
||||||
metalness: 0.35,
|
metalness: 0.35,
|
||||||
|
@ -404,9 +420,20 @@ export class CoreThreeRepository extends TypedEvent<BaseSceneItemModel> {
|
||||||
transparent: false,
|
transparent: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
const mesh = new Mesh(result, material);
|
|
||||||
this.scene.add(mesh);
|
|
||||||
|
|
||||||
|
const mesh = new Mesh(result, material);
|
||||||
|
mesh.name = name;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// var geometry = mesh.geometry;
|
||||||
|
// geometry.computeBoundingBox(); // Вычисляем ограничивающий параллелепипед для геометрии
|
||||||
|
|
||||||
|
if (position) mesh.position.copy(position)
|
||||||
|
|
||||||
|
this.scene.add(mesh);
|
||||||
|
callBack()
|
||||||
},
|
},
|
||||||
|
|
||||||
(err) => { }
|
(err) => { }
|
||||||
|
@ -500,8 +527,7 @@ export class CoreThreeRepository extends TypedEvent<BaseSceneItemModel> {
|
||||||
urdfTransforms.transforms.forEach((transform) => {
|
urdfTransforms.transforms.forEach((transform) => {
|
||||||
if (this.sceneFrame) {
|
if (this.sceneFrame) {
|
||||||
const currentLink = this.sceneFrame[transform?.child_frame_id ?? ""]
|
const currentLink = this.sceneFrame[transform?.child_frame_id ?? ""]
|
||||||
const currentLinkParrent = this.sceneFrame[transform?.header.frame_id ?? ""]
|
|
||||||
// currentLink.position.copy(coordsToVector(transform.transform.translation))
|
|
||||||
currentLink.quaternion.copy(coordsToQuaternion(transform.transform.rotation))
|
currentLink.quaternion.copy(coordsToQuaternion(transform.transform.rotation))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
import { ClassConstructor, plainToInstance } from "class-transformer";
|
import { ClassConstructor, plainToInstance } from "class-transformer";
|
||||||
import { Result } from "../helper/result";
|
import { Result } from "../helper/result";
|
||||||
|
import { Parts } from "../../features/details/details_http_repository";
|
||||||
|
import { UUID } from "../../features/all_projects/data/project_repository";
|
||||||
|
|
||||||
export enum HttpMethod {
|
export enum HttpMethod {
|
||||||
GET = "GET",
|
GET = "GET",
|
||||||
|
@ -16,7 +18,6 @@ export class HttpError extends Error {
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class HttpRepository {
|
export class HttpRepository {
|
||||||
private server = "http://localhost:4001";
|
private server = "http://localhost:4001";
|
||||||
public async _formDataRequest<T>(method: HttpMethod, url: string, data?: any): Promise<Result<HttpError, T>> {
|
public async _formDataRequest<T>(method: HttpMethod, url: string, data?: any): Promise<Result<HttpError, T>> {
|
||||||
|
@ -96,5 +97,13 @@ export class HttpRepository {
|
||||||
return Result.error(new HttpError(error, 0));
|
return Result.error(new HttpError(error, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class CoreHttpRepository extends HttpRepository {
|
||||||
|
getAssetsActiveProject = async (): Promise<Result<HttpError, Parts[]>> => {
|
||||||
|
return this._jsonRequest<Parts[]>(HttpMethod.GET, "/projects/assets");
|
||||||
|
};
|
||||||
|
async getActiveProjectId() {
|
||||||
|
return this._jsonRequest<UUID>(HttpMethod.GET, "/projects/get/active/project/id");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
|
@ -27,15 +27,17 @@ const Block = (props: IBlockProps) => {
|
||||||
style={
|
style={
|
||||||
props.isActive
|
props.isActive
|
||||||
? {
|
? {
|
||||||
textAlignLast: "center",
|
textAlignLast: "center",
|
||||||
height: 32,
|
height: 32,
|
||||||
backgroundColor: "rgba(232, 222, 248, 1)",
|
backgroundColor: "rgba(232, 222, 248, 1)",
|
||||||
marginLeft: 5,
|
marginLeft: 5,
|
||||||
marginRight: 5,
|
marginRight: 5,
|
||||||
alignContent: "center",
|
alignContent: "center",
|
||||||
borderRadius: 12,
|
borderRadius: 12,
|
||||||
}
|
}
|
||||||
: { textAlignLast: "center", alignContent: "center" }
|
: {
|
||||||
|
textAlignLast: "center", alignContent: "center", height: 32,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<Icon type={props.icon ?? ""} />
|
<Icon type={props.icon ?? ""} />
|
||||||
|
|
|
@ -1,17 +1,15 @@
|
||||||
import { HttpMethod, HttpRepository } from "../../../core/repository/http_repository";
|
import { HttpMethod, CoreHttpRepository } from "../../../core/repository/http_repository";
|
||||||
import { IProjectModel } from "../model/project_model";
|
import { IProjectModel } from "../model/project_model";
|
||||||
|
|
||||||
export interface UUID {
|
export interface UUID {
|
||||||
id: string;
|
id: string;
|
||||||
}
|
}
|
||||||
export class ProjectRepository extends HttpRepository {
|
export class ProjectRepository extends CoreHttpRepository {
|
||||||
async getAllProject() {
|
async getAllProject() {
|
||||||
return this._jsonRequest<IProjectModel[]>(HttpMethod.GET, "/projects");
|
return this._jsonRequest<IProjectModel[]>(HttpMethod.GET, "/projects");
|
||||||
}
|
}
|
||||||
|
|
||||||
async getActivePipeline() {
|
|
||||||
return this._jsonRequest<UUID>(HttpMethod.GET, "/projects/get/active/project/id");
|
|
||||||
}
|
|
||||||
async setActivePipeline(id: string) {
|
async setActivePipeline(id: string) {
|
||||||
return this._jsonRequest(HttpMethod.POST, `/projects/set/active/project?id=${id}`);
|
return this._jsonRequest(HttpMethod.POST, `/projects/set/active/project?id=${id}`);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,11 +32,11 @@ export class AllProjectStore extends SimpleErrorState {
|
||||||
await this.mapOk<IProjectModel[]>("projectsModels", this.repository.getAllProject());
|
await this.mapOk<IProjectModel[]>("projectsModels", this.repository.getAllProject());
|
||||||
}
|
}
|
||||||
async getActiveProjectId(): Promise<void> {
|
async getActiveProjectId(): Promise<void> {
|
||||||
await this.mapOk<UUID>("activeProjectId", this.repository.getActivePipeline());
|
await this.mapOk<UUID>("activeProjectId", this.repository.getActiveProjectId());
|
||||||
}
|
}
|
||||||
setActiveProject = async (id: string) => {
|
setActiveProject = async (id: string) => {
|
||||||
await this.messageHttp(this.repository.setActivePipeline(id), { successMessage: "проект активирован", errorMessage: 'ошибка активации' })
|
await this.messageHttp(this.repository.setActivePipeline(id), { successMessage: "проект активирован", errorMessage: 'ошибка активации' })
|
||||||
await this.mapOk<UUID>("activeProjectId", this.repository.getActivePipeline());
|
await this.mapOk<UUID>("activeProjectId", this.repository.getActiveProjectId());
|
||||||
await this.mapOk<IProjectModel[]>("projectsModels", this.repository.getAllProject());
|
await this.mapOk<IProjectModel[]>("projectsModels", this.repository.getAllProject());
|
||||||
}
|
}
|
||||||
async init() {
|
async init() {
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { Result } from "../../../core/helper/result";
|
import { Result } from "../../../core/helper/result";
|
||||||
import { Skills } from "../../../core/model/skill_model";
|
import { Skills } from "../../../core/model/skill_model";
|
||||||
import { HttpError, HttpMethod, HttpRepository } from "../../../core/repository/http_repository";
|
import { HttpError, HttpMethod, CoreHttpRepository } from "../../../core/repository/http_repository";
|
||||||
import { UUID } from "../../all_projects/data/project_repository";
|
import { UUID } from "../../all_projects/data/project_repository";
|
||||||
import { BehaviorTreeModel } from "../model/behavior_tree_model";
|
import { BehaviorTreeModel } from "../model/behavior_tree_model";
|
||||||
import { BehaviorTreeViewModel } from "../model/behavior_tree_view_model";
|
import { BehaviorTreeViewModel } from "../model/behavior_tree_view_model";
|
||||||
|
|
||||||
export class BehaviorTreeBuilderHttpRepository extends HttpRepository {
|
export class BehaviorTreeBuilderHttpRepository extends CoreHttpRepository {
|
||||||
getAllBtInstances = async () => this._jsonRequest<BehaviorTreeModel[]>(HttpMethod.GET, "/behavior/trees");
|
getAllBtInstances = async () => this._jsonRequest<BehaviorTreeModel[]>(HttpMethod.GET, "/behavior/trees");
|
||||||
getBtSkills = async (): Promise<Result<HttpError, Skills>> => {
|
getBtSkills = async (): Promise<Result<HttpError, Skills>> => {
|
||||||
return (await this._jsonToClassInstanceRequest<Skills>(
|
return (await this._jsonToClassInstanceRequest<Skills>(
|
||||||
|
@ -21,9 +21,7 @@ export class BehaviorTreeBuilderHttpRepository extends HttpRepository {
|
||||||
`/behavior/trees/by_id?id=${id}`,
|
`/behavior/trees/by_id?id=${id}`,
|
||||||
BehaviorTreeModel
|
BehaviorTreeModel
|
||||||
) as unknown as Promise<Result<HttpError, BehaviorTreeModel>>;
|
) as unknown as Promise<Result<HttpError, BehaviorTreeModel>>;
|
||||||
getActiveProjectId(): Promise<Result<HttpError, UUID>> {
|
|
||||||
return this._jsonRequest<UUID>(HttpMethod.GET, "/projects/get/active/project/id");
|
|
||||||
}
|
|
||||||
editBt = async (model: BehaviorTreeModel) => {
|
editBt = async (model: BehaviorTreeModel) => {
|
||||||
await this._jsonRequest(HttpMethod.POST, "/behavior/trees/fill/tree", model);
|
await this._jsonRequest(HttpMethod.POST, "/behavior/trees/fill/tree", model);
|
||||||
return await this._jsonRequest(HttpMethod.PUT, "/behavior/trees", model);
|
return await this._jsonRequest(HttpMethod.PUT, "/behavior/trees", model);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Cameras } from "../../../../../../core/model/cameras";
|
import { Cameras } from "../../../../../../core/model/cameras";
|
||||||
import { HttpMethod, HttpRepository } from "../../../../../../core/repository/http_repository";
|
import { HttpMethod, CoreHttpRepository } from "../../../../../../core/repository/http_repository";
|
||||||
|
|
||||||
export class CameraDeviceHttpRepository extends HttpRepository {
|
export class CameraDeviceHttpRepository extends CoreHttpRepository {
|
||||||
getAllCameras = () => this._jsonRequest<Cameras>(HttpMethod.GET, '/behavior/trees/cameras');
|
getAllCameras = () => this._jsonRequest<Cameras>(HttpMethod.GET, '/behavior/trees/cameras');
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
import { HttpRepository } from "../../../../../../core/repository/http_repository";
|
import { CoreHttpRepository } from "../../../../../../core/repository/http_repository";
|
||||||
|
|
||||||
export class RobotDeviceFormHttpRepository extends HttpRepository {
|
export class RobotDeviceFormHttpRepository extends CoreHttpRepository {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { Topics } from "../../../../../../core/model/topics";
|
import { Topics } from "../../../../../../core/model/topics";
|
||||||
import { HttpMethod, HttpRepository } from "../../../../../../core/repository/http_repository";
|
import { HttpMethod, CoreHttpRepository } from "../../../../../../core/repository/http_repository";
|
||||||
|
|
||||||
export class TopicsFormHttpRepository extends HttpRepository {
|
export class TopicsFormHttpRepository extends CoreHttpRepository {
|
||||||
getAllTopics = () => this._jsonRequest<Topics>(HttpMethod.GET, '/behavior/trees/topics');
|
getAllTopics = () => this._jsonRequest<Topics>(HttpMethod.GET, '/behavior/trees/topics');
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ export const WeightsForm = observer((props: IWeightsFormProps) => {
|
||||||
}
|
}
|
||||||
style={{ width: "100%" }}
|
style={{ width: "100%" }}
|
||||||
options={
|
options={
|
||||||
store.assets?.assets.map((el) => {
|
store.parts?.map((el) => {
|
||||||
return { label: el.name, value: el.name };
|
return { label: el.name, value: el.name };
|
||||||
}) ?? []
|
}) ?? []
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
import makeAutoObservable from "mobx-store-inheritance";
|
import makeAutoObservable from "mobx-store-inheritance";
|
||||||
import { FormState, CoreError } from "../../../../../../core/store/base_store";
|
import { FormState, CoreError } from "../../../../../../core/store/base_store";
|
||||||
import { DataSetHttpRepository } from "../../../../../dataset/dataset_http_repository";
|
import { DataSetHttpRepository } from "../../../../../dataset/dataset_http_repository";
|
||||||
import { Assets } from "../../../../../dataset/dataset_model";
|
|
||||||
import { ISkils, SkillsHttpRepository } from "../../../../../skils/skills_http_repository";
|
import { ISkils, SkillsHttpRepository } from "../../../../../skils/skills_http_repository";
|
||||||
import { WeightsViewModel } from "./weights_view_model";
|
import { WeightsViewModel } from "./weights_view_model";
|
||||||
|
import { Parts } from "../../../../../details/details_http_repository";
|
||||||
|
|
||||||
export class WeightsFormStore extends FormState<WeightsViewModel, CoreError> {
|
export class WeightsFormStore extends FormState<WeightsViewModel, CoreError> {
|
||||||
weights?: ISkils[];
|
weights?: ISkils[];
|
||||||
assets?: Assets;
|
parts?: Parts[];
|
||||||
suitableWeights: string[] = [];
|
suitableWeights: string[] = [];
|
||||||
viewModel: WeightsViewModel = WeightsViewModel.empty();
|
viewModel: WeightsViewModel = WeightsViewModel.empty();
|
||||||
skillsHttpRepository: SkillsHttpRepository = new SkillsHttpRepository();
|
skillsHttpRepository: SkillsHttpRepository = new SkillsHttpRepository();
|
||||||
|
@ -18,7 +18,7 @@ export class WeightsFormStore extends FormState<WeightsViewModel, CoreError> {
|
||||||
}
|
}
|
||||||
init = async () => {
|
init = async () => {
|
||||||
await this.mapOk("weights", this.skillsHttpRepository.getAllSkills());
|
await this.mapOk("weights", this.skillsHttpRepository.getAllSkills());
|
||||||
await this.mapOk("assets", this.datasetHttpRepository.getAssetsActiveProject());
|
await this.mapOk("parts", this.datasetHttpRepository.getAssetsActiveProject());
|
||||||
};
|
};
|
||||||
changeDimensions = (index: number, value: number) => {
|
changeDimensions = (index: number, value: number) => {
|
||||||
this.viewModel.dimensions[index] = value;
|
this.viewModel.dimensions[index] = value;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { Result } from "../../core/helper/result";
|
import { Result } from "../../core/helper/result";
|
||||||
import { DatabaseModel } from "../../core/model/database_model";
|
import { DatabaseModel } from "../../core/model/database_model";
|
||||||
import { ITriggerModel } from "../../core/model/trigger_model";
|
import { ITriggerModel } from "../../core/model/trigger_model";
|
||||||
import { HttpMethod, HttpRepository } from "../../core/repository/http_repository";
|
import { HttpMethod, CoreHttpRepository } from "../../core/repository/http_repository";
|
||||||
import { UUID } from "../all_projects/data/project_repository";
|
import { UUID } from "../all_projects/data/project_repository";
|
||||||
import { ICreateProjectViewModel } from "./project_model";
|
import { ICreateProjectViewModel } from "./project_model";
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ export interface PipelineModel extends DatabaseModel {
|
||||||
trigger: ITriggerModel;
|
trigger: ITriggerModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CreateProjectRepository extends HttpRepository {
|
export class CreateProjectRepository extends CoreHttpRepository {
|
||||||
async saveProject(model: ICreateProjectViewModel): Promise<Result<Error, UUID>> {
|
async saveProject(model: ICreateProjectViewModel): Promise<Result<Error, UUID>> {
|
||||||
return await this._jsonRequest<UUID>(HttpMethod.POST, "/projects", model);
|
return await this._jsonRequest<UUID>(HttpMethod.POST, "/projects", model);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
import { Result } from "../../core/helper/result";
|
import { Result } from "../../core/helper/result";
|
||||||
import { HttpError, HttpMethod, HttpRepository } from "../../core/repository/http_repository";
|
import { HttpError, HttpMethod, CoreHttpRepository } from "../../core/repository/http_repository";
|
||||||
import { UUID } from "../all_projects/data/project_repository";
|
import { UUID } from "../all_projects/data/project_repository";
|
||||||
import { Assets, DataSetModel, Dataset, IDatasetModel, ProcessStatus } from "./dataset_model";
|
import { Parts } from "../details/details_http_repository";
|
||||||
|
import { DataSetModel, Dataset, IDatasetModel, ProcessStatus } from "./dataset_model";
|
||||||
|
|
||||||
export class DataSetHttpRepository extends HttpRepository {
|
export class DataSetHttpRepository extends CoreHttpRepository {
|
||||||
editDataset(dataSetModel: DataSetModel) {
|
editDataset(dataSetModel: DataSetModel) {
|
||||||
dataSetModel.processStatus = ProcessStatus.NEW;
|
dataSetModel.processStatus = ProcessStatus.NEW;
|
||||||
return this._jsonRequest<void>(HttpMethod.PUT, `/datasets`, dataSetModel);
|
return this._jsonRequest<void>(HttpMethod.PUT, `/datasets`, dataSetModel);
|
||||||
|
@ -11,12 +12,6 @@ export class DataSetHttpRepository extends HttpRepository {
|
||||||
deleteDataset(id: string) {
|
deleteDataset(id: string) {
|
||||||
return this._jsonRequest<void>(HttpMethod.DELETE, `/datasets/dataset?id=${id}`);
|
return this._jsonRequest<void>(HttpMethod.DELETE, `/datasets/dataset?id=${id}`);
|
||||||
}
|
}
|
||||||
getActiveProjectId(): Promise<Result<HttpError, UUID>> {
|
|
||||||
return this._jsonRequest<UUID>(HttpMethod.GET, "/projects/get/active/project/id");
|
|
||||||
}
|
|
||||||
getAssetsActiveProject = async (): Promise<Result<HttpError, Assets>> => {
|
|
||||||
return this._jsonRequest<Assets>(HttpMethod.GET, "/projects/assets");
|
|
||||||
};
|
|
||||||
saveDataSet = async (model: DataSetModel) => {
|
saveDataSet = async (model: DataSetModel) => {
|
||||||
return this._jsonRequest<Dataset>(HttpMethod.POST, "/datasets", model);
|
return this._jsonRequest<Dataset>(HttpMethod.POST, "/datasets", model);
|
||||||
};
|
};
|
||||||
|
|
|
@ -31,9 +31,6 @@ export interface Dataset {
|
||||||
formBuilder: FormBuilderValidationModel;
|
formBuilder: FormBuilderValidationModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Assets {
|
|
||||||
assets: Asset[];
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Asset {
|
export interface Asset {
|
||||||
name: string;
|
name: string;
|
||||||
|
|
|
@ -101,7 +101,7 @@ export const DataSetScreen: React.FunctionComponent = observer(() => {
|
||||||
filled={true}
|
filled={true}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{store.assets?.assets?.map((el) => {
|
{store.parts?.map((el) => {
|
||||||
return (
|
return (
|
||||||
<ListItem
|
<ListItem
|
||||||
status={store.assetStatus(el.name)}
|
status={store.assetStatus(el.name)}
|
||||||
|
|
|
@ -2,10 +2,11 @@ import makeAutoObservable from "mobx-store-inheritance";
|
||||||
import { DataSetHttpRepository } from "./dataset_http_repository";
|
import { DataSetHttpRepository } from "./dataset_http_repository";
|
||||||
import { Drawer, UiErrorState } from "../../core/store/base_store";
|
import { Drawer, UiErrorState } from "../../core/store/base_store";
|
||||||
import { HttpError } from "../../core/repository/http_repository";
|
import { HttpError } from "../../core/repository/http_repository";
|
||||||
import { Asset, Assets, DataSetModel, IDatasetModel, ProcessStatus } from "./dataset_model";
|
import { DataSetModel, IDatasetModel, ProcessStatus } from "./dataset_model";
|
||||||
import { message } from "antd";
|
import { message } from "antd";
|
||||||
import { UUID } from "../all_projects/data/project_repository";
|
import { UUID } from "../all_projects/data/project_repository";
|
||||||
import { SocketRepository, socketRepository } from "../../core/repository/socket_repository";
|
import { SocketRepository, socketRepository } from "../../core/repository/socket_repository";
|
||||||
|
import { Parts } from "../details/details_http_repository";
|
||||||
|
|
||||||
export enum DrawersDataset {
|
export enum DrawersDataset {
|
||||||
NewDataset = "Новый датасет",
|
NewDataset = "Новый датасет",
|
||||||
|
@ -14,7 +15,7 @@ export enum DrawersDataset {
|
||||||
|
|
||||||
export class DataSetStore extends UiErrorState<HttpError> {
|
export class DataSetStore extends UiErrorState<HttpError> {
|
||||||
dataSetRepository: DataSetHttpRepository;
|
dataSetRepository: DataSetHttpRepository;
|
||||||
assets?: Assets;
|
parts?: Parts[];
|
||||||
datasets?: IDatasetModel[];
|
datasets?: IDatasetModel[];
|
||||||
activeProject: UUID;
|
activeProject: UUID;
|
||||||
dataSetModel = DataSetModel.empty();
|
dataSetModel = DataSetModel.empty();
|
||||||
|
@ -74,11 +75,11 @@ export class DataSetStore extends UiErrorState<HttpError> {
|
||||||
return this.dataSetModel.dataSetObjects.includes(name);
|
return this.dataSetModel.dataSetObjects.includes(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
datasetCheckBox(asset: Asset): void {
|
datasetCheckBox(part: Parts): void {
|
||||||
if (this.assetStatus(asset.name)) {
|
if (this.assetStatus(part.name)) {
|
||||||
this.dataSetModel.dataSetObjects = this.dataSetModel.dataSetObjects.filter((el) => !el.isEqual(asset.name));
|
this.dataSetModel.dataSetObjects = this.dataSetModel.dataSetObjects.filter((el) => !el.isEqual(part.name));
|
||||||
} else {
|
} else {
|
||||||
this.dataSetModel.dataSetObjects.push(asset.name);
|
this.dataSetModel.dataSetObjects.push(part.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,7 +155,7 @@ export class DataSetStore extends UiErrorState<HttpError> {
|
||||||
}
|
}
|
||||||
|
|
||||||
init = async () => {
|
init = async () => {
|
||||||
await this.mapOk("assets", this.dataSetRepository.getAssetsActiveProject());
|
await this.mapOk("parts", this.dataSetRepository.getAssetsActiveProject());
|
||||||
await this.getDatasets();
|
await this.getDatasets();
|
||||||
await this.mapOk("activeProject", this.dataSetRepository.getActiveProjectId());
|
await this.mapOk("activeProject", this.dataSetRepository.getActiveProjectId());
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
import { HttpMethod, HttpRepository } from "../../core/repository/http_repository";
|
import { HttpMethod, CoreHttpRepository } from "../../core/repository/http_repository";
|
||||||
import { UUID } from "../all_projects/data/project_repository";
|
|
||||||
export interface Parts {
|
export interface Parts {
|
||||||
name: string;
|
name: string;
|
||||||
part_path: string;
|
part_path: string;
|
||||||
material_path: string;
|
material_path: string;
|
||||||
httpUrl: string;
|
stlUrl: string;
|
||||||
|
image: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export class DetailsHttpRepository extends HttpRepository {
|
export class DetailsHttpRepository extends CoreHttpRepository {
|
||||||
getAllDetails = async () => this._jsonRequest<Parts[]>(HttpMethod.GET, '/projects/assets/')
|
}
|
||||||
}
|
|
|
@ -11,7 +11,7 @@ export const DetailsScreen = observer(() => {
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
store.loadScene(canvasRef.current!);
|
store.loadScene(canvasRef.current!);
|
||||||
|
|
||||||
})
|
}, [])
|
||||||
const canvasRef = React.useRef<HTMLCanvasElement>(null);
|
const canvasRef = React.useRef<HTMLCanvasElement>(null);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -39,87 +39,3 @@ export const DetailsScreen = observer(() => {
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
// /* state-layer */
|
|
||||||
|
|
||||||
// /* Auto layout */
|
|
||||||
// display: flex;
|
|
||||||
// flex-direction: row;
|
|
||||||
// align-items: center;
|
|
||||||
// padding: 16px 24px 16px 16px;
|
|
||||||
// gap: 12px;
|
|
||||||
|
|
||||||
// width: 256px;
|
|
||||||
// height: 56px;
|
|
||||||
|
|
||||||
// /* Inside auto layout */
|
|
||||||
// flex: none;
|
|
||||||
// order: 0;
|
|
||||||
// align-self: stretch;
|
|
||||||
// flex-grow: 1;
|
|
||||||
|
|
||||||
// /* Icon */
|
|
||||||
|
|
||||||
// width: 24px;
|
|
||||||
// height: 24px;
|
|
||||||
|
|
||||||
// /* Inside auto layout */
|
|
||||||
// flex: none;
|
|
||||||
// order: 0;
|
|
||||||
// flex-grow: 0;
|
|
||||||
|
|
||||||
// /* icon */
|
|
||||||
|
|
||||||
// position: absolute;
|
|
||||||
// left: 25%;
|
|
||||||
// right: 25%;
|
|
||||||
// top: 25%;
|
|
||||||
// bottom: 25%;
|
|
||||||
|
|
||||||
// /* M3/sys/light/on-secondary-container */
|
|
||||||
// background: #1D192B;
|
|
||||||
|
|
||||||
// /* Label */
|
|
||||||
|
|
||||||
// width: 160px;
|
|
||||||
// height: 20px;
|
|
||||||
|
|
||||||
// /* M3/label/large - prominent */
|
|
||||||
// font-family: 'Roboto';
|
|
||||||
// font-style: normal;
|
|
||||||
// font-weight: 600;
|
|
||||||
// font-size: 14px;
|
|
||||||
// line-height: 20px;
|
|
||||||
// /* identical to box height, or 143% */
|
|
||||||
// letter-spacing: 0.1px;
|
|
||||||
|
|
||||||
// /* M3/sys/light/on-secondary-container */
|
|
||||||
// color: #1D192B;
|
|
||||||
|
|
||||||
// /* Inside auto layout */
|
|
||||||
// flex: none;
|
|
||||||
// order: 1;
|
|
||||||
// flex-grow: 1;
|
|
||||||
|
|
||||||
// /* Badge label text */
|
|
||||||
|
|
||||||
// width: 8px;
|
|
||||||
// height: 20px;
|
|
||||||
|
|
||||||
// /* M3/label/large - prominent */
|
|
||||||
// font-family: 'Roboto';
|
|
||||||
// font-style: normal;
|
|
||||||
// font-weight: 600;
|
|
||||||
// font-size: 14px;
|
|
||||||
// line-height: 20px;
|
|
||||||
// /* identical to box height, or 143% */
|
|
||||||
// text-align: right;
|
|
||||||
// letter-spacing: 0.1px;
|
|
||||||
|
|
||||||
// /* M3/sys/light/on-secondary-container */
|
|
||||||
// color: #1D192B;
|
|
||||||
|
|
||||||
// /* Inside auto layout */
|
|
||||||
// flex: none;
|
|
||||||
// order: 2;
|
|
||||||
// flex-grow: 0;
|
|
||||||
|
|
|
@ -2,9 +2,7 @@ import makeAutoObservable from "mobx-store-inheritance";
|
||||||
import { CoreError, UiErrorState } from "../../core/store/base_store";
|
import { CoreError, UiErrorState } from "../../core/store/base_store";
|
||||||
import { NavigateFunction } from "react-router-dom";
|
import { NavigateFunction } from "react-router-dom";
|
||||||
import { DetailsHttpRepository, Parts } from "./details_http_repository";
|
import { DetailsHttpRepository, Parts } from "./details_http_repository";
|
||||||
import { CoreThreeRepository } from "../../core/repository/core_three_repository";
|
import { DetailsThreeRepository } from "./details_three_repository";
|
||||||
import { Color } from "three";
|
|
||||||
import { BabylonRepository } from "../../core/repository/babylon_repository";
|
|
||||||
|
|
||||||
interface IDetailViewModel {
|
interface IDetailViewModel {
|
||||||
label: string;
|
label: string;
|
||||||
|
@ -12,12 +10,12 @@ interface IDetailViewModel {
|
||||||
httpUrl: string;
|
httpUrl: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export class DetailsStore extends UiErrorState<CoreError> {
|
export class DetailsStore extends UiErrorState<CoreError> {
|
||||||
detailsViewModel: IDetailViewModel[] = [];
|
detailsViewModel: IDetailViewModel[] = [];
|
||||||
parts: Parts[] = [];
|
parts: Parts[] = [];
|
||||||
detailsHttpRepository: DetailsHttpRepository = new DetailsHttpRepository();
|
detailsHttpRepository: DetailsHttpRepository = new DetailsHttpRepository();
|
||||||
coreThereRepository?: CoreThreeRepository;
|
detailsThreeRepository?: DetailsThreeRepository;
|
||||||
babylonRepository?: BabylonRepository;
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
makeAutoObservable(this);
|
makeAutoObservable(this);
|
||||||
|
@ -25,12 +23,12 @@ export class DetailsStore extends UiErrorState<CoreError> {
|
||||||
}
|
}
|
||||||
errorHandingStrategy = (error: CoreError) => { };
|
errorHandingStrategy = (error: CoreError) => { };
|
||||||
init = async (navigate?: NavigateFunction | undefined): Promise<void> => {
|
init = async (navigate?: NavigateFunction | undefined): Promise<void> => {
|
||||||
await this.mapOk("parts", this.detailsHttpRepository.getAllDetails());
|
await this.mapOk("parts", this.detailsHttpRepository.getAssetsActiveProject());
|
||||||
this.detailsViewModel = this.parts.map((el) => {
|
this.detailsViewModel = this.parts.map((el) => {
|
||||||
return {
|
return {
|
||||||
label: el.name,
|
label: el.name,
|
||||||
selected: false,
|
selected: false,
|
||||||
httpUrl: el.httpUrl,
|
httpUrl: el.stlUrl,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -43,15 +41,16 @@ export class DetailsStore extends UiErrorState<CoreError> {
|
||||||
this.detailsViewModel.map((el) => {
|
this.detailsViewModel.map((el) => {
|
||||||
if (el.label.match(label)) {
|
if (el.label.match(label)) {
|
||||||
el.selected = true;
|
el.selected = true;
|
||||||
|
this.detailsThreeRepository?.deleteAllObjectsScene()
|
||||||
this.babylonRepository?.load(el.httpUrl)
|
this.detailsThreeRepository?.loadHttpAndPreview(el.httpUrl, el.label, () => { })
|
||||||
return el;
|
return el;
|
||||||
}
|
}
|
||||||
|
return el
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
loadScene = async (ref: HTMLCanvasElement) => {
|
loadScene = async (ref: HTMLCanvasElement) => {
|
||||||
this.babylonRepository = new BabylonRepository(ref);
|
this.detailsThreeRepository = new DetailsThreeRepository(ref, () => { });
|
||||||
|
this.detailsThreeRepository.render();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
26
ui/src/features/details/details_three_repository.ts
Normal file
26
ui/src/features/details/details_three_repository.ts
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
import { Box3, GridHelper, Mesh, Object3D, Vector3 } from "three";
|
||||||
|
import { CoreThreeRepository } from "../../core/repository/core_three_repository";
|
||||||
|
|
||||||
|
export class DetailsThreeRepository extends CoreThreeRepository {
|
||||||
|
raiseAnObjectAboveZeroVector = (name: string) => {
|
||||||
|
const mesh = this.scene.getObjectByName(name) as Object3D;
|
||||||
|
mesh.position.sub(new Box3().setFromObject(mesh).min)
|
||||||
|
}
|
||||||
|
matchTwoPlacesInTheCenter = () => {
|
||||||
|
|
||||||
|
}
|
||||||
|
loadHttpAndPreview = (path: string, name: string, loadCallback?: Function) => {
|
||||||
|
|
||||||
|
this.loader(
|
||||||
|
path,
|
||||||
|
() => {
|
||||||
|
this.raiseAnObjectAboveZeroVector(name)
|
||||||
|
console.log(this.getCenterPoint(this.scene.children.filter((el) => el instanceof GridHelper).at(0) as Object3D))
|
||||||
|
},
|
||||||
|
name,
|
||||||
|
new Vector3(0, 0, 0)
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,11 +0,0 @@
|
||||||
import { Result } from "../../core/helper/result";
|
|
||||||
|
|
||||||
export class NumberTriviaModel {
|
|
||||||
constructor() {}
|
|
||||||
isValid(): Result<string, void> {
|
|
||||||
return Result.ok();
|
|
||||||
}
|
|
||||||
static empty() {
|
|
||||||
return new NumberTriviaModel();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { Result } from "../../../core/helper/result";
|
import { Result } from "../../../core/helper/result";
|
||||||
import { HttpMethod, HttpRepository } from "../../../core/repository/http_repository";
|
import { HttpMethod, CoreHttpRepository } from "../../../core/repository/http_repository";
|
||||||
import { CoreError } from "../../../core/store/base_store";
|
import { CoreError } from "../../../core/store/base_store";
|
||||||
import { RobossemblerAssets } from "../../../core/model/robossembler_assets";
|
import { RobossemblerAssets } from "../../../core/model/robossembler_assets";
|
||||||
|
|
||||||
export class SceneHttpRepository extends HttpRepository {
|
export class SceneHttpRepository extends CoreHttpRepository {
|
||||||
async getRobossemblerAssets() {
|
async getRobossemblerAssets() {
|
||||||
return this._jsonToClassInstanceRequest<RobossemblerAssets>(
|
return this._jsonToClassInstanceRequest<RobossemblerAssets>(
|
||||||
HttpMethod.GET,
|
HttpMethod.GET,
|
||||||
|
|
|
@ -14,7 +14,7 @@ export class SceneMangerStore extends UiErrorState<HttpError> {
|
||||||
sceneMode: SceneMode;
|
sceneMode: SceneMode;
|
||||||
sceneMenu: SceneMenu;
|
sceneMenu: SceneMenu;
|
||||||
isVisibleSaveButton: boolean = false;
|
isVisibleSaveButton: boolean = false;
|
||||||
coreThereRepository: null | CoreThreeRepository = null;
|
coreThreeRepository: null | CoreThreeRepository = null;
|
||||||
sceneHttpRepository: SceneHttpRepository;
|
sceneHttpRepository: SceneHttpRepository;
|
||||||
sceneModels: BaseSceneItemModel[] = [];
|
sceneModels: BaseSceneItemModel[] = [];
|
||||||
isSceneMenuShow = false;
|
isSceneMenuShow = false;
|
||||||
|
@ -39,7 +39,7 @@ export class SceneMangerStore extends UiErrorState<HttpError> {
|
||||||
|
|
||||||
deleteSceneItem(item: BaseSceneItemModel) {
|
deleteSceneItem(item: BaseSceneItemModel) {
|
||||||
const itm = this.sceneModels.filter((el) => el.id === item.id);
|
const itm = this.sceneModels.filter((el) => el.id === item.id);
|
||||||
this.coreThereRepository!.deleteSceneItem(itm[0]);
|
this.coreThreeRepository!.deleteSceneItem(itm[0]);
|
||||||
this.sceneModels = this.sceneModels.filter((el) => el.name !== item.name);
|
this.sceneModels = this.sceneModels.filter((el) => el.name !== item.name);
|
||||||
this.visibleSaveButton();
|
this.visibleSaveButton();
|
||||||
}
|
}
|
||||||
|
@ -49,10 +49,10 @@ export class SceneMangerStore extends UiErrorState<HttpError> {
|
||||||
}
|
}
|
||||||
|
|
||||||
addNewCamera(model: CameraViewModel) {
|
addNewCamera(model: CameraViewModel) {
|
||||||
model.position = this.coreThereRepository!.camera.position;
|
model.position = this.coreThreeRepository!.camera.position;
|
||||||
model.quaternion = this.coreThereRepository!.camera.quaternion;
|
model.quaternion = this.coreThreeRepository!.camera.quaternion;
|
||||||
this.sceneModels.push(model);
|
this.sceneModels.push(model);
|
||||||
this.coreThereRepository?.addSceneCamera(model);
|
this.coreThreeRepository?.addSceneCamera(model);
|
||||||
this.visibleSaveButton();
|
this.visibleSaveButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ export class SceneMangerStore extends UiErrorState<HttpError> {
|
||||||
try {
|
try {
|
||||||
const assetPath = this.robossemblerAssets?.getAssetPath(name) as string;
|
const assetPath = this.robossemblerAssets?.getAssetPath(name) as string;
|
||||||
|
|
||||||
this.coreThereRepository?.loader(assetPath, this.loaderWatcher, name);
|
this.coreThreeRepository?.loader(assetPath, this.loaderWatcher, name);
|
||||||
this.visibleSaveButton();
|
this.visibleSaveButton();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
message.error(String(error));
|
message.error(String(error));
|
||||||
|
@ -99,7 +99,7 @@ export class SceneMangerStore extends UiErrorState<HttpError> {
|
||||||
} else if (this.sceneMode === mode) {
|
} else if (this.sceneMode === mode) {
|
||||||
this.sceneMode = SceneMode.EMPTY;
|
this.sceneMode = SceneMode.EMPTY;
|
||||||
}
|
}
|
||||||
this.coreThereRepository?.setTransformMode(this.sceneMode);
|
this.coreThreeRepository?.setTransformMode(this.sceneMode);
|
||||||
this.sceneModeWatcher();
|
this.sceneModeWatcher();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -117,15 +117,15 @@ export class SceneMangerStore extends UiErrorState<HttpError> {
|
||||||
this.loadWebGl(canvasRef);
|
this.loadWebGl(canvasRef);
|
||||||
await this.mapOk<RobossemblerAssets>("robossemblerAssets", this.sceneHttpRepository.getRobossemblerAssets());
|
await this.mapOk<RobossemblerAssets>("robossemblerAssets", this.sceneHttpRepository.getRobossemblerAssets());
|
||||||
if (this.robossemblerAssets) {
|
if (this.robossemblerAssets) {
|
||||||
this.coreThereRepository?.loadInstances(this.robossemblerAssets);
|
this.coreThreeRepository?.loadInstances(this.robossemblerAssets);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
loadWebGl(canvasRef: HTMLCanvasElement): void {
|
loadWebGl(canvasRef: HTMLCanvasElement): void {
|
||||||
this.coreThereRepository = new CoreThreeRepository(canvasRef as HTMLCanvasElement, this.watcherSceneEditorObject);
|
this.coreThreeRepository = new CoreThreeRepository(canvasRef as HTMLCanvasElement, this.watcherSceneEditorObject);
|
||||||
this.coreThereRepository.on(this.watcherThereObjects);
|
this.coreThreeRepository.on(this.watcherThereObjects);
|
||||||
this.coreThereRepository.render();
|
this.coreThreeRepository.render();
|
||||||
this.sceneModels = this.coreThereRepository.getAllSceneModels();
|
this.sceneModels = this.coreThreeRepository.getAllSceneModels();
|
||||||
|
|
||||||
window.addEventListener("click", (event) => this.clickLister(event));
|
window.addEventListener("click", (event) => this.clickLister(event));
|
||||||
window.addEventListener("mousedown", (e) => this.sceneContextMenu(e));
|
window.addEventListener("mousedown", (e) => this.sceneContextMenu(e));
|
||||||
|
@ -169,9 +169,9 @@ export class SceneMangerStore extends UiErrorState<HttpError> {
|
||||||
};
|
};
|
||||||
|
|
||||||
transformContollsCall = (vector: Vector2) => {
|
transformContollsCall = (vector: Vector2) => {
|
||||||
this.coreThereRepository?.setRayCastAndGetFirstObject(vector).fold(
|
this.coreThreeRepository?.setRayCastAndGetFirstObject(vector).fold(
|
||||||
(success) => this.coreThereRepository?.setTransformControlsAttach(success),
|
(success) => this.coreThreeRepository?.setTransformControlsAttach(success),
|
||||||
(_error) => this.coreThereRepository?.disposeTransformControlsMode()
|
(_error) => this.coreThreeRepository?.disposeTransformControlsMode()
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { UrdfTransforms } from "./tranforms_model";
|
||||||
|
|
||||||
export class SimulationStore {
|
export class SimulationStore {
|
||||||
rosWsUrdfTransfomsListner: RosWsBridgeRepository<UrdfTransforms> = new RosWsBridgeRepository();
|
rosWsUrdfTransfomsListner: RosWsBridgeRepository<UrdfTransforms> = new RosWsBridgeRepository();
|
||||||
coreThereRepository?: CoreThreeRepository;
|
coreThreeRepository?: CoreThreeRepository;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
makeAutoObservable(this)
|
makeAutoObservable(this)
|
||||||
|
@ -15,15 +15,15 @@ export class SimulationStore {
|
||||||
}
|
}
|
||||||
async loadScene(canvasRef: HTMLCanvasElement) {
|
async loadScene(canvasRef: HTMLCanvasElement) {
|
||||||
await this.loadWebGl(canvasRef);
|
await this.loadWebGl(canvasRef);
|
||||||
this.coreThereRepository?.loadUrdf('http://localhost:4001/robot.xml');
|
this.coreThreeRepository?.loadUrdf('http://localhost:4001/robot.xml');
|
||||||
if (this.coreThereRepository?.urdfTransforms) {
|
if (this.coreThreeRepository?.urdfTransforms) {
|
||||||
this.rosWsUrdfTransfomsListner.on(this.coreThereRepository.urdfTransforms)
|
this.rosWsUrdfTransfomsListner.on(this.coreThreeRepository.urdfTransforms)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
loadWebGl = async (canvasRef: HTMLCanvasElement) => {
|
loadWebGl = async (canvasRef: HTMLCanvasElement) => {
|
||||||
this.coreThereRepository = new CoreThreeRepository(canvasRef as HTMLCanvasElement, () => { });
|
this.coreThreeRepository = new CoreThreeRepository(canvasRef as HTMLCanvasElement, () => { });
|
||||||
this.coreThereRepository.on(() => { });
|
this.coreThreeRepository.on(() => { });
|
||||||
this.coreThereRepository.render();
|
this.coreThreeRepository.render();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,5 @@
|
||||||
import { Result } from "../../core/helper/result";
|
import { Result } from "../../core/helper/result";
|
||||||
import { HttpError, HttpMethod, HttpRepository } from "../../core/repository/http_repository";
|
import { HttpError, HttpMethod, CoreHttpRepository } from "../../core/repository/http_repository";
|
||||||
import { UUID } from "../all_projects/data/project_repository";
|
|
||||||
import { IDatasetModel } from "../dataset/dataset_model";
|
import { IDatasetModel } from "../dataset/dataset_model";
|
||||||
import { SkillModel } from "./skill_model";
|
import { SkillModel } from "./skill_model";
|
||||||
|
|
||||||
|
@ -8,15 +7,15 @@ export interface ISkils {
|
||||||
_id: string;
|
_id: string;
|
||||||
name: string;
|
name: string;
|
||||||
processStatus: string;
|
processStatus: string;
|
||||||
epoch:number;
|
epoch: number;
|
||||||
isFinished: boolean;
|
isFinished: boolean;
|
||||||
datasetId: any;
|
datasetId: any;
|
||||||
project: any;
|
project: any;
|
||||||
numberOfTrainedEpochs:number;
|
numberOfTrainedEpochs: number;
|
||||||
__v: number;
|
__v: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SkillsHttpRepository extends HttpRepository {
|
export class SkillsHttpRepository extends CoreHttpRepository {
|
||||||
execSkill(id: string) {
|
execSkill(id: string) {
|
||||||
return this._jsonRequest(HttpMethod.GET, `/weights/exec?id=${id}`);
|
return this._jsonRequest(HttpMethod.GET, `/weights/exec?id=${id}`);
|
||||||
}
|
}
|
||||||
|
@ -36,7 +35,5 @@ export class SkillsHttpRepository extends HttpRepository {
|
||||||
getDatasetsActiveProject = async (): Promise<Result<HttpError, IDatasetModel[]>> => {
|
getDatasetsActiveProject = async (): Promise<Result<HttpError, IDatasetModel[]>> => {
|
||||||
return this._jsonRequest<IDatasetModel[]>(HttpMethod.GET, "/datasets");
|
return this._jsonRequest<IDatasetModel[]>(HttpMethod.GET, "/datasets");
|
||||||
};
|
};
|
||||||
getActiveProjectId(): Promise<Result<HttpError, UUID>> {
|
|
||||||
return this._jsonRequest<UUID>(HttpMethod.GET, "/projects/get/active/project/id");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,9 @@
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"extends": ["react-app", "shared-config"],
|
"extends": ["react-app", "shared-config"],
|
||||||
"rules": {
|
"rules": {
|
||||||
"additional-rule": "warn"
|
"additional-rule": "warn",
|
||||||
|
"no-extend-native":"off",
|
||||||
|
"react-hooks/exhaustive-deps":"off"
|
||||||
},
|
},
|
||||||
"overrides": [
|
"overrides": [
|
||||||
{
|
{
|
||||||
|
@ -10,7 +12,8 @@
|
||||||
"rules": {
|
"rules": {
|
||||||
"additional-typescript-only-rule": "warn",
|
"additional-typescript-only-rule": "warn",
|
||||||
"array-callback-return": "off",
|
"array-callback-return": "off",
|
||||||
"react-hooks/exhaustive-deps": "off"
|
"react-hooks/exhaustive-deps": "off",
|
||||||
|
"no-extend-native":"off"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue