Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PROG2900
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sara Savanovic Djordjevic
PROG2900
Commits
a8e9d14b
Commit
a8e9d14b
authored
1 year ago
by
Sara Savanovic Djordjevic
Browse files
Options
Downloads
Patches
Plain Diff
update: add color fields to subdiv class
parent
cb2d27bb
No related branches found
No related tags found
2 merge requests
!9
Clhp map
,
!8
Clhp map
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/lib/data_classes.dart
+19
-11
19 additions, 11 deletions
app/lib/data_classes.dart
app/lib/pages/default_page.dart
+2
-2
2 additions, 2 deletions
app/lib/pages/default_page.dart
app/lib/widgets/main_layout.dart
+0
-0
0 additions, 0 deletions
app/lib/widgets/main_layout.dart
with
21 additions
and
13 deletions
app/lib/data_classes.dart
+
19
−
11
View file @
a8e9d14b
import
'dart:core'
;
import
'dart:core'
;
import
'package:latlong2/latlong.dart'
;
import
'package:latlong2/latlong.dart'
;
import
'package:flutter/material.dart'
;
class
Measurement
{
class
Measurement
{
int
measurementID
;
int
measurementID
;
...
@@ -17,47 +18,54 @@ class Measurement {
...
@@ -17,47 +18,54 @@ class Measurement {
required
this
.
bodyOfWater
,
required
this
.
bodyOfWater
,
required
this
.
center
,
required
this
.
center
,
required
this
.
subDiv
,
required
this
.
subDiv
,
required
this
.
corners
required
this
.
corners
,
});
});
factory
Measurement
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
factory
Measurement
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
return
Measurement
(
return
Measurement
(
measurementID:
json
[
'MeasurementID'
],
measurementID:
json
[
'MeasurementID'
],
timeMeasured:
DateTime
.
parse
(
json
[
'TimeMeasured'
]),
timeMeasured:
DateTime
.
parse
(
json
[
'TimeMeasured'
]),
sensor:
Sensor
.
fromJson
(
json
[
'Sensor'
]),
sensor:
Sensor
.
fromJson
(
json
[
'Sensor'
]),
bodyOfWater:
json
[
'BodyOfWater'
]
??
'nil'
,
bodyOfWater:
json
[
'BodyOfWater'
]
??
'nil'
,
center:
LatLng
(
json
[
'CenterLat'
],
json
[
'CenterLon'
]),
center:
LatLng
(
json
[
'CenterLat'
],
json
[
'CenterLon'
]),
subDiv:
(
json
[
'Subdivisions'
]
as
List
<
dynamic
>)
.
map
((
data
)
=
>
SubDiv
.
fromJson
(
data
))
.
toList
(),
subDiv:
(
json
[
'Subdivisions'
]
as
List
<
dynamic
>)
.
map
((
data
)
=
>
SubDiv
.
fromJson
(
data
))
.
toList
(),
corners:
(
json
[
'Corners'
]
as
List
<
dynamic
>)
.
map
((
corner
)
=
>
LatLng
(
corner
[
0
],
corner
[
1
]))
.
toList
(),
corners:
(
json
[
'Corners'
]
as
List
<
dynamic
>)
.
map
((
corner
)
=
>
LatLng
(
corner
[
0
],
corner
[
1
]))
.
toList
(),
);
);
}
}
}
}
class
SubDiv
{
class
SubDiv
{
int
sub
DivID
;
int
sub
_div_id
;
int
groupID
;
int
groupID
;
double
minThickness
;
double
minThickness
;
double
avgThickness
;
double
avgThickness
;
LatLng
center
;
LatLng
center
;
double
accuracy
;
double
accuracy
;
Color
color
;
Color
savedColor
;
SubDiv
({
SubDiv
({
required
this
.
sub
DivID
,
required
this
.
sub
_div_id
,
required
this
.
groupID
,
required
this
.
groupID
,
required
this
.
minThickness
,
required
this
.
minThickness
,
required
this
.
avgThickness
,
required
this
.
avgThickness
,
required
this
.
center
,
required
this
.
center
,
required
this
.
accuracy
,
required
this
.
accuracy
,
required
this
.
color
,
required
this
.
savedColor
});
});
factory
SubDiv
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
factory
SubDiv
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
return
SubDiv
(
return
SubDiv
(
sub
DivID
:
json
[
'SubdivID'
],
sub
_div_id
:
json
[
'SubdivID'
],
groupID:
json
[
'GroupID'
],
groupID:
json
[
'GroupID'
],
minThickness:
json
[
'MinThickness'
],
minThickness:
json
[
'MinThickness'
],
avgThickness:
json
[
'AvgThickness'
],
avgThickness:
json
[
'AvgThickness'
],
center:
LatLng
(
json
[
'CenLatitude'
],
json
[
'CenLongitude'
]),
center:
LatLng
(
json
[
'CenLatitude'
],
json
[
'CenLongitude'
]),
accuracy:
json
[
'Accuracy'
],
accuracy:
json
[
'Accuracy'
],
// Set grey as default color
color:
json
[
'Color'
]
!=
null
?
Color
(
json
[
'Color'
])
:
Colors
.
grey
,
savedColor:
json
[
'Color'
]
!=
null
?
Color
(
json
[
'Color'
])
:
Colors
.
grey
,
);
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
app/lib/pages/default_page.dart
+
2
−
2
View file @
a8e9d14b
...
@@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
...
@@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
import
'dart:typed_data'
;
import
'dart:typed_data'
;
import
'../consts.dart'
;
import
'../consts.dart'
;
import
'../widgets/main_
widgets_container
.dart'
;
import
'../widgets/main_
layout
.dart'
;
import
'../data_classes.dart'
;
import
'../data_classes.dart'
;
import
'../server_requests/fetch_markers.dart'
;
import
'../server_requests/fetch_markers.dart'
;
import
'../server_requests/fetch_relation.dart'
;
import
'../server_requests/fetch_relation.dart'
;
...
@@ -120,7 +120,7 @@ class _DefaultPageState extends State<DefaultPage> {
...
@@ -120,7 +120,7 @@ class _DefaultPageState extends State<DefaultPage> {
}
else
{
}
else
{
// Alert the user after the build completes if there is no server connection
// Alert the user after the build completes if there is no server connection
WidgetsBinding
.
instance
.
addPostFrameCallback
((
_
)
{
WidgetsBinding
.
instance
.
addPostFrameCallback
((
_
)
{
if
(
serverConnection
&&
!
dialogShown
)
{
if
(
!
serverConnection
&&
!
dialogShown
)
{
dialogShown
=
true
;
dialogShown
=
true
;
showConnectionMessage
();
showConnectionMessage
();
}
}
...
...
This diff is collapsed.
Click to expand it.
app/lib/widgets/main_
widgets_container
.dart
→
app/lib/widgets/main_
layout
.dart
+
0
−
0
View file @
a8e9d14b
File moved
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment