feat: change control point
@ -1,7 +1,7 @@
|
||||
{
|
||||
"code": 200,
|
||||
"success": true,
|
||||
"data": [
|
||||
"result": [
|
||||
{
|
||||
"id": "mock-robot-1",
|
||||
"label": "模拟机器人A",
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"code": 200,
|
||||
"success": true,
|
||||
"data": {
|
||||
"result": {
|
||||
"id": "mock-robot-0",
|
||||
"label": "模拟机器人-注册",
|
||||
"brand": 1,
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"code": 200,
|
||||
"success": true,
|
||||
"data": [
|
||||
"result": [
|
||||
"mock-robot-1",
|
||||
"mock-robot-2"
|
||||
],
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"code": 200,
|
||||
"success": true,
|
||||
"data": {
|
||||
"result": {
|
||||
"id": "mock-group-scene-1",
|
||||
"label": "模拟组场景A",
|
||||
"group": {
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"code": 200,
|
||||
"success": true,
|
||||
"data": {
|
||||
"result": {
|
||||
"id": "mock-scene-1",
|
||||
"label": "模拟场景A",
|
||||
"json": "{\"robotGroups\":[{\"sid\":\"mock-scene-1\",\"id\":\"mock-robot-group\",\"label\":\"模拟机器人组\",\"robots\":[\"mock-robot-1\",\"mock-robot-2\"]}],\"robots\":[{\"id\":\"mock-robot-1\",\"label\":\"模拟机器人A\",\"brand\":\"模拟品牌A\",\"type\":1,\"ip\":\"127.0.1.1\",\"isConnected\":true,\"state\":4,\"canOrder\":true,\"canStop\":true,\"canControl\":true},{\"id\":\"mock-robot-2\",\"label\":\"模拟机器人B\",\"brand\":\"模拟品牌A\",\"type\":2,\"ip\":\"127.0.1.2\"}],\"points\":[{\"id\":\"776fa1bf\",\"name\":\"测试普通点\",\"x\":100,\"y\":100,\"type\":1,\"config\":{}},{\"id\":\"ea84ca\",\"name\":\"测试等待点\",\"x\":200,\"y\":100,\"type\":2,\"config\":{},\"actions\":[\"343a2f0\"]},{\"id\":\"083f10\",\"name\":\"测试避让点\",\"x\":300,\"y\":100,\"type\":3,\"config\":{}},{\"id\":\"3a350276\",\"name\":\"测试临时避让点\",\"x\":400,\"y\":100,\"type\":4,\"config\":{}},{\"id\":\"51b95527\",\"name\":\"测试电梯点\",\"x\":100,\"y\":300,\"type\":11,\"config\":{}},{\"id\":\"200e2898\",\"name\":\"测试自动门点\",\"x\":200,\"y\":300,\"type\":12,\"config\":{}},{\"id\":\"e94941e\",\"name\":\"测试充电点\",\"x\":300,\"y\":300,\"type\":13,\"config\":{},\"robots\":[\"mock-robot-1\"]},{\"id\":\"5bdd329\",\"name\":\"测试停靠点\",\"x\":400,\"y\":300,\"type\":14,\"config\":{},\"robots\":[]},{\"id\":\"343a2f0\",\"name\":\"测试动作点\",\"x\":500,\"y\":300,\"type\":15,\"config\":{}},{\"id\":\"b6c6cfb\",\"name\":\"测试禁行点\",\"x\":100,\"y\":500,\"type\":16,\"config\":{}}],\"routes\":[{\"id\":\"3de9971\",\"from\":\"776fa1bf\",\"to\":\"ea84ca\",\"type\":\"line\",\"pass\":1,\"config\":{}},{\"id\":\"4781a31f\",\"from\":\"ea84ca\",\"to\":\"083f10\",\"type\":\"line\",\"pass\":1,\"config\":{}},{\"id\":\"fc86102\",\"from\":\"083f10\",\"to\":\"3a350276\",\"type\":\"line\",\"pass\":0,\"config\":{}},{\"id\":\"6f33b86\",\"from\":\"3a350276\",\"to\":\"343a2f0\",\"type\":\"bezier3\",\"pass\":1,\"config\":{}},{\"id\":\"7a48284\",\"from\":\"200e2898\",\"to\":\"51b95527\",\"type\":\"line\",\"pass\":0,\"config\":{}},{\"id\":\"83bc37\",\"from\":\"e94941e\",\"to\":\"200e2898\",\"type\":\"line\",\"pass\":2,\"config\":{}},{\"id\":\"b52b5a\",\"from\":\"5bdd329\",\"to\":\"e94941e\",\"type\":\"line\",\"pass\":2,\"config\":{}},{\"id\":\"610d367\",\"from\":\"343a2f0\",\"to\":\"5bdd329\",\"type\":\"line\",\"pass\":2,\"config\":{}},{\"id\":\"142dbab5\",\"from\":\"51b95527\",\"to\":\"776fa1bf\",\"type\":\"bezier3\",\"pass\":10,\"config\":{},\"c1\":{\"x\":-50,\"y\":100},\"c2\":{\"x\":-10,\"y\":50}},{\"id\":\"a3ad044\",\"from\":\"51b95527\",\"to\":\"b6c6cfb\",\"type\":\"line\",\"pass\":10,\"config\":{}},{\"id\":\"71734a6\",\"from\":\"51b95527\",\"to\":\"b6c6cfb\",\"type\":\"line\",\"config\":{}}],\"areas\":[{\"id\":\"de62ae3\",\"name\":\"测试非互斥区\",\"x\":63,\"y\":67,\"w\":203,\"h\":325,\"type\":12,\"config\":{},\"points\":[\"776fa1bf\",\"ea84ca\",\"51b95527\",\"200e2898\"]},{\"id\":\"f236e4b\",\"name\":\"测试库区\",\"x\":281,\"y\":246,\"w\":292,\"h\":152,\"type\":1,\"config\":{},\"points\":[\"343a2f0\"]},{\"id\":\"1417882e\",\"name\":\"测试互斥区\",\"x\":275,\"y\":54,\"w\":178,\"h\":107,\"type\":11,\"config\":{},\"points\":[\"083f10\",\"3a350276\"],\"routes\":[]}],\"blocks\":[]}"
|
||||
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
@ -79,9 +79,24 @@ export class EditorService extends Meta2d {
|
||||
if (!routes?.length) return;
|
||||
routes.map((v) => {
|
||||
const { id, desc, from, to, type, pass, c1, c2, properties } = v;
|
||||
this.addRoute([from, to], <MapRouteType>type, id);
|
||||
const p1 = this.getPenById(from);
|
||||
const p2 = this.getPenById(to);
|
||||
if (isNil(p1) || isNil(p2)) return;
|
||||
this.addRoute([p1, p2], <MapRouteType>type, id);
|
||||
const { x: x1, y: y1 } = this.getPointRect(p1)!;
|
||||
const { x: x2, y: y2 } = this.getPointRect(p2)!;
|
||||
this.setValue(
|
||||
{ id, desc, properties, route: { type, pass, c1, c2 } },
|
||||
{
|
||||
id,
|
||||
desc,
|
||||
properties,
|
||||
route: {
|
||||
type,
|
||||
pass,
|
||||
c1: { x: (c1?.x ?? 0) - x1, y: (c1?.y ?? 0) - y1 },
|
||||
c2: { x: (c2?.x ?? 0) - x2, y: (c2?.y ?? 0) - y2 },
|
||||
},
|
||||
},
|
||||
{ render: false, history: false, doEvent: false },
|
||||
);
|
||||
});
|
||||
@ -127,24 +142,29 @@ export class EditorService extends Meta2d {
|
||||
if (!pen?.id || pen.anchors?.length !== 2 || isEmpty(pen?.route)) return null;
|
||||
const { id, anchors, desc, properties } = pen;
|
||||
const { type, direction = 1, pass, c1, c2 } = pen.route;
|
||||
const [p1, p2] = anchors.map((v) => v.connectTo!);
|
||||
const [p1, p2] = anchors.map((v) => this.getPenById(v.connectTo!));
|
||||
if (isNil(p1) || isNil(p2)) return null;
|
||||
const route: StandardSceneRoute = {
|
||||
id: id,
|
||||
desc,
|
||||
from: direction < 0 ? p2 : p1,
|
||||
to: direction < 0 ? p1 : p2,
|
||||
from: direction < 0 ? p2.id! : p1.id!,
|
||||
to: direction < 0 ? p1.id! : p2.id!,
|
||||
type,
|
||||
pass,
|
||||
config: {},
|
||||
properties,
|
||||
};
|
||||
const { x: x1, y: y1 } = this.getPointRect(p1)!;
|
||||
const { x: x2, y: y2 } = this.getPointRect(p2)!;
|
||||
const cp1 = { x: x1 + (c1?.x ?? x2 - x1), y: y1 + (c1?.y ?? 0) };
|
||||
const cp2 = { x: x2 + (c2?.x ?? 0), y: y2 + (c2?.y ?? y1 - y2) };
|
||||
switch (type) {
|
||||
case MapRouteType.二阶贝塞尔曲线:
|
||||
route.c1 = c1;
|
||||
route.c1 = cp1;
|
||||
break;
|
||||
case MapRouteType.三阶贝塞尔曲线:
|
||||
route.c1 = direction < 0 ? c2 : c1;
|
||||
route.c2 = direction < 0 ? c1 : c2;
|
||||
route.c1 = direction < 0 ? cp2 : cp1;
|
||||
route.c2 = direction < 0 ? cp1 : cp2;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -503,8 +523,8 @@ export class EditorService extends Meta2d {
|
||||
return `${p1.label}${(d ?? direction) > 0 ? '→' : '←'}${p2.label}`;
|
||||
}
|
||||
|
||||
public addRoute(p: [string, string], type = MapRouteType.直线, id?: string): void {
|
||||
const [p1, p2] = p.map((v) => this.getPenById(v));
|
||||
public addRoute(p: [MapPen, MapPen], type = MapRouteType.直线, id?: string): void {
|
||||
const [p1, p2] = p;
|
||||
if (!p1?.anchors?.length || !p2?.anchors?.length) return;
|
||||
const line = this.connectLine(p1, p2, undefined, undefined, false);
|
||||
id ||= line.id!;
|
||||
|
@ -43,6 +43,7 @@ export default ({ mode }: Record<string, unknown>) =>
|
||||
port: 8888,
|
||||
host: true,
|
||||
proxy: {
|
||||
'/mocks/': { target: 'http://localhost:8888/web-amr' },
|
||||
'/api/': {
|
||||
target: 'http://82.156.39.91:18080/jeecg-boot',
|
||||
rewrite: (path) => path.replace(/^\/api/, ''),
|
||||
|