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. ///