From 12eb1de958bfa1a685f2393474d3f626790e0b0d Mon Sep 17 00:00:00 2001 From: stubbfel Date: Mon, 21 Oct 2013 15:03:34 +0200 Subject: [PATCH 1/3] mv geodb to plc --- .../CampusAppWP8/Api/GeoApi/CampusSpsApi.cs | 2 +- .../CampusAppWP8/Api/GeoApi/PisApi.cs | 2 +- .../CampusAppWP8/Api/GeoApi/PssApi.cs | 2 +- .../CampusAppWP8/Api/GeoApi/SpsApi.cs | 2 +- CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj | 10 ++- .../CampusAppWP8/File/Places/PlacesFile.cs | 6 +- .../Model/Campusmap/BuildingMapModel.cs | 4 +- .../Model/Campusmap/CBMainMapModel.cs | 2 +- .../Model/Campusmap/CampusMapModel.cs | 10 +-- .../Model/Campusmap/ClickAblePlacePinModel.cs | 2 +- .../CampusAppWP8/Model/Campusmap/MapModel.cs | 20 +++--- .../GeoDb/CampusBuildingLayerWp8Model.cs | 18 +++++ .../Model/GeoDb/CampusBuildingWp8Model.cs | 22 +++++++ .../CampusAppWP8/Model/GeoDb/PlaceWp8Model.cs | 65 +++++++++++++++++++ .../Pages/Campusmap/CampusMapPage.xaml.cs | 34 +++++----- .../Pages/Campusmap/RoomListPage.xaml.cs | 32 ++++----- .../CampusAppWP8/Pages/Dev/NFC.xaml.cs | 2 +- .../Pages/PlaceNews/PlaceNews.xaml.cs | 10 +-- .../Pages/PlaceNews/ShowPad.xaml.cs | 4 +- 19 files changed, 176 insertions(+), 73 deletions(-) create mode 100644 CampusAppWP8/CampusAppWP8/Model/GeoDb/CampusBuildingLayerWp8Model.cs create mode 100644 CampusAppWP8/CampusAppWP8/Model/GeoDb/CampusBuildingWp8Model.cs create mode 100644 CampusAppWP8/CampusAppWP8/Model/GeoDb/PlaceWp8Model.cs diff --git a/CampusAppWP8/CampusAppWP8/Api/GeoApi/CampusSpsApi.cs b/CampusAppWP8/CampusAppWP8/Api/GeoApi/CampusSpsApi.cs index 94ef65b8..578ebf8a 100644 --- a/CampusAppWP8/CampusAppWP8/Api/GeoApi/CampusSpsApi.cs +++ b/CampusAppWP8/CampusAppWP8/Api/GeoApi/CampusSpsApi.cs @@ -63,7 +63,7 @@ namespace CampusAppWP8.Api.GeoApi } CampusAppWPortalLib8.Model.Settings.Campus campus; - foreach (PlaceModel place in this.Model.Places) + foreach (PlaceWp8Model place in this.Model.Places) { if (Enum.TryParse(place.PlaceId, true, out campus)) { diff --git a/CampusAppWP8/CampusAppWP8/Api/GeoApi/PisApi.cs b/CampusAppWP8/CampusAppWP8/Api/GeoApi/PisApi.cs index 9d8b112d..70387d5d 100644 --- a/CampusAppWP8/CampusAppWP8/Api/GeoApi/PisApi.cs +++ b/CampusAppWP8/CampusAppWP8/Api/GeoApi/PisApi.cs @@ -18,7 +18,7 @@ namespace CampusAppWP8.Api.GeoApi /// Pis api. /// Stubbfel, 09.09.2013. /// - public class PisApi : XmlModel + public class PisApi : XmlModel { #region Constructor diff --git a/CampusAppWP8/CampusAppWP8/Api/GeoApi/PssApi.cs b/CampusAppWP8/CampusAppWP8/Api/GeoApi/PssApi.cs index 52e5afb3..550561ff 100644 --- a/CampusAppWP8/CampusAppWP8/Api/GeoApi/PssApi.cs +++ b/CampusAppWP8/CampusAppWP8/Api/GeoApi/PssApi.cs @@ -18,7 +18,7 @@ namespace CampusAppWP8.Api.GeoApi /// Pss api. /// Stubbfel, 09.09.2013. /// - public class PssApi : XmlModel + public class PssApi : XmlModel { #region Constructor diff --git a/CampusAppWP8/CampusAppWP8/Api/GeoApi/SpsApi.cs b/CampusAppWP8/CampusAppWP8/Api/GeoApi/SpsApi.cs index 806d1ca2..6e0959db 100644 --- a/CampusAppWP8/CampusAppWP8/Api/GeoApi/SpsApi.cs +++ b/CampusAppWP8/CampusAppWP8/Api/GeoApi/SpsApi.cs @@ -19,7 +19,7 @@ namespace CampusAppWP8.Api.GeoApi /// Class for SPSAPI. /// Stubbfel, 14.10.2013. /// - public class SpsApi : XmlModel + public class SpsApi : XmlModel { #region Constructor diff --git a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj index 1f098b7d..2a862bee 100644 --- a/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj +++ b/CampusAppWP8/CampusAppWP8/CampusAppWP8.csproj @@ -128,12 +128,10 @@ - - - - - - + + + + diff --git a/CampusAppWP8/CampusAppWP8/File/Places/PlacesFile.cs b/CampusAppWP8/CampusAppWP8/File/Places/PlacesFile.cs index e39c9ad0..92d2235c 100644 --- a/CampusAppWP8/CampusAppWP8/File/Places/PlacesFile.cs +++ b/CampusAppWP8/CampusAppWP8/File/Places/PlacesFile.cs @@ -16,7 +16,7 @@ namespace CampusAppWP8.File.Places /// Places file. /// Stubbfel, 09.09.2013. /// - public class PlacesFile : XmlModel + public class PlacesFile : XmlModel { #region Constructor @@ -39,7 +39,7 @@ namespace CampusAppWP8.File.Places /// The model. /// Information describing the file. /// true if it succeeds, false if it fails. - private bool CheckIsFileUpToDate(SpsModel model, System.IO.FileInfo fileInfo) + private bool CheckIsFileUpToDate(SpsWp8Model model, System.IO.FileInfo fileInfo) { if (fileInfo == null || !fileInfo.Exists || fileInfo.Length < 1 || (model != null && model.HasChanged)) { @@ -53,7 +53,7 @@ namespace CampusAppWP8.File.Places /// Stubbfel, 14.10.2013. public void FallBackLoad() { - SpsModel fallBackModel = XmlManager.DeserializationFileToModel(Constants.FileMap_OfflineMap); + SpsWp8Model fallBackModel = XmlManager.DeserializationFileToModel(Constants.FileMap_OfflineMap); this.Model = fallBackModel; this.SaveData(); } diff --git a/CampusAppWP8/CampusAppWP8/Model/Campusmap/BuildingMapModel.cs b/CampusAppWP8/CampusAppWP8/Model/Campusmap/BuildingMapModel.cs index 9c9dc708..d24d18d4 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Campusmap/BuildingMapModel.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Campusmap/BuildingMapModel.cs @@ -25,8 +25,8 @@ namespace CampusAppWP8.Model.Campusmap /// The identifier. public BuildingMapModel(string id) { - SpsModel buildings = XmlManager.DeserializationFileToModel(Constants.FileMap_BuildingsMap); - PlaceModel building = buildings.GetPlaceById(id); + SpsWp8Model buildings = XmlManager.DeserializationFileToModel(Constants.FileMap_BuildingsMap); + PlaceWp8Model building = buildings.GetPlaceById(id); if (buildings == null) { return; diff --git a/CampusAppWP8/CampusAppWP8/Model/Campusmap/CBMainMapModel.cs b/CampusAppWP8/CampusAppWP8/Model/Campusmap/CBMainMapModel.cs index 2e2757c5..e92434e4 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Campusmap/CBMainMapModel.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Campusmap/CBMainMapModel.cs @@ -30,7 +30,7 @@ namespace CampusAppWP8.Model.Campusmap /// Initializes a new instance of the class. /// Stubbfel, 14.10.2013. /// List of places. - public CBMainMapModel(List placeList) + public CBMainMapModel(List placeList) : base(placeList, CBMainMapModel.Campus) { this.ImageSource = Constants.FileMap_CBMainMap; diff --git a/CampusAppWP8/CampusAppWP8/Model/Campusmap/CampusMapModel.cs b/CampusAppWP8/CampusAppWP8/Model/Campusmap/CampusMapModel.cs index 45a71407..3229f649 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Campusmap/CampusMapModel.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Campusmap/CampusMapModel.cs @@ -22,7 +22,7 @@ namespace CampusAppWP8.Model.Campusmap /// Stubbfel, 14.10.2013. /// list of places. /// id of the campus. - public CampusMapModel(List placeList, string campusId) + public CampusMapModel(List placeList, string campusId) { this.CampusId = campusId; this.LoadSpatials(placeList); @@ -50,12 +50,12 @@ namespace CampusAppWP8.Model.Campusmap /// Loads the spatial./. /// Stubbfel, 14.10.2013. /// - protected override void LoadSpatials(List placeList) + protected override void LoadSpatials(List placeList) { - List campusPlaces = new List(); - this.Spatial = new SpsModel(); + List campusPlaces = new List(); + this.Spatial = new SpsWp8Model(); - foreach (PlaceModel place in placeList) + foreach (PlaceWp8Model place in placeList) { if (place.ParentId.Equals(this.CampusId) || place.PlaceId.Equals(this.CampusId)) { diff --git a/CampusAppWP8/CampusAppWP8/Model/Campusmap/ClickAblePlacePinModel.cs b/CampusAppWP8/CampusAppWP8/Model/Campusmap/ClickAblePlacePinModel.cs index 9fc74d80..d8c245fc 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Campusmap/ClickAblePlacePinModel.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Campusmap/ClickAblePlacePinModel.cs @@ -24,7 +24,7 @@ namespace CampusAppWP8.Model.Campusmap /// Gets or sets place which are associative with this pin. /// The associated places. - public List AssocPlaces { get; set; } + public List AssocPlaces { get; set; } #endregion diff --git a/CampusAppWP8/CampusAppWP8/Model/Campusmap/MapModel.cs b/CampusAppWP8/CampusAppWP8/Model/Campusmap/MapModel.cs index 5e105c5d..e03d0a6d 100644 --- a/CampusAppWP8/CampusAppWP8/Model/Campusmap/MapModel.cs +++ b/CampusAppWP8/CampusAppWP8/Model/Campusmap/MapModel.cs @@ -32,7 +32,7 @@ namespace CampusAppWP8.Model.Campusmap /// Initializes a new instance of the class. /// Stubbfel, 14.10.2013. /// list of places. - public MapModel(List placeList) + public MapModel(List placeList) { this.IsReady = false; this.LoadSpatials(placeList); @@ -46,7 +46,7 @@ namespace CampusAppWP8.Model.Campusmap /// Delegate for MapInfo. /// Stubbfel, 14.10.2013. /// list of places. - public delegate void MapInfos(List places); + public delegate void MapInfos(List places); /// Event ShowMapInfo. public event MapInfos ShowMapInfos = null; @@ -100,7 +100,7 @@ namespace CampusAppWP8.Model.Campusmap /// Gets or sets the spatial of the map. /// The spatial. - public SpsModel Spatial { get; set; } + public SpsWp8Model Spatial { get; set; } #endregion @@ -137,7 +137,7 @@ namespace CampusAppWP8.Model.Campusmap /// The type. /// (Optional) list of places. /// image of the pin. - public Image AddPin(double x, double y, MapPinModel.PinType type, List places = null) + public Image AddPin(double x, double y, MapPinModel.PinType type, List places = null) { Point position = new Point(x, y); return this.AddPin(position, type, places); @@ -153,7 +153,7 @@ namespace CampusAppWP8.Model.Campusmap /// The type. /// (Optional) list of places. /// image of the pin. - public Image AddPinFromRefPoint(double x, double y, MapPinModel.PinType type, List places = null) + public Image AddPinFromRefPoint(double x, double y, MapPinModel.PinType type, List places = null) { Point position = new Point(this.RefPoint.X + x, this.RefPoint.Y - y); return this.AddPin(position, type, places); @@ -168,7 +168,7 @@ namespace CampusAppWP8.Model.Campusmap /// The type. /// (Optional) list of places. /// image of the pin. - public Image AddPinFromRefPoint(Point position, MapPinModel.PinType type, List places = null) + public Image AddPinFromRefPoint(Point position, MapPinModel.PinType type, List places = null) { return this.AddPinFromRefPoint(position.X, position.Y, type, places); } @@ -179,7 +179,7 @@ namespace CampusAppWP8.Model.Campusmap /// The type. /// (Optional) list of places. /// image of the pin. - public Image AddPin(Point position, MapPinModel.PinType type, List places = null) + public Image AddPin(Point position, MapPinModel.PinType type, List places = null) { Image pinImg = new Image(); MapPinModel pin = this.CreatePin(type, places, pinImg); @@ -243,9 +243,9 @@ namespace CampusAppWP8.Model.Campusmap /// Loads the spatial object /// Stubbfel, 19.08.2013. /// list of places. - protected virtual void LoadSpatials(List placeList) + protected virtual void LoadSpatials(List placeList) { - this.Spatial = new SpsModel(); + this.Spatial = new SpsWp8Model(); this.Spatial.AddPlaces(placeList); } @@ -259,7 +259,7 @@ namespace CampusAppWP8.Model.Campusmap /// list of places. /// image of the pin. /// The new pin. - private MapPinModel CreatePin(MapPinModel.PinType type, List places, Image pinImg) + private MapPinModel CreatePin(MapPinModel.PinType type, List places, Image pinImg) { MapPinModel pin; switch (type) diff --git a/CampusAppWP8/CampusAppWP8/Model/GeoDb/CampusBuildingLayerWp8Model.cs b/CampusAppWP8/CampusAppWP8/Model/GeoDb/CampusBuildingLayerWp8Model.cs new file mode 100644 index 00000000..94a5b0c3 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/GeoDb/CampusBuildingLayerWp8Model.cs @@ -0,0 +1,18 @@ +//----------------------------------------------------------------------- +// +// The MIT License (MIT). Copyright (c) 2013 BTU/IIT. +// +// Stubbfel +// 15.10.2013 +// Implements the campus building layer model class +//----------------------------------------------------------------------- +namespace CampusAppWP8.Model.GeoDb +{ + + + /// Class is model for buildings of a campus. + /// Stubbfel, 15.10.2013. + public class CampusBuildingLayerWp8Model : CampusAppWPortalLib8.Model.GeoDb.CampusBuildingLayerModel + { + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/GeoDb/CampusBuildingWp8Model.cs b/CampusAppWP8/CampusAppWP8/Model/GeoDb/CampusBuildingWp8Model.cs new file mode 100644 index 00000000..6595b52c --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/GeoDb/CampusBuildingWp8Model.cs @@ -0,0 +1,22 @@ +//----------------------------------------------------------------------- +// +// The MIT License (MIT). Copyright (c) 2013 BTU/IIT. +// +// Stubbfel +// 15.10.2013 +// Implements the campus building model class +//----------------------------------------------------------------------- +namespace CampusAppWP8.Model.GeoDb +{ + using System.Collections.Generic; + + /// Class is model for buildings of a campus. + /// Stubbfel, 15.10.2013. + public class CampusBuildingWp8Model : CampusAppWPortalLib8.Model.GeoDb.CampusBuildingModel + { + public CampusBuildingWp8Model(string buildingId, List places) + : base(buildingId, places) + { + } + } +} diff --git a/CampusAppWP8/CampusAppWP8/Model/GeoDb/PlaceWp8Model.cs b/CampusAppWP8/CampusAppWP8/Model/GeoDb/PlaceWp8Model.cs new file mode 100644 index 00000000..3d3af099 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/GeoDb/PlaceWp8Model.cs @@ -0,0 +1,65 @@ +//----------------------------------------------------------------------- +// +// The MIT License (MIT). Copyright (c) 2013 BTU/IIT. +// +// Stubbfel +// 15.10.2013 +// Implements the place model class +//----------------------------------------------------------------------- +namespace CampusAppWP8.Model.GeoDb +{ + using System; + using System.Collections.Generic; + using System.Collections.ObjectModel; + using System.Device.Location; + using System.Globalization; + using System.Text.RegularExpressions; + using System.Xml.Serialization; + using CampusAppWP8.Resources; + using CampusAppWPortalLib8.Utility; + using CampusAppWPortalLib8.Model.GeoDb; + + /// Model for a place of the SPSService. + /// Stubbfel, 15.10.2013. + /// + public class PlaceWp8Model : CampusAppWPortalLib8.Model.GeoDb.PlaceModel + { + #region Property + + /// Gets the geo reference point. + /// The geo reference point. + public GeoCoordinate GeoRefPoint + { + get + { + string refstring = this.RefPoint; + Regex rx = new Regex(Constants.Regex_Coordinate); + MatchCollection matches = rx.Matches(refstring); + if (matches.Count != 1) + { + return null; + } + + string[] values = matches[0].ToString().Split(' '); + + if (values.Length != 2) + { + return null; + } + + // create the GeoCoordirate + try + { + return new GeoCoordinate(double.Parse(values[1], CultureInfo.InvariantCulture), double.Parse(values[0], CultureInfo.InvariantCulture)); + } + catch (Exception ex) + { + Logger.LogException(ex); + return null; + } + } + } + + #endregion + } +} diff --git a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml.cs index f8e25a50..fce5730c 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml.cs @@ -138,7 +138,7 @@ namespace CampusAppWP8.Pages.Campusmap scroll = false; if (Utilities.IsRoomId(alias)) { - PlaceModel place = this.file.Model.GetPlaceById(alias); + PlaceWp8Model place = this.file.Model.GetPlaceById(alias); if (place != null) { this.GoToRoomList(place.ParentId, place.PlaceId); @@ -159,7 +159,7 @@ namespace CampusAppWP8.Pages.Campusmap App.SaveToIsolatedStorage(Constants.CampusMapApp_QRCodeSearchResultStorageKey, null); string searchPid = Wp8StringManager.FilterPlaceIdinQRResultString(qrcodeResult); - PlaceModel place = this.file.Model.GetPlaceById(searchPid); + PlaceWp8Model place = this.file.Model.GetPlaceById(searchPid); if (searchPid != null) { @@ -431,9 +431,9 @@ namespace CampusAppWP8.Pages.Campusmap return; } - List placeList = new List(); - PlaceModel tmpPlace; - SpsModel spatial; + List placeList = new List(); + PlaceWp8Model tmpPlace; + SpsWp8Model spatial; if (allPlaces) { spatial = this.file.Model; @@ -499,7 +499,7 @@ namespace CampusAppWP8.Pages.Campusmap // search for placeId string nfcContent = ndef.GetContent(); string searchPid = Wp8StringManager.FilterPlaceIdinNFCResultString(nfcContent.Trim()); - PlaceModel place = this.file.Model.GetPlaceById(searchPid); + PlaceWp8Model place = this.file.Model.GetPlaceById(searchPid); if (searchPid != null) { @@ -561,9 +561,9 @@ namespace CampusAppWP8.Pages.Campusmap /// (optional) if its true, search places in place file, otherwise in CampusMapModel. /// /// The found places. - private List SearchPlaces(string query, bool allPlaces = false) + private List SearchPlaces(string query, bool allPlaces = false) { - SpsModel spatial; + SpsWp8Model spatial; if (allPlaces) { spatial = this.file.Model; @@ -576,7 +576,7 @@ namespace CampusAppWP8.Pages.Campusmap // if query is an id if (Wp8StringManager.IsDigitsOnly(query)) { - return new List() { spatial.GetPlaceById(query) }; + return new List() { spatial.GetPlaceById(query) }; } if (this.informationsNames == null) @@ -595,9 +595,9 @@ namespace CampusAppWP8.Pages.Campusmap /// The places. /// The type. /// (Optional) the scroll. - private void AddPins(List places, MapPinModel.PinType type, bool scroll = true) + private void AddPins(List places, MapPinModel.PinType type, bool scroll = true) { - foreach (PlaceModel place in places) + foreach (PlaceWp8Model place in places) { if (place == null) { @@ -607,7 +607,7 @@ namespace CampusAppWP8.Pages.Campusmap GeoCoordinate coor = place.GeoRefPoint; if (coor != null) { - List assocPlaces = new List(); + List assocPlaces = new List(); assocPlaces.Add(place); this.AddPin(coor.Longitude, coor.Latitude, type, scroll, assocPlaces); } @@ -623,7 +623,7 @@ 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) + private void AddPin(double x, double y, MapPinModel.PinType type, bool scroll = true, List assocPlaces = null) { 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)); @@ -748,7 +748,7 @@ namespace CampusAppWP8.Pages.Campusmap /// Method show same PlaceInformation. /// Stubbfel, 15.10.2013. /// List of places. - private void ShowMapInfo(List places) + private void ShowMapInfo(List places) { if (places == null) { @@ -756,7 +756,7 @@ namespace CampusAppWP8.Pages.Campusmap } string msgText = string.Empty; - foreach (PlaceModel place in places) + foreach (PlaceWp8Model place in places) { msgText += AppResources.PlaceLabel_Name + ": "; msgText += place.GetInformationsValue(Constants.PisInformationName_Name); @@ -789,7 +789,7 @@ namespace CampusAppWP8.Pages.Campusmap MessageBoxes.ShowMainModelInfoMessageBox(msgText); - foreach (PlaceModel place in places) + foreach (PlaceWp8Model place in places) { if (place.ParentId.Equals(this.campusMap.CampusId) && this.HasRooms(place.PlaceId)) { @@ -827,7 +827,7 @@ namespace CampusAppWP8.Pages.Campusmap /// true, if the place has got rooms, otherwise false. private bool HasRooms(string placeId) { - foreach (PlaceModel place in this.file.Model.Places) + foreach (PlaceWp8Model place in this.file.Model.Places) { if (place.ParentId.Equals(placeId)) { diff --git a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml.cs index 70ca3d7b..ee51d2ad 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml.cs @@ -8,13 +8,6 @@ //----------------------------------------------------------------------- namespace CampusAppWP8.Pages.Campusmap { - using System.Collections.Generic; - using System.Linq; - using System.Windows; - using System.Windows.Controls; - using System.Windows.Input; - using System.Windows.Media; - using System.Windows.Navigation; using CampusAppWP8.File.Places; using CampusAppWP8.Model.Campusmap; using CampusAppWP8.Model.GeoDb; @@ -23,6 +16,13 @@ namespace CampusAppWP8.Pages.Campusmap using CampusAppWP8.Utility.Lui.MessageBoxes; using CampusAppWPortalLib8.Model.Utility; using Microsoft.Phone.Controls; + using System.Collections.Generic; + using System.Linq; + using System.Windows; + using System.Windows.Controls; + using System.Windows.Input; + using System.Windows.Media; + using System.Windows.Navigation; /// Class of the RoomListPage. /// Stubbfel, 14.10.2013. @@ -34,7 +34,7 @@ namespace CampusAppWP8.Pages.Campusmap private PlacesFile placeFile; /// Variable of building which is shown in the list. - private CampusBuildingModel building; + private CampusBuildingWp8Model building; /// Variable for the map model. private BuildingMapModel buildingMap; @@ -149,20 +149,20 @@ namespace CampusAppWP8.Pages.Campusmap this.ClearMap(new List() { MapPinModel.InfoPlacePinString }); - PlaceModel room = this.building.GetPlaceById(placeId); + PlaceWp8Model room = this.building.GetPlaceById(placeId); x = room.GeoRefPoint.Longitude; y = room.GeoRefPoint.Latitude; Point roompoint = this.buildingMap.GetScrollPoint(this.buildingMap.ConverToPixelPoint(this.buildingMap.ConverToMapPoint(x, y))); Point viewPoint = new Point(roompoint.X - this.mappoint.X + this.offsetPoint.X, roompoint.Y - this.mappoint.Y + this.offsetPoint.Y); - MapCanvas.Children.Add(this.buildingMap.AddPin(viewPoint, MapPinModel.PinType.InfoRedPlace, new List { room })); + MapCanvas.Children.Add(this.buildingMap.AddPin(viewPoint, MapPinModel.PinType.InfoRedPlace, new List { room })); } /// Shows the map information. /// Stubbfel, 14.10.2013. /// The places. - private void ShowMapInfo(List places) + private void ShowMapInfo(List places) { if (this.pinchRun) { @@ -175,7 +175,7 @@ namespace CampusAppWP8.Pages.Campusmap return; } - foreach (PlaceModel place in places) + foreach (PlaceWp8Model place in places) { msgText += AppResources.PlaceLabel_Name + ": "; msgText += place.GetInformationsValue(Constants.PisInformationName_Name); @@ -288,13 +288,13 @@ namespace CampusAppWP8.Pages.Campusmap layerKey = this.building.Layers.Keys.First(); } - CampusBuildingLayerModel layer = this.building.Layers[layerKey]; + CampusBuildingLayerWp8Model layer = this.building.Layers[layerKey]; double x; double y; this.ClearMap(new List() { MapPinModel.InfoPlacePinString }); - foreach (PlaceModel room in layer.Rooms.Places) + foreach (PlaceWp8Model room in layer.Rooms.Places) { x = room.GeoRefPoint.Longitude; y = room.GeoRefPoint.Latitude; @@ -321,7 +321,7 @@ namespace CampusAppWP8.Pages.Campusmap break; } - MapCanvas.Children.Add(this.buildingMap.AddPin(viewPoint, type, new List { room })); + MapCanvas.Children.Add(this.buildingMap.AddPin(viewPoint, type, new List { room })); } // MapCanvas.Children.Add(this.buildingMap.AddPin(offsetPoint, MapPinModel.PinType.SearchPlace)); @@ -341,7 +341,7 @@ namespace CampusAppWP8.Pages.Campusmap /// Identifier for the building. private void SetupCanvas(string buildingId) { - this.building = new CampusBuildingModel(buildingId, this.placeFile.Model.Places.ToList()); + this.building = new CampusBuildingWp8Model(buildingId, this.placeFile.Model.Places.ToList()); this.buildingMap = new BuildingMapModel(this.building.Building.PlaceId); this.buildingMap.ShowMapInfos += new CBMainMapModel.MapInfos(this.ShowMapInfo); diff --git a/CampusAppWP8/CampusAppWP8/Pages/Dev/NFC.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Dev/NFC.xaml.cs index ca19f7d8..de581d45 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Dev/NFC.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Dev/NFC.xaml.cs @@ -85,7 +85,7 @@ namespace CampusAppWP8.Pages.Dev this.ndefList = new List(); // MapModel map = new CBMainMapModel(this.file.Model.Places.ToList()); - foreach (PlaceModel place in this.file.Model.Places.ToList()) + foreach (PlaceWp8Model place in this.file.Model.Places.ToList()) { this.ndefList.Add(new NDEFMessage(place.ToNfcString(), NDEFMessage.TYPEVAL.TEXT)); } diff --git a/CampusAppWP8/CampusAppWP8/Pages/PlaceNews/PlaceNews.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/PlaceNews/PlaceNews.xaml.cs index 0bd1f127..5ef73703 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/PlaceNews/PlaceNews.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/PlaceNews/PlaceNews.xaml.cs @@ -90,7 +90,7 @@ namespace CampusAppWP8.Pages.PlaceNews if (this.places == null) { this.places = new PlacesFile(); - this.places.Model = App.LoadFromIsolatedStorage(Constants.IsolatedStorage_AllPlaces); + this.places.Model = App.LoadFromIsolatedStorage(Constants.IsolatedStorage_AllPlaces); } if (this.qrScan) @@ -131,7 +131,7 @@ namespace CampusAppWP8.Pages.PlaceNews { if (NavigationMode.Back == e.NavigationMode) { - App.SaveToIsolatedStorage(Constants.IsolatedStorage_AllPlaces, null); + App.SaveToIsolatedStorage(Constants.IsolatedStorage_AllPlaces, null); } } @@ -199,7 +199,7 @@ namespace CampusAppWP8.Pages.PlaceNews /// Stubbfel, 09.09.2013. private void PlacesFileIsFail() { - this.places.Model = new SpsModel(); + this.places.Model = new SpsWp8Model(); if (this.spsApi == null) { this.spsApi = new SpsApi(); @@ -328,7 +328,7 @@ namespace CampusAppWP8.Pages.PlaceNews this.ResultBox.ItemsSource = this.places.Model.FilterByPid(this.searchPidList); this.ProgressBar.Visibility = Visibility.Collapsed; this.places.SaveData(); - App.SaveToIsolatedStorage(Constants.IsolatedStorage_AllPlaces, this.places.Model); + App.SaveToIsolatedStorage(Constants.IsolatedStorage_AllPlaces, this.places.Model); this.forceRequest = false; } @@ -412,7 +412,7 @@ namespace CampusAppWP8.Pages.PlaceNews return; } - PlaceModel place = this.places.Model.GetPlaceById(placeID); + PlaceWp8Model place = this.places.Model.GetPlaceById(placeID); txt.Text = place.GetInformationsValue(Constants.PisInformationName_Name); } diff --git a/CampusAppWP8/CampusAppWP8/Pages/PlaceNews/ShowPad.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/PlaceNews/ShowPad.xaml.cs index d26c4b46..0d0ce2df 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/PlaceNews/ShowPad.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/PlaceNews/ShowPad.xaml.cs @@ -39,9 +39,9 @@ namespace CampusAppWP8.Pages.PlaceNews { if (NavigationContext.QueryString.ContainsKey(Constants.ParamPlaceID)) { - SpsModel model = App.LoadFromIsolatedStorage(Constants.IsolatedStorage_AllPlaces); + SpsWp8Model model = App.LoadFromIsolatedStorage(Constants.IsolatedStorage_AllPlaces); string placeId = NavigationContext.QueryString[Constants.ParamPlaceID]; - PlaceModel place = model.GetPlaceById(placeId); + PlaceWp8Model place = model.GetPlaceById(placeId); if (place != null && place.Services != null && place.Services.Count > 0 && place.Informations != null && place.Informations.Count > 0) { this.Room.Text += " - " + place.Informations[0].InformationValue; From d296fe25ea26839e47daa6960025d2bd9841b242 Mon Sep 17 00:00:00 2001 From: stubbfel Date: Mon, 21 Oct 2013 15:04:24 +0200 Subject: [PATCH 2/3] no message --- .../CampusAppWP8/Model/GeoDb/SpsWp8Model.cs | 23 ++++++ .../CampusAppWPortalLib8.csproj | 6 ++ .../Model/GeoDb/CampusBuildingLayerModel.cs | 49 +++++++---- .../Model/GeoDb/CampusBuildingModel.cs | 82 ++++++++++++------- .../Model/GeoDb/PlaceInformation.cs | 2 +- .../Model/GeoDb/PlaceModel.cs | 39 +-------- .../Model/GeoDb/PlaceService.cs | 2 +- .../Model/GeoDb/SpsModel.cs | 36 ++++---- .../Resources/Constants.resx | 3 + .../Resources/Constants1.Designer.cs | 9 ++ 10 files changed, 148 insertions(+), 103 deletions(-) create mode 100644 CampusAppWP8/CampusAppWP8/Model/GeoDb/SpsWp8Model.cs rename CampusAppWP8/{CampusAppWP8 => CampusAppWPortalLib8}/Model/GeoDb/CampusBuildingLayerModel.cs (66%) rename CampusAppWP8/{CampusAppWP8 => CampusAppWPortalLib8}/Model/GeoDb/CampusBuildingModel.cs (67%) rename CampusAppWP8/{CampusAppWP8 => CampusAppWPortalLib8}/Model/GeoDb/PlaceInformation.cs (97%) rename CampusAppWP8/{CampusAppWP8 => CampusAppWPortalLib8}/Model/GeoDb/PlaceModel.cs (85%) rename CampusAppWP8/{CampusAppWP8 => CampusAppWPortalLib8}/Model/GeoDb/PlaceService.cs (98%) rename CampusAppWP8/{CampusAppWP8 => CampusAppWPortalLib8}/Model/GeoDb/SpsModel.cs (85%) diff --git a/CampusAppWP8/CampusAppWP8/Model/GeoDb/SpsWp8Model.cs b/CampusAppWP8/CampusAppWP8/Model/GeoDb/SpsWp8Model.cs new file mode 100644 index 00000000..620e7c91 --- /dev/null +++ b/CampusAppWP8/CampusAppWP8/Model/GeoDb/SpsWp8Model.cs @@ -0,0 +1,23 @@ +//----------------------------------------------------------------------- +// +// The MIT License (MIT). Copyright (c) 2013 BTU/IIT. +// +// Stubbfel +// 15.10.2013 +// Implements the sps model class +//----------------------------------------------------------------------- +namespace CampusAppWP8.Model.GeoDb +{ + using CampusAppWPortalLib8.Model.GeoDb; + using System.Collections.Generic; + using System.Collections.ObjectModel; + using System.Linq; + using System.Xml.Serialization; + + /// Model for a xml-response of the SPSService. + /// Stubbfel, 15.10.2013. + [XmlRoot("root")] + public class SpsWp8Model : CampusAppWPortalLib8.Model.GeoDb.SpsModel + { + } +} diff --git a/CampusAppWP8/CampusAppWPortalLib8/CampusAppWPortalLib8.csproj b/CampusAppWP8/CampusAppWPortalLib8/CampusAppWPortalLib8.csproj index 166b9581..a492bf65 100644 --- a/CampusAppWP8/CampusAppWPortalLib8/CampusAppWPortalLib8.csproj +++ b/CampusAppWP8/CampusAppWPortalLib8/CampusAppWPortalLib8.csproj @@ -39,6 +39,12 @@ + + + + + + diff --git a/CampusAppWP8/CampusAppWP8/Model/GeoDb/CampusBuildingLayerModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/CampusBuildingLayerModel.cs similarity index 66% rename from CampusAppWP8/CampusAppWP8/Model/GeoDb/CampusBuildingLayerModel.cs rename to CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/CampusBuildingLayerModel.cs index d55db74c..78f84d22 100644 --- a/CampusAppWP8/CampusAppWP8/Model/GeoDb/CampusBuildingLayerModel.cs +++ b/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/CampusBuildingLayerModel.cs @@ -6,36 +6,31 @@ // 15.10.2013 // Implements the campus building layer model class //----------------------------------------------------------------------- -namespace CampusAppWP8.Model.GeoDb +namespace CampusAppWPortalLib8.Model.GeoDb { using System.Collections.Generic; - using CampusAppWP8.Resources; + using CampusAppWPortalLib8.Resources; /// Class is model for buildings of a campus. /// Stubbfel, 15.10.2013. - public class CampusBuildingLayerModel + public class CampusBuildingLayerModel where V : PlaceModel { #region Constructor + public CampusBuildingLayerModel() + { + } + /// /// Initializes a new instance of the class. /// /// Stubbfel, 15.10.2013. /// id of the layer. /// list of place which can be room of the layer. - public CampusBuildingLayerModel(string layerId, List places) + public CampusBuildingLayerModel(string layerId, List places) { this.LayerId = layerId; - this.Rooms = new SpsModel(); - - foreach (PlaceModel place in places) - { - string placeLayerId = place.GetInformationsValue(Constants.PisInformationName_Layer); - if (placeLayerId != null && placeLayerId.Equals(layerId)) - { - this.Rooms.Places.Add(place); - } - } + this.AddsRooms(places); } #endregion @@ -44,12 +39,36 @@ namespace CampusAppWP8.Model.GeoDb /// Gets or sets Rooms. /// The rooms. - public SpsModel Rooms { get; set; } + public SpsModel Rooms { get; set; } /// Gets or sets LayerId. /// The identifier of the layer. public string LayerId { get; set; } #endregion + + #region Method + + /// Adds rooms. + /// Stubbfel, 21.10.2013. + /// list of place which can be room of the layer. + public void AddsRooms(List places) + { + if (this.Rooms == null) + { + this.Rooms = new SpsModel(); + } + + foreach (V place in places) + { + string placeLayerId = place.GetInformationsValue(Constants.PisInformationName_Layer); + if (placeLayerId != null && placeLayerId.Equals(this.LayerId)) + { + this.Rooms.Places.Add(place); + } + } + } + + #endregion } } diff --git a/CampusAppWP8/CampusAppWP8/Model/GeoDb/CampusBuildingModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/CampusBuildingModel.cs similarity index 67% rename from CampusAppWP8/CampusAppWP8/Model/GeoDb/CampusBuildingModel.cs rename to CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/CampusBuildingModel.cs index 05da5f80..1f1381da 100644 --- a/CampusAppWP8/CampusAppWP8/Model/GeoDb/CampusBuildingModel.cs +++ b/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/CampusBuildingModel.cs @@ -6,30 +6,64 @@ // 15.10.2013 // Implements the campus building model class //----------------------------------------------------------------------- -namespace CampusAppWP8.Model.GeoDb +namespace CampusAppWPortalLib8.Model.GeoDb { using System.Collections.Generic; - using CampusAppWP8.Resources; + using CampusAppWPortalLib8.Resources; /// Class is model for buildings of a campus. /// Stubbfel, 15.10.2013. - public class CampusBuildingModel + public class CampusBuildingModel + where V : PlaceModel + where T : CampusBuildingLayerModel, new() { #region constructor + public CampusBuildingModel() + { + } + /// /// Initializes a new instance of the class. /// /// Stubbfel, 15.10.2013. /// id of the building. /// list of place which can be room of the buildings. - public CampusBuildingModel(string buildingId, List places) + public CampusBuildingModel(string buildingId, List places) { - this.Layers = new Dictionary(); + this.BuildingId = buildingId; - foreach (PlaceModel place in places) + this.AddLayers(places); + } + + #endregion + + #region Property + + /// Gets the Layer of the building. + /// The layers. + public Dictionary Layers { get; private set; } + + /// Gets or sets the Building V. + /// The building. + public V Building { get; set; } + + public string BuildingId { get; set; } + + #endregion + + #region method + + public void AddLayers(List places) + { + if (this.Layers == null) { - if (place.ParentId.Equals(buildingId)) + this.Layers = new Dictionary(); + } + + foreach (V place in places) + { + if (place.ParentId.Equals(this.BuildingId)) { string placeLayerId = place.GetInformationsValue(Constants.PisInformationName_Layer); if (placeLayerId == null) @@ -43,40 +77,26 @@ namespace CampusAppWP8.Model.GeoDb } else { - this.Layers.Add(placeLayerId, new CampusBuildingLayerModel(placeLayerId, new List() { place })); + T layer = new T() { LayerId = placeLayerId }; + layer.AddsRooms(new List { place }); + this.Layers.Add(placeLayerId, layer); } } - else if (place.PlaceId.Equals(buildingId)) + else if (place.PlaceId.Equals(this.BuildingId)) { this.Building = place; } } } - #endregion - - #region Property - - /// Gets the Layer of the building. - /// The layers. - public Dictionary Layers { get; private set; } - - /// Gets or sets the Building PlaceModel. - /// The building. - public PlaceModel Building { get; set; } - - #endregion - - #region method - /// Method gets a place by their placeID. /// Stubbfel, 15.10.2013. /// the placeId of the place. /// The place by identifier. - public PlaceModel GetPlaceById(string placeID) + public V GetPlaceById(string placeID) { - PlaceModel result = null; - foreach (CampusBuildingLayerModel layer in this.Layers.Values) + V result = null; + foreach (T layer in this.Layers.Values) { result = layer.Rooms.GetPlaceById(placeID); if (result != null) @@ -94,13 +114,13 @@ namespace CampusAppWP8.Model.GeoDb /// The layer key. public string GetLayerKey(string placeId) { - PlaceModel tmpPlace = null; - foreach (CampusBuildingLayerModel layer in this.Layers.Values) + V tmpPlace = null; + foreach (T layer in this.Layers.Values) { tmpPlace = layer.Rooms.GetPlaceById(placeId); if (tmpPlace != null) { - + return layer.LayerId; } } diff --git a/CampusAppWP8/CampusAppWP8/Model/GeoDb/PlaceInformation.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/PlaceInformation.cs similarity index 97% rename from CampusAppWP8/CampusAppWP8/Model/GeoDb/PlaceInformation.cs rename to CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/PlaceInformation.cs index 4882a456..e6d67498 100644 --- a/CampusAppWP8/CampusAppWP8/Model/GeoDb/PlaceInformation.cs +++ b/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/PlaceInformation.cs @@ -6,7 +6,7 @@ // 15.10.2013 // Implements the place information class //----------------------------------------------------------------------- -namespace CampusAppWP8.Model.GeoDb +namespace CampusAppWPortalLib8.Model.GeoDb { using System; using System.Xml.Serialization; diff --git a/CampusAppWP8/CampusAppWP8/Model/GeoDb/PlaceModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/PlaceModel.cs similarity index 85% rename from CampusAppWP8/CampusAppWP8/Model/GeoDb/PlaceModel.cs rename to CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/PlaceModel.cs index f6b29595..cdde8539 100644 --- a/CampusAppWP8/CampusAppWP8/Model/GeoDb/PlaceModel.cs +++ b/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/PlaceModel.cs @@ -6,16 +6,15 @@ // 15.10.2013 // Implements the place model class //----------------------------------------------------------------------- -namespace CampusAppWP8.Model.GeoDb +namespace CampusAppWPortalLib8.Model.GeoDb { using System; using System.Collections.Generic; using System.Collections.ObjectModel; - using System.Device.Location; using System.Globalization; using System.Text.RegularExpressions; using System.Xml.Serialization; - using CampusAppWP8.Resources; + using CampusAppWPortalLib8.Resources; using CampusAppWPortalLib8.Utility; /// Model for a place of the SPSService. @@ -40,40 +39,6 @@ namespace CampusAppWP8.Model.GeoDb [XmlAttribute("refpoint")] public string RefPoint { get; set; } - /// Gets the geo reference point. - /// The geo reference point. - public GeoCoordinate GeoRefPoint - { - get - { - string refstring = this.RefPoint; - Regex rx = new Regex(Constants.Regex_Coordinate); - MatchCollection matches = rx.Matches(refstring); - if (matches.Count != 1) - { - return null; - } - - string[] values = matches[0].ToString().Split(' '); - - if (values.Length != 2) - { - return null; - } - - // create the GeoCoordirate - try - { - return new GeoCoordinate(double.Parse(values[1], CultureInfo.InvariantCulture), double.Parse(values[0], CultureInfo.InvariantCulture)); - } - catch (Exception ex) - { - Logger.LogException(ex); - return null; - } - } - } - /// Gets or sets the information. /// The information. [XmlElement("placeInformation")] diff --git a/CampusAppWP8/CampusAppWP8/Model/GeoDb/PlaceService.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/PlaceService.cs similarity index 98% rename from CampusAppWP8/CampusAppWP8/Model/GeoDb/PlaceService.cs rename to CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/PlaceService.cs index a4d00deb..9fb5fc4f 100644 --- a/CampusAppWP8/CampusAppWP8/Model/GeoDb/PlaceService.cs +++ b/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/PlaceService.cs @@ -6,7 +6,7 @@ // 15.10.2013 // Implements the place service class //----------------------------------------------------------------------- -namespace CampusAppWP8.Model.GeoDb +namespace CampusAppWPortalLib8.Model.GeoDb { using System; using System.Xml.Serialization; diff --git a/CampusAppWP8/CampusAppWP8/Model/GeoDb/SpsModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/SpsModel.cs similarity index 85% rename from CampusAppWP8/CampusAppWP8/Model/GeoDb/SpsModel.cs rename to CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/SpsModel.cs index 00219adc..c30d03b2 100644 --- a/CampusAppWP8/CampusAppWP8/Model/GeoDb/SpsModel.cs +++ b/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/SpsModel.cs @@ -6,7 +6,7 @@ // 15.10.2013 // Implements the sps model class //----------------------------------------------------------------------- -namespace CampusAppWP8.Model.GeoDb +namespace CampusAppWPortalLib8.Model.GeoDb { using System.Collections.Generic; using System.Collections.ObjectModel; @@ -16,7 +16,7 @@ namespace CampusAppWP8.Model.GeoDb /// Model for a xml-response of the SPSService. /// Stubbfel, 15.10.2013. [XmlRoot("root")] - public class SpsModel + public class SpsModel where T : PlaceModel { #region Constructor @@ -25,7 +25,7 @@ namespace CampusAppWP8.Model.GeoDb public SpsModel() { this.HasChanged = false; - this.Places = new ObservableCollection(); + this.Places = new ObservableCollection(); } #endregion @@ -35,7 +35,7 @@ namespace CampusAppWP8.Model.GeoDb /// Gets or sets a list of places. /// The places. [XmlElement("place")] - public ObservableCollection Places { get; set; } + public ObservableCollection Places { get; set; } /// Gets or sets a value indicating whether this object has changed. /// true if this object has changed, false if not. @@ -53,12 +53,12 @@ namespace CampusAppWP8.Model.GeoDb /// (Optional) the ignore cases. /// (Optional) name of the information. /// The places by information. - public List GetPlacesByInformation(string query, bool ignoreCases = true, List informationNames = null) + public List GetPlacesByInformation(string query, bool ignoreCases = true, List informationNames = null) { string querryStr = string.Empty; - List resultplaces = new List(); + List resultplaces = new List(); - foreach (PlaceModel place in this.Places) + foreach (T place in this.Places) { if (this.IsPlaceQueryMatched(place, query, ignoreCases, informationNames)) { @@ -72,9 +72,9 @@ namespace CampusAppWP8.Model.GeoDb /// Adds the places. /// Stubbfel, 09.09.2013. /// A list of places. - public void AddPlaces(List places) + public void AddPlaces(List places) { - foreach (PlaceModel place in places) + foreach (T place in places) { if (this.Places.Contains(place)) { @@ -97,7 +97,7 @@ namespace CampusAppWP8.Model.GeoDb public List CreatePidList() { List pidList = new List(); - foreach (PlaceModel place in this.Places) + foreach (T place in this.Places) { pidList.Add(place.PlaceId); } @@ -109,9 +109,9 @@ namespace CampusAppWP8.Model.GeoDb /// Stubbfel, 09.09.2013. /// The identifier. /// The place by identifier. - public PlaceModel GetPlaceById(string id) + public T GetPlaceById(string id) { - foreach (PlaceModel place in this.Places) + foreach (T place in this.Places) { if (place.PlaceId.Equals(id)) { @@ -131,7 +131,7 @@ namespace CampusAppWP8.Model.GeoDb { foreach (string pid in pidList) { - PlaceModel place = this.GetPlaceById(pid); + T place = this.GetPlaceById(pid); if (!place.ContainsInformationNames(names)) { return false; @@ -150,7 +150,7 @@ namespace CampusAppWP8.Model.GeoDb { foreach (string pid in pidList) { - PlaceModel place = this.GetPlaceById(pid); + T place = this.GetPlaceById(pid); if (!place.ContainsServiceNames(names)) { return false; @@ -164,16 +164,16 @@ namespace CampusAppWP8.Model.GeoDb /// Stubbfel, 11.09.2013. /// List of pids. /// filtered list of places. - public List FilterByPid(List pidList) + public List FilterByPid(List pidList) { - List fitlerList = new List(); + List fitlerList = new List(); if (pidList == null || pidList.Count < 1) { return fitlerList; } - foreach (PlaceModel place in this.Places) + foreach (T place in this.Places) { if (pidList.Contains(place.PlaceId)) { @@ -195,7 +195,7 @@ namespace CampusAppWP8.Model.GeoDb /// (Optional) the ignore cases. /// (Optional) name of the information. /// true if it match otherwise false. - private bool IsPlaceQueryMatched(PlaceModel place, string query, bool ignoreCases = true, List informationNames = null) + private bool IsPlaceQueryMatched(T place, string query, bool ignoreCases = true, List informationNames = null) { string queryString = query; if (ignoreCases) diff --git a/CampusAppWP8/CampusAppWPortalLib8/Resources/Constants.resx b/CampusAppWP8/CampusAppWPortalLib8/Resources/Constants.resx index 80453741..76f77d12 100644 --- a/CampusAppWP8/CampusAppWPortalLib8/Resources/Constants.resx +++ b/CampusAppWP8/CampusAppWPortalLib8/Resources/Constants.resx @@ -129,6 +129,9 @@ /Pages/News/NewsIndexPage.xaml + + Ebene + 035569 diff --git a/CampusAppWP8/CampusAppWPortalLib8/Resources/Constants1.Designer.cs b/CampusAppWP8/CampusAppWPortalLib8/Resources/Constants1.Designer.cs index f9f35440..440ee001 100644 --- a/CampusAppWP8/CampusAppWPortalLib8/Resources/Constants1.Designer.cs +++ b/CampusAppWP8/CampusAppWPortalLib8/Resources/Constants1.Designer.cs @@ -97,6 +97,15 @@ namespace CampusAppWPortalLib8.Resources { } } + /// + /// Sucht eine lokalisierte Zeichenfolge, die Ebene ähnelt. + /// + public static string PisInformationName_Layer { + get { + return ResourceManager.GetString("PisInformationName_Layer", resourceCulture); + } + } + /// /// Sucht eine lokalisierte Zeichenfolge, die 035569 ähnelt. /// From dcff024136d8133efa9e0f9f694fa6770e51b345 Mon Sep 17 00:00:00 2001 From: stubbfel Date: Mon, 21 Oct 2013 15:14:18 +0200 Subject: [PATCH 3/3] fix docs --- .../GeoDb/CampusBuildingLayerWp8Model.cs | 13 +++++----- .../Model/GeoDb/CampusBuildingWp8Model.cs | 13 ++++++---- .../CampusAppWP8/Model/GeoDb/PlaceWp8Model.cs | 11 ++++----- .../CampusAppWP8/Model/GeoDb/SpsWp8Model.cs | 15 +++++------- .../Pages/Campusmap/CampusMapPage.xaml.cs | 24 +++++++++---------- .../Pages/Campusmap/RoomListPage.xaml.cs | 14 +++++------ .../Model/GeoDb/CampusBuildingLayerModel.cs | 15 ++++++------ .../Model/GeoDb/CampusBuildingModel.cs | 18 +++++++++----- .../Model/GeoDb/PlaceModel.cs | 4 ---- .../Model/GeoDb/SpsModel.cs | 1 + 10 files changed, 65 insertions(+), 63 deletions(-) diff --git a/CampusAppWP8/CampusAppWP8/Model/GeoDb/CampusBuildingLayerWp8Model.cs b/CampusAppWP8/CampusAppWP8/Model/GeoDb/CampusBuildingLayerWp8Model.cs index 94a5b0c3..531574a1 100644 --- a/CampusAppWP8/CampusAppWP8/Model/GeoDb/CampusBuildingLayerWp8Model.cs +++ b/CampusAppWP8/CampusAppWP8/Model/GeoDb/CampusBuildingLayerWp8Model.cs @@ -1,17 +1,16 @@ //----------------------------------------------------------------------- -// +// // The MIT License (MIT). Copyright (c) 2013 BTU/IIT. // // Stubbfel -// 15.10.2013 -// Implements the campus building layer model class +// 21.10.2013 +// Implements the campus building layer wp 8 model class //----------------------------------------------------------------------- namespace CampusAppWP8.Model.GeoDb { - - - /// Class is model for buildings of a campus. - /// Stubbfel, 15.10.2013. + /// A data Model for the campus building layer wp 8. + /// Stubbfel, 21.10.2013. + /// public class CampusBuildingLayerWp8Model : CampusAppWPortalLib8.Model.GeoDb.CampusBuildingLayerModel { } diff --git a/CampusAppWP8/CampusAppWP8/Model/GeoDb/CampusBuildingWp8Model.cs b/CampusAppWP8/CampusAppWP8/Model/GeoDb/CampusBuildingWp8Model.cs index 6595b52c..6ba4909f 100644 --- a/CampusAppWP8/CampusAppWP8/Model/GeoDb/CampusBuildingWp8Model.cs +++ b/CampusAppWP8/CampusAppWP8/Model/GeoDb/CampusBuildingWp8Model.cs @@ -1,19 +1,24 @@ //----------------------------------------------------------------------- -// +// // The MIT License (MIT). Copyright (c) 2013 BTU/IIT. // // Stubbfel -// 15.10.2013 +// 21.10.2013 // Implements the campus building model class //----------------------------------------------------------------------- namespace CampusAppWP8.Model.GeoDb { using System.Collections.Generic; - /// Class is model for buildings of a campus. - /// Stubbfel, 15.10.2013. + /// A data Model for the campus building. + /// Stubbfel, 21.10.2013. + /// public class CampusBuildingWp8Model : CampusAppWPortalLib8.Model.GeoDb.CampusBuildingModel { + /// Initializes a new instance of the CampusBuildingWp8Model class. + /// Stubbfel, 21.10.2013. + /// Identifier for the building. + /// The places. public CampusBuildingWp8Model(string buildingId, List places) : base(buildingId, places) { diff --git a/CampusAppWP8/CampusAppWP8/Model/GeoDb/PlaceWp8Model.cs b/CampusAppWP8/CampusAppWP8/Model/GeoDb/PlaceWp8Model.cs index 3d3af099..92113a00 100644 --- a/CampusAppWP8/CampusAppWP8/Model/GeoDb/PlaceWp8Model.cs +++ b/CampusAppWP8/CampusAppWP8/Model/GeoDb/PlaceWp8Model.cs @@ -1,26 +1,23 @@ //----------------------------------------------------------------------- -// +// // The MIT License (MIT). Copyright (c) 2013 BTU/IIT. // // Stubbfel -// 15.10.2013 -// Implements the place model class +// 21.10.2013 +// Implements the place wp 8 model class //----------------------------------------------------------------------- namespace CampusAppWP8.Model.GeoDb { using System; - using System.Collections.Generic; - using System.Collections.ObjectModel; using System.Device.Location; using System.Globalization; using System.Text.RegularExpressions; - using System.Xml.Serialization; using CampusAppWP8.Resources; using CampusAppWPortalLib8.Utility; - using CampusAppWPortalLib8.Model.GeoDb; /// Model for a place of the SPSService. /// Stubbfel, 15.10.2013. + /// /// public class PlaceWp8Model : CampusAppWPortalLib8.Model.GeoDb.PlaceModel { diff --git a/CampusAppWP8/CampusAppWP8/Model/GeoDb/SpsWp8Model.cs b/CampusAppWP8/CampusAppWP8/Model/GeoDb/SpsWp8Model.cs index 620e7c91..3ef6895c 100644 --- a/CampusAppWP8/CampusAppWP8/Model/GeoDb/SpsWp8Model.cs +++ b/CampusAppWP8/CampusAppWP8/Model/GeoDb/SpsWp8Model.cs @@ -1,21 +1,18 @@ //----------------------------------------------------------------------- -// +// // The MIT License (MIT). Copyright (c) 2013 BTU/IIT. // // Stubbfel -// 15.10.2013 -// Implements the sps model class +// 21.10.2013 +// Implements the sps wp 8 model class //----------------------------------------------------------------------- namespace CampusAppWP8.Model.GeoDb { - using CampusAppWPortalLib8.Model.GeoDb; - using System.Collections.Generic; - using System.Collections.ObjectModel; - using System.Linq; using System.Xml.Serialization; - /// Model for a xml-response of the SPSService. - /// Stubbfel, 15.10.2013. + /// A data Model for the sps wp 8. + /// Stubbfel, 21.10.2013. + /// [XmlRoot("root")] public class SpsWp8Model : CampusAppWPortalLib8.Model.GeoDb.SpsModel { diff --git a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml.cs index fce5730c..92281c60 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/CampusMapPage.xaml.cs @@ -19,7 +19,6 @@ namespace CampusAppWP8.Pages.Campusmap using System.Windows.Controls; using System.Windows.Input; using System.Windows.Navigation; - using Windows.Networking.Proximity; using CampusAppWP8.File.Places; using CampusAppWP8.Model.Campusmap; using CampusAppWP8.Model.GeoDb; @@ -29,6 +28,7 @@ namespace CampusAppWP8.Pages.Campusmap using CampusAppWP8.Utility.NDEF; using Microsoft.Phone.Controls; using Microsoft.Phone.Shell; + using Windows.Networking.Proximity; /// Class for the campusMap page. /// Stubbfel, 19.08.2013. @@ -163,8 +163,7 @@ namespace CampusAppWP8.Pages.Campusmap if (searchPid != null) { - - //this.ShowAllPlacesByPlaceIdAsSearchPin(searchPid); + // this.ShowAllPlacesByPlaceIdAsSearchPin(searchPid); if (place.ParentId.Equals(this.campusMap.CampusId) || place.PlaceId.Equals(this.campusMap.CampusId)) { this.ShowAllPlacesByPlaceIdAsSearchPin(searchPid); @@ -176,7 +175,7 @@ namespace CampusAppWP8.Pages.Campusmap } } - ndefId = this.device.SubscribeForMessage(Constants.NCFMessageType_NDEF, this.NDEFHandler); + this.ndefId = this.device.SubscribeForMessage(Constants.NCFMessageType_NDEF, this.NDEFHandler); } /// Methods overrides the OnNavigatedFrom-Method. @@ -184,12 +183,11 @@ namespace CampusAppWP8.Pages.Campusmap /// protected override void OnNavigatedFrom(NavigationEventArgs e) { - this.device.StopSubscribingForMessage(ndefId); + this.device.StopSubscribingForMessage(this.ndefId); base.OnNavigatedFrom(e); } - #endregion #region private @@ -466,6 +464,7 @@ namespace CampusAppWP8.Pages.Campusmap private void SearchPlaceByNFC_Click(object sender, EventArgs e) { MessageBoxes.ShowMainModelInfoMessageBox(AppResources.ScarNfc_Search); + // this.DefHeader.ProgressVisibility = Visibility.Visible; // this.device.StopSubscribingForMessage(this.ndefId); // this.ndefId = this.device.SubscribeForMessage(Constants.NCFMessageType_NDEF, this.NDEFHandler); @@ -517,7 +516,7 @@ namespace CampusAppWP8.Pages.Campusmap } else { - //this.ShowAllPlacesByPlaceIdAsSearchPin(searchPid); + // this.ShowAllPlacesByPlaceIdAsSearchPin(searchPid); if (place.ParentId.Equals(this.campusMap.CampusId)) { this.ShowAllPlacesByPlaceIdAsSearchPin(searchPid); @@ -549,9 +548,8 @@ namespace CampusAppWP8.Pages.Campusmap { this.DefHeader.ProgressVisibility = Visibility.Collapsed; } - ndefId = this.device.SubscribeForMessage(Constants.NCFMessageType_NDEF, this.NDEFHandler); - - + + this.ndefId = this.device.SubscribeForMessage(Constants.NCFMessageType_NDEF, this.NDEFHandler); } /// Searches for the first places. @@ -648,6 +646,7 @@ namespace CampusAppWP8.Pages.Campusmap { scrollPoint.Y = 0; } + MapScroller.ScrollToVerticalOffset(scrollPoint.Y); MapScroller.ScrollToHorizontalOffset(scrollPoint.X); } @@ -817,6 +816,7 @@ namespace CampusAppWP8.Pages.Campusmap { urlString += "&" + Constants.ParamRoomId + "=" + roomId; } + Uri url = new Uri(urlString as string, UriKind.Relative); this.NavigationService.Navigate(url); } @@ -848,9 +848,9 @@ namespace CampusAppWP8.Pages.Campusmap { this.SearchByText(sender, e); this.MapScroller.Focus(); - } - + } } + #endregion #endregion diff --git a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml.cs b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml.cs index ee51d2ad..a6e3446f 100644 --- a/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml.cs +++ b/CampusAppWP8/CampusAppWP8/Pages/Campusmap/RoomListPage.xaml.cs @@ -8,6 +8,13 @@ //----------------------------------------------------------------------- namespace CampusAppWP8.Pages.Campusmap { + using System.Collections.Generic; + using System.Linq; + using System.Windows; + using System.Windows.Controls; + using System.Windows.Input; + using System.Windows.Media; + using System.Windows.Navigation; using CampusAppWP8.File.Places; using CampusAppWP8.Model.Campusmap; using CampusAppWP8.Model.GeoDb; @@ -16,13 +23,6 @@ namespace CampusAppWP8.Pages.Campusmap using CampusAppWP8.Utility.Lui.MessageBoxes; using CampusAppWPortalLib8.Model.Utility; using Microsoft.Phone.Controls; - using System.Collections.Generic; - using System.Linq; - using System.Windows; - using System.Windows.Controls; - using System.Windows.Input; - using System.Windows.Media; - using System.Windows.Navigation; /// Class of the RoomListPage. /// Stubbfel, 14.10.2013. diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/CampusBuildingLayerModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/CampusBuildingLayerModel.cs index 78f84d22..de69584a 100644 --- a/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/CampusBuildingLayerModel.cs +++ b/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/CampusBuildingLayerModel.cs @@ -11,21 +11,22 @@ namespace CampusAppWPortalLib8.Model.GeoDb using System.Collections.Generic; using CampusAppWPortalLib8.Resources; - /// Class is model for buildings of a campus. - /// Stubbfel, 15.10.2013. + /// A data Model for the campus building layer. + /// Stubbfel, 21.10.2013. + /// Generic type parameter. PlaceModel public class CampusBuildingLayerModel where V : PlaceModel { #region Constructor + /// Initializes a new instance of the CampusBuildingLayerModel class. + /// Stubbfel, 21.10.2013. public CampusBuildingLayerModel() { } - /// - /// Initializes a new instance of the class. - /// - /// Stubbfel, 15.10.2013. - /// id of the layer. + /// Initializes a new instance of the CampusBuildingLayerModel class. + /// Stubbfel, 21.10.2013. + /// The identifier of the layer. /// list of place which can be room of the layer. public CampusBuildingLayerModel(string layerId, List places) { diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/CampusBuildingModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/CampusBuildingModel.cs index 1f1381da..44903867 100644 --- a/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/CampusBuildingModel.cs +++ b/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/CampusBuildingModel.cs @@ -13,21 +13,23 @@ namespace CampusAppWPortalLib8.Model.GeoDb /// Class is model for buildings of a campus. /// Stubbfel, 15.10.2013. + /// Generic type parameter. CampusBuildingLayerModel + /// Generic type parameter. PlaceModel public class CampusBuildingModel where V : PlaceModel where T : CampusBuildingLayerModel, new() { #region constructor + /// Initializes a new instance of the CampusBuildingModel class. + /// Stubbfel, 21.10.2013. public CampusBuildingModel() { } - /// - /// Initializes a new instance of the class. - /// - /// Stubbfel, 15.10.2013. - /// id of the building. + /// Initializes a new instance of the CampusBuildingModel class. + /// Stubbfel, 21.10.2013. + /// The identifier of the building. /// list of place which can be room of the buildings. public CampusBuildingModel(string buildingId, List places) { @@ -48,12 +50,17 @@ namespace CampusAppWPortalLib8.Model.GeoDb /// The building. public V Building { get; set; } + /// Gets or sets the identifier of the building. + /// The identifier of the building. public string BuildingId { get; set; } #endregion #region method + /// Adds the layers. + /// Stubbfel, 21.10.2013. + /// list of place which can be room of the buildings. public void AddLayers(List places) { if (this.Layers == null) @@ -120,7 +127,6 @@ namespace CampusAppWPortalLib8.Model.GeoDb tmpPlace = layer.Rooms.GetPlaceById(placeId); if (tmpPlace != null) { - return layer.LayerId; } } diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/PlaceModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/PlaceModel.cs index cdde8539..a93a2737 100644 --- a/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/PlaceModel.cs +++ b/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/PlaceModel.cs @@ -11,11 +11,7 @@ namespace CampusAppWPortalLib8.Model.GeoDb using System; using System.Collections.Generic; using System.Collections.ObjectModel; - using System.Globalization; - using System.Text.RegularExpressions; using System.Xml.Serialization; - using CampusAppWPortalLib8.Resources; - using CampusAppWPortalLib8.Utility; /// Model for a place of the SPSService. /// Stubbfel, 15.10.2013. diff --git a/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/SpsModel.cs b/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/SpsModel.cs index c30d03b2..c10a4bb9 100644 --- a/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/SpsModel.cs +++ b/CampusAppWP8/CampusAppWPortalLib8/Model/GeoDb/SpsModel.cs @@ -15,6 +15,7 @@ namespace CampusAppWPortalLib8.Model.GeoDb /// Model for a xml-response of the SPSService. /// Stubbfel, 15.10.2013. + /// Generic type parameter. [XmlRoot("root")] public class SpsModel where T : PlaceModel {