no message

This commit is contained in:
stubbfel
2013-10-21 15:04:24 +02:00
parent 12eb1de958
commit d296fe25ea
10 changed files with 148 additions and 103 deletions

View File

@@ -0,0 +1,23 @@
//-----------------------------------------------------------------------
// <copyright file="SpsModel.cs" company="BTU/IIT">
// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
// </copyright>
// <author>Stubbfel</author>
// <date>15.10.2013</date>
// <summary>Implements the sps model class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWP8.Model.GeoDb
{
using CampusAppWPortalLib8.Model.GeoDb;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Xml.Serialization;
/// <summary> Model for a xml-response of the SPSService. </summary>
/// <remarks> Stubbfel, 15.10.2013. </remarks>
[XmlRoot("root")]
public class SpsWp8Model : CampusAppWPortalLib8.Model.GeoDb.SpsModel<PlaceWp8Model>
{
}
}

View File

@@ -39,6 +39,12 @@
<Compile Include="Model\Exams\ExamListModel.cs" />
<Compile Include="Model\Exams\ExamModel.cs" />
<Compile Include="Model\ForcesTypes.cs" />
<Compile Include="Model\GeoDb\CampusBuildingLayerModel.cs" />
<Compile Include="Model\GeoDb\CampusBuildingModel.cs" />
<Compile Include="Model\GeoDb\PlaceInformation.cs" />
<Compile Include="Model\GeoDb\PlaceModel.cs" />
<Compile Include="Model\GeoDb\PlaceService.cs" />
<Compile Include="Model\GeoDb\SpsModel.cs" />
<Compile Include="Model\Lecture\LectureActivity.cs" />
<Compile Include="Model\Lecture\LectureCourse.cs" />
<Compile Include="Model\Lecture\LectureDate.cs" />

View File

