/////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance"). // All rights reserved. // // This software and its documentation and related materials are owned by // the Alliance. The software may only be incorporated into application // programs owned by members of the Alliance, subject to a signed // Membership Agreement and Supplemental Software License Agreement with the // Alliance. The structure and organization of this software are the valuable // trade secrets of the Alliance and its suppliers. The software is also // protected by copyright law and international treaty provisions. Application // programs incorporating this software must include the following statement // with their copyright notices: // // This application incorporates Open Design Alliance software pursuant to a license // agreement with Open Design Alliance. // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance. // All rights reserved. // // By use of this software, its documentation or related materials, you // acknowledge and accept the above terms. /////////////////////////////////////////////////////////////////////////////// #pragma once #include #include #include "IdArrays.h" #include "Ge/GeCurve3d.h" class CSvgPathLoop { public: CSvgPathLoop() : m_bIsClockWise(false) {} ~CSvgPathLoop() {} void init(const OdDbObjectIdArray& entIds); void appendCurve(OdGeCurve3d* pCurve); void getCurves(OdArray& arr) const; bool isInside(const CSvgPathLoop& otherLoop) const; bool isInsideByRay(const CSvgPathLoop& otherLoop) const; bool intersectWith(const CSvgPathLoop& otherLoop, OdArray* points = nullptr) const; bool intersectWith(const OdGeCurve3d* pCurve, OdArray* points = nullptr) const; bool isClockWise() const { return m_bIsClockWise; } bool static isXTangentPoint(const OdGeCurve3d* pCurve, const OdGePoint3d& pnt); double static calcPolygonSignedArea(const OdGePoint3dArray& pnts, bool isClosed); OdDbObjectIdArray m_entIds; protected: bool calcClockWise() const; void setCurves(const OdDbObjectIdArray& entIds); void setSamplePoints(); bool m_bIsClockWise; OdGeCurve3dPtrArray m_curves; OdGePoint2dArray m_loopPoints; OdGeExtents3d m_extents; }; struct LoopNode { LoopNode() : m_loop(nullptr), m_parent(nullptr) {} LoopNode(const CSvgPathLoop* loop, const LoopNode* parent) : m_loop(loop), m_parent(parent) {} ~LoopNode() {} bool isZeroLoop() const; bool isExternal() const; bool isNewHatch() const; void static buildChildren(LoopNode* parent, const OdArray& allLoops, std::vector& processed); bool static buildLoopHierarchy(const OdArray& arrLoops, std::vector>& hierarchy); const CSvgPathLoop* m_loop; std::vector> m_children; const LoopNode* m_parent; };