aboutsummaryrefslogtreecommitdiffstats
path: root/GUIModel/CruisingRange/CruisingRange.qml
blob: cc49b80b51f3a027e8c057bd276373b4e3139313 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
/*
 * Copyright (c) 2020,2021 Panasonic Corporation
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

import QtQuick 2.14

Item{
    id: cruisingRange
    
    x:258
    y:309
    width:268
    height:39
    
    property real cruisingRangeValue

    readonly property real cruisingRangeValueMax: 999.9
    readonly property real cruisingRangeValueMin: 0

    onCruisingRangeValueChanged: {
        updateCruisingRangeValue();
        updateCruisingRangeVisible();
    }

    Connections{
        target: rootItem
        onTransNormalToAdas:{
            normalToAdasAnimationFuel.start()
        }

        onTransAdasToMap:{
            /**/
        }

        onTransMapToNormal:{
            mapToNormalAnimationFuel.start()
        }
    }

    function updateCruisingRangeValue(){
        cruisingRangeParts.cruisingRangeValue100 = (cruisingRangeValue/100)%10
        cruisingRangeParts.cruisingRangeValue10 = (cruisingRangeValue/10)%10
        cruisingRangeParts.cruisingRangeValue1 = cruisingRangeValue%10
        cruisingRangeParts.cruisingRangeValue01 = 0
    }

    function updateCruisingRangeVisible(){
        if((100 <= cruisingRangeValue) && (cruisingRangeValue <= cruisingRangeValueMax)){
            fuelNum01.visible = true
            fuelNum1.visible = true
            fuelNum10.visible = true
            fuelNum100.visible = true
        }else if((10 <= cruisingRangeValue) && (cruisingRangeValue < 100)){
            fuelNum01.visible = true
            fuelNum1.visible = true
            fuelNum10.visible = true
            fuelNum100.visible = false
        }else if((1 <= cruisingRangeValue) && (cruisingRangeValue < 10)){
            fuelNum01.visible = true
            fuelNum1.visible = true
            fuelNum10.visible = false
            fuelNum100.visible = false
        }else if((cruisingRangeValueMin <= cruisingRangeValue) && (cruisingRangeValue < 1)){
            fuelNum01.visible = true
            fuelNum1.visible = true
            fuelNum10.visible = false
            fuelNum100.visible = false
        }else{
            fuelNum01.visible = false
            fuelNum1.visible = false
            fuelNum10.visible = false
            fuelNum100.visible = false
        }
    }

    Item{
        id: cruisingRangeParts
        property int cruisingRangeValue100 //hundreds place
        property int cruisingRangeValue10  //tens place
        property int cruisingRangeValue1   //ones place
        property int cruisingRangeValue01  //first decimal place
        Image{
            id: fuelUnit
            source: "qrc:/Images/NormalView/FUEL/fuel_unit.png"
            x:228
            y:9
            width:40
            height:26
        }
        Image{
            id: fuelNum01
            source: "qrc:/Images/NormalView/FUEL/fuel_num1-" + parent.cruisingRangeValue01 + ".png"
            x:202
            y:6
            width:19
            height:29
            visible: false
        }
        Image{
            id: fuelNum1
            source: "qrc:/Images/NormalView/FUEL/fuel_num10-" + parent.cruisingRangeValue1 + ".png"
            x:174
            y:6
            width:19
            height:29
            visible: false
        }
        Image{
            id: fuelNum10
            source: "qrc:/Images/NormalView/FUEL/fuel_num100-" + parent.cruisingRangeValue10 + ".png"
            x:154
            y:6
            width:19
            height:29
            visible:false
        }
        Image{
            id: fuelNum100
            source: "qrc:/Images/NormalView/FUEL/fuel_num1000-" + parent.cruisingRangeValue100 + ".png"
            x:134
            y:6
            width:19
            height:29
            visible:false
        }
        Image{
            id: fuelDot
            source: "qrc:/Images/NormalView/FUEL/fuel_dot.png"
            x:194
            y:28
            width:6
            height:6
        }
        Image{
            id: fuelIcon
            source: "qrc:/Images/NormalView/FUEL/fuel_icon.png"
            x:0
            y:0
            width:119
            height:39
        }
    }

    SequentialAnimation{
        id:normalToAdasAnimationFuel
        onStarted: rootItem.focus=false
        PauseAnimation{
            duration:330
        }

        PathAnimation{
            target: cruisingRange
            duration: 891
            easing.type: Easing.InOutSine
            path:Path {
                startX: 258; startY: 309
                PathArc {
                    x: 238; y: 657
                    radiusX: 180; radiusY: 180
                    direction: PathArc.Counterclockwise
                }
            }
        }
    }

    SequentialAnimation{
        id:mapToNormalAnimationFuel
        onStarted: rootItem.focus=false
        PauseAnimation{
            duration: 254 + 330
        }

        PathAnimation{
            target: cruisingRange
            duration: 891
            easing.type: Easing.InOutSine
            path:Path {
                startX: 238; startY: 657
                PathArc {
                    x: 258; y: 309
                    radiusX: 180; radiusY: 180
                    direction: PathArc.Clockwise
                }
            }
        }

    }
}