|
|
@ -1,5 +1,6 @@
|
|
|
|
import { Vector3 } from 'three';
|
|
|
|
import { Vector3 } from 'three';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import { Arc } from '../DatabaseServices/Arc';
|
|
|
|
import { Curve } from '../DatabaseServices/Curve';
|
|
|
|
import { Curve } from '../DatabaseServices/Curve';
|
|
|
|
import { angle, equal } from './GeUtils';
|
|
|
|
import { angle, equal } from './GeUtils';
|
|
|
|
|
|
|
|
|
|
|
@ -61,10 +62,9 @@ export class RegionParse
|
|
|
|
//找到最小的站.
|
|
|
|
//找到最小的站.
|
|
|
|
let minStand = this.FindMinStand(needFinds);
|
|
|
|
let minStand = this.FindMinStand(needFinds);
|
|
|
|
needFinds.delete(minStand);
|
|
|
|
needFinds.delete(minStand);
|
|
|
|
//顺时针搜索.
|
|
|
|
//逆时针+逆时针
|
|
|
|
for (let i = minStand.routes.length; i--;)
|
|
|
|
for (let i = minStand.routes.length; i--;)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
let route = minStand.routes[i];
|
|
|
|
|
|
|
|
let wayS = new Set<Stand>();
|
|
|
|
let wayS = new Set<Stand>();
|
|
|
|
let routeS = new Set<Route>();
|
|
|
|
let routeS = new Set<Route>();
|
|
|
|
let isFind = this.FindRegion(minStand, minStand, undefined, wayS, routeS, 1);
|
|
|
|
let isFind = this.FindRegion(minStand, minStand, undefined, wayS, routeS, 1);
|
|
|
@ -86,7 +86,7 @@ export class RegionParse
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 使用类似涨潮的方式,从最低的地方,采用逆时针填充.
|
|
|
|
* 使用类似涨潮的方式,从最低的地方,采用顺时针填充.
|
|
|
|
* 算法允许搜索到的区域在外轮廓外.
|
|
|
|
* 算法允许搜索到的区域在外轮廓外.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param {Set<Stand>} standS 外轮廓站点
|
|
|
|
* @param {Set<Stand>} standS 外轮廓站点
|
|
|
@ -110,7 +110,7 @@ export class RegionParse
|
|
|
|
passingStands.add(minStand);
|
|
|
|
passingStands.add(minStand);
|
|
|
|
needFinds.delete(minStand);
|
|
|
|
needFinds.delete(minStand);
|
|
|
|
|
|
|
|
|
|
|
|
//逆时针搜索
|
|
|
|
//顺时针搜索
|
|
|
|
for (let j = minStand.routes.length; j--;)
|
|
|
|
for (let j = minStand.routes.length; j--;)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
let route = minStand.routes[j];
|
|
|
|
let route = minStand.routes[j];
|
|
|
@ -187,12 +187,19 @@ export class RegionParse
|
|
|
|
{
|
|
|
|
{
|
|
|
|
for (let cu of cuList)
|
|
|
|
for (let cu of cuList)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
let startS = this.GetStand(cu.StartPoint);
|
|
|
|
//由于圆弧可能导致最低点计算错误的问题.
|
|
|
|
let endS = this.GetStand(cu.EndPoint);
|
|
|
|
if (cu instanceof Arc)
|
|
|
|
let routeS2E: Route = { curve: cu, to: endS };
|
|
|
|
{
|
|
|
|
let routeE2S: Route = { curve: cu, to: startS };
|
|
|
|
let underPt = cu.Center.add(new Vector3(0, -cu.Radius));
|
|
|
|
startS.routes.push(routeS2E);
|
|
|
|
let param = cu.GetParamAtPoint(underPt);
|
|
|
|
endS.routes.push(routeE2S);
|
|
|
|
if (cu.ParamOnCurve(param))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
let arcs = cu.GetSplitCurves(param);
|
|
|
|
|
|
|
|
arcs.forEach(a => this.addCurveToMap(a));
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
this.addCurveToMap(cu);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.m_NodeMap.forEach(s =>
|
|
|
|
this.m_NodeMap.forEach(s =>
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -215,6 +222,16 @@ export class RegionParse
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private addCurveToMap(cu: Curve)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
let startS = this.GetStand(cu.StartPoint);
|
|
|
|
|
|
|
|
let endS = this.GetStand(cu.EndPoint);
|
|
|
|
|
|
|
|
let routeS2E: Route = { curve: cu, to: endS };
|
|
|
|
|
|
|
|
let routeE2S: Route = { curve: cu, to: startS };
|
|
|
|
|
|
|
|
startS.routes.push(routeS2E);
|
|
|
|
|
|
|
|
endS.routes.push(routeE2S);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 获得指定点的站台.
|
|
|
|
* 获得指定点的站台.
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -253,7 +270,7 @@ export class RegionParse
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//寻找闭合轮廓,下一站总是使用顺时针规划.
|
|
|
|
//寻找闭合轮廓,下一站总是使用逆时针规划.
|
|
|
|
private FindRegion(firstS: Stand, //起点
|
|
|
|
private FindRegion(firstS: Stand, //起点
|
|
|
|
nowStand: Stand, //当前站
|
|
|
|
nowStand: Stand, //当前站
|
|
|
|
lastCurve: Curve, //上一条线索引
|
|
|
|
lastCurve: Curve, //上一条线索引
|
|
|
@ -267,7 +284,7 @@ export class RegionParse
|
|
|
|
let lastIndex = -1;
|
|
|
|
let lastIndex = -1;
|
|
|
|
if (lastCurve)
|
|
|
|
if (lastCurve)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
for (let i = routeCount; i--;)//逆时针搜索.
|
|
|
|
for (let i = routeCount; i--;)//顺时针搜索.
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (nowStand.routes[i].curve === lastCurve)
|
|
|
|
if (nowStand.routes[i].curve === lastCurve)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -279,7 +296,7 @@ export class RegionParse
|
|
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < routeCount - 1; i++)
|
|
|
|
for (let i = 0; i < routeCount - 1; i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
let index = lastIndex + i + 1;//转弯,顺时针
|
|
|
|
let index = lastIndex + i + 1;//转弯,逆时针
|
|
|
|
if (index >= routeCount) index -= routeCount;
|
|
|
|
if (index >= routeCount) index -= routeCount;
|
|
|
|
|
|
|
|
|
|
|
|
//下一站
|
|
|
|
//下一站
|
|
|
|