public static int AddLocation(Location locToInsert, double x, double y) { WebResponse resp = POST(Uri + "/rest/locations", JsonConvert.SerializeObject(new AddSpatialWrapper(locToInsert, x, y))); String id = new StreamReader(resp.GetResponseStream()).ReadToEnd(); return int.Parse(JsonConvert.DeserializeObject<String>(id)); }
public Appointment(String name, String description, DateTime? startTime, DateTime? endTime, Location location, EnumAppointmentType type) { this.Name = name; this.Description = description; this.StartTime = startTime; this.EndTime = endTime; this.Location = location; this.Grounded = 0; this.Type = type; }
public Appointment(string name, string description, Location location, RehearsalRequest rehReq) { this.Id = rehReq.Id; this.Name = name; this.Description = description; this.StartTime = rehReq.StartTime; this.EndTime = rehReq.EndTime; this.Location = location; this.Grounded = 0; this.Type = EnumAppointmentType.Rehearsal; }
//sets name of ellipse corresponding to the data of the location private void setEllNameFromLocationData(Location locData, Ellipse ell) { ell.Name = "city_" + locData.Id + "_" + locData.Name; }
private Location getLocationDataFromEllName(String ellName) { Location retLoc = new Location(); String[] splittedEllName = ellName.Split('_'); int parsedId; int.TryParse(splittedEllName[1], out parsedId); retLoc.Id = parsedId; retLoc.Name = splittedEllName[2]; return retLoc; }
//if mouse on canvas pressed private void canSpatialData_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { Point currentMousePos = e.GetPosition(this.canSpatialData); Shape clickedElement = this.canSpatialData.InputHitTest(currentMousePos) as Shape; if (clickedElement != null && clickedElement == this.currentSpatialObjectSelected) { this.IsDragAndDropActive = true; if (this.currentSpatialObjectSelected is Line) //if is street { this.StreetDragDropStart = currentMousePos; } } else { //insert city or street if (this.currentSpatialInsertType == EnumSpatialType.CITY) //insert city at mouse position { Location locToInsert = new Location(); locToInsert.Name = this.tbNameOfObject.Text; //insert city in oracle locToInsert.Id = WebserviceManager.AddLocation(locToInsert, Math.Round(currentMousePos.X, 2), Math.Round(currentMousePos.Y, 2)); //insert city in canvas String ellName = "city_" + locToInsert.Id + "_" + locToInsert.Name; //name like "city_1_Villach Ellipse ellCity = generateEllipse(ellName, 12, 12); this.canSpatialData.Children.Add(ellCity); Canvas.SetTop(ellCity, Math.Round(currentMousePos.Y, 2) - (ellCity.Height / 2)); Canvas.SetLeft(ellCity, Math.Round(currentMousePos.X, 2) - (ellCity.Width / 2)); } else if (this.currentSpatialInsertType == EnumSpatialType.STREET) //set start point of the street { this.StreetStartPoint = currentMousePos; PointCollection pC = new PointCollection(); pC.Add(this.StreetStartPoint); pC.Add(this.StreetStartPoint); this.IsDrawingStreet = true; this.DrawingLine = generateLine("drawingLine", pC); this.canSpatialData.Children.Add(this.DrawingLine); } } }
public AddSpatialWrapper(Location l, double x, double y) { Location = l; X = x; Y = y; }
public static void UpdateLocation(Location loc, double x, double y) { PUT(Uri + "/rest/locations", JsonConvert.SerializeObject(new AddSpatialWrapper(loc, x, y))); }