-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshapegraphdm.cpp
More file actions
57 lines (43 loc) · 1.93 KB
/
Copy pathshapegraphdm.cpp
File metadata and controls
57 lines (43 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// SPDX-FileCopyrightText: 2000-2010 University College London, Alasdair Turner
// SPDX-FileCopyrightText: 2011-2012 Tasos Varoudis
// SPDX-FileCopyrightText: 2024 Petros Koutsolampros
//
// SPDX-License-Identifier: GPL-3.0-or-later
#include "shapegraphdm.hpp"
void ShapeGraphDM::makeConnections(const KeyVertices &keyvertices) {
getInternalMap().makeConnections(keyvertices);
m_displayedAttribute = -1; // <- override if it's already showing
auto connCol =
getInternalMap().getAttributeTable().getColumnIndex(ShapeGraph::Column::CONNECTIVITY);
setDisplayedAttribute(static_cast<int>(connCol));
}
void ShapeGraphDM::unlinkFromShapeMap(const ShapeMap &shapemap) {
getInternalMap().unlinkFromShapeMap(shapemap);
// reset displayed attribute if it happens to be "Connectivity":
auto connCol =
getInternalMap().getAttributeTable().getColumnIndex(ShapeGraph::Column::CONNECTIVITY);
if (getDisplayedAttribute() == static_cast<int>(connCol)) {
invalidateDisplayedAttribute();
setDisplayedAttribute(
static_cast<int>(connCol)); // <- reflect changes to connectivity counts
}
}
void ShapeGraphDM::makeSegmentConnections(std::vector<Connector> &connectionset) {
getInternalMap().makeSegmentConnections(connectionset);
m_displayedAttribute = -2; // <- override if it's already showing
auto uwConnCol =
getInternalMap().getAttributeTable().getColumnIndex(ShapeGraph::Column::CONNECTIVITY);
setDisplayedAttribute(static_cast<int>(uwConnCol));
}
bool ShapeGraphDM::read(std::istream &stream) {
bool read = getInternalMap().readShapeGraphData(stream);
// now base class read:
read = read && ShapeMapDM::read(stream);
return read;
}
bool ShapeGraphDM::write(std::ostream &stream) {
bool written = getInternalMap().writeShapeGraphData(stream);
// now simply run base class write:
written = written & ShapeMapDM::write(stream);
return written;
}