From 73c468f15121303635afbea5d09dabad40c66b3a Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Sun, 1 Sep 2019 19:57:45 -0700 Subject: [PATCH] Change entry/exit, use new MapLineArrow control --- src/PlanView/TransectStyleMapVisuals.qml | 88 ++++++++++++++++++------ 1 file changed, 66 insertions(+), 22 deletions(-) diff --git a/src/PlanView/TransectStyleMapVisuals.qml b/src/PlanView/TransectStyleMapVisuals.qml index 57212b841..90d93ce7a 100644 --- a/src/PlanView/TransectStyleMapVisuals.qml +++ b/src/PlanView/TransectStyleMapVisuals.qml @@ -28,35 +28,35 @@ Item { property var _mapPolygon: object.surveyAreaPolygon property bool _currentItem: object.isCurrentItem property var _transectPoints: _missionItem.visualTransectPoints - property bool _showPartialEntryExit: !_currentItem && _missionItem.turnAroundDistance.rawValue !== 0 &&_transectPoints.length >= 2 + property int _transectCount: _transectPoints.length / (_hasTurnaround ? 4 : 2) + property bool _hasTurnaround: _missionItem.turnAroundDistance.rawValue !== 0 + property int _firstTrueTransectIndex: _hasTurnaround ? 1 : 0 + property int _lastTrueTransectIndex: _transectPoints.length - (_hasTurnaround ? 2 : 1) + property int _lastPointIndex: _transectPoints.length - 1 + property bool _showPartialEntryExit: !_currentItem && _hasTurnaround &&_transectPoints.length >= 2 property var _fullTransectsComponent: null property var _entryTransectsComponent: null property var _exitTransectsComponent: null property var _entryCoordinate property var _exitCoordinate + property var _dynamicComponents: [ ] signal clicked(int sequenceNumber) function _addVisualElements() { - _fullTransectsComponent = fullTransectsComponent.createObject(map) - _entryTransectsComponent = entryTransectComponent.createObject(map) - _exitTransectsComponent = exitTransectComponent.createObject(map) - _entryCoordinate = entryPointComponent.createObject(map) - _exitCoordinate = exitPointComponent.createObject(map) - - map.addMapItem(_fullTransectsComponent) - map.addMapItem(_entryTransectsComponent) - map.addMapItem(_exitTransectsComponent) - map.addMapItem(_entryCoordinate) - map.addMapItem(_exitCoordinate) + var toAdd = [ fullTransectsComponent, entryTransectComponent, exitTransectComponent, entryPointComponent, exitPointComponent, + entryArrow1Component, entryArrow2Component, exitArrow1Component, exitArrow2Component ] + for (var i=0; i 3 + + property int nextTrueTransectIndex: _firstTrueTransectIndex + (_hasTurnaround ? 4 : 2) + } + } + + Component { + id: exitArrow1Component + + MapLineArrow { + fromCoord: _transectPoints[_lastTrueTransectIndex - 1] + toCoord: _transectPoints[_lastTrueTransectIndex] + exitPosition: true + visible: _currentItem + } + } + + Component { + id: exitArrow2Component + + MapLineArrow { + fromCoord: _transectPoints[prevTrueTransectIndex - 1] + toCoord: _transectPoints[prevTrueTransectIndex] + exitPosition: true + visible: _currentItem && _transectCount > 3 + + property int prevTrueTransectIndex: _lastTrueTransectIndex - (_hasTurnaround ? 4 : 2) + } + } + // Exit point Component { id: exitPointComponent @@ -148,7 +193,6 @@ Item { sourceItem: MissionItemIndexLabel { index: _missionItem.lastSequenceNumber - label: qsTr("Exit") checked: _missionItem.isCurrentItem onClicked: _root.clicked(_missionItem.sequenceNumber) } -- 2.22.0