public void addStopToStation(String key, Stop value) { stationsList[key].addStopToStation(value); }
private void addAllStopsAndStations() { FileReader frStops = new FileReader("stops.txt"); FileReader frStations = new FileReader("stations.txt"); List <String> stopData = frStops.readFile(); List <String> stationData = frStations.readFile(); foreach (var item in stopData) { String[] tempStopData = item.Split(','); GMapMarker marker; PointLatLng location = new PointLatLng(Double.Parse(tempStopData[7], CultureInfo.InvariantCulture.NumberFormat), Double.Parse(tempStopData[6], CultureInfo.InvariantCulture.NumberFormat)); marker = new GMarkerGoogle(location, GMarkerGoogleType.blue_small); marker.ToolTipText = tempStopData[3]; String zoneName = ""; int zoneNum = -1; Stop newStop; foreach (var zone in zones) { if (zone.isInside(location)) { zoneName = zone.getName(); zoneNum = zone.getNumber(); newStop = new Stop(marker.ToolTipText, location, zone); zone.addStop(newStop); break; } } marker.ToolTipText += " En " + zoneName; (stopsListOverlays[zoneNum]).Markers.Add(marker); } foreach (var item in stationData) { String[] tempStationData = item.Split(','); GMapMarker marker; PointLatLng location = new PointLatLng(Double.Parse(tempStationData[7], CultureInfo.InvariantCulture.NumberFormat), Double.Parse(tempStationData[6], CultureInfo.InvariantCulture.NumberFormat)); marker = new GMarkerGoogle(location, new Bitmap("./img/station.png")); marker.ToolTipText = tempStationData[3]; String zoneName = ""; int zoneNum = -1; String stationName = isStation(tempStationData[3]); Station newStation; foreach (var zone in zones) { if (zone.isInside(location)) { zoneName = zone.getName(); zoneNum = zone.getNumber(); Stop newStop = new Stop(marker.ToolTipText, location, zone); try { newStation = zone.getStation(stationName); zone.addStopToStation(stationName, newStop); } catch (Exception) { newStation = new Station(stationName, zone); zone.addStation(stationName, newStation); zone.addStopToStation(stationName, newStop); } break; } } marker.ToolTipText += " En " + zoneName; (fullStationsOverlays[zoneNum]).Markers.Add(marker); } //Adding the perimeter polygon for each station foreach (var zone in zones) { List <String> stationNamesInZone = zone.getStationsNames(); foreach (var key in stationNamesInZone) { Station station = zone.getStation(key); List <Stop> stopsInStation = station.getStationStops(); List <PointLatLng> perimeterPoints = new List <PointLatLng>(); Boolean addedFirst = false; foreach (var stop in stopsInStation) { perimeterPoints.Add(stop.getPosition()); if (!addedFirst) { GMapMarker markerStation = new GMarkerGoogle(stop.getPosition(), new Bitmap("./img/station.png")); markerStation.ToolTipText = stop.getName() + "En " + zone.getName(); stationsZoomedOutList[zone.getNumber()].Markers.Add(markerStation); addedFirst = true; } } station.setPerimeter(new Polygon(perimeterPoints, station.getName())); } } //Painting all the station polygons setStationsPolygons(); }
public void addStop(Stop stop) { stopsList.Add(stop); }
public void addStopToStation(Stop newStop) { stationStops.Add(newStop); }