24#if !defined(DEBUG_DRAW_INCLUDED)
25#define DEBUG_DRAW_INCLUDED
28#if !defined(_DEBUG) && defined(DEBUG_DRAW_ENABLED)
29#undef DEBUG_DRAW_ENABLED
31#if defined(_DEBUG) && defined(DEBUG_DRAW_ENABLED)
32#pragma comment(lib, "TD_DbRoot.lib")
33#pragma comment(lib, "TD_Db.lib")
34#pragma comment(lib, "TD_Gi.lib")
35#pragma comment(lib, "TD_DbIO.lib")
38#if defined(DEBUG_DRAW_ENABLED)
46#include "../Extensions/ExServices/ExHostAppServices.h"
115#if defined(DEBUG_DRAW_ENABLED)
118static bool g_DEBUG_DRAW_ENABLED =
true;
120template <
class TSegment2d>
125 pts[0] = rSeg.startPt();
126 pts[1] = rSeg.endPt();
135 rSeg.getArcSeg( arc2d );
140template <
class TSegment2d>
142 if( g_DEBUG_DRAW_ENABLED ) {
148 _debug_draw( proxy.
wGeom(), rSeg );
162 for (
OdUInt32 i = 0; i < nSegments; ++i )
179 if( g_DEBUG_DRAW_ENABLED ) {
191 if( !g_DEBUG_DRAW_ENABLED )
205 if( g_DEBUG_DRAW_ENABLED ) {
218 if( g_DEBUG_DRAW_ENABLED ) {
225 for(
OdUInt32 nContour = 0; nContour < profile.
size(); nContour++)
241 pt3d[1] = pt3d[0] + (pt3d[1] - pt3d[0]) * 0.1;
268 if( !g_DEBUG_DRAW_ENABLED )
274 const double dMult = 100000.0;
291 if( !g_DEBUG_DRAW_ENABLED )
299 const double dMult = 100000.0;
303 cLineRep.appendVertex(ptS2d);
304 cLineRep.appendVertex(ptE2d);
311 if( !g_DEBUG_DRAW_ENABLED )
322 static const double fMarkerSize = 100;
343 if( g_DEBUG_DRAW_ENABLED ) {
355 if (g_DEBUG_DRAW_ENABLED) {
359 for (
OdUInt32 i = 0; i != nPts; i++)
370 if( !g_DEBUG_DRAW_ENABLED )
390 if( g_DEBUG_DRAW_ENABLED ) {
398 for( i = 0; i <iSize; i++ )
400 OdUInt32 j, jSize = profile[ i ].numSegments();
401 for( j = 0; j < jSize; j++ )
404 profile[ i ].getSegmentAt( j, seg );
405 _debug_draw( proxy.
wGeom(), seg );
413inline void DEBUG_DRAW(
const std::vector<FacetModeler::Profile2D>& rProfiles,
OdInt16 color )
415 if( !g_DEBUG_DRAW_ENABLED )
418 for(
size_t idx = 0; idx < rProfiles.size(); idx++)
426 if (g_DEBUG_DRAW_ENABLED) {
440 if( g_DEBUG_DRAW_ENABLED ) {
454 if(!g_DEBUG_DRAW_ENABLED)
460 const double dLineLength = 10000;
483 Face* pFace = itF.get();
488 std::vector<OdInt32> aFaceIndex;
489 for (
unsigned int i = 0; i < profile.
size(); ++i)
493 const bool bHole = !contour.
isCCW();
494 aFaceIndex.push_back(bHole ? -nVt : nVt);
495 for (
int j = 0; j < nVt; ++j)
501 aFaceIndex.push_back(iVx);
510 for (
int i = 0; i < nVxFace; ++i)
515 for (
int i = 0; i < nTr; ++i)
519 tr.
tr[0] = nVxMesh + aTrFace[i * 4 + 1];
520 tr.
tr[1] = nVxMesh + aTrFace[i * 4 + 2];
521 tr.
tr[2] = nVxMesh + aTrFace[i * 4 + 3];
522 mesh.
m_aTr.push_back(tr);
536 while (!itEdges.done())
542 if (pPairEdge != NULL)
557 bodyGenMesh(mesh, rBody);
561 for (
unsigned int i = 0; i < mesh.
m_aTr.length(); i++)
574 if( !g_DEBUG_DRAW_ENABLED )
583 DebugDrawBody( proxy, body, wired);
592 if( !g_DEBUG_DRAW_ENABLED )
600 const double dSizes = dSize;
611 if( !g_DEBUG_DRAW_ENABLED )
628 if( !g_DEBUG_DRAW_ENABLED )
654 if( g_DEBUG_DRAW_ENABLED )
659 const double dLength =
v.length();
660 const double dVecLength = dLength * 0.9;
675 if( g_DEBUG_DRAW_ENABLED ) {
691 OdGePoint3d ptArrowBase = ptEnd - (ptEnd - ptStart) / 20.0;
693 OdInt16 edgeColor = edgeBaseColor;
701 if( g_DEBUG_DRAW_ENABLED ) {
750 c3dPlane.as2d().push_back(c2dBox);
773 for(
OdUInt32 contourIdx = 0; contourIdx < faceProfile.
size(); contourIdx++)
776 if(currentContour.
isCCW())
838 double dMin =
odmin(dL, dW);
847 pts[1] = ptOrigin + mEntity.
getCsXAxis() * dL;
874 pts[1] = origin + xAxis * dBaseLen;
877 pts[1] = origin + yAxis * dBaseLen * 3;
880 pts[1] = origin + zAxis * dBaseLen * 5;
909 for(
int s = 0; s < numSegs; s++)
914 double dBulge = aSeg.
bulge();
928 for(
int i = 0; i < numVerts; i++)
996 closedLoop[i] = loop[i];
998 closedLoop[loop.
size()] = loop[0];
1006template <
class TSegment2d>
void DEBUG_DRAW_ENTITY_EXTENTS_2D(const OdGeMatrix3d &mEntity, const OdGeExtents3d &mExtents, OdUInt16 color)
void DEBUG_DRAW_AXIS4(const OdGePoint3d &ptOrigin, const OdGeVector3d &vAxis, const double fLen, OdInt16 color)
void DEBUG_DRAW_EXTENTS(const OdGeExtents2d &box, OdUInt16 color)
void DEBUG_CONTOUR2D(const Contour2D &c)
void DEBUG_DRAW_POLYLINE(const OdGePoint3d *ptPoly, OdUInt32 nPts, OdInt16 color)
void DEBUG_DRAW_FACE_PROFILE(const Profile2D &faceProfile)
void DEBUG_DRAW_PLANE(const OdGePlane &rPlane, const double fWidth, OdInt16 color)
void DEBUG_DRAW_LINE(const OdGeLine2d &aLine, OdInt16 color)
void DEBUG_DRAW1(const OdCmColor &color)
void DEBUG_DRAW_CS(const OdGePoint3d &ptOrigin, const OdGeVector3d &vx, const OdGeVector3d &vy, const OdGeVector3d &vz, const double fLen)
void DEBUG_DRAW3(OdRemoteGeomProxy &proxy, const Contour2D &contour, OdInt16 color)
void DEBUG_DRAW_LINESEG(const OdGePoint2d &pt1, const OdGePoint2d &pt2, OdInt16 color)
void DEBUG_DRAW(const TSegment2d &rSeg, OdInt16 color)
void DEBUG_DRAW_FACE(const Face *pFace, OdInt16 color)
void DEBUG_DRAW_AXIS(const OdGePoint3d &ptOrigin, const OdGeVector3d &vAxis, const double fLen)
void DEBUG_DRAW2(const OdGePoint2d &pt1, const OdGePoint2d &pt2, OdInt16 color)
void DEBUG_DRAW_LOOP(const OdGePoint2dArray &loop, OdUInt16 color)
TAecAutoColor< OdUInt16 > AecAutoColor
void DEBUG_DRAW_TRIANGLE(const OdGePoint3d *ptTriangle, OdInt16 color)
OdArray< OdGePoint2d, OdMemoryAllocator< OdGePoint2d > > OdGePoint2dArray
OdArray< OdInt32, OdMemoryAllocator< OdInt32 > > OdInt32Array
bool OdZero(double x, double tol=1.e-10)
static Body box(const OdGePoint3d &ptOrigin, const OdGeVector3d &vSizes)
Result getLineSegAt(OdUInt32 iIndex, OdGeLineSeg2d &geLine) const
Result getVertexAt(OdUInt32 iIndex, OdGePoint2d *pPoint, double *pBulge=NULL, OdIntPtr *pMetadata=NULL, OdUInt32 *puRawFlags=NULL) const
Result getBulgeAt(OdUInt32 iIndex, double &dBulge) const
void setClosed(bool bClosed=true)
Result getArcSegAt(OdUInt32 iIndex, OdGeCircArc2d &geArc) const
OdUInt32 numVerts() const
SegmentType segmentType(OdUInt32 iIndex) const
bool isSelfIntersecting(const OdGeTol &gTol=FMGeGbl::gTol, bool bExcludeTouch=false) const
Result getSegmentAt(OdUInt32 iIndex, Segment2D &rSegment) const
OdUInt32 numSegments() const
Result appendVertex(const OdGePoint2d &ptStart, double dBulge=0.0, OdIntPtr uMetadata=0, OdUInt32 uRawFlags=0)
const OdGePoint3d & startPoint() const
const OdGePoint3d & endPoint() const
void projection(const OdGePlane &plane, Profile2D &result, bool bIncludeHoles=true, OdArray< const Edge * > *pSourceEdges=NULL) const
void profile(Profile3D &rResult, const OdGePlane *pPlane=NULL, bool bIncludeHoles=true) const
const OdGePlane & plane() const
const OdGePoint2d & endPt() const
const OdGePoint2d & startPt() const
const OdGePoint3d & point() const
void to3D(const OdGePoint2d &rSource2D, OdGePoint3d &rDest3D) const
const OdGeMatrix3d & transform() const
const T * asArrayPtr() const
void push_back(const T &value)
size_type logicalLength() const
void resize(size_type logicalLength, const T &value)
OdCmEntityColor entityColor() const
const OdGePoint2d & maxPoint() const
const OdGePoint2d & minPoint() const
const OdGePoint3d & maxPoint() const
const OdGePoint3d & minPoint() const
OdGePoint3d startPoint() const
OdGePoint3d endPoint() const
OdGePoint2d pointOnLine() const
OdGeVector2d direction() const
OdGeVector3d direction() const
OdGePoint3d pointOnLine() const
void getCoordSystem(OdGePoint3d &origin, OdGeVector3d &xAxis, OdGeVector3d &yAxis, OdGeVector3d &zAxis) const
OdGePoint3d getCsOrigin() const
OdGeVector3d getCsYAxis() const
OdGeVector3d getCsXAxis() const
OdGePoint3d pointOnPlane() const
OdGeVector3d normal() const
double distanceTo(const OdGePoint3d &point) const
OdGePoint3d evalPoint(const OdGePoint2d ¶m) const
virtual void popModelTransform()=0
virtual void shell(OdInt32 numVertices, const OdGePoint3d *vertexList, OdInt32 faceListSize, const OdInt32 *faceList, const OdGiEdgeData *pEdgeData=0, const OdGiFaceData *pFaceData=0, const OdGiVertexData *pVertexData=0)=0
virtual void polyline(OdInt32 numVertices, const OdGePoint3d *vertexList, const OdGeVector3d *pNormal=0, OdGsMarker baseSubEntMarker=-1)=0
virtual void pushModelTransform(const OdGeVector3d &normal)=0
virtual OdUInt16 color() const =0
virtual void setLineWeight(OdDb::LineWeight lineWeight)=0
virtual void setColor(OdUInt16 color)=0
virtual void setTrueColor(const OdCmEntityColor &color)=0
OdGiSubEntityTraits & traits()
void sendStringToExecute(const OdString &s)
OdGiWorldGeometry & wGeom()
GLfloat GLfloat GLfloat v2
GE_TOOLKIT_EXPORT bool triangulateProfile(const OdGePoint2dArray &vertexSource, const std::vector< OdInt32 > &inFaceData, OdArray< OdInt32 > &vecTriangles, double tol=0)
static const OdUInt16 clear
static const OdUInt16 magenta
static const OdUInt16 blue
static const OdUInt16 red
static const OdUInt16 cyan
static const OdUInt16 yellow
static const OdUInt16 green
static const OdUInt16 white