File indexing completed on 2024-06-16 04:21:01
0001 /* This file is part of the TikZKit project. 0002 * 0003 * Copyright (C) 2013-2014 Dominik Haumann <dhaumann@kde.org> 0004 * 0005 * This library is free software; you can redistribute it and/or modify 0006 * it under the terms of the GNU Library General Public License as published 0007 * by the Free Software Foundation, either version 2 of the License, or 0008 * (at your option) any later version. 0009 * 0010 * This library is distributed in the hope that it will be useful, 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0013 * GNU Library General Public License for more details. 0014 * 0015 * You should have received a copy of the GNU Library General Public License 0016 * along with this library; see the file COPYING.LIB. If not, see 0017 * <http://www.gnu.org/licenses/>. 0018 */ 0019 0020 #ifndef TIKZ_ELLIPSE_PATH_H 0021 #define TIKZ_ELLIPSE_PATH_H 0022 0023 #include "Path.h" 0024 #include "MetaPos.h" 0025 #include "Pos.h" 0026 0027 namespace tikz { 0028 namespace core { 0029 0030 class Node; 0031 class EllipsePathPrivate; 0032 0033 /** 0034 * This class represents a TikZ ellipse path. 0035 * For instance, a typical edge looks like this: 0036 * @code 0037 * \draw (1, 1) ellipse (2cm and 1cm); 0038 * @endcode 0039 */ 0040 class TIKZKITCORE_EXPORT EllipsePath : public Path 0041 { 0042 Q_OBJECT 0043 0044 public: 0045 /** 0046 * Virtual destructor. 0047 */ 0048 virtual ~EllipsePath(); 0049 0050 /** 0051 * Returns type tikz::PathType::Ellipse. 0052 */ 0053 PathType type() const override; 0054 0055 // 0056 // Node manipulation 0057 // 0058 public: 0059 0060 /** 0061 * Get the node, which was set with setNode(Node*). 0062 */ 0063 Node* node() const; 0064 0065 public Q_SLOTS: 0066 /** 0067 * Attach the ellipse to @p node; 0068 */ 0069 void setNode(Node* node); 0070 0071 // 0072 // x/y-position methods 0073 // 0074 public: 0075 /** 0076 * Get the position of the ellipse. 0077 * @note This is the same as node()->pos(). 0078 */ 0079 tikz::Pos pos() const; 0080 0081 /** 0082 * Get the position of this ellipse as MetaPos object. 0083 */ 0084 const tikz::core::MetaPos & metaPos() const; 0085 0086 public Q_SLOTS: 0087 /** 0088 * Set the position of the ellipse to @p pos. 0089 * @param pos the new position 0090 */ 0091 void setPos(const tikz::Pos & pos); 0092 0093 /** 0094 * Set the position of this ellipse as a shared MetaPos object. 0095 */ 0096 void setMetaPos(const tikz::core::MetaPos & pos); 0097 0098 // 0099 // anchor methods 0100 // 0101 public: 0102 /** 0103 * Get the anchor of the ellipse. 0104 */ 0105 QString anchor() const; 0106 0107 0108 public Q_SLOTS: 0109 /** 0110 * Set the anchor of the ellipse to @p anchor. 0111 */ 0112 void setAnchor(const QString & anchor); 0113 0114 // 0115 // signals 0116 // 0117 Q_SIGNALS: 0118 /** 0119 * This signal is emitted whenever the node of this ellipse changes. 0120 * @param node may be 0 0121 */ 0122 void nodeChanged(tikz::core::Node * node); 0123 0124 // 0125 // internal to tikz::Document 0126 // 0127 protected: 0128 friend class Document; 0129 0130 /** 0131 * Constructor that associates this path with the tikz Document 0132 * referred to by @p uid. 0133 * @param uid unique id of the path 0134 */ 0135 EllipsePath(const Uid & uid); 0136 0137 /** 0138 * Destruct the ellipse by saving the position or node connection. 0139 */ 0140 void deconstruct() override; 0141 0142 /** 0143 * Detach the ellipse from @p node, since @p node is about to be deleted. 0144 */ 0145 void detachFromNode(Node * node) override; 0146 0147 // 0148 // internal 0149 // 0150 private: 0151 /** 0152 * Private default constructor, not implemented 0153 */ 0154 EllipsePath(); 0155 0156 private: 0157 EllipsePathPrivate * const d; 0158 }; 0159 0160 } 0161 } 0162 0163 #endif // TIKZ_ELLIPSE_PATH_H 0164 0165 // kate: indent-width 4; replace-tabs on;