diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj index 5494815e..d64c1764 100644 --- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj +++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj @@ -112,12 +112,15 @@ + + + @@ -131,6 +134,9 @@ + + RoomListPage.xaml + Exams.xaml @@ -294,6 +300,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/CampusAppWP8/CampusAppWP8/Model/Campusmap/CBMainMapModel.cs b/CampusAppWP8/CampusAppWP8/Model/Campusmap/CBMainMapModel.cs index 220d403f..73e1c75f 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Campusmap/CBMainMapModel.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Campusmap/CBMainMapModel.cs @@ -15,7 +15,7 @@ namespace CampusAppWP8.Model.Campusmap /// /// Class for the MapModel of the mainCampus of cottbus /// - public class CBMainMapModel : MapModel + public class CBMainMapModel : CampusMapModel { #region Member @@ -46,6 +46,7 @@ namespace CampusAppWP8.Model.Campusmap this.ScaleY = 197648.8919266073; this.GeoOffsetX = 14.327159; this.GeoOffsetY = 51.766548; + this.CampusId = CBMainMapModel.Campus; } #endregion diff --git a/CampusAppWP8/CampusAppWP8/Model/Campusmap/CampusMapModel.cs b/CampusAppWP8/CampusAppWP8/Model/Campusmap/CampusMapModel.cs new file mode 100644 index 00000000..812a8d78 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/Campusmap/CampusMapModel.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CampusAppWP8.Model.Campusmap +{ + public class CampusMapModel : MapModel + { + public string CampusId { get; protected set; } + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/GeoDb/CampusBuildingLayerModel.cs b/CampusAppWP8/CampusAppWP8/Model/GeoDb/CampusBuildingLayerModel.cs new file mode 100644 index 00000000..2ff5f882 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/GeoDb/CampusBuildingLayerModel.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CampusAppWP8.Model.GeoDb +{ + public class CampusBuildingLayerModel + { + + public CampusBuildingLayerModel(string layerId, List places) + { + this.LayerId = layerId; + this.Rooms = new List(); + + foreach (PlaceModel place in places) + { + string placeLayerId = place.GetInformationsValue("Ebene"); + if (placeLayerId != null && placeLayerId.Equals(layerId)) + { + this.Rooms.Add(place); + } + } + } + public List Rooms {get; set;} + + public string LayerId { get; set; } + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/GeoDb/CampusBuildingModel.cs b/CampusAppWP8/CampusAppWP8/Model/GeoDb/CampusBuildingModel.cs new file mode 100644 index 00000000..a3240341 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/GeoDb/CampusBuildingModel.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CampusAppWP8.Model.GeoDb +{ + public class CampusBuildingModel + { + + public CampusBuildingModel(string buildingId, List places) + { + this.Layers = new Dictionary(); + + foreach (PlaceModel place in places) + { + if (place.ParentId.Equals(buildingId)) + { + string placeLayerId = place.GetInformationsValue("Ebene"); + if (placeLayerId == null) + { + continue; + } + + if (this.Layers.ContainsKey(placeLayerId)) + { + this.Layers[placeLayerId].Rooms.Add(place); + } + else + { + this.Layers.Add(placeLayerId, new CampusBuildingLayerModel(placeLayerId, new List() { place })); + } + + } + else if (place.PlaceId.Equals(buildingId)) + { + this.Building = place; + } + } + } + public Dictionary Layers { get; private set; } + + public PlaceModel Building { get; set; } + } +} diff --git a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml.cs index 74fadd03..8f698f63 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml.cs @@ -11,6 +11,7 @@ namespace CampusAppWP8.Pages.Campusmap using System.Collections.Generic; using System.Device.Location; using System.Globalization; + using System.Linq; using System.Runtime.InteropServices.WindowsRuntime; using System.Threading; using System.Windows; @@ -35,7 +36,7 @@ namespace CampusAppWP8.Pages.Campusmap private readonly ProximityDevice device = ProximityDevice.GetDefault(); /// Variable for the map model. - private MapModel map; + private CampusMapModel campusMap; /// /// List of information names @@ -56,9 +57,9 @@ namespace CampusAppWP8.Pages.Campusmap public CampusMapPage() { this.InitializeComponent(); - this.map = new CBMainMapModel(); - this.MapCanvas.DataContext = this.map; - this.map.ShowMapInfos += new CBMainMapModel.MapInfos(this.ShowMapInfo); + this.campusMap = new CBMainMapModel(); + this.MapCanvas.DataContext = this.campusMap; + this.campusMap.ShowMapInfos += new CBMainMapModel.MapInfos(this.ShowMapInfo); ApplicationBarMenuItem menuItem1 = ApplicationBar.MenuItems[0] as ApplicationBarMenuItem; ApplicationBarMenuItem menuItem2 = ApplicationBar.MenuItems[1] as ApplicationBarMenuItem; @@ -86,7 +87,7 @@ namespace CampusAppWP8.Pages.Campusmap protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); - if (this.map.Spatial == null) + if (this.campusMap.Spatial == null) { return; } @@ -153,7 +154,7 @@ namespace CampusAppWP8.Pages.Campusmap foreach (string pid in pidList) { - tmpPlace = this.map.Spatial.GetPlaceById(pid); + tmpPlace = this.campusMap.Spatial.GetPlaceById(pid); if (tmpPlace != null) { placeList.Add(tmpPlace); @@ -284,7 +285,7 @@ namespace CampusAppWP8.Pages.Campusmap this.informationsNames.Add(Constants.PisInformationName_ShortName); } - return this.map.Spatial.GetPlacesByInformation(query, true, this.informationsNames); + return this.campusMap.Spatial.GetPlacesByInformation(query, true, this.informationsNames); } /// Adds the pins. @@ -315,8 +316,8 @@ namespace CampusAppWP8.Pages.Campusmap /// (Optional) List of places, whose are associative with the pin private void AddPin(double x, double y, MapPinModel.PinType type, bool scroll = true, List assocPlaces = null) { - Point scrollPoint = this.map.GetScrollPoint(this.map.ConverToPixelPoint(this.map.ConverToMapPoint(x, y))); - MapCanvas.Children.Add(this.map.AddPinFromRefPoint(this.map.ConverToPixelPoint(this.map.ConverToMapPoint(x, y)), type, assocPlaces)); + Point scrollPoint = this.campusMap.GetScrollPoint(this.campusMap.ConverToPixelPoint(this.campusMap.ConverToMapPoint(x, y))); + MapCanvas.Children.Add(this.campusMap.AddPinFromRefPoint(this.campusMap.ConverToPixelPoint(this.campusMap.ConverToMapPoint(x, y)), type, assocPlaces)); MapScroller.UpdateLayout(); if (scroll) @@ -435,6 +436,11 @@ namespace CampusAppWP8.Pages.Campusmap msgText += AppResources.PlaceLabel_ShortDesc + ": "; msgText += place.GetInformationsValue(Constants.PisInformationName_ShortDesc); msgText = Wp8StringManager.AddNewLine(msgText); + + if (place.ParentId.Equals(this.campusMap.CampusId)) + { + CampusBuildingModel biulding = new CampusBuildingModel(place.PlaceId, campusMap.Spatial.Places.ToList()); + } } MessageBoxes.ShowMainModelInfoMessageBox(msgText); diff --git a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml new file mode 100644 index 00000000..dee25795 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml.cs new file mode 100644 index 00000000..a3aac555 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Navigation; +using Microsoft.Phone.Controls; +using Microsoft.Phone.Shell; +using CampusAppWP8.File.Places; + +namespace CampusAppWP8.Pages.Campusmap +{ + public partial class RoomListPage : PhoneApplicationPage + { + private PlacesFile placeFile; + + public RoomListPage() + { + InitializeComponent(); + } + + protected override void OnNavigatedTo(NavigationEventArgs e) + { + base.OnNavigatedTo(e); + + if (NavigationMode.Back == e.NavigationMode) + { + if (this.placeFile == null) + { + this.placeFile = new PlacesFile(); + this.placeFile.OnLoaded += new PlacesFile.OnIO(this.PlacesFileIsReady); + this.placeFile.OnFailedLoad += new PlacesFile.OnFailed(this.PlacesFileIsFail); + this.placeFile.LoadData(); + } + } + } + + private void PlacesFileIsFail() + { + throw new NotImplementedException(); + } + + private void PlacesFileIsReady() + { + throw new NotImplementedException(); + } + + private void setupPivot() + { + + } + } +} \ No newline at end of file diff --git a/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs b/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs index 75be2464..c373f1ff 100644 --- a/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs +++ b/CampusAppWP8/CampusAppWP8/Utility/Utilities.cs @@ -127,7 +127,7 @@ namespace CampusAppWP8.Utility } else { - retValue.AddRange(GetChild(child as DependencyObject, elemName)); + retValue.AddRange(Utilities.GetChild(child as DependencyObject, elemName)); } }