comparison layer/RegionLayer.cpp @ 1417:2487521e857b

Merge
author Chris Cannam
date Wed, 23 Jan 2019 14:44:16 +0000
parents 89d124ac9bfa d057dcc827e7
children 62e908518c71
comparison
equal deleted inserted replaced
1416:d794630429a7 1417:2487521e857b
44 #include <iostream> 44 #include <iostream>
45 #include <cmath> 45 #include <cmath>
46 46
47 RegionLayer::RegionLayer() : 47 RegionLayer::RegionLayer() :
48 SingleColourLayer(), 48 SingleColourLayer(),
49 m_model(0), 49 m_model(nullptr),
50 m_editing(false), 50 m_editing(false),
51 m_dragPointX(0), 51 m_dragPointX(0),
52 m_dragPointY(0), 52 m_dragPointY(0),
53 m_dragStartX(0), 53 m_dragStartX(0),
54 m_dragStartY(0), 54 m_dragStartY(0),
55 m_originalPoint(0, 0.0, 0, tr("New Region")), 55 m_originalPoint(0, 0.0, 0, tr("New Region")),
56 m_editingPoint(0, 0.0, 0, tr("New Region")), 56 m_editingPoint(0, 0.0, 0, tr("New Region")),
57 m_editingCommand(0), 57 m_editingCommand(nullptr),
58 m_verticalScale(EqualSpaced), 58 m_verticalScale(EqualSpaced),
59 m_colourMap(0), 59 m_colourMap(0),
60 m_colourInverted(false), 60 m_colourInverted(false),
61 m_plotStyle(PlotLines) 61 m_plotStyle(PlotLines)
62 { 62 {
1198 void 1198 void
1199 RegionLayer::drawEnd(LayerGeometryProvider *, QMouseEvent *) 1199 RegionLayer::drawEnd(LayerGeometryProvider *, QMouseEvent *)
1200 { 1200 {
1201 if (!m_model || !m_editing) return; 1201 if (!m_model || !m_editing) return;
1202 finish(m_editingCommand); 1202 finish(m_editingCommand);
1203 m_editingCommand = 0; 1203 m_editingCommand = nullptr;
1204 m_editing = false; 1204 m_editing = false;
1205 1205
1206 recalcSpacing(); 1206 recalcSpacing();
1207 } 1207 }
1208 1208
1213 1213
1214 if (!getPointToDrag(v, e->x(), e->y(), m_editingPoint)) return; 1214 if (!getPointToDrag(v, e->x(), e->y(), m_editingPoint)) return;
1215 1215
1216 if (m_editingCommand) { 1216 if (m_editingCommand) {
1217 finish(m_editingCommand); 1217 finish(m_editingCommand);
1218 m_editingCommand = 0; 1218 m_editingCommand = nullptr;
1219 } 1219 }
1220 1220
1221 m_editing = true; 1221 m_editing = true;
1222 recalcSpacing(); 1222 recalcSpacing();
1223 } 1223 }
1242 (m_model, tr("Erase Region")); 1242 (m_model, tr("Erase Region"));
1243 1243
1244 m_editingCommand->deletePoint(m_editingPoint); 1244 m_editingCommand->deletePoint(m_editingPoint);
1245 1245
1246 finish(m_editingCommand); 1246 finish(m_editingCommand);
1247 m_editingCommand = 0; 1247 m_editingCommand = nullptr;
1248 m_editing = false; 1248 m_editing = false;
1249 recalcSpacing(); 1249 recalcSpacing();
1250 } 1250 }
1251 1251
1252 void 1252 void
1263 1263
1264 m_originalPoint = m_editingPoint; 1264 m_originalPoint = m_editingPoint;
1265 1265
1266 if (m_editingCommand) { 1266 if (m_editingCommand) {
1267 finish(m_editingCommand); 1267 finish(m_editingCommand);
1268 m_editingCommand = 0; 1268 m_editingCommand = nullptr;
1269 } 1269 }
1270 1270
1271 m_editing = true; 1271 m_editing = true;
1272 m_dragStartX = e->x(); 1272 m_dragStartX = e->x();
1273 m_dragStartY = e->y(); 1273 m_dragStartY = e->y();
1330 1330
1331 m_editingCommand->setName(newName); 1331 m_editingCommand->setName(newName);
1332 finish(m_editingCommand); 1332 finish(m_editingCommand);
1333 } 1333 }
1334 1334
1335 m_editingCommand = 0; 1335 m_editingCommand = nullptr;
1336 m_editing = false; 1336 m_editing = false;
1337 recalcSpacing(); 1337 recalcSpacing();
1338 } 1338 }
1339 1339
1340 bool 1340 bool