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
68799d9e
Commit
68799d9e
authored
1 year ago
by
Sara Savanovic Djordjevic
Browse files
Options
Downloads
Patches
Plain Diff
add: polygons instead of markers
parent
1874f684
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/lib/pages/consts.dart
+4
-0
4 additions, 0 deletions
app/lib/pages/consts.dart
app/lib/pages/widgets/map_widget.dart
+16
-21
16 additions, 21 deletions
app/lib/pages/widgets/map_widget.dart
with
20 additions
and
21 deletions
app/lib/pages/consts.dart
+
4
−
0
View file @
68799d9e
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:google_fonts/google_fonts.dart'
;
import
'package:google_fonts/google_fonts.dart'
;
import
'package:latlong2/latlong.dart'
;
// API variables
// API variables
const
String
port
=
"8443"
;
const
String
port
=
"8443"
;
...
@@ -7,6 +8,9 @@ const String serverURI = "https://127.0.0.1:$port/";
...
@@ -7,6 +8,9 @@ const String serverURI = "https://127.0.0.1:$port/";
const
String
mapEndpoint
=
"update_map"
;
const
String
mapEndpoint
=
"update_map"
;
const
int
fetchInterval
=
60
;
// Fetch marker data every n minutes
const
int
fetchInterval
=
60
;
// Fetch marker data every n minutes
// Map center
LatLng
mapCenter
=
LatLng
(
60.7666
,
10.8471
);
// Font variables
// Font variables
const
textColor
=
Colors
.
white
;
const
textColor
=
Colors
.
white
;
final
appTitleStyle
=
GoogleFonts
.
dmSans
(
final
appTitleStyle
=
GoogleFonts
.
dmSans
(
...
...
This diff is collapsed.
Click to expand it.
app/lib/pages/widgets/map_widget.dart
+
16
−
21
View file @
68799d9e
...
@@ -43,7 +43,7 @@ class _MapContainerWidgetState extends State<MapContainerWidget> {
...
@@ -43,7 +43,7 @@ class _MapContainerWidgetState extends State<MapContainerWidget> {
height:
screenWidth
*
boxHeight
,
height:
screenWidth
*
boxHeight
,
child:
FlutterMap
(
child:
FlutterMap
(
options:
MapOptions
(
options:
MapOptions
(
center:
LatLng
(
60.7666
,
10.8471
),
center:
mapCenter
,
// From consts
zoom:
9.0
,
zoom:
9.0
,
),
),
children:
[
children:
[
...
@@ -51,28 +51,23 @@ class _MapContainerWidgetState extends State<MapContainerWidget> {
...
@@ -51,28 +51,23 @@ class _MapContainerWidgetState extends State<MapContainerWidget> {
urlTemplate:
"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
,
urlTemplate:
"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
,
subdomains:
const
[
'a'
,
'b'
,
'c'
],
subdomains:
const
[
'a'
,
'b'
,
'c'
],
),
),
MarkerLayer
(
PolygonLayer
(
// Map each element in markerList to Measurement object
markers:
widget
.
markerList
.
map
((
Measurement
Measurement
)
{
polygons:
widget
.
markerList
.
map
((
Measurement
measurement
)
{
return
Marker
(
return
Polygon
(
width:
50
,
points:
measurement
.
cornerList
.
map
((
Corner
corner
)
{
height:
50
,
// Match corners to LatLng objects
point:
LatLng
(
Measurement
.
dataList
[
0
]
.
latitude
,
Measurement
.
dataList
[
0
]
.
longitude
),
return
LatLng
(
corner
.
latitude
,
corner
.
longitude
);
builder:
(
ctx
)
=
>
GestureDetector
(
})
.
toList
(),
onTap:
()
{
/*onTap: () {
setState
(()
{
setState(() {
selectedMarker
=
Measurement
;
selectedMarker = measurement;
});
});
},
},*/
child:
Image
.
asset
(
color:
Colors
.
blue
,
'assets/icons/circle-red.png'
,
isFilled:
true
,
color:
Colors
.
red
,
width:
50
,
height:
50
,
),
),
);
);
})
.
toList
(),
})
.
toList
(),
)
,
)
],
],
),
),
),
),
...
...
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