@@ -6,36 +6,31 @@
// <date>15.10.2013</date>
// <summary>Implements the campus building layer model class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWP8.Model.GeoDb
namespace CampusAppWPortalLib8.Model.GeoDb
{
using System.Collections.Generic;
using CampusAppWP8.Resources;
using CampusAppWPortalLib8.Resources;
/// <summary> Class is model for buildings of a campus. </summary>
/// <remarks> Stubbfel, 15.10.2013. </remarks>
public class CampusBuildingLayerModel
public class CampusBuildingLayerModel<V> where V : PlaceModel
{
#region Constructor
public CampusBuildingLayerModel()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="CampusBuildingLayerModel" /> class.
/// </summary>
/// <remarks> Stubbfel, 15.10.2013. </remarks>
/// <param name="layerId"> id of the layer. </param>
/// <param name="places"> list of place which can be room of the layer. </param>
public CampusBuildingLayerModel(string layerId, List<PlaceModel> places)
public CampusBuildingLayerModel(string layerId, List<V> 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
/// <summary> Gets or sets Rooms. </summary>
/// <value> The rooms. </value>
public SpsModel Rooms { get; set; }
public SpsModel<V> Rooms { get; set; }
/// <summary> Gets or sets LayerId. </summary>
/// <value> The identifier of the layer. </value>
public string LayerId { get; set; }
#endregion
#region Method
/// <summary> Adds rooms. </summary>
/// <remarks> Stubbfel, 21.10.2013. </remarks>
/// <param name="places"> list of place which can be room of the layer. </param>
public void AddsRooms(List<V> places)
{
if (this.Rooms == null)
{
this.Rooms = new SpsModel<V>();
}
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
}
}

View File

@@ -6,30 +6,64 @@
// <date>15.10.2013</date>
// <summary>Implements the campus building model class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWP8.Model.GeoDb
namespace CampusAppWPortalLib8.Model.GeoDb
{
using System.Collections.Generic;
using CampusAppWP8.Resources;
using CampusAppWPortalLib8.Resources;
/// <summary> Class is model for buildings of a campus. </summary>
/// <remarks> Stubbfel, 15.10.2013. </remarks>
public class CampusBuildingModel
public class CampusBuildingModel<T, V>
where V : PlaceModel
where T : CampusBuildingLayerModel<V>, new()
{
#region constructor
public CampusBuildingModel()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="CampusBuildingModel" /> class.
/// </summary>
/// <remarks> Stubbfel, 15.10.2013. </remarks>
/// <param name="buildingId"> id of the building. </param>
/// <param name="places"> list of place which can be room of the buildings. </param>
public CampusBuildingModel(string buildingId, List<PlaceModel> places)
public CampusBuildingModel(string buildingId, List<V> places)
{
this.Layers = new Dictionary<string, CampusBuildingLayerModel>();
this.BuildingId = buildingId;
foreach (PlaceModel place in places)
this.AddLayers(places);
}
#endregion
#region Property
/// <summary> Gets the Layer of the building. </summary>
/// <value> The layers. </value>
public Dictionary<string, T> Layers { get; private set; }
/// <summary> Gets or sets the Building V. </summary>
/// <value> The building. </value>
public V Building { get; set; }
public string BuildingId { get; set; }
#endregion
#region method
public void AddLayers(List<V> places)
{
if (this.Layers == null)
{
if (place.ParentId.Equals(buildingId))
this.Layers = new Dictionary<string, T>();
}
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<PlaceModel>() { place }));
T layer = new T() { LayerId = placeLayerId };
layer.AddsRooms(new List<V> { 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
/// <summary> Gets the Layer of the building. </summary>
/// <value> The layers. </value>
public Dictionary<string, CampusBuildingLayerModel> Layers { get; private set; }
/// <summary> Gets or sets the Building PlaceModel. </summary>
/// <value> The building. </value>
public PlaceModel Building { get; set; }
#endregion
#region method
/// <summary> Method gets a place by their placeID. </summary>
/// <remarks> Stubbfel, 15.10.2013. </remarks>
/// <param name="placeID"> the placeId of the place. </param>
/// <returns> The place by identifier. </returns>
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
/// <returns> The layer key. </returns>
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;
}
}

View File

@@ -6,7 +6,7 @@
// <date>15.10.2013</date>
// <summary>Implements the place information class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWP8.Model.GeoDb
namespace CampusAppWPortalLib8.Model.GeoDb
{
using System;
using System.Xml.Serialization;

View File

@@ -6,16 +6,15 @@
// <date>15.10.2013</date>
// <summary>Implements the place model class</summary>
//-----------------------------------------------------------------------
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;
/// <summary> Model for a place of the SPSService. </summary>
@@ -40,40 +39,6 @@ namespace CampusAppWP8.Model.GeoDb
[XmlAttribute("refpoint")]
public string RefPoint { get; set; }
/// <summary> Gets the geo reference point. </summary>
/// <value> The geo reference point. </value>
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;
}
}
}
/// <summary> Gets or sets the information. </summary>
/// <value> The information. </value>
[XmlElement("placeInformation")]

View File

@@ -6,7 +6,7 @@
// <date>15.10.2013</date>
// <summary>Implements the place service class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWP8.Model.GeoDb
namespace CampusAppWPortalLib8.Model.GeoDb
{
using System;
using System.Xml.Serialization;

View File

@@ -6,7 +6,7 @@
// <date>15.10.2013</date>
// <summary>Implements the sps model class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWP8.Model.GeoDb
namespace CampusAppWPortalLib8.Model.GeoDb
{
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -16,7 +16,7 @@ namespace CampusAppWP8.Model.GeoDb
/// <summary> Model for a xml-response of the SPSService. </summary>
/// <remarks> Stubbfel, 15.10.2013. </remarks>
[XmlRoot("root")]
public class SpsModel
public class SpsModel<T> where T : PlaceModel
{
#region Constructor
@@ -25,7 +25,7 @@ namespace CampusAppWP8.Model.GeoDb
public SpsModel()
{
this.HasChanged = false;
this.Places = new ObservableCollection<PlaceModel>();
this.Places = new ObservableCollection<T>();
}
#endregion
@@ -35,7 +35,7 @@ namespace CampusAppWP8.Model.GeoDb
/// <summary> Gets or sets a list of places. </summary>
/// <value> The places. </value>
[XmlElement("place")]
public ObservableCollection<PlaceModel> Places { get; set; }
public ObservableCollection<T> Places { get; set; }
/// <summary> Gets or sets a value indicating whether this object has changed. </summary>
/// <value> true if this object has changed, false if not. </value>
@@ -53,12 +53,12 @@ namespace CampusAppWP8.Model.GeoDb
/// <param name="ignoreCases"> (Optional) the ignore cases. </param>
/// <param name="informationNames"> (Optional) name of the information. </param>
/// <returns> The places by information. </returns>
public List<PlaceModel> GetPlacesByInformation(string query, bool ignoreCases = true, List<string> informationNames = null)
public List<T> GetPlacesByInformation(string query, bool ignoreCases = true, List<string> informationNames = null)
{
string querryStr = string.Empty;
List<PlaceModel> resultplaces = new List<PlaceModel>();
List<T> resultplaces = new List<T>();
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
/// <summary> Adds the places. </summary>
/// <remarks> Stubbfel, 09.09.2013. </remarks>
/// <param name="places"> A list of places. </param>
public void AddPlaces(List<PlaceModel> places)
public void AddPlaces(List<T> 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<string> CreatePidList()
{
List<string> pidList = new List<string>();
foreach (PlaceModel place in this.Places)
foreach (T place in this.Places)
{
pidList.Add(place.PlaceId);
}
@@ -109,9 +109,9 @@ namespace CampusAppWP8.Model.GeoDb
/// <remarks> Stubbfel, 09.09.2013. </remarks>
/// <param name="id"> The identifier. </param>
/// <returns> The place by identifier. </returns>
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
/// <remarks> Stubbfel, 11.09.2013. </remarks>
/// <param name="pidList"> List of pids. </param>
/// <returns> filtered list of places. </returns>
public List<PlaceModel> FilterByPid(List<string> pidList)
public List<T> FilterByPid(List<string> pidList)
{
List<PlaceModel> fitlerList = new List<PlaceModel>();
List<T> fitlerList = new List<T>();
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
/// <param name="ignoreCases"> (Optional) the ignore cases. </param>
/// <param name="informationNames"> (Optional) name of the information. </param>
/// <returns> true if it match otherwise false. </returns>
private bool IsPlaceQueryMatched(PlaceModel place, string query, bool ignoreCases = true, List<string> informationNames = null)
private bool IsPlaceQueryMatched(T place, string query, bool ignoreCases = true, List<string> informationNames = null)
{
string queryString = query;
if (ignoreCases)

View File

@@ -129,6 +129,9 @@
<data name="PathNews_NewsIndexPage" xml:space="preserve">
<value>/Pages/News/NewsIndexPage.xaml</value>
</data>
<data name="PisInformationName_Layer" xml:space="preserve">
<value>Ebene</value>
</data>
<data name="UniCBTelPrefix" xml:space="preserve">
<value>035569</value>
</data>

View File

@@ -97,6 +97,15 @@ namespace CampusAppWPortalLib8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Ebene ähnelt.
/// </summary>
public static string PisInformationName_Layer {
get {
return ResourceManager.GetString("PisInformationName_Layer", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die 035569 ähnelt.
/// </summary>