Skip to content
Snippets Groups Projects
Commit f99f520d authored by Rhys Evans's avatar Rhys Evans
Browse files

Beginning to work on front-end mapping per approved location

parent 8df335d5
No related branches found
No related tags found
1 merge request!30Resolve "As a user I would like to see a map of the landmarks, so that I can figure out where to go"
package Team5.SmartTowns.placeswithcoordinates;
import Team5.SmartTowns.trails.Trail;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import java.util.List;
@Controller
public class PlacesController {
//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;
// }
}
...@@ -113,13 +113,9 @@ public class PlacesCoordinatesRepositoryJDBC implements PlacesCoordinatesReposit ...@@ -113,13 +113,9 @@ public class PlacesCoordinatesRepositoryJDBC implements PlacesCoordinatesReposit
index = i; index = i;
return index; return index;
} else{
return index= Integer.parseInt(null);
} }
} return index= Integer.parseInt(null);
}
} }
...@@ -134,7 +130,7 @@ public class PlacesCoordinatesRepositoryJDBC implements PlacesCoordinatesReposit ...@@ -134,7 +130,7 @@ public class PlacesCoordinatesRepositoryJDBC implements PlacesCoordinatesReposit
PlacesCoordinatesRepositoryJDBC jbdcsecond = new PlacesCoordinatesRepositoryJDBC(jdbc); PlacesCoordinatesRepositoryJDBC jbdcsecond = new PlacesCoordinatesRepositoryJDBC(jdbc);
List<TownWithTrails> allTowns = jbdcsecond.getAllTownCoords(); List<TownWithTrails> allTowns = jbdcsecond.getAllTownCoords();
int unapporvedLocationsListIndex=99; // initialiose variable to allow after if statement to run todo fix this int unapporvedLocationsListIndex=99; // initialize variable to allow after if statement to run todo fix this
for (int i=0; i<unapprovedLocations.size();i++){ // check if location exists for (int i=0; i<unapprovedLocations.size();i++){ // check if location exists
if (Objects.equals(unapprovedLocations.get(i).getLocationName(), locationsName)){ if (Objects.equals(unapprovedLocations.get(i).getLocationName(), locationsName)){
unapporvedLocationsListIndex =i; unapporvedLocationsListIndex =i;
......
...@@ -67,9 +67,9 @@ insert into stickers (packID, stickerID, name, description, rarity) value (3, 3, ...@@ -67,9 +67,9 @@ insert into stickers (packID, stickerID, name, description, rarity) value (3, 3,
# insert into stickerprogress (userID, stickerID, hasSticker) value ('2', '2', true); # insert into stickerprogress (userID, stickerID, hasSticker) value ('2', '2', true);
delete from locationCoordinates; delete from locationCoordinates;
insert into locationCoordinates(locationID, locationCoordsLat, locationCoordsLong) value (2,'51.57623','-3.21910' ); insert into locationCoordinates(locationID, locationCoordsLat, locationCoordsLong) value (2, '51.57623', '-3.21910' );
insert into locationCoordinates(locationID, locationCoordsLat, locationCoordsLong) value (3,'51.575372','-3.219186'); insert into locationCoordinates(locationID, locationCoordsLat, locationCoordsLong) value (3, '51.575372', '-3.219186');
insert into locationCoordinates(locationID, locationCoordsLat, locationCoordsLong) value (4, '51.576363','-3.220712' ); insert into locationCoordinates(locationID, locationCoordsLat, locationCoordsLong) value (4, '51.576363', '-3.220712' );
# #
# insert into stickerprogress (userID, packID, stickerID) value (1, 1, 1); # insert into stickerprogress (userID, packID, stickerID) value (1, 1, 1);
# insert into stickerprogress (userID, packID, stickerID) value (1, 1, 2); # insert into stickerprogress (userID, packID, stickerID) value (1, 1, 2);
...@@ -78,17 +78,10 @@ insert into locationCoordinates(locationID, locationCoordsLat, locationCoordsLon ...@@ -78,17 +78,10 @@ insert into locationCoordinates(locationID, locationCoordsLat, locationCoordsLon
# insert into stickerprogress (userID, packID, stickerID) value (1, 2, 1); # insert into stickerprogress (userID, packID, stickerID) value (1, 2, 1);
# insert into stickerprogress (userID, packID, stickerID) value (1, 2, 3); # insert into stickerprogress (userID, packID, stickerID) value (1, 2, 3);
delete from townsWithTrails; 'Caerphilly', '-3.22075','51.57903',,'-3.24597','-3.22496','51.57224','51.58856');
# insert into townsWithTrails (townName, townCentreCoordsLong, townCentreCoordsLat, townLeftmostCoordsLong, townRightmostCoordsLong, townUppermostCoordsLat, townLowermostCoordsLat) value ('Caerphilly', '51.57903','-3.22075','51.57224','51.58856','-3.24597','-3.22496');
# insert into townsWithTrails (townName, townCentreCoordsLong, townCentreCoordsLat, townLeftmostCoordsLong, townRightmostCoordsLong, townUppermostCoordsLat, townLowermostCoordsLat) value ('Risca','51.61155','-3.10170','51.61483','51.60566','-3.09853','-3.09377');
# insert into townsWithTrails (townName, townCentreCoordsLong, townCentreCoordsLat, townLeftmostCoordsLong, townRightmostCoordsLong, townUppermostCoordsLat, townLowermostCoordsLat) value ('Penarth','51.43893','-3.17354','51.34750','51.44365','-3.18830','-3.18187');
#
# #
# insert into townsWithTrails (townName, townCentreCoordsLat, townCentreCoordsLong, townLeftmostCoordsLat, townRightmostCoordsLat, townUppermostCoordsLong, townLowermostCoordsLong) value ('Caerphilly', '51.57903','-3. ','51.57224','51.58856','-3.24597','-3.22496'); delete from townsWithTrails;
# insert into townsWithTrails (townName, townCentreCoordsLat, townCentreCoordsLong, townLeftmostCoordsLat, townRightmostCoordsLat, townUppermostCoordsLong, townLowermostCoordsLong) value ('Risca','51.61195','-3.09648','51.61483','51.60566','-3.09853','-3.09377');
# insert into townsWithTrails (townName, townCentreCoordsLat, townCentreCoordsLong, townLeftmostCoordsLat, townRightmostCoordsLat, townUppermostCoordsLong, townLowermostCoordsLong) value ('Penarth','51.43893','-3.17354','51.34750','51.44365','-3.18830','-3.18187');
# lat=y=50s long=x=-3.0s
insert into townsWithTrails (townName, townCentreCoordsLat, townCentreCoordsLong, townUppermostCoordsLat, townLowermostCoordsLat, townLeftmostCoordsLong, townRightmostCoordsLong) value ('Caerphilly', '51.57903','-3.22075 ','51.60418','51.55093','-3.25222','-3.17696'); insert into townsWithTrails (townName, townCentreCoordsLat, townCentreCoordsLong, townUppermostCoordsLat, townLowermostCoordsLat, townLeftmostCoordsLong, townRightmostCoordsLong) value ('Caerphilly', '51.57903','-3.22075 ','51.60418','51.55093','-3.25222','-3.17696');
insert into townsWithTrails (townName, townCentreCoordsLat, townCentreCoordsLong, townUppermostCoordsLat, townLowermostCoordsLat, townLeftmostCoordsLong, townRightmostCoordsLong) value ('Risca','51.61195','-3.09648','51.63039','51.59175','-3.12129','-3.06438'); insert into townsWithTrails (townName, townCentreCoordsLat, townCentreCoordsLong, townUppermostCoordsLat, townLowermostCoordsLat, townLeftmostCoordsLong, townRightmostCoordsLong) value ('Risca','51.61195','-3.09648','51.63039','51.59175','-3.12129','-3.06438');
insert into townsWithTrails (townName, townCentreCoordsLat, townCentreCoordsLong, townUppermostCoordsLat, townLowermostCoordsLat, townLeftmostCoordsLong, townRightmostCoordsLong) value ('Penarth','51.43893','-3.17354','51.44878','51.41233','-3.20271','-3.16005'); insert into townsWithTrails (townName, townCentreCoordsLat, townCentreCoordsLong, townUppermostCoordsLat, townLowermostCoordsLat, townLeftmostCoordsLong, townRightmostCoordsLong) value ('Penarth','51.43893','-3.17354','51.44878','51.41233','-3.20271','-3.16005');
\ No newline at end of file
...@@ -88,9 +88,10 @@ create table if not exists townsWithTrails ...@@ -88,9 +88,10 @@ create table if not exists townsWithTrails
townName varchar(128), townName varchar(128),
townCentreCoordsLat varchar(128), townCentreCoordsLat varchar(128),
townCentreCoordsLong varchar(128), townCentreCoordsLong varchar(128),
townLeftmostCoordsLat varchar(128), townUppermostCoordsLat varchar(128),
townRightmostCoordsLat varchar(128), townLowermostCoordsLat varchar(128),
townUppermostCoordsLong varchar(128), townLeftmostCoordsLong varchar(128),
townLowermostCoordsLong varchar(128) townRightmostCoordsLong varchar(128)
)engine=InnoDB; )engine=InnoDB;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
</body>
</html>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment