You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kev/Drawer/SSBase/FaciesTrackingAlgo/PolygonCreatorBoundary.h

152 lines
4.8 KiB
C++

#ifndef __POLYGONCREATORBOUNDARY_H__
#define __POLYGONCREATORBOUNDARY_H__
class CGDFObjectLine;
class CObjectPolyline;
class CGDFObjectFill;
class CGDFLayer;
class CGDFSegment;
class CFillBoundary;
#include <float.h>
#include "CommonDefines.h"
#include "PointSegment.h"
#include "BezierPointSegment.h"
class CPolygonCreatorLine;
class POLYGONCREATORSEGMENT
{
public:
POLYGONCREATORSEGMENT();
char m_iType;//-1--invalid 0--实线段,为线的一段 1--横向虚线段,为网格边 2--纵向虚线段 3--临时保存的端点 4--其它用途
//以下针对虚线段
double m_dPosition;//虚线段的网格边界的位置(图坐标)
union
{
double m_dHeadIndex;//对于实线段,表示起点的点号
double m_dHeadPosition;//对于虚线段,表示起点的位置(图坐标)
};
union
{
double m_dEndIndex;//对于实线段,表示终点的点号
double m_dEndPosition;//对于虚线段,表示终点的位置(图坐标)
};
//以下针对实线段
union
{
CGDFObjectLine* m_pObject;
int m_iIndex;//追踪等值线而加入的
};
BYTE m_byteHeadIsEnd;
BYTE m_byteEndIsEnd;
BOOL OnInsertPoint(CObjectPolyline* pLine,double dIndex);
BOOL EndIsEndOfObject();
BOOL HeadIsEndOfObject();
BOOL IsWholeClosedLine();
BOOL IsOnePoint();
};
class CPolygonCreatorSegment : public POLYGONCREATORSEGMENT
{
public:
CPolygonCreatorSegment();
CPolygonCreatorSegment(CGDFObjectLine* pObject,double index0,double index1);//加入实边界段
CPolygonCreatorSegment(int iType,double position,double headposition,double endposition);
CPolygonCreatorSegment(CPolygonCreatorSegment& segment);
CPolygonCreatorSegment(POLYGONCREATORSEGMENT& segment);
~CPolygonCreatorSegment();
//Attributes
public:
CPoint2D m_headpoint;//方向与线的原方向一致
CPoint2D m_endpoint;//方向与线的原方向一致
CPoint2D m_headmappoint[6];//方向与线的原方向一致
CPoint2D m_endmappoint[6];//方向与线的原方向一致
//used for draw
POINT m_headdrawpoint[6];//方向与线的原方向一致
POINT m_enddrawpoint[6];//方向与线的原方向一致
short m_middlestartindex;
short m_middlepointcount;
//Operations
public:
BOOL AddEnd(CGDFObjectLine* pObject,double index0,double index1);
BOOL AddEnd(int iType,double position,double headposition,double endposition);
BOOL AddEnd(CPolygonCreatorSegment& segment);
BOOL AddHead(CGDFObjectLine* pObject,double index0,double index1);
BOOL AddHead(int iType,double position,double headposition,double endposition);
BOOL AddHead(CPolygonCreatorSegment& segment);
void Clear();
void CreateMapPoint();
CGDFObjectLine* CreateObject(CGDFLayer* pLayer,CTypedPtrArray<CPtrArray,CPolygonCreatorLine*>& linearray,CArray<POLYGONCREATORSEGMENT,POLYGONCREATORSEGMENT>& segmentarray);
FACIESSEGMENTDIRECTION GetDirection();
double GetEndPosition();
double GetHeadPosition();
double GetHeadIndex();
double GetEndIndex();
CGDFObjectLine* GetObjectG();
void SetPosition(double dValue);
double GetPosition();
void SetType(int iValue);
int GetType();
void SetHeadPosition(double dValue);
void SetEndPosition(double dValue);
BOOL OnInsertPoint(CObjectPolyline* pLine,double dIndex);
void operator=(CPolygonCreatorSegment& segment);
void operator=(POLYGONCREATORSEGMENT& segment);
void SendInsertPointMessage(CTypedPtrArray<CPtrArray,CPolygonCreatorLine*>& linearray,CArray<POLYGONCREATORSEGMENT,POLYGONCREATORSEGMENT>& segmentarray,CObjectPolyline* pLine,double dIndex);
void SetHeadIndex(double dValue);
void SetEndIndex(double dValue);
};
class CPolygonCreatorLine//构造填充区域的一条边,可以是外边界,也可以是内边界
{
public:
CPolygonCreatorLine();
~CPolygonCreatorLine();
//Attributes
public:
CArray<CPolygonCreatorSegment,CPolygonCreatorSegment> m_segmentarray;
private:
CBezierStyleDrawPointSegmentArray m_drawsegmentarray;
CBezierStyleMapPointSegmentArray m_mapsegmentarray;
BOOL m_bNeedExtend;
BOOL m_bModifyFlag;
//Operations
public:
void AddSegment(CGDFObjectLine* pObject,double index0,double index1);//加入实边界段
void AddSegment(int iType,double position,double headposition,double endposition);
int AddSegment(CPolygonCreatorSegment& segment,BOOL bCanCombine=TRUE);//bCanCombine是否可以与已有的段合并
CFillBoundary* CreateBoundary(CGDFLayer* pLayer,CTypedPtrArray<CPtrArray,CPolygonCreatorLine*>& linearray,CArray<POLYGONCREATORSEGMENT,POLYGONCREATORSEGMENT>& segmentarray);
void DeleteSegment(int index,int count=1);
CPolygonCreatorSegment* GetSegment(int index);
CPolygonCreatorSegment* GetSegmentArray();
void GetSegmentArray(CArray<CPolygonCreatorSegment,CPolygonCreatorSegment>& segmentarray);
int GetSegmentCount();
void OnInsertPoint(CObjectPolyline* pLine,double dIndex);
int PointInBorder(int iType,double dPosition,double dHeadPosition,double dEndPosition,int iBorderType);
int PointInBorder(CPoint2D point);//只检查是否在方格的边界上
int PointInBorder(int iType,double dPosition,double dPointPosition);
BOOL GetModifyFlag();
void SetSegmentAsHead(int index);
CPolygonCreatorLine* TrySplitLine(int index);
int TryCombineSegment(int index);
};
#endif