You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
2.2 KiB
71 lines
2.2 KiB
9 months ago
|
#pragma once
|
||
|
|
||
|
#ifdef _WIN32
|
||
9 months ago
|
#ifdef WIREROUTINGDLL_EXPORTS // VisualStudio DLL 项目模板会将 <PROJECTNAME>_EXPORTS 添加到定义预处理器宏。
|
||
|
#define BASIC_EDGE_API __declspec(dllexport) // _WIN32
|
||
9 months ago
|
#else
|
||
|
#define BASIC_EDGE_API __declspec(dllimport)
|
||
|
#endif
|
||
|
#else
|
||
|
#define BASIC_EDGE_API
|
||
9 months ago
|
#endif
|
||
9 months ago
|
|
||
|
#include "BasicChannel.h"
|
||
9 months ago
|
#include <cmath>
|
||
|
#include <vector>
|
||
|
#include <queue>
|
||
|
#include <map>
|
||
|
#include <iostream>
|
||
|
#include <fstream>
|
||
|
#include <sstream>
|
||
9 months ago
|
using namespace std;
|
||
|
|
||
9 months ago
|
// 存储卡箍与卡箍之间,卡箍与分支点之间,分支点与分支点之间的边关系
|
||
|
struct BASIC_EDGE_API BasicEdge
|
||
|
{
|
||
|
vector<pair<int, int>> clip[MAXPointNum][2], branchPoint[N][2];
|
||
|
// 0,1代表两种模式,0代表同分支段的卡箍与分支点,1则相反
|
||
9 months ago
|
|
||
9 months ago
|
private:
|
||
|
vector<pair<int, int>> edge[N][2]; // 卡箍到卡箍的连线
|
||
9 months ago
|
|
||
9 months ago
|
// 预处理分支点和卡箍之间的连线关系
|
||
|
public:
|
||
|
void buildEdgeBetweenClipAndBranchPoint();
|
||
9 months ago
|
|
||
9 months ago
|
// 返回卡箍能连接到的卡箍,如果没有能连接到的,返回只含有0的数组
|
||
|
vector<pair<int, int>> getClipConnectedToClip(int cid, int inOut);
|
||
9 months ago
|
|
||
9 months ago
|
/*根据分支点返回卡箍
|
||
|
mode=0为模式A,否则为模式B
|
||
|
其中模式B需要过滤掉通道中的卡箍
|
||
9 months ago
|
*/
|
||
9 months ago
|
vector<pair<int, int>> getClipConnectedToBranchPoint(int bid, int mode);
|
||
|
/*根据卡箍返回分支点,卡箍与分支点在同一个Bundle上
|
||
|
卡箍分为3种,断头/通道中的点/孤立点
|
||
|
其中通道中的点只能采用模式A
|
||
|
孤立点只能采用模式B
|
||
|
断头可以根据inOut来判断采用哪种模式
|
||
|
offset代表偏移量,用来将分支点标号对应到Astar中点的标号
|
||
9 months ago
|
*/
|
||
9 months ago
|
vector<pair<int, int>> getBranchPointConnectedToClip(int cid, int inOut, int offset = 0);
|
||
9 months ago
|
|
||
9 months ago
|
// 返回Astar中编号为id的点能建立边的下个点
|
||
|
public:
|
||
|
vector<pair<int, int>> getNextPoint(int id, int mode, int offset);
|
||
9 months ago
|
|
||
9 months ago
|
/*返回端点可以连接到的点
|
||
|
p是端点坐标
|
||
|
offSet是分支点坐标的偏移量
|
||
|
isEnd=1表示这个端点是路径终点,否则是路径起点
|
||
9 months ago
|
*/
|
||
9 months ago
|
public:
|
||
|
vector<pair<int, int>> getEXTNextPoint(P p, int offSet, int isEnd);
|
||
9 months ago
|
|
||
9 months ago
|
// 根据新的路径更新边信息
|
||
|
public:
|
||
|
void addPath(Path path);
|
||
9 months ago
|
};
|
||
|
|
||
|
extern BASIC_EDGE_API BasicEdge basicEdge;
|