diff options
Diffstat (limited to 'examples/location/mapviewer/map/PolygonItem.qml')
-rw-r--r-- | examples/location/mapviewer/map/PolygonItem.qml | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/examples/location/mapviewer/map/PolygonItem.qml b/examples/location/mapviewer/map/PolygonItem.qml index 97f4e95c..d9a2be99 100644 --- a/examples/location/mapviewer/map/PolygonItem.qml +++ b/examples/location/mapviewer/map/PolygonItem.qml @@ -3,24 +3,30 @@ import QtQuick import QtLocation -//TODO: remove me when items are integrated - MapPolygon { - color: "#46a2da" - border.color: "#190a33" + color: "#da5546" + border.color: "#330a0a" border.width: 2 smooth: true - opacity: 0.25 + opacity: 0.75 + + function setGeometry(anchorCoordinate){ + addCoordinate(anchorCoordinate) + } - function setGeometry(markers, index){ - for (var i = index; i<markers.length; i++){ - addCoordinate(markers[i].coordinate) - } + function addGeometry(newCoordinate, changeLast){ + if (changeLast && path.length > 0) + removeCoordinate(path[path.length-1]) + addCoordinate(newCoordinate) + return false } - MouseArea { - anchors.fill:parent - id: mousearea - drag.target: parent + + function finishAddGeometry(){ + if (path.length > 0) + removeCoordinate(path[path.length-1]) + color = "#46a2da" + border.color = "#190a33" + opacity = 0.25 } } |