@buerli.io/core 0.7.1-beta.2 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/geometry/ThreeGeometryCreator.js +3 -2
- package/build/cjs/graphic/filters.js +6 -6
- package/build/cjs/store/states/drawing.js +8 -6
- package/build/cjs/store/states/geometry.js +2 -1
- package/build/cjs/store/subscribtion/selection.js +4 -1
- package/build/cjs/types/IGraphicPackage.js +5 -8
- package/build/cjs/utils/Measure.js +2 -5
- package/build/esm/geometry/ThreeGeometryCreator.js +3 -2
- package/build/esm/graphic/filters.js +4 -4
- package/build/esm/store/states/drawing.js +8 -6
- package/build/esm/store/states/geometry.js +2 -1
- package/build/esm/store/subscribtion/selection.js +4 -1
- package/build/esm/types/IGraphicPackage.js +4 -7
- package/build/esm/utils/Measure.js +2 -5
- package/build/types/geometry/ThreeGeometryCreator.d.ts +9 -9
- package/build/types/graphic/filters.d.ts +1 -1
- package/build/types/store/states/drawing.d.ts +1 -0
- package/build/types/store/states/geometry.d.ts +8 -7
- package/build/types/types/IGraphicPackage.d.ts +8 -9
- package/package.json +3 -3
|
@@ -55,7 +55,8 @@ class ThreeGeometryCreator {
|
|
|
55
55
|
color = geomProps.material.color || color;
|
|
56
56
|
opacity = geomProps.material.opacity || opacity;
|
|
57
57
|
}
|
|
58
|
-
|
|
58
|
+
// Provide values as a CSS color string, which will be gamma corrected by three.js
|
|
59
|
+
const rgbColor = color ? new THREE.Color(`rgb(${color[0]}, ${color[1]}, ${color[2]})`) : undefined;
|
|
59
60
|
const layer = geomProps && geomProps.layer ? geomProps.layer : container.properties.layer;
|
|
60
61
|
return {
|
|
61
62
|
color: rgbColor,
|
|
@@ -200,7 +201,7 @@ class ThreeGeometryCreator {
|
|
|
200
201
|
createEdge(edge, container, points, color) {
|
|
201
202
|
const threePts = [];
|
|
202
203
|
const graphicId = edge.id;
|
|
203
|
-
let type = types_1.GraphicType.
|
|
204
|
+
let type = types_1.GraphicType.NURBSCURVE;
|
|
204
205
|
if (container.type === types_1.ContainerType.CURVEARRAY) {
|
|
205
206
|
type = types_1.GraphicType.CURVESPLINE;
|
|
206
207
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.solidFilter = exports.loopFilter = exports.planeFilter = exports.meshFilter = exports.pointFilter = exports.arcCircleFilter = exports.circleFilter = exports.arcFilter = exports.
|
|
4
|
-
const IGraphicPackage_1 = require("../types/IGraphicPackage");
|
|
3
|
+
exports.solidFilter = exports.loopFilter = exports.planeFilter = exports.meshFilter = exports.pointFilter = exports.arcCircleFilter = exports.circleFilter = exports.arcFilter = exports.edgeFilter = exports.lineFilter = void 0;
|
|
5
4
|
const selection_1 = require("../store/states/selection");
|
|
6
|
-
const
|
|
5
|
+
const IGraphicPackage_1 = require("../types/IGraphicPackage");
|
|
6
|
+
const lineFilter = (scope, data) => scope === selection_1.BuerliScope && data === IGraphicPackage_1.GraphicType.LINE;
|
|
7
7
|
exports.lineFilter = lineFilter;
|
|
8
|
-
const
|
|
9
|
-
exports.
|
|
8
|
+
const edgeFilter = (scope, data) => scope === selection_1.BuerliScope && IGraphicPackage_1.EdgeTypes.includes(data);
|
|
9
|
+
exports.edgeFilter = edgeFilter;
|
|
10
10
|
const arcFilter = (scope, data) => scope === selection_1.BuerliScope && data === IGraphicPackage_1.GraphicType.ARC;
|
|
11
11
|
exports.arcFilter = arcFilter;
|
|
12
12
|
const circleFilter = (scope, data) => scope === selection_1.BuerliScope && data === IGraphicPackage_1.GraphicType.CIRCLE;
|
|
@@ -15,7 +15,7 @@ const arcCircleFilter = (scope, data) => scope === selection_1.BuerliScope && (d
|
|
|
15
15
|
exports.arcCircleFilter = arcCircleFilter;
|
|
16
16
|
const pointFilter = (scope, data) => scope === selection_1.BuerliScope && data === IGraphicPackage_1.GraphicType.POINT;
|
|
17
17
|
exports.pointFilter = pointFilter;
|
|
18
|
-
const meshFilter = (scope, data) => scope === selection_1.BuerliScope && IGraphicPackage_1.
|
|
18
|
+
const meshFilter = (scope, data) => scope === selection_1.BuerliScope && IGraphicPackage_1.MeshTypes.includes(data);
|
|
19
19
|
exports.meshFilter = meshFilter;
|
|
20
20
|
const planeFilter = (scope, data) => scope === selection_1.BuerliScope && data === IGraphicPackage_1.GraphicType.PLANE;
|
|
21
21
|
exports.planeFilter = planeFilter;
|
|
@@ -23,7 +23,7 @@ const structure_1 = require("./structure");
|
|
|
23
23
|
////////////////////////////////////////////////////
|
|
24
24
|
const createDrawingState = (set, get, buerliApi, drawingNumber, name) => {
|
|
25
25
|
const drawingId = (0, uuid_1.v4)();
|
|
26
|
-
|
|
26
|
+
const initialData = () => ({
|
|
27
27
|
structure: (0, structure_1.structureData)(),
|
|
28
28
|
selection: (0, selection_1.selectionData)(),
|
|
29
29
|
interaction: (0, interaction_1.interactionData)(),
|
|
@@ -31,7 +31,8 @@ const createDrawingState = (set, get, buerliApi, drawingNumber, name) => {
|
|
|
31
31
|
geometry: (0, geometry_1.geometryData)(),
|
|
32
32
|
graphic: (0, graphic_1.graphicData)(),
|
|
33
33
|
cad: (0, cad_1.cadData)(),
|
|
34
|
-
|
|
34
|
+
});
|
|
35
|
+
return Object.assign(Object.assign({}, initialData()), { api: {
|
|
35
36
|
structure: (0, structure_1.structureApi)(set, get, buerliApi),
|
|
36
37
|
selection: (0, selection_1.selectionApi)(set, get, buerliApi),
|
|
37
38
|
plugin: (0, plugin_1.pluginApi)(set, get, buerliApi),
|
|
@@ -39,9 +40,10 @@ const createDrawingState = (set, get, buerliApi, drawingNumber, name) => {
|
|
|
39
40
|
graphic: (0, graphic_1.graphicApi)(set, get, buerliApi),
|
|
40
41
|
cad: (0, cad_1.cadApi)(set, get, buerliApi),
|
|
41
42
|
interaction: (0, interaction_1.interactionApi)(set, get, buerliApi),
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
reset: () => {
|
|
44
|
+
set(state => (Object.assign(Object.assign({}, state), initialData())));
|
|
45
|
+
buerliApi.getState().options.globalPlugins.forEach(def => get().api.plugin.createPlugin(def));
|
|
46
|
+
},
|
|
47
|
+
}, id: drawingId, name: name || `Drawing #${drawingNumber}` });
|
|
46
48
|
};
|
|
47
49
|
exports.createDrawingState = createDrawingState;
|
|
@@ -74,7 +74,8 @@ const geometryApi = (set, get, buerliApi) => ({
|
|
|
74
74
|
return geom;
|
|
75
75
|
},
|
|
76
76
|
setColor: (containerId, r, g, b) => {
|
|
77
|
-
|
|
77
|
+
// Provide values as a CSS color string, which will be gamma corrected by three.js
|
|
78
|
+
const color = new THREE.Color(`rgb(${Math.round(r * 255)}, ${Math.round(g * 255)}, ${Math.round(b * 255)})`);
|
|
78
79
|
const cachedGeom = Object.assign(Object.assign({}, get().geometry.cache[containerId]), { color });
|
|
79
80
|
set(state => ({
|
|
80
81
|
geometry: Object.assign(Object.assign({}, state.geometry), { cache: Object.assign(Object.assign({}, state.geometry.cache), { [containerId]: Object.assign(Object.assign({}, cachedGeom), { dirtyStamp: Date.now() }) }) }),
|
|
@@ -29,7 +29,10 @@ function subscribeItem(buerliApi, drawingId, selectorId, item) {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
function unsubscribeItems(buerliApi, drawingId, selectorId, items) {
|
|
32
|
-
|
|
32
|
+
var _a, _b, _c, _d;
|
|
33
|
+
// The following line leeds to exceptions if for example the corresponding drawing is going to be reset.
|
|
34
|
+
// To prevent those exceptions, check all properties for existance.
|
|
35
|
+
const items_ = items || ((_d = (_c = (_b = (_a = buerliApi.getState().drawing.refs[drawingId]) === null || _a === void 0 ? void 0 : _a.selection) === null || _b === void 0 ? void 0 : _b.refs) === null || _c === void 0 ? void 0 : _c[selectorId]) === null || _d === void 0 ? void 0 : _d.items) || [];
|
|
33
36
|
items_.forEach(item => {
|
|
34
37
|
unsubscribeItem(selectorId, item);
|
|
35
38
|
});
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PointTypes = exports.EntityTypes = exports.
|
|
3
|
+
exports.PointTypes = exports.EntityTypes = exports.CurveTypes = exports.EdgeTypes = exports.MeshTypes = exports.ContainerType = exports.GraphicType = void 0;
|
|
4
4
|
var GraphicType;
|
|
5
5
|
(function (GraphicType) {
|
|
6
6
|
// Primitives
|
|
7
7
|
GraphicType["POINT"] = "point";
|
|
8
8
|
GraphicType["LINE"] = "line";
|
|
9
|
-
GraphicType["EDGE"] = "edge";
|
|
10
9
|
GraphicType["ARC"] = "arc";
|
|
11
10
|
GraphicType["CIRCLE"] = "circle";
|
|
12
11
|
GraphicType["PLANE"] = "plane";
|
|
13
12
|
GraphicType["CYLINDER"] = "cylinder";
|
|
14
13
|
GraphicType["CONE"] = "cone";
|
|
15
14
|
GraphicType["SPHERE"] = "sphere";
|
|
16
|
-
GraphicType["
|
|
15
|
+
GraphicType["NURBSCURVE"] = "nurbsCurve";
|
|
17
16
|
GraphicType["NURBSSURFACE"] = "nurbsSurface";
|
|
18
17
|
// Entities
|
|
19
18
|
GraphicType["NONE"] = "none";
|
|
@@ -40,10 +39,8 @@ var ContainerType;
|
|
|
40
39
|
// LIGHTWEIGHTBREP = 6, // Not used at the moment
|
|
41
40
|
})(ContainerType = exports.ContainerType || (exports.ContainerType = {}));
|
|
42
41
|
const G = GraphicType;
|
|
43
|
-
exports.
|
|
44
|
-
exports.
|
|
45
|
-
exports.
|
|
46
|
-
exports.Primitives = exports.Surfaces.concat(exports.LineSegments).concat([G.POINT]);
|
|
47
|
-
exports.CurveSegments = [G.CURVELINE, G.CURVESPLINE, G.CURVEARC, G.CURVECIRCLE];
|
|
42
|
+
exports.MeshTypes = [G.PLANE, G.CYLINDER, G.CONE, G.SPHERE, G.NURBSSURFACE];
|
|
43
|
+
exports.EdgeTypes = [G.LINE, G.ARC, G.CIRCLE, G.NURBSCURVE];
|
|
44
|
+
exports.CurveTypes = [G.CURVELINE, G.CURVESPLINE, G.CURVEARC, G.CURVECIRCLE];
|
|
48
45
|
exports.EntityTypes = [G.BREP, G.POLYBREP, G.CURVEARRAY];
|
|
49
46
|
exports.PointTypes = [G.POINT, G.CURVEPOINT];
|
|
@@ -128,7 +128,7 @@ exports.Measure = {
|
|
|
128
128
|
measureData: { value: absoluteDistance, start: line.start.clone(), end: line.end.clone() },
|
|
129
129
|
});
|
|
130
130
|
break;
|
|
131
|
-
case types_1.GraphicType.
|
|
131
|
+
case types_1.GraphicType.NURBSCURVE:
|
|
132
132
|
case types_1.GraphicType.CURVESPLINE:
|
|
133
133
|
const edge = element;
|
|
134
134
|
results.push({
|
|
@@ -139,7 +139,7 @@ exports.Measure = {
|
|
|
139
139
|
results.push({
|
|
140
140
|
description: 'Edge end',
|
|
141
141
|
type: MeasureResultType.POSITION,
|
|
142
|
-
measureData: { value: edge.
|
|
142
|
+
measureData: { value: edge.end.clone() },
|
|
143
143
|
});
|
|
144
144
|
break;
|
|
145
145
|
case types_1.GraphicType.ARC:
|
|
@@ -275,9 +275,6 @@ exports.Measure = {
|
|
|
275
275
|
measureData: { value: sphere.radius },
|
|
276
276
|
});
|
|
277
277
|
break;
|
|
278
|
-
case types_1.GraphicType.NURBS:
|
|
279
|
-
results.push({ description: 'NURBS', type: MeasureResultType.NONE });
|
|
280
|
-
break;
|
|
281
278
|
case types_1.GraphicType.NURBSSURFACE:
|
|
282
279
|
results.push({ description: 'NURBS Surface', type: MeasureResultType.NONE });
|
|
283
280
|
break;
|
|
@@ -29,7 +29,8 @@ export class ThreeGeometryCreator {
|
|
|
29
29
|
color = geomProps.material.color || color;
|
|
30
30
|
opacity = geomProps.material.opacity || opacity;
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
// Provide values as a CSS color string, which will be gamma corrected by three.js
|
|
33
|
+
const rgbColor = color ? new THREE.Color(`rgb(${color[0]}, ${color[1]}, ${color[2]})`) : undefined;
|
|
33
34
|
const layer = geomProps && geomProps.layer ? geomProps.layer : container.properties.layer;
|
|
34
35
|
return {
|
|
35
36
|
color: rgbColor,
|
|
@@ -174,7 +175,7 @@ export class ThreeGeometryCreator {
|
|
|
174
175
|
createEdge(edge, container, points, color) {
|
|
175
176
|
const threePts = [];
|
|
176
177
|
const graphicId = edge.id;
|
|
177
|
-
let type = GraphicType.
|
|
178
|
+
let type = GraphicType.NURBSCURVE;
|
|
178
179
|
if (container.type === ContainerType.CURVEARRAY) {
|
|
179
180
|
type = GraphicType.CURVESPLINE;
|
|
180
181
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { GraphicType as GT, LineSegments, Surfaces } from '../types/IGraphicPackage';
|
|
2
1
|
import { BuerliScope } from '../store/states/selection';
|
|
3
|
-
|
|
4
|
-
export const
|
|
2
|
+
import { EdgeTypes, GraphicType as GT, MeshTypes } from '../types/IGraphicPackage';
|
|
3
|
+
export const lineFilter = (scope, data) => scope === BuerliScope && data === GT.LINE;
|
|
4
|
+
export const edgeFilter = (scope, data) => scope === BuerliScope && EdgeTypes.includes(data);
|
|
5
5
|
export const arcFilter = (scope, data) => scope === BuerliScope && data === GT.ARC;
|
|
6
6
|
export const circleFilter = (scope, data) => scope === BuerliScope && data === GT.CIRCLE;
|
|
7
7
|
export const arcCircleFilter = (scope, data) => scope === BuerliScope && (data === GT.ARC || data === GT.CIRCLE);
|
|
8
8
|
export const pointFilter = (scope, data) => scope === BuerliScope && data === GT.POINT;
|
|
9
|
-
export const meshFilter = (scope, data) => scope === BuerliScope &&
|
|
9
|
+
export const meshFilter = (scope, data) => scope === BuerliScope && MeshTypes.includes(data);
|
|
10
10
|
export const planeFilter = (scope, data) => scope === BuerliScope && data === GT.PLANE;
|
|
11
11
|
export const loopFilter = (scope, data) => scope === BuerliScope && data === GT.LOOP;
|
|
12
12
|
export const solidFilter = (scope, data) => scope === BuerliScope && data === GT.BREP;
|
|
@@ -20,7 +20,7 @@ import { structureApi, structureData } from './structure';
|
|
|
20
20
|
////////////////////////////////////////////////////
|
|
21
21
|
export const createDrawingState = (set, get, buerliApi, drawingNumber, name) => {
|
|
22
22
|
const drawingId = uuidv4();
|
|
23
|
-
|
|
23
|
+
const initialData = () => ({
|
|
24
24
|
structure: structureData(),
|
|
25
25
|
selection: selectionData(),
|
|
26
26
|
interaction: interactionData(),
|
|
@@ -28,7 +28,8 @@ export const createDrawingState = (set, get, buerliApi, drawingNumber, name) =>
|
|
|
28
28
|
geometry: geometryData(),
|
|
29
29
|
graphic: graphicData(),
|
|
30
30
|
cad: cadData(),
|
|
31
|
-
|
|
31
|
+
});
|
|
32
|
+
return Object.assign(Object.assign({}, initialData()), { api: {
|
|
32
33
|
structure: structureApi(set, get, buerliApi),
|
|
33
34
|
selection: selectionApi(set, get, buerliApi),
|
|
34
35
|
plugin: pluginApi(set, get, buerliApi),
|
|
@@ -36,8 +37,9 @@ export const createDrawingState = (set, get, buerliApi, drawingNumber, name) =>
|
|
|
36
37
|
graphic: graphicApi(set, get, buerliApi),
|
|
37
38
|
cad: cadApi(set, get, buerliApi),
|
|
38
39
|
interaction: interactionApi(set, get, buerliApi),
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
reset: () => {
|
|
41
|
+
set(state => (Object.assign(Object.assign({}, state), initialData())));
|
|
42
|
+
buerliApi.getState().options.globalPlugins.forEach(def => get().api.plugin.createPlugin(def));
|
|
43
|
+
},
|
|
44
|
+
}, id: drawingId, name: name || `Drawing #${drawingNumber}` });
|
|
43
45
|
};
|
|
@@ -47,7 +47,8 @@ export const geometryApi = (set, get, buerliApi) => ({
|
|
|
47
47
|
return geom;
|
|
48
48
|
},
|
|
49
49
|
setColor: (containerId, r, g, b) => {
|
|
50
|
-
|
|
50
|
+
// Provide values as a CSS color string, which will be gamma corrected by three.js
|
|
51
|
+
const color = new THREE.Color(`rgb(${Math.round(r * 255)}, ${Math.round(g * 255)}, ${Math.round(b * 255)})`);
|
|
51
52
|
const cachedGeom = Object.assign(Object.assign({}, get().geometry.cache[containerId]), { color });
|
|
52
53
|
set(state => ({
|
|
53
54
|
geometry: Object.assign(Object.assign({}, state.geometry), { cache: Object.assign(Object.assign({}, state.geometry.cache), { [containerId]: Object.assign(Object.assign({}, cachedGeom), { dirtyStamp: Date.now() }) }) }),
|
|
@@ -25,7 +25,10 @@ function subscribeItem(buerliApi, drawingId, selectorId, item) {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
export function unsubscribeItems(buerliApi, drawingId, selectorId, items) {
|
|
28
|
-
|
|
28
|
+
var _a, _b, _c, _d;
|
|
29
|
+
// The following line leeds to exceptions if for example the corresponding drawing is going to be reset.
|
|
30
|
+
// To prevent those exceptions, check all properties for existance.
|
|
31
|
+
const items_ = items || ((_d = (_c = (_b = (_a = buerliApi.getState().drawing.refs[drawingId]) === null || _a === void 0 ? void 0 : _a.selection) === null || _b === void 0 ? void 0 : _b.refs) === null || _c === void 0 ? void 0 : _c[selectorId]) === null || _d === void 0 ? void 0 : _d.items) || [];
|
|
29
32
|
items_.forEach(item => {
|
|
30
33
|
unsubscribeItem(selectorId, item);
|
|
31
34
|
});
|
|
@@ -3,14 +3,13 @@ export var GraphicType;
|
|
|
3
3
|
// Primitives
|
|
4
4
|
GraphicType["POINT"] = "point";
|
|
5
5
|
GraphicType["LINE"] = "line";
|
|
6
|
-
GraphicType["EDGE"] = "edge";
|
|
7
6
|
GraphicType["ARC"] = "arc";
|
|
8
7
|
GraphicType["CIRCLE"] = "circle";
|
|
9
8
|
GraphicType["PLANE"] = "plane";
|
|
10
9
|
GraphicType["CYLINDER"] = "cylinder";
|
|
11
10
|
GraphicType["CONE"] = "cone";
|
|
12
11
|
GraphicType["SPHERE"] = "sphere";
|
|
13
|
-
GraphicType["
|
|
12
|
+
GraphicType["NURBSCURVE"] = "nurbsCurve";
|
|
14
13
|
GraphicType["NURBSSURFACE"] = "nurbsSurface";
|
|
15
14
|
// Entities
|
|
16
15
|
GraphicType["NONE"] = "none";
|
|
@@ -37,10 +36,8 @@ export var ContainerType;
|
|
|
37
36
|
// LIGHTWEIGHTBREP = 6, // Not used at the moment
|
|
38
37
|
})(ContainerType || (ContainerType = {}));
|
|
39
38
|
const G = GraphicType;
|
|
40
|
-
export const
|
|
41
|
-
export const
|
|
42
|
-
export const
|
|
43
|
-
export const Primitives = Surfaces.concat(LineSegments).concat([G.POINT]);
|
|
44
|
-
export const CurveSegments = [G.CURVELINE, G.CURVESPLINE, G.CURVEARC, G.CURVECIRCLE];
|
|
39
|
+
export const MeshTypes = [G.PLANE, G.CYLINDER, G.CONE, G.SPHERE, G.NURBSSURFACE];
|
|
40
|
+
export const EdgeTypes = [G.LINE, G.ARC, G.CIRCLE, G.NURBSCURVE];
|
|
41
|
+
export const CurveTypes = [G.CURVELINE, G.CURVESPLINE, G.CURVEARC, G.CURVECIRCLE];
|
|
45
42
|
export const EntityTypes = [G.BREP, G.POLYBREP, G.CURVEARRAY];
|
|
46
43
|
export const PointTypes = [G.POINT, G.CURVEPOINT];
|
|
@@ -102,7 +102,7 @@ export const Measure = {
|
|
|
102
102
|
measureData: { value: absoluteDistance, start: line.start.clone(), end: line.end.clone() },
|
|
103
103
|
});
|
|
104
104
|
break;
|
|
105
|
-
case GraphicType.
|
|
105
|
+
case GraphicType.NURBSCURVE:
|
|
106
106
|
case GraphicType.CURVESPLINE:
|
|
107
107
|
const edge = element;
|
|
108
108
|
results.push({
|
|
@@ -113,7 +113,7 @@ export const Measure = {
|
|
|
113
113
|
results.push({
|
|
114
114
|
description: 'Edge end',
|
|
115
115
|
type: MeasureResultType.POSITION,
|
|
116
|
-
measureData: { value: edge.
|
|
116
|
+
measureData: { value: edge.end.clone() },
|
|
117
117
|
});
|
|
118
118
|
break;
|
|
119
119
|
case GraphicType.ARC:
|
|
@@ -249,9 +249,6 @@ export const Measure = {
|
|
|
249
249
|
measureData: { value: sphere.radius },
|
|
250
250
|
});
|
|
251
251
|
break;
|
|
252
|
-
case GraphicType.NURBS:
|
|
253
|
-
results.push({ description: 'NURBS', type: MeasureResultType.NONE });
|
|
254
|
-
break;
|
|
255
252
|
case GraphicType.NURBSSURFACE:
|
|
256
253
|
results.push({ description: 'NURBS Surface', type: MeasureResultType.NONE });
|
|
257
254
|
break;
|
|
@@ -30,7 +30,7 @@ export declare class ThreeGeometryCreator {
|
|
|
30
30
|
operationId: any;
|
|
31
31
|
rawGraphic: IGraphicElement | null;
|
|
32
32
|
isValid: boolean;
|
|
33
|
-
geometry: THREE.BufferGeometry
|
|
33
|
+
geometry: THREE.BufferGeometry<THREE.NormalBufferAttributes>;
|
|
34
34
|
graphicId: number;
|
|
35
35
|
type: GraphicType;
|
|
36
36
|
loops: number[][];
|
|
@@ -47,7 +47,7 @@ export declare class ThreeGeometryCreator {
|
|
|
47
47
|
operationId: any;
|
|
48
48
|
rawGraphic: IGraphicElement | null;
|
|
49
49
|
isValid: boolean;
|
|
50
|
-
geometry: THREE.BufferGeometry
|
|
50
|
+
geometry: THREE.BufferGeometry<THREE.NormalBufferAttributes>;
|
|
51
51
|
graphicId: number;
|
|
52
52
|
type: GraphicType;
|
|
53
53
|
loops: number[][];
|
|
@@ -67,7 +67,7 @@ export declare class ThreeGeometryCreator {
|
|
|
67
67
|
operationId: any;
|
|
68
68
|
rawGraphic: IGraphicElement | null;
|
|
69
69
|
isValid: boolean;
|
|
70
|
-
geometry: THREE.BufferGeometry
|
|
70
|
+
geometry: THREE.BufferGeometry<THREE.NormalBufferAttributes>;
|
|
71
71
|
graphicId: number;
|
|
72
72
|
loops: number[][];
|
|
73
73
|
};
|
|
@@ -88,7 +88,7 @@ export declare class ThreeGeometryCreator {
|
|
|
88
88
|
operationId: any;
|
|
89
89
|
rawGraphic: IGraphicElement | null;
|
|
90
90
|
isValid: boolean;
|
|
91
|
-
geometry: THREE.BufferGeometry
|
|
91
|
+
geometry: THREE.BufferGeometry<THREE.NormalBufferAttributes>;
|
|
92
92
|
graphicId: number;
|
|
93
93
|
loops: number[][];
|
|
94
94
|
};
|
|
@@ -110,7 +110,7 @@ export declare class ThreeGeometryCreator {
|
|
|
110
110
|
operationId: any;
|
|
111
111
|
rawGraphic: IGraphicElement | null;
|
|
112
112
|
isValid: boolean;
|
|
113
|
-
geometry: THREE.BufferGeometry
|
|
113
|
+
geometry: THREE.BufferGeometry<THREE.NormalBufferAttributes>;
|
|
114
114
|
graphicId: number;
|
|
115
115
|
loops: number[][];
|
|
116
116
|
};
|
|
@@ -128,7 +128,7 @@ export declare class ThreeGeometryCreator {
|
|
|
128
128
|
operationId: any;
|
|
129
129
|
rawGraphic: IGraphicElement | null;
|
|
130
130
|
isValid: boolean;
|
|
131
|
-
geometry: THREE.BufferGeometry
|
|
131
|
+
geometry: THREE.BufferGeometry<THREE.NormalBufferAttributes>;
|
|
132
132
|
graphicId: number;
|
|
133
133
|
loops: number[][];
|
|
134
134
|
};
|
|
@@ -145,7 +145,7 @@ export declare class ThreeGeometryCreator {
|
|
|
145
145
|
};
|
|
146
146
|
operationId: any;
|
|
147
147
|
rawGraphic: IGraphicElement | null;
|
|
148
|
-
geometry: THREE.BufferGeometry
|
|
148
|
+
geometry: THREE.BufferGeometry<THREE.NormalBufferAttributes>;
|
|
149
149
|
graphicId: number;
|
|
150
150
|
type: GraphicType;
|
|
151
151
|
};
|
|
@@ -162,7 +162,7 @@ export declare class ThreeGeometryCreator {
|
|
|
162
162
|
};
|
|
163
163
|
operationId: any;
|
|
164
164
|
rawGraphic: IGraphicElement | null;
|
|
165
|
-
geometry: THREE.BufferGeometry
|
|
165
|
+
geometry: THREE.BufferGeometry<THREE.NormalBufferAttributes>;
|
|
166
166
|
graphicId: number;
|
|
167
167
|
type: GraphicType;
|
|
168
168
|
};
|
|
@@ -181,7 +181,7 @@ export declare class ThreeGeometryCreator {
|
|
|
181
181
|
};
|
|
182
182
|
operationId: any;
|
|
183
183
|
rawGraphic: IGraphicElement | null;
|
|
184
|
-
geometry: THREE.BufferGeometry
|
|
184
|
+
geometry: THREE.BufferGeometry<THREE.NormalBufferAttributes>;
|
|
185
185
|
graphicId: number;
|
|
186
186
|
type: GraphicType;
|
|
187
187
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GraphicType as GT } from '../types/IGraphicPackage';
|
|
2
2
|
export declare const lineFilter: (scope: string, data: GT) => boolean;
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const edgeFilter: (scope: string, data: GT) => boolean;
|
|
4
4
|
export declare const arcFilter: (scope: string, data: GT) => boolean;
|
|
5
5
|
export declare const circleFilter: (scope: string, data: GT) => boolean;
|
|
6
6
|
export declare const arcCircleFilter: (scope: string, data: GT) => boolean;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
2
|
import { StoreApi } from 'zustand';
|
|
3
3
|
import { ContainerGeometryT, GeometryElement } from '../../geometry/ThreeGeometryCreator';
|
|
4
|
-
import { GraphicID } from '../../types/IGraphicPackage';
|
|
5
4
|
import { ObjectID } from '../../types/IStructureTree';
|
|
6
5
|
import { BuerliState } from './buerli';
|
|
7
6
|
import { DrawingState } from './drawing';
|
|
@@ -26,7 +25,9 @@ export declare type GeometryConfig = {
|
|
|
26
25
|
points?: ElementConfig;
|
|
27
26
|
};
|
|
28
27
|
export declare type GeometryData = {
|
|
29
|
-
cache: Record<
|
|
28
|
+
cache: Record<ObjectID, // The id of the CADEntity
|
|
29
|
+
// The id of the CADEntity
|
|
30
|
+
ContainerGeometryT & {
|
|
30
31
|
/**
|
|
31
32
|
* The dirty stamp will be updated, as soon as a client side modification of the geometry will happen!
|
|
32
33
|
* Examples: 'setColor' or 'setOpacity'
|
|
@@ -38,7 +39,7 @@ export declare type GeometryData = {
|
|
|
38
39
|
stamp: number;
|
|
39
40
|
bounds: GeometryBounds;
|
|
40
41
|
config: {
|
|
41
|
-
product: Record<ObjectID
|
|
42
|
+
product: Record<ObjectID, GeometryConfig>;
|
|
42
43
|
};
|
|
43
44
|
};
|
|
44
45
|
export declare type GeometryApi = ReturnType<typeof geometryApi>;
|
|
@@ -49,10 +50,10 @@ export declare const geometryApi: (set: StoreApi<DrawingState>['setState'], get:
|
|
|
49
50
|
* The update will only happen, if at least one solid of one product is available.
|
|
50
51
|
*/
|
|
51
52
|
updateBounds: () => void;
|
|
52
|
-
createGeometryIfNotCached: (containerId:
|
|
53
|
-
setColor: (containerId:
|
|
54
|
-
setOpacity: (containerId:
|
|
55
|
-
setConfig: (objId: ObjectID
|
|
53
|
+
createGeometryIfNotCached: (containerId: ObjectID, color?: number[]) => ContainerGeometryT | undefined;
|
|
54
|
+
setColor: (containerId: ObjectID, r: number, g: number, b: number) => void;
|
|
55
|
+
setOpacity: (containerId: ObjectID, opacity: number) => void;
|
|
56
|
+
setConfig: (objId: ObjectID, config: Partial<GeometryConfig> | null) => void;
|
|
56
57
|
findDecorated: () => GeometryElement[];
|
|
57
58
|
filter: (cb: (elem: GeometryElement) => boolean, options?: {
|
|
58
59
|
onlyOne?: boolean;
|
|
@@ -8,7 +8,9 @@ export interface IGraphicPackageProperties {
|
|
|
8
8
|
version: number;
|
|
9
9
|
}
|
|
10
10
|
export interface IGraphicContainer {
|
|
11
|
-
id
|
|
11
|
+
/** The CADEntity id */
|
|
12
|
+
id: ObjectID;
|
|
13
|
+
/** The CC_Solid id */
|
|
12
14
|
owner: ObjectID;
|
|
13
15
|
type: ContainerType;
|
|
14
16
|
properties: IGraphicContainerProps;
|
|
@@ -87,7 +89,7 @@ export interface IGraphicMeshProperties {
|
|
|
87
89
|
material: IGraphicMaterial;
|
|
88
90
|
}
|
|
89
91
|
export interface IGraphicSurface {
|
|
90
|
-
type: GraphicType.PLANE | GraphicType.CYLINDER | GraphicType.CONE | GraphicType.SPHERE | GraphicType.
|
|
92
|
+
type: GraphicType.PLANE | GraphicType.CYLINDER | GraphicType.CONE | GraphicType.SPHERE | GraphicType.NURBSSURFACE;
|
|
91
93
|
}
|
|
92
94
|
export interface IGraphicPlane extends IGraphicSurface {
|
|
93
95
|
pointOnPlane: number[];
|
|
@@ -112,14 +114,13 @@ export interface IGraphicSphere extends IGraphicSurface {
|
|
|
112
114
|
export declare enum GraphicType {
|
|
113
115
|
POINT = "point",
|
|
114
116
|
LINE = "line",
|
|
115
|
-
EDGE = "edge",
|
|
116
117
|
ARC = "arc",
|
|
117
118
|
CIRCLE = "circle",
|
|
118
119
|
PLANE = "plane",
|
|
119
120
|
CYLINDER = "cylinder",
|
|
120
121
|
CONE = "cone",
|
|
121
122
|
SPHERE = "sphere",
|
|
122
|
-
|
|
123
|
+
NURBSCURVE = "nurbsCurve",
|
|
123
124
|
NURBSSURFACE = "nurbsSurface",
|
|
124
125
|
NONE = "none",
|
|
125
126
|
BREP = "brep",
|
|
@@ -139,11 +140,9 @@ export declare enum ContainerType {
|
|
|
139
140
|
POLYBREP = 3
|
|
140
141
|
}
|
|
141
142
|
declare type RoA = ReadonlyArray<GraphicType>;
|
|
142
|
-
export declare const
|
|
143
|
-
export declare const
|
|
144
|
-
export declare const
|
|
145
|
-
export declare const Primitives: RoA;
|
|
146
|
-
export declare const CurveSegments: RoA;
|
|
143
|
+
export declare const MeshTypes: RoA;
|
|
144
|
+
export declare const EdgeTypes: RoA;
|
|
145
|
+
export declare const CurveTypes: RoA;
|
|
147
146
|
export declare const EntityTypes: RoA;
|
|
148
147
|
export declare const PointTypes: RoA;
|
|
149
148
|
export interface IGraphicMaterial {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buerli.io/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "buerli state management",
|
|
5
5
|
"author": "AWV Informatik AG <info@awv-informatik.ch>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"prettify": "prettier --write \"./{src,tests}/**/*.{js,jsx,ts,tsx,json}\""
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@types/three": "^0.
|
|
24
|
+
"@types/three": "^0.152.1",
|
|
25
25
|
"@babel/preset-env": "^7.10.4",
|
|
26
26
|
"@babel/preset-typescript": "^7.10.4",
|
|
27
27
|
"babel-jest": "^26.1.0",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"babel-plugin-transform-class-properties": "^6.24.1",
|
|
30
30
|
"jest": "^26.1.0",
|
|
31
31
|
"rimraf": "^2.6.3",
|
|
32
|
-
"three": "^0.
|
|
32
|
+
"three": "^0.153",
|
|
33
33
|
"typescript": "4.8.4"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|