<commit_before>// [WriteFile Name=ListTransformations, Category=Geometry]
// [Legal]
// Copyright 2017 Esri.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0

// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// [Legal]

import QtQuick 2.6
import QtQuick.Controls 1.4
import Esri.ArcGISRuntime 100.2
import Esri.ArcGISExtras 1.1

Rectangle {
    id: rootRectangle
    clip: true
    width: 800
    height: 600

    property real scaleFactor: System.displayScaleFactor
    property bool peDataSet: true
    property string dataPath: System.userHomePath + "/ArcGIS/Runtime/Data/PEDataff"

    Component.onCompleted: TransformationCatalog.projectionEngineDirectory = dataPath

    Connections {
        target: TransformationCatalog
        onErrorChanged: peDataSet = false;
    }

    MapView {
        id: mapView
        anchors {
            left: parent.left
            right: parent.right
            top: parent.top
        }
        height: parent.height / 2

        Map {
            id: map
            BasemapLightGrayCanvas {}

            ViewpointCenter {
                center: originalGeometry
                targetScale: 5000
            }

            onLoadStatusChanged: {
                if (loadStatus !== Enums.LoadStatusLoaded)
                    return;

                getTransformations();
                statusBar.expand();
            }
        }

        // Create a GraphicsOverlay with two Graphics - one to hold the default
        // transformed geometry, and the other to use the selected transformation
        GraphicsOverlay {
            Graphic {
                geometry: originalGeometry

                SimpleMarkerSymbol {
                    style: Enums.SimpleMarkerSymbolStyleSquare
                    color: "blue"
                    size: 20
                }
            }

            Graphic {
                id: projectedGraphic
                geometry: originalGeometry

                SimpleMarkerSymbol {
                    style: Enums.SimpleMarkerSymbolStyleCross
                    color: "red"
                    size: 20
                }
            }
        }

        // Create a geometry located in the Greenwich observatory courtyard in London, UK, the location of the
        // Greenwich prime meridian. This will be projected using the selected transformation.
        Point {
            id: originalGeometry
            x: 538985.355
            y: 177329.516
            SpatialReference { wkid: 27700 }
        }
    }

    Rectangle {
        id: transformationView

        anchors {
            left: parent.left
            right: parent.right
            top: mapView.bottom
        }

        height: (parent.height / 2)
        color: "#f7f7f7"

        CheckBox {
            id: orderCheckbox
            anchors {
                left: parent.left
                top: parent.top
                margins: 10 * scaleFactor
            }
            text: "Order by suitability for map extent"
            onCheckedChanged: {
                getTransformations();
            }
        }

        ListView {
            id: transformationList
            anchors {
                left: parent.left
                right: parent.right
                top: orderCheckbox.bottom
                bottom: parent.bottom
                margins: 10 * scaleFactor
            }
            clip: true

            delegate: Item {
                id: itemDelegate
                height: 45 * scaleFactor
                width: parent.width
                clip: true

                // show the DatumTransformation name
                Text {
                    id: label
                    anchors {
                        verticalCenter: parent.verticalCenter
                        left: parent.left
                        right: parent.right
                    }
                    width: parent.width
                    text: model.modelData.missingProjectionEngineFiles ? "%1 <font color=red><b>Missing grid files</b></font>".arg(model.modelData.name) : model.modelData.name
                    textFormat: Text.RichText
                    wrapMode: Text.WrapAnywhere
                    maximumLineCount: 2
                    font.pixelSize: 12 * scaleFactor
                }

                MouseArea {
                    id: itemMouseArea
                    anchors.fill: parent
                    onClicked: {
                        transformationList.currentIndex = index;
                        var transform = transformationList.model[index];
                        if (transform.missingProjectionEngineFiles) {
                            var missingFiles = "Missing grid files: ";
                            var steps = transform.steps;
                            for (var i = 0; i < steps.length; i++) {
                                for (var j = 0; j < steps[i].projectionEngineFilenames.length; j++) {
                                    missingFiles += steps[i].projectionEngineFilenames[j];
                                }
                            }
                            statusText.text = missingFiles + " ";
                            statusBar.expand();
                        } else {
                            projectedGraphic.geometry = GeometryEngine.project(originalGeometry, map.spatialReference, transform);
                        }
                    }
                }
            }

            highlightFollowsCurrentItem: true
            highlight: Rectangle {
                color: "#d6d6d6"
                radius: 4 * scaleFactor
            }
        }
    }

    Rectangle {
        id: statusBar
        property int expanded: parent.height - height
        property int hidden: parent.height
        property bool isExpanded: false;
        anchors {
            left: parent.left
            right: parent.right
        }
        height: 45 * scaleFactor
        color: "black"
        y: hidden

        Text {
            id: statusText
            anchors {
                left: parent.left
                right: parent.right
                verticalCenter: parent.verticalCenter
                margins: 10 * scaleFactor
            }
            color: "white"
            wrapMode: Text.WrapAnywhere
            text: peDataSet ?
                      "Projection engine directory set %1".arg(dataPath) :
                      "Error setting projection engine directory: %1. %2".arg(TransformationCatalog.error.message).arg(TransformationCatalog.error.additionalMessage)
        }

        Timer {
            id: timer
            interval: 5000
            onTriggered: statusBar.animate();
        }

        onYChanged: {
            if (y === expanded)
                timer.start();
        }

        NumberAnimation {
            id: statusAnimation
            target: statusBar
            properties: "y"
            duration: 500
            easing.type: Easing.OutQuad
        }

        function expand() {
            statusAnimation.from = statusBar.hidden;
            statusAnimation.to = statusBar.expanded;
            statusAnimation.start();
        }

        function hide() {
            statusAnimation.from = statusBar.expanded;
            statusAnimation.to = statusBar.hidden;
            statusAnimation.start();
        }

        function animate() {
            if (statusBar.y === statusBar.hidden)
                expand();
            else
                hide();
        }
    }

    function getTransformations() {
        if (orderCheckbox.checked)
            transformationList.model = TransformationCatalog.transformationsBySuitability(originalGeometry.spatialReference, map.spatialReference, mapView.visibleArea.extent);
        else
            transformationList.model = TransformationCatalog.transformationsBySuitability(originalGeometry.spatialReference, map.spatialReference);
    }
}
<commit_msg>updating move duration<commit_after>// [WriteFile Name=ListTransformations, Category=Geometry]
// [Legal]
// Copyright 2017 Esri.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0

// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// [Legal]

import QtQuick 2.6
import QtQuick.Controls 1.4
import Esri.ArcGISRuntime 100.2
import Esri.ArcGISExtras 1.1

Rectangle {
    id: rootRectangle
    clip: true
    width: 800
    height: 600

    property real scaleFactor: System.displayScaleFactor
    property bool peDataSet: true
    property string dataPath: System.userHomePath + "/ArcGIS/Runtime/Data/PEDataff"

    Component.onCompleted: TransformationCatalog.projectionEngineDirectory = dataPath

    Connections {
        target: TransformationCatalog
        onErrorChanged: peDataSet = false;
    }

    MapView {
        id: mapView
        anchors {
            left: parent.left
            right: parent.right
            top: parent.top
        }
        height: parent.height / 2

        Map {
            id: map
            BasemapLightGrayCanvas {}

            ViewpointCenter {
                center: originalGeometry
                targetScale: 5000
            }

            onLoadStatusChanged: {
                if (loadStatus !== Enums.LoadStatusLoaded)
                    return;

                getTransformations();
                statusBar.expand();
            }
        }

        // Create a GraphicsOverlay with two Graphics - one to hold the default
        // transformed geometry, and the other to use the selected transformation
        GraphicsOverlay {
            Graphic {
                geometry: originalGeometry

                SimpleMarkerSymbol {
                    style: Enums.SimpleMarkerSymbolStyleSquare
                    color: "blue"
                    size: 20
                }
            }

            Graphic {
                id: projectedGraphic
                geometry: originalGeometry

                SimpleMarkerSymbol {
                    style: Enums.SimpleMarkerSymbolStyleCross
                    color: "red"
                    size: 20
                }
            }
        }

        // Create a geometry located in the Greenwich observatory courtyard in London, UK, the location of the
        // Greenwich prime meridian. This will be projected using the selected transformation.
        Point {
            id: originalGeometry
            x: 538985.355
            y: 177329.516
            SpatialReference { wkid: 27700 }
        }
    }

    Rectangle {
        id: transformationView

        anchors {
            left: parent.left
            right: parent.right
            top: mapView.bottom
        }

        height: (parent.height / 2)
        color: "#f7f7f7"

        CheckBox {
            id: orderCheckbox
            anchors {
                left: parent.left
                top: parent.top
                margins: 10 * scaleFactor
            }
            text: "Order by suitability for map extent"
            onCheckedChanged: {
                getTransformations();
            }
        }

        ListView {
            id: transformationList
            anchors {
                left: parent.left
                right: parent.right
                top: orderCheckbox.bottom
                bottom: parent.bottom
                margins: 10 * scaleFactor
            }
            clip: true

            delegate: Item {
                id: itemDelegate
                height: 45 * scaleFactor
                width: parent.width
                clip: true

                // show the DatumTransformation name
                Text {
                    id: label
                    anchors {
                        verticalCenter: parent.verticalCenter
                        left: parent.left
                        right: parent.right
                    }
                    width: parent.width
                    text: model.modelData.missingProjectionEngineFiles ? "%1 <font color=red><b>Missing grid files</b></font>".arg(model.modelData.name) : model.modelData.name
                    textFormat: Text.RichText
                    wrapMode: Text.WrapAnywhere
                    maximumLineCount: 2
                    font.pixelSize: 12 * scaleFactor
                }

                MouseArea {
                    id: itemMouseArea
                    anchors.fill: parent
                    onClicked: {
                        transformationList.currentIndex = index;
                        var transform = transformationList.model[index];
                        if (transform.missingProjectionEngineFiles) {
                            var missingFiles = "Missing grid files: ";
                            var steps = transform.steps;
                            for (var i = 0; i < steps.length; i++) {
                                for (var j = 0; j < steps[i].projectionEngineFilenames.length; j++) {
                                    missingFiles += steps[i].projectionEngineFilenames[j];
                                }
                            }
                            statusText.text = missingFiles + " ";
                            statusBar.expand();
                        } else {
                            projectedGraphic.geometry = GeometryEngine.project(originalGeometry, map.spatialReference, transform);
                        }
                    }
                }
            }

            highlightMoveDuration: 1
            highlightFollowsCurrentItem: true
            highlight: Rectangle {
                color: "#d6d6d6"
                radius: 4 * scaleFactor
            }
        }
    }

    Rectangle {
        id: statusBar
        property int expanded: parent.height - height
        property int hidden: parent.height
        property bool isExpanded: false;
        anchors {
            left: parent.left
            right: parent.right
        }
        height: 45 * scaleFactor
        color: "black"
        y: hidden

        Text {
            id: statusText
            anchors {
                left: parent.left
                right: parent.right
                verticalCenter: parent.verticalCenter
                margins: 10 * scaleFactor
            }
            color: "white"
            wrapMode: Text.WrapAnywhere
            text: peDataSet ?
                      "Projection engine directory set %1".arg(dataPath) :
                      "Error setting projection engine directory: %1. %2".arg(TransformationCatalog.error.message).arg(TransformationCatalog.error.additionalMessage)
        }

        Timer {
            id: timer
            interval: 5000
            onTriggered: statusBar.animate();
        }

        onYChanged: {
            if (y === expanded)
                timer.start();
        }

        NumberAnimation {
            id: statusAnimation
            target: statusBar
            properties: "y"
            duration: 500
            easing.type: Easing.OutQuad
        }

        function expand() {
            statusAnimation.from = statusBar.hidden;
            statusAnimation.to = statusBar.expanded;
            statusAnimation.start();
        }

        function hide() {
            statusAnimation.from = statusBar.expanded;
            statusAnimation.to = statusBar.hidden;
            statusAnimation.start();
        }

        function animate() {
            if (statusBar.y === statusBar.hidden)
                expand();
            else
                hide();
        }
    }

    function getTransformations() {
        if (orderCheckbox.checked)
            transformationList.model = TransformationCatalog.transformationsBySuitability(originalGeometry.spatialReference, map.spatialReference, mapView.visibleArea.extent);
        else
            transformationList.model = TransformationCatalog.transformationsBySuitability(originalGeometry.spatialReference, map.spatialReference);
    }
}

{'fraction_non_alphanumeric': 0.06767857142857144, 'fraction_numerical': 0.010773809523809524, 'mean_word_length': 1.3145061303209808, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6443554', 'n_tokens_mistral': 4104, 'n_tokens_neox': 3756, 'n_words': 1016}