| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- import { type_manager } from "./functions.js";
- import { element } from "./element.js";
- import { order } from "./order.js";
- import { file } from "./file.js";
- class element_builder {
- #name;
- #description;
- #pictures;
- #meshes;
- #solids;
- #order;
- constructor() {
- this.#order = [];
- this.#solids = [];
- this.#meshes = [];
- this.#pictures = [];
- this.#name = undefined;
- this.#description = undefined;
- }
- set name(target) {
- if (!type_manager.is_string(target)) {
- throw "Element name must be an string.";
- }
- this.#name = target;
- }
- set description(target) {
- if (!type_manager.is_string(target)) {
- throw "Description of the element must be an string.";
- }
- this.#description = target;
- }
- add_solid(target) {
- this.#solids.push(new file(target));
- }
- add_mesh(target) {
- this.#meshes.push(new file(target));
- }
- add_picture(target) {
- this.#pictures.push(new file(target));
- }
- add_order(target) {
- this.#order.push(new order(target));
- }
- get result() {
- return new element(
- this.#name,
- this.#description,
- this.#pictures,
- this.#meshes,
- this.#solids,
- this.#order
- );
- }
- }
- export { element_builder };
|