550 lines
15 KiB
C++
550 lines
15 KiB
C++
#include "StdAfx.h"
|
|
#include "AecUnknownViewportGeometry.h"
|
|
#include <vector>
|
|
#include "AecUnknownViewportDraw.h"
|
|
#include "DrawingFlowData.h"
|
|
#include "comdef.h"
|
|
#include "KTCADUtilityEx.h"
|
|
|
|
ACRX_CONS_DEFINE_MEMBERS(AecUnknownViewportGeometry,AcGiViewportGeometry,AcDb::kDHL_CURRENT)
|
|
|
|
AecUnknownViewportGeometry::AecUnknownViewportGeometry(void)
|
|
{
|
|
mpCustomWorldDraw = NULL;
|
|
m_bToFindDrawingFrame = false;
|
|
m_bToFindForESignTrue = false;
|
|
}
|
|
|
|
AecUnknownViewportGeometry::AecUnknownViewportGeometry(AecUnknownViewportDraw* pWorldDraw)
|
|
{
|
|
mpCustomWorldDraw = pWorldDraw;
|
|
m_bToFindDrawingFrame = false;
|
|
m_bToFindForESignTrue = false;
|
|
}
|
|
|
|
AecUnknownViewportGeometry::~AecUnknownViewportGeometry(void)
|
|
{
|
|
|
|
}
|
|
|
|
void AecUnknownViewportGeometry::setToFindDrawingFrame()
|
|
{
|
|
m_bToFindDrawingFrame = true;
|
|
}
|
|
|
|
void AecUnknownViewportGeometry::setToFindForESignTrue()
|
|
{
|
|
m_bToFindForESignTrue = true;
|
|
}
|
|
|
|
void AecUnknownViewportGeometry::getModelToWorldTransform(AcGeMatrix3d &pMatrix) const
|
|
{
|
|
return;
|
|
}
|
|
void AecUnknownViewportGeometry::getWorldToModelTransform(AcGeMatrix3d &pMatrix) const
|
|
{
|
|
return;
|
|
}
|
|
void AecUnknownViewportGeometry::setExtents(AcGePoint3d *pNewExtents) const
|
|
{
|
|
|
|
}
|
|
|
|
Adesk::Boolean AecUnknownViewportGeometry::circle( const AcGePoint3d& center,
|
|
const double radius,
|
|
const AcGeVector3d& normal
|
|
) const
|
|
{
|
|
AcDbCircle* pCir = new AcDbCircle;
|
|
pCir->setCenter(center);
|
|
pCir->setRadius(radius);
|
|
pCir->setNormal(normal);
|
|
mpCustomWorldDraw->m_prcDrawingFlowData->Append(pCir);
|
|
|
|
return Adesk::kTrue;
|
|
}
|
|
|
|
Adesk::Boolean AecUnknownViewportGeometry::circle(const AcGePoint3d& pt1,
|
|
const AcGePoint3d& pt2,
|
|
const AcGePoint3d& pt3
|
|
) const
|
|
{
|
|
AcGeCircArc3d cir(pt1,pt2,pt3);
|
|
AcDbCircle* pCir = new AcDbCircle;
|
|
pCir->setCenter(cir.center());
|
|
pCir->setRadius(cir.radius());
|
|
pCir->setNormal(cir.normal());
|
|
|
|
mpCustomWorldDraw->m_prcDrawingFlowData->Append(pCir);
|
|
return Adesk::kTrue;
|
|
}
|
|
|
|
Adesk::Boolean AecUnknownViewportGeometry::circularArc( const AcGePoint3d& center,
|
|
const double radius,
|
|
const AcGeVector3d& normal,
|
|
const AcGeVector3d& startVector,
|
|
const double sweepAngle,
|
|
const AcGiArcType arcType
|
|
) const
|
|
{
|
|
AcGeVector3d vtSta = startVector;
|
|
vtSta.normalize();
|
|
vtSta *= radius;
|
|
|
|
AcGeVector3d vtEnd = vtSta;
|
|
vtEnd.rotateBy(sweepAngle,normal);
|
|
|
|
AcGeVector3d vtHaf = vtSta;
|
|
vtHaf.rotateBy(sweepAngle * 0.5,normal);
|
|
|
|
AcGePoint3d pt1 = center + vtSta;
|
|
AcGePoint3d pt2 = center + vtHaf;
|
|
AcGePoint3d pt3 = center + vtEnd;
|
|
|
|
AcDbArc* pArc = KTCADUtilityEx::FormatArc(pt1,pt2,pt3);
|
|
if (pArc != NULL)
|
|
{
|
|
mpCustomWorldDraw->m_prcDrawingFlowData->Append(pArc);
|
|
}
|
|
|
|
if (arcType == kAcGiArcSector)
|
|
{
|
|
AcDbLine* pLn = new AcDbLine(center,pt1);
|
|
pLn->setNormal(normal);
|
|
mpCustomWorldDraw->m_prcDrawingFlowData->Append(pLn);
|
|
|
|
pLn = new AcDbLine(center,pt3);
|
|
pLn->setNormal(normal);
|
|
mpCustomWorldDraw->m_prcDrawingFlowData->Append(pLn);
|
|
}
|
|
|
|
if (arcType == kAcGiArcChord)
|
|
{
|
|
AcDbLine* pLn = new AcDbLine(pt1,pt3);
|
|
pLn->setNormal(normal);
|
|
mpCustomWorldDraw->m_prcDrawingFlowData->Append(pLn);
|
|
}
|
|
return Adesk::kTrue;
|
|
}
|
|
|
|
Adesk::Boolean AecUnknownViewportGeometry::circularArc( const AcGePoint3d& start,
|
|
const AcGePoint3d& point,
|
|
const AcGePoint3d& end,
|
|
const AcGiArcType arcType
|
|
) const
|
|
{
|
|
AcGePoint3d pt1 = start;
|
|
AcGePoint3d pt2 = point;
|
|
AcGePoint3d pt3 = end;
|
|
AcDbArc* pArc = KTCADUtilityEx::FormatArc(pt1,pt2,pt3);
|
|
if (pArc != NULL)
|
|
{
|
|
mpCustomWorldDraw->m_prcDrawingFlowData->Append(pArc);
|
|
|
|
AcGeVector3d normal = pArc->normal();
|
|
|
|
if (arcType == kAcGiArcSector)
|
|
{
|
|
AcDbLine* pLn = new AcDbLine(pArc->center(),start);
|
|
pLn->setNormal(normal);
|
|
mpCustomWorldDraw->m_prcDrawingFlowData->Append(pLn);
|
|
|
|
pLn = new AcDbLine(pArc->center(),end);
|
|
pLn->setNormal(normal);
|
|
mpCustomWorldDraw->m_prcDrawingFlowData->Append(pLn);
|
|
}
|
|
|
|
if (arcType == kAcGiArcChord)
|
|
{
|
|
AcDbLine* pLn = new AcDbLine(start,end);
|
|
pLn->setNormal(normal);
|
|
mpCustomWorldDraw->m_prcDrawingFlowData->Append(pLn);
|
|
}
|
|
}
|
|
|
|
return Adesk::kTrue;
|
|
}
|
|
|
|
#if (ARX>=18)
|
|
Adesk::Boolean AecUnknownViewportGeometry::polyline(const AcGiPolyline& polylineObj) const
|
|
{
|
|
Adesk::UInt32 nbPoints = polylineObj.points();
|
|
AcGePoint3d* pVertexList = (AcGePoint3d*)polylineObj.vertexList();
|
|
AcGeVector3d* pNormal = (AcGeVector3d*)polylineObj.normal();
|
|
Adesk::LongPtr lBaseSubEntMarker = polylineObj.baseSubEntMarker();
|
|
return polyline(nbPoints,pVertexList,pNormal,lBaseSubEntMarker);
|
|
}
|
|
|
|
Adesk::Boolean AecUnknownViewportGeometry::polyPolyline( Adesk::UInt32 nbPolylines,
|
|
const AcGiPolyline* pPolylines) const
|
|
{
|
|
for(int i = 0;i < nbPolylines;i++)
|
|
{
|
|
const AcGiPolyline& polylineObj = pPolylines[i];
|
|
polyline(polylineObj);
|
|
}
|
|
return Adesk::kTrue;
|
|
}
|
|
|
|
Adesk::Boolean AecUnknownViewportGeometry::polyPolygon(const Adesk::UInt32 numPolygonIndices,
|
|
const Adesk::UInt32* numPolygonPositions,
|
|
const AcGePoint3d* polygonPositions,
|
|
const Adesk::UInt32* numPolygonPoints,
|
|
const AcGePoint3d* polygonPoints,
|
|
const AcCmEntityColor* outlineColors,
|
|
const AcGiLineType* outlineTypes,
|
|
const AcCmEntityColor* fillColors,
|
|
const AcCmTransparency* fillOpacities) const
|
|
{
|
|
return Adesk::kTrue;
|
|
}
|
|
|
|
Adesk::Boolean AecUnknownViewportGeometry::ellipticalArc(const AcGePoint3d& center,
|
|
const AcGeVector3d& normal,
|
|
double majorAxisLength,
|
|
double minorAxisLength,
|
|
double startDegreeInRads,
|
|
double endDegreeInRads,
|
|
double tiltDegreeInRads,
|
|
AcGiArcType arcType) const
|
|
{
|
|
return Adesk::kTrue;
|
|
}
|
|
Adesk::Boolean AecUnknownViewportGeometry::image( const AcGiImageBGRA32& imageSource,
|
|
const AcGePoint3d& position,
|
|
const AcGeVector3d& u, //orientation and magnitude of width
|
|
const AcGeVector3d& v, //orientation and magnitude of height
|
|
TransparencyMode transparencyMode
|
|
) const
|
|
{
|
|
return Adesk::kTrue;
|
|
}
|
|
|
|
Adesk::Boolean AecUnknownViewportGeometry::rowOfDots( int count,
|
|
const AcGePoint3d& start,
|
|
const AcGeVector3d& step
|
|
) const
|
|
{
|
|
return Adesk::kTrue;
|
|
}
|
|
#endif
|
|
|
|
|
|
#ifdef _WIN64
|
|
Adesk::Boolean AecUnknownViewportGeometry::polyline(const Adesk::UInt32 nbPoints,
|
|
const AcGePoint3d* pVertexList,
|
|
const AcGeVector3d* pNormal,
|
|
Adesk::LongPtr lBaseSubEntMarker) const
|
|
{
|
|
if (pVertexList != NULL)
|
|
{
|
|
for (int i = 0;i < nbPoints - 1;i++)
|
|
{
|
|
AcDbLine* pLn = new AcDbLine(pVertexList[i],pVertexList[i+1]);
|
|
mpCustomWorldDraw->m_prcDrawingFlowData->Append(pLn);
|
|
}
|
|
}
|
|
return Adesk::kTrue;
|
|
}
|
|
#else
|
|
Adesk::Boolean AecUnknownViewportGeometry::polyline(const Adesk::UInt32 nbPoints,
|
|
const AcGePoint3d* pVertexList,
|
|
const AcGeVector3d* pNormal,
|
|
Adesk::Int32 lBaseSubEntMarker) const
|
|
{
|
|
if (pVertexList != NULL)
|
|
{
|
|
for (int i = 0;i < nbPoints - 1;i++)
|
|
{
|
|
AcDbLine* pLn = new AcDbLine(pVertexList[i],pVertexList[i+1]);
|
|
mpCustomWorldDraw->m_prcDrawingFlowData->Append(pLn);
|
|
}
|
|
}
|
|
return Adesk::kTrue;
|
|
}
|
|
#endif
|
|
|
|
Adesk::Boolean AecUnknownViewportGeometry::polygon(const Adesk::UInt32 nbPoints,
|
|
const AcGePoint3d* pVertexList
|
|
) const
|
|
{
|
|
if (pVertexList != NULL)
|
|
{
|
|
for (int i = 0;i < nbPoints - 1;i++)
|
|
{
|
|
AcDbLine* pLn = new AcDbLine(pVertexList[i],pVertexList[i+1]);
|
|
mpCustomWorldDraw->m_prcDrawingFlowData->Append(pLn);
|
|
}
|
|
}
|
|
return Adesk::kTrue;
|
|
}
|
|
|
|
#if ARX>16
|
|
Adesk::Boolean AecUnknownViewportGeometry::mesh(const Adesk::UInt32 rows,
|
|
const Adesk::UInt32 columns,
|
|
const AcGePoint3d* pVertexList,
|
|
const AcGiEdgeData* pEdgeData,//6-2
|
|
const AcGiFaceData* pFaceData,//8-4
|
|
const AcGiVertexData* pVertexData,//3-1
|
|
const bool bAutoGenerateNormals
|
|
) const
|
|
{
|
|
return Adesk::kTrue;
|
|
}
|
|
|
|
Adesk::Boolean AecUnknownViewportGeometry::shell( const Adesk::UInt32 nbVertex,
|
|
const AcGePoint3d* pVertexList,
|
|
const Adesk::UInt32 faceListSize,
|
|
const Adesk::Int32* pFaceList,
|
|
const AcGiEdgeData* pEdgeData,//6-2
|
|
const AcGiFaceData* pFaceData ,//8-2
|
|
const AcGiVertexData* pVertexData,//3-1
|
|
const struct resbuf* pResBuf,
|
|
const bool bAutoGenerateNormals
|
|
) const
|
|
|
|
{
|
|
return Adesk::kTrue;
|
|
}
|
|
#else
|
|
Adesk::Boolean AecUnknownViewportGeometry::mesh(const Adesk::UInt32 rows,
|
|
const Adesk::UInt32 columns,
|
|
const AcGePoint3d* pVertexList,
|
|
const AcGiEdgeData* pEdgeData,//6-2
|
|
const AcGiFaceData* pFaceData,//8-2
|
|
const AcGiVertexData* pVertexData//3-1
|
|
) const
|
|
{
|
|
return Adesk::kTrue;
|
|
}
|
|
|
|
Adesk::Boolean AecUnknownViewportGeometry::shell(const Adesk::UInt32 nbVertex,
|
|
const AcGePoint3d* pVertexList,
|
|
const Adesk::UInt32 faceListSize,
|
|
const Adesk::Int32* pFaceList,
|
|
const AcGiEdgeData* pEdgeData,//6-2
|
|
const AcGiFaceData* pFaceData ,//8-2
|
|
const AcGiVertexData* pVertexData,//3-1
|
|
const struct resbuf* pResBuf
|
|
) const
|
|
|
|
{
|
|
return Adesk::kTrue;
|
|
}
|
|
#endif
|
|
|
|
Adesk::Boolean AecUnknownViewportGeometry::text(const AcGePoint3d& position,
|
|
const AcGeVector3d& normal,
|
|
const AcGeVector3d& direction,
|
|
const double height,
|
|
const double width,
|
|
const double oblique,
|
|
const TCHAR* pMsg
|
|
) const
|
|
{
|
|
AcDbText* pText = new AcDbText;
|
|
pText->setPosition(position);
|
|
pText->setNormal(normal);
|
|
pText->setTextString(pMsg);
|
|
pText->setHeight(height);
|
|
pText->setWidthFactor(width / height);
|
|
pText->setOblique(oblique);
|
|
|
|
double dAngle = AcGeVector3d::kXAxis.angleTo(direction);
|
|
pText->setRotation(dAngle);
|
|
mpCustomWorldDraw->m_prcDrawingFlowData->Append(pText);
|
|
|
|
return Adesk::kTrue;
|
|
}
|
|
|
|
Adesk::Boolean AecUnknownViewportGeometry::text(const AcGePoint3d& position,
|
|
const AcGeVector3d& normal,
|
|
const AcGeVector3d& direction,
|
|
const TCHAR* pMsg,
|
|
const Adesk::Int32 length,
|
|
const Adesk::Boolean raw,
|
|
const AcGiTextStyle &pTextStyle
|
|
) const
|
|
{
|
|
AcDbText* pText = new AcDbText;
|
|
pText->setPosition(position);
|
|
pText->setNormal(normal);
|
|
pText->setTextString(pMsg);
|
|
pText->setHeight(pTextStyle.textSize());
|
|
pText->setWidthFactor(pTextStyle.xScale());
|
|
pText->setOblique(pTextStyle.obliquingAngle());
|
|
|
|
double dAngle = AcGeVector3d::kXAxis.angleTo(direction);
|
|
pText->setRotation(dAngle);
|
|
|
|
AcDbObjectId id;
|
|
toAcDbTextStyle((AcGiTextStyle &)pTextStyle,id);
|
|
pText->setTextStyle(id);
|
|
|
|
mpCustomWorldDraw->m_prcDrawingFlowData->Append(pText);
|
|
|
|
return Adesk::kTrue;
|
|
}
|
|
|
|
Adesk::Boolean AecUnknownViewportGeometry::xline(const AcGePoint3d& one_xline_point,
|
|
const AcGePoint3d& a_different_xline_point
|
|
) const
|
|
{
|
|
return Adesk::kTrue;
|
|
}
|
|
|
|
Adesk::Boolean AecUnknownViewportGeometry::pline(const AcDbPolyline& lwBuf,
|
|
Adesk::UInt32 fromIndex,
|
|
Adesk::UInt32 numSegs
|
|
) const
|
|
{
|
|
AcDbVoidPtrArray arEntPtrs;
|
|
lwBuf.explode(arEntPtrs);
|
|
|
|
for(int i = 0;i < arEntPtrs.length();i++)
|
|
{
|
|
mpCustomWorldDraw->m_prcDrawingFlowData->Append((AcDbEntity*)arEntPtrs.at(i));
|
|
}
|
|
return Adesk::kTrue;
|
|
}
|
|
|
|
Adesk::Boolean AecUnknownViewportGeometry::ray(const AcGePoint3d& rays_starting_point,
|
|
const AcGePoint3d& a_different_ray_point
|
|
) const
|
|
{
|
|
return Adesk::kTrue;
|
|
}
|
|
|
|
|
|
Adesk::Boolean AecUnknownViewportGeometry::pushModelTransform(const AcGeVector3d & vNormal)
|
|
{
|
|
m_lastXForm.setToTranslation(vNormal);
|
|
return Adesk::kTrue;
|
|
}
|
|
|
|
Adesk::Boolean AecUnknownViewportGeometry::pushModelTransform(const AcGeMatrix3d & xMat)
|
|
{
|
|
m_lastXForm = xMat;
|
|
return Adesk::kTrue;
|
|
}
|
|
|
|
Adesk::Boolean AecUnknownViewportGeometry::popModelTransform()
|
|
{
|
|
return Adesk::kTrue;
|
|
}
|
|
|
|
#if (ARX>=18)
|
|
AcGeMatrix3d AecUnknownViewportGeometry::pushPositionTransform (AcGiPositionTransformBehavior behavior, const AcGePoint3d& offset)
|
|
{
|
|
return AcGeMatrix3d::kIdentity;
|
|
}
|
|
|
|
AcGeMatrix3d AecUnknownViewportGeometry::pushPositionTransform (AcGiPositionTransformBehavior behavior, const AcGePoint2d& offset)
|
|
{
|
|
return AcGeMatrix3d::kIdentity;
|
|
}
|
|
|
|
AcGeMatrix3d AecUnknownViewportGeometry::pushScaleTransform (AcGiScaleTransformBehavior behavior, const AcGePoint3d& extents)
|
|
{
|
|
return AcGeMatrix3d::kIdentity;
|
|
}
|
|
|
|
AcGeMatrix3d AecUnknownViewportGeometry::pushScaleTransform (AcGiScaleTransformBehavior behavior, const AcGePoint2d& extents)
|
|
{
|
|
return AcGeMatrix3d::kIdentity;
|
|
}
|
|
|
|
AcGeMatrix3d AecUnknownViewportGeometry::pushOrientationTransform (AcGiOrientationTransformBehavior behavior)
|
|
{
|
|
return AcGeMatrix3d::kIdentity;
|
|
}
|
|
#endif
|
|
|
|
Adesk::Boolean AecUnknownViewportGeometry::draw(AcGiDrawable* pDra) const
|
|
{
|
|
//acutPrintf(_T("\ndraw %s"),pDra->isA()->name());
|
|
AcDbCurve* pCrv = AcDbCurve::cast(pDra);
|
|
if (pCrv != NULL)
|
|
{
|
|
mpCustomWorldDraw->m_prcDrawingFlowData->Append((AcDbEntity*)pCrv->clone());
|
|
return Adesk::kTrue;
|
|
}
|
|
|
|
AcDbEntity* pSolid = AcDbEntity::cast(pDra);
|
|
if (pSolid != NULL)
|
|
{
|
|
AcDbVoidPtrArray arEntPtrs;
|
|
pSolid->explode(arEntPtrs);
|
|
|
|
for(int i = 0;i < arEntPtrs.length();i++)
|
|
{
|
|
mpCustomWorldDraw->m_prcDrawingFlowData->Append((AcDbEntity*)arEntPtrs.at(i));
|
|
}
|
|
}
|
|
|
|
return Adesk::kTrue;
|
|
}
|
|
|
|
Adesk::Boolean AecUnknownViewportGeometry::pushClipBoundary(AcGiClipBoundary * pBoundary)
|
|
{
|
|
return Adesk::kTrue;
|
|
}
|
|
|
|
void AecUnknownViewportGeometry::popClipBoundary()
|
|
{
|
|
return;
|
|
}
|
|
|
|
Adesk::Boolean AecUnknownViewportGeometry::polylineEye(const Adesk::UInt32 nbPoints,const AcGePoint3d* pPoints) const
|
|
{
|
|
return Adesk::kFalse;
|
|
}
|
|
|
|
Adesk::Boolean AecUnknownViewportGeometry::polygonEye(const Adesk::UInt32 nbPoints,const AcGePoint3d* pPoints) const
|
|
{
|
|
return Adesk::kFalse;
|
|
}
|
|
|
|
Adesk::Boolean AecUnknownViewportGeometry::polylineDc(const Adesk::UInt32 nbPoints,const AcGePoint3d* pPoints) const
|
|
{
|
|
return Adesk::kFalse;
|
|
}
|
|
|
|
Adesk::Boolean AecUnknownViewportGeometry::polygonDc(const Adesk::UInt32 nbPoints,const AcGePoint3d* pPoints) const
|
|
{
|
|
return Adesk::kFalse;
|
|
}
|
|
|
|
Adesk::Boolean AecUnknownViewportGeometry::rasterImageDc(
|
|
const AcGePoint3d& origin,
|
|
const AcGeVector3d& u,
|
|
const AcGeVector3d& v,
|
|
const AcGeMatrix2d& pixelToDc,
|
|
AcDbObjectId entityId,
|
|
AcGiImageOrg imageOrg,
|
|
Adesk::UInt32 imageWidth,
|
|
Adesk::UInt32 imageHeight,
|
|
Adesk::Int16 imageColorDepth,
|
|
Adesk::Boolean transparency,
|
|
ImageSource source,
|
|
const AcGeVector3d& unrotatedU,
|
|
const AcGiImageOrg origionalImageOrg,
|
|
const AcGeMatrix2d& unrotatedPixelToDc,
|
|
const Adesk::UInt32 unrotatedImageWidth,
|
|
const Adesk::UInt32 unrotatedImageHeight
|
|
) const
|
|
{
|
|
return Adesk::kFalse;
|
|
}
|
|
|
|
Adesk::Boolean AecUnknownViewportGeometry::ownerDrawDc(
|
|
long vpnumber,
|
|
long left,
|
|
long top,
|
|
long right,
|
|
long bottom,
|
|
const OwnerDraw* pOwnerDraw
|
|
) const
|
|
{
|
|
return Adesk::kFalse;
|
|
} |