Subversion Repositories public iLand

Rev

Rev 1221 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
879 werner 1
import QtQuick 2.0
2
import QtQuick.Controls 1.1
880 werner 3
import QtQuick.Layouts 1.1
879 werner 4
 
5
Rectangle {
6
    width: 250
880 werner 7
    height: 400
882 werner 8
    id: main
880 werner 9
    //anchors.fill: parent
10
    //color:  "gray"
1054 werner 11
    Image {
12
        id: splash_image
13
        source: "qrc:/iland_splash.png"
14
        visible: rulercolors.caption == '';
15
        fillMode: Image.PreserveAspectFit
16
        anchors.fill: parent
17
    }
880 werner 18
    ColumnLayout {
19
        anchors.fill: parent
20
        anchors.margins: 10
21
        spacing: 10
1054 werner 22
        visible: rulercolors.caption != '';
879 werner 23
 
1036 werner 24
 
880 werner 25
        ColumnLayout{
1036 werner 26
            Layout.fillWidth: true
879 werner 27
 
880 werner 28
            Text {
29
                id: rulerCaption
30
                text: rulercolors.caption
31
                font.pixelSize: 16
879 werner 32
            }
880 werner 33
            Text {
34
                id: rulerDesc
35
                text: rulercolors.description
1036 werner 36
                wrapMode: Text.WordWrap
880 werner 37
                width: 100
38
                anchors.top: rulerCaption.bottom
39
                anchors.topMargin: 10
1036 werner 40
                anchors.leftMargin: 10
41
                anchors.rightMargin: 10
880 werner 42
 
43
            }
44
            Rectangle { height: 10}
45
 
879 werner 46
        }
880 werner 47
        Rectangle {
48
            //color: "#ea6b6b"
49
            Layout.fillHeight: true
50
            Layout.fillWidth: true
51
 
52
 
53
 
879 werner 54
            Rectangle {
880 werner 55
                visible: !rulercolors.hasFactors
56
                anchors.margins: 5
57
                anchors.leftMargin: 20
58
                anchors.topMargin: 10
59
                anchors.fill: parent
60
 
61
 
1041 werner 62
                ColumnLayout {
63
                    id: rulerDetailsLayout
64
 
65
                    CheckBox {
66
                        id: showRulerDetails
67
                        text: "Show details"
880 werner 68
                    }
1041 werner 69
 
70
                    GroupBox {
71
                        id: details
72
                        flat: true
73
                        visible: showRulerDetails.checked
74
                        anchors.top: showRulerDetails.bottom
75
                        height: visible?50:0
76
 
77
                        anchors.topMargin: 10
78
                        SpinBox {
79
                            id: minValueSpin
80
                            enabled: !rangeAuto.checked
81
                            decimals: 2
82
                            minimumValue: -10000
83
                            maximumValue: 1000000
84
                            width: 80
85
                            value: rulercolors.minValue
86
                            onValueChanged: rulercolors.minValue = value
87
                        }
88
                        SpinBox {
89
                            id: maxValueSpin
90
                            enabled: !rangeAuto.checked
91
                            decimals: 2
92
                            width: 80
93
                            minimumValue: -10000
94
                            maximumValue: 1000000
95
                            value: rulercolors.maxValue
96
                            anchors.left: minValueSpin.right
97
                            anchors.leftMargin: 10
98
                            onValueChanged: rulercolors.maxValue = value
99
                        }
100
                        CheckBox {
101
                            id: rangeAuto
102
                            anchors.left: maxValueSpin.right
103
                            anchors.leftMargin: 5
104
                            text: "Auto"
105
                            checked: rulercolors.autoScale
106
                            onClicked: rulercolors.autoScale=rangeAuto.checked
107
                        }
880 werner 108
                    }
1041 werner 109
                    GroupBox {
110
                        anchors.top: details.bottom
111
                        anchors.topMargin: 10
112
                        flat: true
113
                        Column {
114
                            id: colorRamp
115
                            anchors.topMargin: 10
880 werner 116
 
117
 
1041 werner 118
                            Repeater {
119
                                //model: ["yellow", "red", "green", "darkgrey", "blue","yellow", "red", "green", "darkgrey", "blue", "darkgrey", "blue"]
120
                                model: rulercolors.colors
121
                                Rectangle {
122
                                    width: 60; height: 150 / rulercolors.count
123
                                    color: modelData
124
                                }
125
                            }
880 werner 126
                        }
1041 werner 127
                        Text {
128
                            id: maxValue
129
                            text: rulercolors.labels[4]
130
                            anchors.left: colorRamp.right
131
                            anchors.top: colorRamp.top
132
                            anchors.topMargin: -height/2
133
                            anchors.leftMargin: 5
134
                        }
135
                        Text {
136
                            id: upperQuartileValue
137
                            text: rulercolors.labels[3]
138
                            anchors.left: colorRamp.right
139
                            anchors.top:  colorRamp.top
140
                            anchors.topMargin: colorRamp.height/4 - height/2
141
                            anchors.leftMargin: 5
142
                            visible: colorRamp.height>100
143
                        }
144
                        Text {
145
                            id: centerValue
146
                            text: rulercolors.labels[2]
147
                            anchors.left: colorRamp.right
148
                            anchors.verticalCenter:  colorRamp.verticalCenter
149
                            anchors.topMargin: height/2
150
                            anchors.leftMargin: 5
151
                        }
152
                        Text {
153
                            id: lowerQuartileValue
154
                            text: rulercolors.labels[1]
155
                            anchors.left: colorRamp.right
156
                            anchors.top:  colorRamp.top
157
                            anchors.topMargin: colorRamp.height*3/4 - height/2
158
                            anchors.leftMargin: 5
159
                            visible: colorRamp.height>100
160
                        }
161
                        Text {
162
                            id: minValue
163
                            text: rulercolors.labels[0]
164
                            anchors.left: colorRamp.right
165
                            anchors.bottom: colorRamp.bottom
166
                            anchors.topMargin: height/2
167
                            anchors.leftMargin: 5
168
                        }
169
                    }                }
170
 
171
 
879 werner 172
            }
880 werner 173
            ScrollView {
174
                visible: rulercolors.hasFactors
175
                id: palFactorsList
176
 
177
                anchors.fill: parent
178
                anchors.leftMargin: 20
179
 
180
                ListView {
181
                    anchors.fill: parent
182
                    model: rulercolors.factorLabels
183
                    delegate: Rectangle {
184
                        height: 25
185
                        width: 200
186
                        Rectangle {
187
                            id: delColorRect
188
                            height: 20; width: 50
189
                            color: rulercolors.colors[index]
190
                        }
191
 
192
                        Text { text: modelData
193
                            anchors.top: delColorRect.top;
194
                            anchors.left: delColorRect.right;
195
                            anchors.verticalCenter: delColorRect.verticalCenter;
196
                            anchors.leftMargin: 5
197
                        }
198
                    }
199
                }
200
            }
879 werner 201
        }
880 werner 202
 
203
        Rectangle {
204
 
205
            id: scale
206
            height: 40
207
 
208
            //color: "grey"
209
            width: parent.width
210
            Text {
211
                //text: "Meter/px:" + rulercolors.meterPerPixel
212
                text: "0m"
213
                height: 20
214
                anchors.top: scale.top
215
                anchors.topMargin: 30
216
            }
217
 
218
 
219
            Row{
220
 
221
                anchors.top: scale.top
222
                anchors.topMargin: 10
223
 
224
 
225
                Repeater {
226
                    id: scaleRep
227
                    width: parent.width
228
                    model: 4
229
                    property real cellWidth
882 werner 230
                    cellWidth: { var n = rulercolors.meterPerPixel*main.width/5;
1041 werner 231
                        var sig=1;
232
                        var mult = Math.pow(10, sig - Math.floor(Math.log(n) / Math.LN10) - 1);
233
                        var s= Math.round(n * mult) / mult;
234
                        //console.log("n: " + n + " s: " + s);
235
                        return s / rulercolors.meterPerPixel;
236
                    }
880 werner 237
                    Item {
238
                        width: scaleRep.cellWidth
239
                        height: 30
240
                        Rectangle {
241
                            width: scaleRep.cellWidth
242
                            height: 20
243
                            border.width: 1
244
                            border.color: "#808080"
245
                            color: index % 2==1?"#808080":"#a0a0a0"
246
                        }
247
                        Text {
248
                            text: Math.round(parent.width * (modelData+1) * rulercolors.meterPerPixel)
249
                            anchors.top: parent.top
250
                            anchors.left: parent.left
251
                            anchors.topMargin: 20
252
                            anchors.leftMargin: scaleRep.cellWidth-contentWidth/2
253
 
254
                        }
255
                    }
256
                }
257
            }
258
 
259
        }
879 werner 260
    }
880 werner 261
 
879 werner 262
}