Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Team 5 - Smart Towns
Manage
Activity
Members
Labels
Plan
Issues
34
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Rhys Evans
Team 5 - Smart Towns
Commits
65e6f44d
Commit
65e6f44d
authored
1 year ago
by
Rhys Evans
Browse files
Options
Downloads
Patches
Plain Diff
Final touches to map feature, feature is in functioning order
parent
e6b6e35d
No related branches found
No related tags found
1 merge request
!30
Resolve "As a user I would like to see a map of the landmarks, so that I can figure out where to go"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/Team5/SmartTowns/placeswithcoordinates/PlacesController.java
+9
-40
9 additions, 40 deletions
...m5/SmartTowns/placeswithcoordinates/PlacesController.java
src/main/resources/templates/landmarks/locationPage.html
+1
-0
1 addition, 0 deletions
src/main/resources/templates/landmarks/locationPage.html
with
10 additions
and
40 deletions
src/main/java/Team5/SmartTowns/placeswithcoordinates/PlacesController.java
+
9
−
40
View file @
65e6f44d
...
...
@@ -2,10 +2,7 @@ package Team5.SmartTowns.placeswithcoordinates;
import
Team5.SmartTowns.data.Location
;
import
Team5.SmartTowns.data.LocationRepository
;
import
Team5.SmartTowns.data.Trail
;
import
Team5.SmartTowns.data.TrailsRepository
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
...
@@ -16,7 +13,6 @@ import org.springframework.web.servlet.ModelAndView;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Objects
;
@Controller
public
class
PlacesController
{
...
...
@@ -60,49 +56,22 @@ public class PlacesController {
List
<
Integer
>
locationIDIndex
=
new
ArrayList
<
Integer
>();
List
<
Location
>
locationCoordsWorkaround
=
new
ArrayList
<
Location
>();
int
locationID
=
999
;
int
workAroundID
=
0
;
// otherwise cases errors e.g. null used. 999 unlikely to be used so safe until then
for
(
int
i
=
0
;
i
<
locCoords
.
size
();
i
++){
/// for loop iterating over coordinates table need to match coordinate index with lcoation index manually
locationIDIndex
.
add
(
locCoords
.
get
(
i
).
getLocationID
()-
1
);
// gets location ID and therefore location list index number
locationCoordsWorkaround
.
add
(
locations
.
get
(
locCoords
.
get
(
i
).
getLocationID
()-
1
));
System
.
out
.
println
(
locCoords
.
get
(
i
).
getLocationID
()-
1
);
System
.
out
.
println
(
i
);
System
.
out
.
println
(
locations
.
get
(
locCoords
.
get
(
i
).
getLocationID
()-
1
).
getLocationName
().
replace
(
' '
,
'-'
));
System
.
out
.
println
(
location
);
System
.
out
.
println
((
locations
.
get
(
locCoords
.
get
(
i
).
getLocationID
()
-
1
).
getLocationName
().
replace
(
' '
,
'-'
).
trim
().
equals
(
location
)));
if
(
(
locations
.
get
(
locCoords
.
get
(
i
).
getLocationID
()
-
1
).
getLocationName
().
replace
(
' '
,
'-'
).
trim
().
equals
(
location
))
){
locationID
=
locCoords
.
get
(
i
).
getLocationID
()-
1
;
}
}
locationID
=
i
;
break
;
}
workAroundID
++;
}
System
.
out
.
println
(
locationCoordsWorkaround
);
System
.
out
.
println
(
"ag"
+
locationID
);
ModelAndView
modelAndView
=
new
ModelAndView
(
"fragments/locationPageFrags :: locationSection"
);
System
.
out
.
println
(
"ag"
+
locationID
);
modelAndView
.
addObject
(
"locCoord"
,
locCoords
.
get
(
locationID
));
System
.
out
.
println
(
"sd"
+
workAroundID
);
modelAndView
.
addObject
(
"location"
,
locationCoordsWorkaround
.
get
(
locationID
));
return
modelAndView
;
}
//
//
// //GC example
//
// @GetMapping("/allTrails")
// public ModelAndView getAllTrails(){
// ModelAndView mav = new ModelAndView("allTrails/allTrails");
// mav.addObject("trails", Trail.trails); //Mock data for trails
// return mav;
// }
// @RequestMapping(value="/id", method= RequestMethod.POST)
// public String sendHtmlFragment(Model map) {
// map.addAttribute("foo", "bar");
// return "allTrails/allTrails";
// }
//
// @GetMapping("/allTrails/{id}")
// public ModelAndView getResultBySearchKey(@PathVariable int id)
// {
// List<Trail> trailList= Trail.trails;//results from db
// ModelAndView mv= new ModelAndView("fragments/allTrailsFrags :: trailSection");
// mv.addObject("trail", trailList.get(id-1));
// return mv;
// }
}
This diff is collapsed.
Click to expand it.
src/main/resources/templates/landmarks/locationPage.html
+
1
−
0
View file @
65e6f44d
...
...
@@ -3,6 +3,7 @@
<head>
<meta
charset=
"UTF-8"
>
<title>
Checkpoint
</title>
<!-- todo make this a list per trail or per town that when clicked brings to unique location page-->
<link
rel=
"stylesheet"
th:href=
"@{/css/templatingstyle.css}"
>
</head>
<body>
...
...
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