<commit_before>import QtQuick 2.5
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.1
import QtLocation 5.5
import QtPositioning 5.5
import "./Helper.js" as Helper
import "./"

Map {
    id: mapOfEurope
    signal search
    signal categories
    signal routes
    property bool followMe:false
    property bool autoUpdatePois:true
    property variant currentModel: filteredTrailModel
    property variant scaleLengths: [5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000, 20000, 50000, 100000, 200000, 500000, 1000000, 2000000]
    property alias theItemModel: housetrailMapItems
    z: 20000
    zoomLevel: 16

    Timer {
        id: scaleTimer
        interval: 100
        running: false
        repeat: false
        onTriggered: {
            mapOfEurope.calculateScale()
            if (autoUpdatePois)
            updatePois()
        }
    }

    onCenterChanged: {
        scaleTimer.restart()
        //   if (mapOfEurope.followme)
        //if (mapOfEurope.center !== positionSource.position.coordinate) mapOfEurope.followme = false
    }

    onZoomLevelChanged: {
        scaleTimer.restart()
        //   if (mapOfEurope.followme) mapOfEurope.center = positionSource.position.coordinate
    }

    onWidthChanged: {
        scaleTimer.restart()
    }

    onHeightChanged: {
        scaleTimer.restart()
    }

    Slider {
        id: zoomSlider
        z: mapOfEurope.z + 3
        minimumValue: mapOfEurope.minimumZoomLevel
        maximumValue: mapOfEurope.maximumZoomLevel
        anchors.margins: 10
        anchors.bottom: scale.top
        anchors.top: parent.top
        anchors.right: parent.right
        orientation: Qt.Vertical
        value: mapOfEurope.zoomLevel
        onValueChanged: {
            mapOfEurope.zoomLevel = value
            //console.log("Zoomlevel: " + mapOfEurope.zoomLevel)
        }
    }
    function updatePois() {
            var coord1 = mapOfEurope.toCoordinate(Qt.point(0, 0))
            var coord2 = mapOfEurope.toCoordinate(Qt.point(mapOfEurope.width, mapOfEurope.height))
            var dist1 = Math.abs(coord1.latitude - coord2.latitude)
            var dist2 = Math.abs(coord1.longitude - coord2.longitude)
            var dist = (dist1 > dist2) ? dist1 : dist2;
            dialog.getPois(mapOfEurope.center.latitude,mapOfEurope.center.longitude, dist, mapOfEurope.zoomLevel);
    }<commit_msg> Fix map distance calculation for loading markers<commit_after>import QtQuick 2.5
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.1
import QtLocation 5.5
import QtPositioning 5.5
import "./Helper.js" as Helper
import "./"

Map {
    id: mapOfEurope
    signal search
    signal categories
    signal routes
    property bool followMe:false
    property bool autoUpdatePois:true
    property variant currentModel: filteredTrailModel
    property variant scaleLengths: [5, 10, 20, 50, 100, 200, 500, 1000, 2000, 5000, 10000, 20000, 50000, 100000, 200000, 500000, 1000000, 2000000]
    property alias theItemModel: housetrailMapItems
    z: 20000
    zoomLevel: 16

    Timer {
        id: scaleTimer
        interval: 100
        running: false
        repeat: false
        onTriggered: {
            mapOfEurope.calculateScale()
            if (autoUpdatePois)
            updatePois()
        }
    }

    onCenterChanged: {
        scaleTimer.restart()
        //   if (mapOfEurope.followme)
        //if (mapOfEurope.center !== positionSource.position.coordinate) mapOfEurope.followme = false
    }

    onZoomLevelChanged: {
        scaleTimer.restart()
        //   if (mapOfEurope.followme) mapOfEurope.center = positionSource.position.coordinate
    }

    onWidthChanged: {
        scaleTimer.restart()
    }

    onHeightChanged: {
        scaleTimer.restart()
    }

    Slider {
        id: zoomSlider
        z: mapOfEurope.z + 3
        minimumValue: mapOfEurope.minimumZoomLevel
        maximumValue: mapOfEurope.maximumZoomLevel
        anchors.margins: 10
        anchors.bottom: scale.top
        anchors.top: parent.top
        anchors.right: parent.right
        orientation: Qt.Vertical
        value: mapOfEurope.zoomLevel
        onValueChanged: {
            mapOfEurope.zoomLevel = value
            //console.log("Zoomlevel: " + mapOfEurope.zoomLevel)
        }
    }
    function updatePois() {
            var coord1 = mapOfEurope.toCoordinate(Qt.point(0, 0))
            var coord2 = mapOfEurope.toCoordinate(Qt.point(mapOfEurope.width-1, mapOfEurope.height-1))
            var dist1 = Math.abs(coord1.latitude - coord2.latitude)
            var dist2 = Math.abs(coord1.longitude - coord2.longitude)
            var dist = (dist1 > dist2) ? dist1 : dist2;
            dialog.getPois(mapOfEurope.center.latitude,mapOfEurope.center.longitude, dist, mapOfEurope.zoomLevel);
    }
{'fraction_non_alphanumeric': 0.08748430305567183, 'fraction_numerical': 0.04730012557555462, 'mean_word_length': 2.3654929577464787, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '899150', 'n_tokens_mistral': 1600, 'n_tokens_neox': 1403, 'n_words': 317}