File indexing completed on 2024-05-12 15:56:43

0001 /* This file is part of the KDE project
0002    SPDX-FileCopyrightText: 2006 Thorsten Zachmann <zachmann@kde.org>
0003    SPDX-FileCopyrightText: 2007 Thomas Zander <zander@kde.org>
0004 
0005    SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #ifndef KOPATHPOINTDATA_H
0009 #define KOPATHPOINTDATA_H
0010 
0011 #include "KoPathShape.h"
0012 #include <boost/operators.hpp>
0013 
0014 /**
0015  * @brief Describe a KoPathPoint by a KoPathShape and its indices
0016  */
0017 class KoPathPointData  : public boost::equality_comparable<KoPathPointData>
0018 {
0019 public:
0020     /// constructor
0021     KoPathPointData(KoPathShape * path, const KoPathPointIndex & pointIndex)
0022             : pathShape(path)
0023             , pointIndex(pointIndex) {}
0024 
0025     /// operator used for sorting
0026     bool operator<(const KoPathPointData & other) const {
0027         return pathShape < other.pathShape ||
0028                (pathShape == other.pathShape &&
0029                 (pointIndex.first < other.pointIndex.first ||
0030                  (pointIndex.first == other.pointIndex.first &&
0031                   pointIndex.second < other.pointIndex.second)));
0032 
0033     }
0034     bool operator==(const KoPathPointData & other) const {
0035         return pathShape == other.pathShape &&
0036                pointIndex.first == other.pointIndex.first &&
0037                pointIndex.second == other.pointIndex.second;
0038     }
0039     /// path shape the path point belongs too
0040     KoPathShape *pathShape;
0041     /// position of the point in the path shape
0042     KoPathPointIndex pointIndex;
0043 };
0044 
0045 #endif