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.
74 lines
1.8 KiB
C++
74 lines
1.8 KiB
C++
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
//文件 Rect8.h
|
|
//主要功能:
|
|
// 基础类库
|
|
//程序编写: 2005-12-07
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
#pragma once
|
|
#include "Point2D.h"
|
|
|
|
namespace NBase
|
|
{
|
|
|
|
class AFX_EXT_CLASS CRect8
|
|
{
|
|
public:
|
|
CRect8(void);
|
|
CRect8(double left, double top, double right, double bottom);
|
|
~CRect8(void);
|
|
|
|
void SetRect(double left, double top, double right, double bottom);
|
|
void SetRect(const CPoint2D& TopLeft, const CPoint2D& RightBottom);
|
|
|
|
double Width(void);
|
|
double Height(void);
|
|
CSize8 GetSize(void);
|
|
|
|
void SetOne(void);
|
|
void ToInt(CRect& rect);
|
|
|
|
bool operator==(const CRect8& rt);
|
|
void operator= (const CRect8& rt);
|
|
void operator= (CRect& rt);
|
|
void operator*=(double sv);
|
|
|
|
bool PtInRect(const CPoint2D& point);
|
|
bool PtInRect(double x, double y);
|
|
virtual bool RtInRect(CRect8& rect);
|
|
|
|
CPoint2D TopLeft(void);
|
|
CPoint2D BottomRight(void);
|
|
CPoint2D CenterPoint(void);
|
|
|
|
void CombinRect(const CRect8& rect);
|
|
void CombinRect(double xmin, double ymin, double xmax, double ymax);
|
|
void CombinPoint(double x, double y);
|
|
void CombinPoint(const CPoint2D& point);
|
|
|
|
void Empty(void);
|
|
bool IsEmpty(void);
|
|
|
|
void InflateRect(double x, double y);
|
|
void DeflateRect(double x, double y);
|
|
|
|
void IntersectRect(CRect8& rect);
|
|
void RotateRect(double x0, double y0, double angle);
|
|
void OffsetRect(double dx, double dy);
|
|
void NormalizeRect(void);
|
|
|
|
virtual void ScaleCoor(double xs,double ys,double dx,double dy);
|
|
virtual void ExchangeXY(void); //交换XY坐标
|
|
virtual void Serialize(CArchive& ar);
|
|
|
|
void Write(CFile& fw);
|
|
int Read(CFile& fr);
|
|
|
|
public:
|
|
double left,right,top,bottom;
|
|
//bool IsNormalized;
|
|
};
|
|
};
|
|
using namespace NBase;
|