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