26template<
class NodeData>
57 typedef std::vector<NodeData> NodesData;
58 NodesData m_nodesData;
62template<
class NodeData>
65 Q_ASSERT(nodeIndex >= 0);
66 Q_ASSERT(nodeIndex <
int(m_nodesData.size()));
68 return m_nodesData[nodeIndex];
72template<
class NodeData>
75 Q_ASSERT(nodeIndex >= 0);
76 Q_ASSERT(nodeIndex <
int(m_nodesData.size()));
78 return m_nodesData[nodeIndex];
84template<
class NodeData>
87 Q_ASSERT(nodeIndex >= 0);
88 Q_ASSERT(nodeIndex <
int(m_nodesData.size()));
90 return m_nodesData[nodeIndex];
94template<
class NodeData>
97 Q_ASSERT(nodeIndex >= 0);
98 Q_ASSERT(nodeIndex <
int(m_nodesData.size()));
100 return m_nodesData[nodeIndex];
106template<
class NodeData>
109 if (!m_nodesData.empty()) {
119template<
class NodeData>
124 m_nodesData.resize(nodesCount);
126 BaseClass::SetNodesCount(nodesCount);
130template<
class NodeData>
135 m_nodesData.insert(m_nodesData.end(), NodeData());
137 return BaseClass::InsertNode(position);
141template<
class NodeData>
146 typename NodesData::iterator iter = m_nodesData.begin();
148 m_nodesData.insert(iter, NodeData());
150 return BaseClass::InsertNode(index, position);
154template<
class NodeData>
159 typename NodesData::iterator iter = m_nodesData.begin();
161 m_nodesData.erase(iter);
163 return BaseClass::RemoveNode(index);
169template<
class NodeData>
178 if (polygonPtr !=
nullptr) {
182 for (
int nodesIndex = 0; nodesIndex < sourceNodesCount; nodesIndex++) {
183 InsertNode(polygonPtr->
GetNodePos(nodesIndex));
185 m_nodesData[nodesIndex] = polygonPtr->m_nodesData[nodesIndex];
Base class for polylines with additional data stored in each node.
bool CopyFrom(const istd::IChangeable &object, CompatibilityMode mode=CM_WITHOUT_REFS) override
Copy this object from another one.
virtual const i2d::CVector2d & GetNodePos(int index) const
Return position of node at specified index.
virtual int GetNodesCount() const
Return size of node table.
Definition of position or mathematical vector on 2D plane.
Generic polyline implementation with additional information stored for each node.
bool CopyFrom(const IChangeable &object, CompatibilityMode mode=CM_WITHOUT_REFS) override
NodeData & GetTNodeDataRef(int nodeIndex)
Get reference of user data in the given node.
CDataNodePolylineBase BaseClass
bool RemoveNode(int index) override
Remove a node at specified index.
void SetNodesCount(int nodesCount) override
Set new nodes count.
const iser::ISerializable & GetNodeData(int nodeIndex) const override
Get user data from the given node.
void Clear() override
Removes all nodes.
const NodeData & GetTNodeData(int nodeIndex) const
Get user data from the given node.
iser::ISerializable & GetNodeDataRef(int nodeIndex) override
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool InsertNode(const i2d::CVector2d &position) override
Insert a node at the end of node table.
bool InsertNode(int index, const i2d::CVector2d &position) override
Insert a node at specified index.
Common class for all classes which objects can be archived or restored from archive.
Help class which provides the group of changes for update mechanism of the model.
Help class which provides the automatic update mechanism of the model.
CompatibilityMode
Control how relationship betweeen objects are interpreted.
@ CM_WITHOUT_REFS
External references are simple ignored.