94 lines
1.7 KiB
C++
94 lines
1.7 KiB
C++
//-----------------------------------------------------------------------------+
|
|
// Copyright (C), 1998-2007, Beijing Tangent Software Co. Ltd.
|
|
// = FileName : TGObject2D.cpp
|
|
// = Version : ver2.0
|
|
// = Author : xlc
|
|
// = CreateDate : 2002-09-09
|
|
// = Description: 类的定义
|
|
// = Maintainers:
|
|
//
|
|
//-----------------------------------------------------------------------------+
|
|
#include "StdAfx.h"
|
|
#include "TGObject2D.h"
|
|
#include "TGPoint2D.h"
|
|
|
|
IMPLEMENT_RUN_TIME_CLASS1(TGObject2D,"TGObject2D",TGObject)
|
|
|
|
TGObject2D::~TGObject2D()
|
|
{
|
|
|
|
}
|
|
|
|
//设标高
|
|
void TGObject2D::SetElev(double elev)
|
|
{
|
|
|
|
}
|
|
|
|
//取标高
|
|
double TGObject2D::GetElev() const
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
//转化为对应三维实体
|
|
TGObject3D * TGObject2D::Convert3D() const
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
void TGObject2D::Move(double cx,double cy)
|
|
{
|
|
TGMatrix matrix;
|
|
matrix.CreateMoveMatrix(cx,cy);
|
|
TransformBy(matrix);
|
|
}
|
|
|
|
void TGObject2D::Scale(double sx,double sy)
|
|
{
|
|
TGMatrix matrix;
|
|
matrix.CreateScaleMatrix(sx,sy);
|
|
TransformBy(matrix);
|
|
}
|
|
|
|
void TGObject2D::Scale(double sx,double sy,const TGPoint&basePoint)
|
|
{
|
|
TGMatrix matrix;
|
|
matrix.CreateScaleMatrix(sx,sy,basePoint);
|
|
TransformBy(matrix);
|
|
}
|
|
|
|
void TGObject2D::Rotate(double angle)
|
|
{
|
|
TGMatrix matrix;
|
|
matrix.CreateZRotateMatrix(angle);
|
|
TransformBy(matrix);
|
|
}
|
|
|
|
void TGObject2D::Rotate(double angle,const TGPoint& basePoint)
|
|
{
|
|
TGMatrix matrix;
|
|
matrix.CreateRotateMatrix(angle,basePoint);
|
|
TransformBy(matrix);
|
|
}
|
|
|
|
bool TGObject2D::IsInclude(const TGObject&obj) const
|
|
{
|
|
if(IS_TYPE(&obj,TGPoint2D))
|
|
{
|
|
return HitTest((const TGPoint2D&)obj).Is(GR_IN);
|
|
}
|
|
else
|
|
{
|
|
return TGObject::IsInclude(obj);
|
|
}
|
|
}
|
|
bool TGObject2D::GetExtend3D(TPGeExtend3D&ext) const
|
|
{
|
|
if(GetExtend2D(ext))
|
|
{
|
|
ext.m_zExt.SetRange(GetElev(),GetElev());
|
|
return true;
|
|
}
|
|
return false;
|
|
} |