This commit is contained in:
stubbfel
2013-10-22 11:01:29 +02:00
parent 99f465bb0c
commit 8f4f2c88f7
6 changed files with 86 additions and 77 deletions

View File

@@ -21,7 +21,7 @@ namespace CampusAppWP8.Model.Campusmap.Map
/// <summary> This Class manage the properties of a Map. </summary>
/// <remarks> Stubbfel, 14.10.2013. </remarks>
/// <seealso cref="T:CampusAppWPortalLib8.Model.Campusmap.Map.MapModel{CampusAppWP8.Model.GeoDb.SpsWp8Model,CampusAppWP8.Model.GeoDb.PlaceWp8Model}"/>
public class MapWp8Model : CampusAppWPortalLib8.Model.Campusmap.Map.MapModel<SpsWp8Model, PlaceWp8Model>
public class MapWp8Model : CampusAppWPortalLib8.Model.Campusmap.Map.MapModel<SpsWp8Model, PlaceWp8Model, Image>
{
#region Constructors
@@ -58,50 +58,7 @@ namespace CampusAppWP8.Model.Campusmap.Map
#region Methods
#region public
/// <summary> Method create in image, which can show at a certain position. </summary>
/// <remarks> Stubbfel, 27.08.2013. </remarks>
/// <param name="x"> the x- coordinate. </param>
/// <param name="y"> the y-coordinate. </param>
/// <param name="type"> The type. </param>
/// <param name="places"> (Optional) list of places. </param>
/// <returns> image of the pin. </returns>
public Image AddPin(double x, double y, MapPinModel.PinType type, List<PlaceWp8Model> places = null)
{
MapPoint position = new MapPoint(x, y);
return this.AddPin(position, type, places);
}
/// <summary>
/// Method create in image, which can show at a certain position depend of the
/// <see cref="RefPoint" />
/// </summary>
/// <remarks> Stubbfel, 27.08.2013. </remarks>
/// <param name="x"> the x-coordinate. </param>
/// <param name="y"> the y-coordinate. </param>
/// <param name="type"> The type. </param>
/// <param name="places"> (Optional) list of places. </param>
/// <returns> image of the pin. </returns>
public Image AddPinFromRefPoint(double x, double y, MapPinModel.PinType type, List<PlaceWp8Model> places = null)
{
MapPoint position = new MapPoint(this.RefPoint.X + x, this.RefPoint.Y - y);
return this.AddPin(position, type, places);
}
/// <summary>
/// Method create in image, which can show at a certain position depend of the
/// <see cref="RefPoint" />
/// </summary>
/// <remarks> Stubbfel, 27.08.2013. </remarks>
/// <param name="position"> input point. </param>
/// <param name="type"> The type. </param>
/// <param name="places"> (Optional) list of places. </param>
/// <returns> image of the pin. </returns>
public Image AddPinFromRefPoint(MapPoint position, MapPinModel.PinType type, List<PlaceWp8Model> places = null)
{
return this.AddPinFromRefPoint(position.X, position.Y, type, places);
}
#region public
/// <summary> Method create in image, which can show at a certain position. </summary>
/// <remarks> Stubbfel, 27.08.2013. </remarks>
@@ -109,7 +66,7 @@ namespace CampusAppWP8.Model.Campusmap.Map
/// <param name="type"> The type. </param>
/// <param name="places"> (Optional) list of places. </param>
/// <returns> image of the pin. </returns>
public Image AddPin(MapPoint position, MapPinModel.PinType type, List<PlaceWp8Model> places = null)
public override Image AddPin(MapPoint position, PinType type, List<PlaceWp8Model> places = null)
{
Image pinImg = new Image();
MapPinModel pin = this.CreatePin(type, places, pinImg);
@@ -137,50 +94,50 @@ namespace CampusAppWP8.Model.Campusmap.Map
/// <param name="places"> list of places. </param>
/// <param name="pinImg"> image of the pin. </param>
/// <returns> The new pin. </returns>
private MapPinModel CreatePin(MapPinModel.PinType type, List<PlaceWp8Model> places, Image pinImg)
private MapPinModel CreatePin(PinType type, List<PlaceWp8Model> places, Image pinImg)
{
MapPinModel pin;
switch (type)
{
case MapPinModel.PinType.CurrentPosition:
case PinType.CurrentPosition:
pin = new CurrentPositionPinModel();
break;
case MapPinModel.PinType.SearchPlace:
case PinType.SearchPlace:
pin = new SearchPlacePinModel();
pinImg.MouseLeftButtonDown += new MouseButtonEventHandler(((SearchPlacePinModel)pin).ShowInfo);
((SearchPlacePinModel)pin).AssocPlaces = places;
((SearchPlacePinModel)pin).CallBack = this.ShowMapInfos;
break;
case MapPinModel.PinType.InfoPlace:
case PinType.InfoPlace:
pin = new InfoPlacePinModel();
pinImg.MouseLeftButtonDown += new MouseButtonEventHandler(((InfoPlacePinModel)pin).ShowInfo);
((InfoPlacePinModel)pin).AssocPlaces = places;
((InfoPlacePinModel)pin).CallBack = this.ShowMapInfos;
break;
case MapPinModel.PinType.InfoLabPlace:
case PinType.InfoLabPlace:
pin = new InfoLabPlacePinModel();
pinImg.MouseLeftButtonDown += new MouseButtonEventHandler(((InfoLabPlacePinModel)pin).ShowInfo);
((InfoLabPlacePinModel)pin).AssocPlaces = places;
((InfoLabPlacePinModel)pin).CallBack = this.ShowMapInfos;
break;
case MapPinModel.PinType.InfoAccesPlace:
case PinType.InfoAccesPlace:
pin = new InfoPlaceAccessPinModel();
pinImg.MouseLeftButtonDown += new MouseButtonEventHandler(((InfoPlaceAccessPinModel)pin).ShowInfo);
((InfoPlaceAccessPinModel)pin).AssocPlaces = places;
((InfoPlaceAccessPinModel)pin).CallBack = this.ShowMapInfos;
break;
case MapPinModel.PinType.InfoRedPlace:
case PinType.InfoRedPlace:
pin = new InfoPlaceRedPinModel();
pinImg.MouseLeftButtonDown += new MouseButtonEventHandler(((InfoPlaceRedPinModel)pin).ShowInfo);
((InfoPlaceRedPinModel)pin).AssocPlaces = places;
((InfoPlaceRedPinModel)pin).CallBack = this.ShowMapInfos;
break;
case MapPinModel.PinType.InfoWcPlace:
case PinType.InfoWcPlace:
pin = new InfoPlaceWCPinModel();
pinImg.MouseLeftButtonDown += new MouseButtonEventHandler(((InfoPlaceWCPinModel)pin).ShowInfo);

View File

@@ -215,7 +215,7 @@ namespace CampusAppWP8.Pages.Campusmap
}
else
{
this.ShowPlacesByQuery(query, MapPinModel.PinType.Hidden, false);
this.ShowPlacesByQuery(query, PinType.Hidden, false);
}
}
@@ -236,7 +236,7 @@ namespace CampusAppWP8.Pages.Campusmap
allPlaces = true;
}
this.ShowPlacesByQuery(query, MapPinModel.PinType.SearchPlace, allPlaces);
this.ShowPlacesByQuery(query, PinType.SearchPlace, allPlaces);
}
}
@@ -247,7 +247,7 @@ namespace CampusAppWP8.Pages.Campusmap
/// <param name="allPlaces">
/// if its true then send query to the place file otherwise to the CampusMapModel.
/// </param>
private void ShowPlacesByQuery(string query, MapPinModel.PinType pintype, bool allPlaces)
private void ShowPlacesByQuery(string query, PinType pintype, bool allPlaces)
{
this.AddPins(this.SearchPlaces(query, allPlaces), pintype);
}
@@ -259,7 +259,7 @@ namespace CampusAppWP8.Pages.Campusmap
/// <param name="allPlaces">
/// if its true then send query to the place file otherwise to the CampusMapModel.
/// </param>
private void ShowPlacesByPlaceId(string placeId, MapPinModel.PinType pintype, bool allPlaces)
private void ShowPlacesByPlaceId(string placeId, PinType pintype, bool allPlaces)
{
this.AddPinsByPids(new List<string>() { placeId }, pintype, false, allPlaces);
}
@@ -275,7 +275,7 @@ namespace CampusAppWP8.Pages.Campusmap
}
else
{
this.ShowPlacesByPlaceId(placeId, MapPinModel.PinType.SearchPlace, true);
this.ShowPlacesByPlaceId(placeId, PinType.SearchPlace, true);
}
}
@@ -290,7 +290,7 @@ namespace CampusAppWP8.Pages.Campusmap
}
else
{
this.ShowPlacesByPlaceId(placeId, MapPinModel.PinType.SearchPlace, false);
this.ShowPlacesByPlaceId(placeId, PinType.SearchPlace, false);
}
}
@@ -305,7 +305,7 @@ namespace CampusAppWP8.Pages.Campusmap
}
else
{
this.AddPins(this.campusMap.Spatial.Places.ToList(), MapPinModel.PinType.InfoPlace, false);
this.AddPins(this.campusMap.Spatial.Places.ToList(), PinType.InfoPlace, false);
}
}
@@ -413,7 +413,7 @@ namespace CampusAppWP8.Pages.Campusmap
/// <param name="allPlaces">
/// (optional) if its true, load place from place file, otherwise from CampusMapModel.
/// </param>
private void AddPinsByPids(List<string> pidList, MapPinModel.PinType pinType, bool clearCanvas = true, bool allPlaces = false)
private void AddPinsByPids(List<string> pidList, PinType pinType, bool clearCanvas = true, bool allPlaces = false)
{
// clear canvas
if (clearCanvas)
@@ -595,7 +595,7 @@ namespace CampusAppWP8.Pages.Campusmap
/// <param name="places"> The places. </param>
/// <param name="type"> The type. </param>
/// <param name="scroll"> (Optional) the scroll. </param>
private void AddPins(List<PlaceWp8Model> places, MapPinModel.PinType type, bool scroll = true)
private void AddPins(List<PlaceWp8Model> places,PinType type, bool scroll = true)
{
foreach (PlaceWp8Model place in places)
{
@@ -623,7 +623,7 @@ namespace CampusAppWP8.Pages.Campusmap
/// <param name="assocPlaces">
/// (Optional) List of places, whose are associative with the pin.
/// </param>
private void AddPin(double x, double y, MapPinModel.PinType type, bool scroll = true, List<PlaceWp8Model> assocPlaces = null)
private void AddPin(double x, double y, PinType type, bool scroll = true, List<PlaceWp8Model> assocPlaces = null)
{
MapPoint 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));
@@ -723,7 +723,7 @@ namespace CampusAppWP8.Pages.Campusmap
else
{
this.ClearMap(new List<string>() { MapPinModel.CurrentPositionPlacePinString });
this.SetPinToPosition(lat, log, MapPinModel.PinType.CurrentPosition, scroll);
this.SetPinToPosition(lat, log, PinType.CurrentPosition, scroll);
}
}
@@ -733,7 +733,7 @@ namespace CampusAppWP8.Pages.Campusmap
/// <param name="longitude"> The longitude. </param>
/// <param name="type"> The type. </param>
/// <param name="scroll"> (Optional) the scroll. </param>
private void SetPinToPosition(string latitude, string longitude, MapPinModel.PinType type, bool scroll = true)
private void SetPinToPosition(string latitude, string longitude, PinType type, bool scroll = true)
{
double x;
double y;

View File

@@ -157,7 +157,7 @@ namespace CampusAppWP8.Pages.Campusmap
MapPoint roompoint = this.buildingMap.GetScrollPoint(this.buildingMap.ConverToPixelPoint(this.buildingMap.ConverToMapPoint(x, y)));
MapPoint viewPoint = roompoint - this.mappoint + this.offsetPoint;
MapCanvas.Children.Add(this.buildingMap.AddPin(viewPoint, MapPinModel.PinType.InfoRedPlace, new List<PlaceWp8Model> { room }));
MapCanvas.Children.Add(this.buildingMap.AddPin(viewPoint, PinType.InfoRedPlace, new List<PlaceWp8Model> { room }));
}
/// <summary> Shows the map information. </summary>
@@ -302,23 +302,23 @@ namespace CampusAppWP8.Pages.Campusmap
MapPoint roompoint = this.buildingMap.GetScrollPoint(this.buildingMap.ConverToPixelPoint(this.buildingMap.ConverToMapPoint(x, y)));
MapPoint viewPoint = roompoint - this.mappoint + this.offsetPoint;
MapPinModel.PinType type;
PinType type;
switch (room.GetInformationsValue(Constants.PisInformationName_Typ))
{
case "Labor":
type = MapPinModel.PinType.InfoLabPlace;
type = PinType.InfoLabPlace;
break;
case "Zugangsbereich":
type = MapPinModel.PinType.InfoAccesPlace;
type = PinType.InfoAccesPlace;
break;
case "WC":
type = MapPinModel.PinType.InfoWcPlace;
type = PinType.InfoWcPlace;
break;
case "Regal":
continue;
default:
type = MapPinModel.PinType.InfoPlace;
type = PinType.InfoPlace;
break;
}

View File

@@ -9,14 +9,16 @@
namespace CampusAppWPortalLib8.Model.Campusmap.Map
{
using System.Collections.Generic;
using CampusAppWPortalLib8.Model.Campusmap.Pin;
using CampusAppWPortalLib8.Model.GeoDb;
using CampusAppWPortalLib8.Model.Utility;
/// <summary> A data Model for the map. </summary>
/// <remarks> Stubbfel, 22.10.2013. </remarks>
/// <typeparam name="T"> Generic type parameter. SpsModel </typeparam>
/// <typeparam name="V"> Generic type parameter. PlaceModel</typeparam>
public class MapModel<T, V>
/// <typeparam name="T"> Generic type parameter. SpsModel. </typeparam>
/// <typeparam name="V"> Generic type parameter. PlaceModel. </typeparam>
/// <typeparam name="I"> Generic type parameter. Image class </typeparam>
public abstract class MapModel<T, V, I>
where V : PlaceModel
where T : SpsModel<V>, new()
{
@@ -94,6 +96,56 @@ namespace CampusAppWPortalLib8.Model.Campusmap.Map
#region Methods
#region public
/// <summary> Method create in image, which can show at a certain position. </summary>
/// <remarks> Stubbfel, 27.08.2013. </remarks>
/// <param name="x"> the x- coordinate. </param>
/// <param name="y"> the y-coordinate. </param>
/// <param name="type"> The type. </param>
/// <param name="places"> (Optional) list of places. </param>
/// <returns> image of the pin. </returns>
public I AddPin(double x, double y, PinType type, List<V> places = null)
{
MapPoint position = new MapPoint(x, y);
return this.AddPin(position, type, places);
}
/// <summary>
/// Method create in image, which can show at a certain position depend of the
/// <see cref="RefPoint" />
/// </summary>
/// <remarks> Stubbfel, 27.08.2013. </remarks>
/// <param name="x"> the x-coordinate. </param>
/// <param name="y"> the y-coordinate. </param>
/// <param name="type"> The type. </param>
/// <param name="places"> (Optional) list of places. </param>
/// <returns> image of the pin. </returns>
public I AddPinFromRefPoint(double x, double y, PinType type, List<V> places = null)
{
MapPoint position = new MapPoint(this.RefPoint.X + x, this.RefPoint.Y - y);
return this.AddPin(position, type, places);
}
/// <summary>
/// Method create in image, which can show at a certain position depend of the
/// <see cref="RefPoint" />
/// </summary>
/// <remarks> Stubbfel, 27.08.2013. </remarks>
/// <param name="position"> input point. </param>
/// <param name="type"> The type. </param>
/// <param name="places"> (Optional) list of places. </param>
/// <returns> image of the pin. </returns>
public I AddPinFromRefPoint(MapPoint position, PinType type, List<V> places = null)
{
return this.AddPinFromRefPoint(position.X, position.Y, type, places);
}
/// <summary> Method create in image, which can show at a certain position. </summary>
/// <remarks> Stubbfel, 27.08.2013. </remarks>
/// <param name="position"> input point. </param>
/// <param name="type"> The type. </param>
/// <param name="places"> (Optional) list of places. </param>
/// <returns> image of the pin. </returns>
public abstract I AddPin(MapPoint position, PinType type, List<V> places = null);
/// <summary> Gets scroll point. </summary>
/// <remarks> Stubbfel, 21.10.2013. </remarks>

View File

@@ -8,7 +8,7 @@
//-----------------------------------------------------------------------
namespace CampusAppWPortalLib8.Model.Campusmap.Pin
{
using CampusAppWPortalLib8.Model.Campusmap.Pins;
using CampusAppWPortalLib8.Model.Campusmap.Pin;
using CampusAppWPortalLib8.Model.Utility;
using CampusAppWPortalLib8.Resources;

View File

@@ -6,7 +6,7 @@
// <date>22.10.2013</date>
// <summary>Implements the pin types class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWPortalLib8.Model.Campusmap.Pins
namespace CampusAppWPortalLib8.Model.Campusmap.Pin
{
#region enums