Files
envi-code/SourceCode/Code2026/inc/AdsXRx/SectionUtility.h
T
2026-09-28 15:28:50 +08:00

71 lines
2.9 KiB
C++

#ifndef _SECTIONUTILITY_H_
#define _SECTIONUTILITY_H_
#include "SectionStructDef.h"
#include "acgiutil.h"
#include "XExplodeStreamBase.h"
namespace SectionUtility
{
// 线到面投影
// 返回值为1,说明线与平面垂直,则 out_pt 值有效, 返回值为0,说明 out_seg 值有效, 返回值为-1, 说明投不到平面上
short GEOAPI Projection_line2plane(const XSectionPlane &plane, const AcGeLineSeg3d &in_seg,
AcGeLineSeg3d &out_seg, AcGePoint3d &out_pt);
short GEOAPI Projection_line2plane(const XSectionPlane &plane, const XLine &in_seg,
XLine &out_seg, AcGePoint3d &out_pt);
// 线到面的投影,只处理线段两端点都在面法向方向同侧的线段
short GEOAPI Projection_line2Plane_sub(const XSectionPlane &plane, const AcGeLineSeg3d &in_seg,
AcGeLineSeg3d &out_seg, AcGePoint3d &out_pt);
// 面到面投影, 返回值为 两面之间最短距离
double GEOAPI Projection_plane2plane(const XSectionPlane &section, const XSectionPlane &plane, XPoly2D &poly);
// poly2d 到 投影面的投影
double GEOAPI Projection_poly2plane(const XSectionPlane &section, const XPoly2D &plane, XPoly2D &poly);
// 画一个箭头
void GEOAPI MakeArrow(AcDbPolyline &poly, const AcGePoint3d &arrowHead, const AcGePoint3d &arrowTail);
// 画一个画柱体
void GEOAPI DrawColumn3D(XExplodeDraw &dc, const AcGePoint3d& TopCenter, const AcGePoint3d &BottomCenter, const double &scale);
// 画一个圆锥体
void GEOAPI DrawTaper3D(XExplodeDraw &dc, const AcGePoint3d &BottomCenter, const AcGeVector3d &vtDir, const double &scale);
bool GEOAPI GetLine(const std::vector<std::pair<int, XLine> > &lines, const int nIndex, XLine &line);
// 对全部 AecDbSectionPathSign 实例 进行刷新
void GEOAPI RefreshSectionPath();
// objId - 被 clone 的 对象 ID
// sLine - 线形
AcDbObjectId GEOAPI CloneAndResetLineTypeForBlockTableRecord(AcDbObjectId &objId, const CString &sLine);
XCurveSegment GetSegmentOfPoly(const XPoly2D &poly, const int nIdx);
int GetCountOfSegmentForPoly(const XPoly2D &poly);
AcGeMatrix3d GEOAPI GetCoordSystem(const AcGeVector3d &vt);
// 跟据 xy 面上的 poly 曲线 将之上下拉伸,生成系列的面
void GEOAPI MakeFacesByPoly(const XPoly2D &poly, const double &elev, const double &height,
std::vector<XSectionPlane> &planes, const bool bTopFace = false);
// bTopface 是否需要顶面和底面.
// 跟据 xy 面上的 poly 曲线 将之上下拉伸,生成系列的面 并将这些面进行投影,添充到 ObjSectionRecord 数组中
void GEOAPI FillRecordsByPoly(const XPoly2D &poly, const XSectionPlane &section,
std::vector<ObjSectionRecord> &records, const double &elev, const double &height,
const AcDbEntity &ent, ObjSectionRecord::SectionType type = ObjSectionRecord::eAEC_WALL,
const bool bTopFace = false); // bTopface 是否需要顶面和底面.
// for test
void GEOAPI DrawPoly2D(const XPoly2D &poly, const int color = 7);
void GEOAPI DrawXPlane(const XSectionPlane &plane, const int color = 7);
void GEOAPI DrawLines(const std::vector<XLine> &lines, const AcCmColor color);
}
#endif