Skip to content
Snippets Groups Projects

Resolve "As a user I would like to see a map of the landmarks, so that I can figure out where to go"

2 files
+ 10
40
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -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;
// }
}
Loading