add mapoint

This commit is contained in:
stubbfel
2013-10-21 18:51:09 +02:00
parent 09a7626d49
commit b6df184f04
28 changed files with 544 additions and 329 deletions

View File

@@ -113,19 +113,18 @@
<Compile Include="File\Exams\ExamFile.cs" />
<Compile Include="File\Places\PlacesFile.cs" />
<Compile Include="Model\BinaryModel.cs" />
<Compile Include="Model\Campusmap\BuildingMapModel.cs" />
<Compile Include="Model\Campusmap\CampusMapModel.cs" />
<Compile Include="Model\Campusmap\CBMainMapModel.cs" />
<Compile Include="Model\Campusmap\ClickAblePlacePinModel.cs" />
<Compile Include="Model\Campusmap\CurrentPositionPinModel.cs" />
<Compile Include="Model\Campusmap\HiddenPinPlaceModel.cs" />
<Compile Include="Model\Campusmap\InfoPlacePinModel.cs" />
<Compile Include="Model\Campusmap\CBMainMapRoomModel.cs" />
<Compile Include="Model\Campusmap\InfoLabPlacePinModel.cs" />
<Compile Include="Model\Campusmap\InfoPlaceRedPinModel.cs" />
<Compile Include="Model\Campusmap\InfoPlaceAccessPinModel.cs" />
<Compile Include="Model\Campusmap\InfoPlaceWCPinModel.cs" />
<Compile Include="Model\Campusmap\SearchPlacePinModel.cs" />
<Compile Include="Model\Campusmap\Maps\BuildingMapModel.cs" />
<Compile Include="Model\Campusmap\Maps\CampusMapModel.cs" />
<Compile Include="Model\Campusmap\Maps\CBMainMapModel.cs" />
<Compile Include="Model\Campusmap\Pins\ClickAblePlacePinModel.cs" />
<Compile Include="Model\Campusmap\Pins\CurrentPositionPinModel.cs" />
<Compile Include="Model\Campusmap\Pins\HiddenPinPlaceModel.cs" />
<Compile Include="Model\Campusmap\Pins\InfoPlacePinModel.cs" />
<Compile Include="Model\Campusmap\Pins\InfoLabPlacePinModel.cs" />
<Compile Include="Model\Campusmap\Pins\InfoPlaceRedPinModel.cs" />
<Compile Include="Model\Campusmap\Pins\InfoPlaceAccessPinModel.cs" />
<Compile Include="Model\Campusmap\Pins\InfoPlaceWCPinModel.cs" />
<Compile Include="Model\Campusmap\Pins\SearchPlacePinModel.cs" />
<Compile Include="Model\Exams\ExamListWp8Model.cs" />
<Compile Include="Model\Exams\ExamWp8Model.cs" />
<Compile Include="Model\GeoDb\CampusBuildingLayerWp8Model.cs" />
@@ -198,10 +197,7 @@
<Compile Include="Feed\Openinghours\OpeninghoursFeed.cs" />
<Compile Include="Feed\StudentCouncil\StudentCouncilFeed.cs" />
<Compile Include="LocalizedStrings.cs" />
<Compile Include="Model\Campusmap\MapModel.cs" />
<Compile Include="Model\Campusmap\MapPinModel.cs">
<ExcludeFromStyleCop>False</ExcludeFromStyleCop>
</Compile>
<Compile Include="Model\Campusmap\Maps\MapWp8Model.cs" />
<Compile Include="Model\Lecture\LectureWp8Activity.cs" />
<Compile Include="Model\Lecture\LectureWp8List.cs" />
<Compile Include="Model\Lecture\LecturePageModel.cs" />

View File

@@ -10,7 +10,7 @@
<placeInformation placeInformationName="ImageHeight">800</placeInformation>
<placeInformation placeInformationName="MapImageOffsetX">-288</placeInformation>
<placeInformation placeInformationName="MapImageOffsetY">-390</placeInformation>
<placeInformation placeInformationName="MapRefPoint">Point(430 500)</placeInformation>
<placeInformation placeInformationName="MapRefPoint">Point(410, 480)</placeInformation>
<placeInformation placeInformationName="ScaleX">650000</placeInformation>
<placeInformation placeInformationName="ScaleY">1200000</placeInformation>
</place>
@@ -24,7 +24,7 @@
<placeInformation placeInformationName="ImageHeight">800</placeInformation>
<placeInformation placeInformationName="MapImageOffsetX">-252</placeInformation>
<placeInformation placeInformationName="MapImageOffsetY">-390</placeInformation>
<placeInformation placeInformationName="MapRefPoint">Point(235 380)</placeInformation>
<placeInformation placeInformationName="MapRefPoint">Point(215, 355)</placeInformation>
<placeInformation placeInformationName="ScaleX">300000</placeInformation>
<placeInformation placeInformationName="ScaleY">500000</placeInformation>
</place>

View File

@@ -1,25 +0,0 @@
//-----------------------------------------------------------------------
// <copyright file="CBMainMapRoomModel.cs" company="BTU/IIT">
// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
// </copyright>
// <author>Stubbfel</author>
// <date>14.10.2013</date>
// <summary>Implements the main map room model class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWP8.Model.Campusmap
{
/// <summary> Class for the MapModel of the mainCampus of cottbus. </summary>
/// <remarks> Stubbfel, 14.10.2013. </remarks>
public class CBMainMapRoomModel
{
#region Constructor
/// <summary> Initializes a new instance of the CBMainMapRoomModel class. </summary>
/// <remarks> Stubbfel, 14.10.2013. </remarks>
public CBMainMapRoomModel()
{
}
#endregion
}
}

View File

@@ -6,7 +6,7 @@
// <date>14.10.2013</date>
// <summary>Implements the building map model class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWP8.Model.Campusmap
namespace CampusAppWP8.Model.Campusmap.Map
{
using System.Globalization;
using System.Linq;
@@ -14,11 +14,12 @@ namespace CampusAppWP8.Model.Campusmap
using CampusAppWP8.Model.GeoDb;
using CampusAppWP8.Resources;
using CampusAppWPortalLib8.Utility;
using CampusAppWPortalLib8.Model.Utility;
/// <summary> A data Model for the building map. </summary>
/// <remarks> Stubbfel, 14.10.2013. </remarks>
/// <seealso cref="T:CampusAppWP8.Model.Campusmap.MapModel"/>
public class BuildingMapModel : MapModel
public class BuildingMapModel : MapWp8Model
{
/// <summary> Initializes a new instance of the BuildingMapModel class. </summary>
/// <remarks> Stubbfel, 14.10.2013. </remarks>
@@ -34,6 +35,7 @@ namespace CampusAppWP8.Model.Campusmap
this.ImageSource = building.GetInformationsValue("ImageSource");
double tmpVal;
if (double.TryParse(building.GetInformationsValue("ImageWidth"), NumberStyles.Number, CultureInfo.InvariantCulture, out tmpVal))
{
this.ImageWidth = tmpVal;
@@ -44,16 +46,6 @@ namespace CampusAppWP8.Model.Campusmap
this.ImageHeight = tmpVal;
}
if (double.TryParse(building.GetInformationsValue("MapImageOffsetX"), NumberStyles.Number, CultureInfo.InvariantCulture, out tmpVal))
{
this.MapImageOffsetX = tmpVal;
}
if (double.TryParse(building.GetInformationsValue("MapImageOffsetY"), NumberStyles.Number, CultureInfo.InvariantCulture, out tmpVal))
{
this.MapImageOffsetY = tmpVal;
}
string pointString = building.GetInformationsValue("MapRefPoint");
pointString = pointString.TrimStart("Point(".ToArray());
pointString = pointString.TrimEnd(')');
@@ -66,25 +58,26 @@ namespace CampusAppWP8.Model.Campusmap
double x;
double y;
if (double.TryParse(building.GetInformationsValue("MapImageOffsetX"), NumberStyles.Number, CultureInfo.InvariantCulture, out x)
&& double.TryParse(building.GetInformationsValue("MapImageOffsetY"), NumberStyles.Number, CultureInfo.InvariantCulture, out y))
{
this.MapImageOffsetPoint = new MapPoint(x, y);
}
if (!double.TryParse(coord[0], NumberStyles.Number, CultureInfo.InvariantCulture, out x) || !double.TryParse(coord[1], NumberStyles.Number, CultureInfo.InvariantCulture, out y))
{
return;
}
this.RefPoint = new Point(x, y);
this.RefPoint = new MapPoint(x, y);
if (double.TryParse(building.GetInformationsValue("ScaleX"), NumberStyles.Number, CultureInfo.InvariantCulture, out tmpVal))
if (double.TryParse(building.GetInformationsValue("ScaleX"), NumberStyles.Number, CultureInfo.InvariantCulture, out x)
&& double.TryParse(building.GetInformationsValue("ScaleY"), NumberStyles.Number, CultureInfo.InvariantCulture, out y))
{
this.ScaleX = tmpVal;
this.ScalePoint = new MapPoint(x, y);
}
if (double.TryParse(building.GetInformationsValue("ScaleY"), NumberStyles.Number, CultureInfo.InvariantCulture, out tmpVal))
{
this.ScaleY = tmpVal;
}
this.GeoOffsetX = building.GeoRefPoint.Longitude;
this.GeoOffsetY = building.GeoRefPoint.Latitude;
this.GeoOffsetPoint = new MapPoint(building.GeoRefPoint.Longitude, building.GeoRefPoint.Latitude);
}
}
}

View File

@@ -6,12 +6,13 @@
// <date>14.10.2013</date>
// <summary>Implements the main map model class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWP8.Model.Campusmap
namespace CampusAppWP8.Model.Campusmap.Map
{
using System.Collections.Generic;
using System.Windows;
using System.Collections.Generic;
using System.Windows;
using CampusAppWP8.Model.GeoDb;
using CampusAppWP8.Resources;
using CampusAppWP8.Resources;
using CampusAppWPortalLib8.Model.Utility;
/// <summary> Class for the MapModel of the mainCampus of cottbus. </summary>
/// <remarks> Stubbfel, 14.10.2013. </remarks>
@@ -36,13 +37,10 @@ namespace CampusAppWP8.Model.Campusmap
this.ImageSource = Constants.FileMap_CBMainMap;
this.ImageWidth = 2000;
this.ImageHeight = 1425;
this.MapImageOffsetX = -228;
this.MapImageOffsetY = -300;
this.RefPoint = new Point(1365, 800);
this.ScaleX = 129483.4123222749;
this.ScaleY = 197648.8919266073;
this.GeoOffsetX = 14.327159;
this.GeoOffsetY = 51.766548;
this.MapImageOffsetPoint = new MapPoint(-228, -300);
this.RefPoint = new MapPoint(1335, 775);
this.ScalePoint = new MapPoint(129483.4123222749, 197648.8919266073);
this.GeoOffsetPoint = new MapPoint(14.327159, 51.766548);
}
#endregion

View File

@@ -6,7 +6,7 @@
// <date>14.10.2013</date>
// <summary>Implements the campus map model class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWP8.Model.Campusmap
namespace CampusAppWP8.Model.Campusmap.Map
{
using System.Collections.Generic;
using CampusAppWP8.Model.GeoDb;
@@ -14,7 +14,7 @@ namespace CampusAppWP8.Model.Campusmap
/// <summary> Class for the CampusMapModel. </summary>
/// <remarks> Stubbfel, 14.10.2013. </remarks>
/// <seealso cref="T:CampusAppWP8.Model.Campusmap.MapModel"/>
public class CampusMapModel : MapModel
public class CampusMapModel : MapWp8Model
{
#region constructor

View File

@@ -6,7 +6,7 @@
// <date>14.10.2013</date>
// <summary>Implements the map model class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWP8.Model.Campusmap
namespace CampusAppWP8.Model.Campusmap.Map
{
using System;
using System.Collections.Generic;
@@ -15,24 +15,27 @@ namespace CampusAppWP8.Model.Campusmap
using System.Windows.Input;
using System.Windows.Media.Imaging;
using CampusAppWP8.Model.GeoDb;
using CampusAppWP8.Model.Campusmap.Pin;
using CampusAppWPortalLib8.Model.Utility;
using CampusAppWPortalLib8.Model.Campusmap.Pin;
/// <summary> This Class manage the properties of a Map. </summary>
/// <remarks> Stubbfel, 14.10.2013. </remarks>
public class MapModel
public class MapWp8Model : CampusAppWPortalLib8.Model.Campusmap.Map.MapModel<SpsWp8Model,PlaceWp8Model>
{
#region Constructors
/// <summary> Initializes a new instance of the <see cref="MapModel" /> class. </summary>
/// <summary> Initializes a new instance of the <see cref="MapWp8Model" /> class. </summary>
/// <remarks> Stubbfel, 14.10.2013. </remarks>
public MapModel()
public MapWp8Model()
{
this.IsReady = false;
}
/// <summary> Initializes a new instance of the <see cref="MapModel" /> class. </summary>
/// <summary> Initializes a new instance of the <see cref="MapWp8Model" /> class. </summary>
/// <remarks> Stubbfel, 14.10.2013. </remarks>
/// <param name="placeList"> list of places. </param>
public MapModel(List<PlaceWp8Model> placeList)
public MapWp8Model(List<PlaceWp8Model> placeList)
{
this.IsReady = false;
this.LoadSpatials(placeList);
@@ -51,85 +54,12 @@ namespace CampusAppWP8.Model.Campusmap
/// <summary> Event ShowMapInfo. </summary>
public event MapInfos ShowMapInfos = null;
#endregion
#region Property
/// <summary> Gets or sets a value indicating whether the map is ready or not. </summary>
/// <value> true if this object is ready, false if not. </value>
public bool IsReady { get; protected set; }
/// <summary> Gets or sets the ImageSource of the map. </summary>
/// <value> The image source. </value>
public string ImageSource { get; set; }
/// <summary> Gets or sets the ImageWidth of the map. </summary>
/// <value> The width of the image. </value>
public double ImageWidth { get; set; }
/// <summary> Gets or sets the ImageHeight of the map. </summary>
/// <value> The height of the image. </value>
public double ImageHeight { get; set; }
/// <summary> Gets or sets the ImageOffsetX of the map. </summary>
/// <value> The map image offset x coordinate. </value>
public double MapImageOffsetX { get; set; }
/// <summary> Gets or sets the ImageOffsetY of the map. </summary>
/// <value> The map image offset y coordinate. </value>
public double MapImageOffsetY { get; set; }
/// <summary> Gets or sets the GeoOffsetX of the map. </summary>
/// <value> The geo offset x coordinate. </value>
public double GeoOffsetX { get; set; }
/// <summary> Gets or sets the GeoOffsetY of the map. </summary>
/// <value> The geo offset y coordinate. </value>
public double GeoOffsetY { get; set; }
/// <summary> Gets or sets the Scale (to pixel) of the map. </summary>
/// <value> The scale x coordinate. </value>
public double ScaleX { get; set; }
/// <summary> Gets or sets the Scale (to pixel) of the map. </summary>
/// <value> The scale y coordinate. </value>
public double ScaleY { get; set; }
/// <summary> Gets or sets the reference point. </summary>
/// <value> The reference point. </value>
public Point RefPoint { get; set; }
/// <summary> Gets or sets the spatial of the map. </summary>
/// <value> The spatial. </value>
public SpsWp8Model Spatial { get; set; }
#endregion
#region Methods
#region public
/// <summary> Method calculate the coordinates of ScrollToOffsets point. </summary>
/// <remarks> Stubbfel, 14.10.2013. </remarks>
/// <param name="point"> input point. </param>
/// <returns> point (in pixel) </returns>
public Point GetScrollPoint(Point point)
{
return this.GetScrollPoint(point.X, point.Y);
}
/// <summary> Method calculate the coordinates of ScrollToOffsets point. </summary>
/// <remarks> the input-point will be shown in the center. </remarks>
/// <param name="x"> x - coordinate. </param>
/// <param name="y"> y - coordinate. </param>
/// <returns> point (in pixel) </returns>
public Point GetScrollPoint(double x, double y)
{
x = this.RefPoint.X + this.MapImageOffsetX + x;
y = this.RefPoint.Y + this.MapImageOffsetY - y;
return new Point(x, y);
}
/// <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>
@@ -139,7 +69,7 @@ namespace CampusAppWP8.Model.Campusmap
/// <returns> image of the pin. </returns>
public Image AddPin(double x, double y, MapPinModel.PinType type, List<PlaceWp8Model> places = null)
{
Point position = new Point(x, y);
MapPoint position = new MapPoint(x, y);
return this.AddPin(position, type, places);
}
@@ -155,7 +85,7 @@ namespace CampusAppWP8.Model.Campusmap
/// <returns> image of the pin. </returns>
public Image AddPinFromRefPoint(double x, double y, MapPinModel.PinType type, List<PlaceWp8Model> places = null)
{
Point position = new Point(this.RefPoint.X + x, this.RefPoint.Y - y);
MapPoint position = new MapPoint(this.RefPoint.X + x, this.RefPoint.Y - y);
return this.AddPin(position, type, places);
}
@@ -168,7 +98,7 @@ namespace CampusAppWP8.Model.Campusmap
/// <param name="type"> The type. </param>
/// <param name="places"> (Optional) list of places. </param>
/// <returns> image of the pin. </returns>
public Image AddPinFromRefPoint(Point position, MapPinModel.PinType type, List<PlaceWp8Model> places = null)
public Image AddPinFromRefPoint(MapPoint position, MapPinModel.PinType type, List<PlaceWp8Model> places = null)
{
return this.AddPinFromRefPoint(position.X, position.Y, type, places);
}
@@ -179,7 +109,7 @@ namespace CampusAppWP8.Model.Campusmap
/// <param name="type"> The type. </param>
/// <param name="places"> (Optional) list of places. </param>
/// <returns> image of the pin. </returns>
public Image AddPin(Point position, MapPinModel.PinType type, List<PlaceWp8Model> places = null)
public Image AddPin(MapPoint position, MapPinModel.PinType type, List<PlaceWp8Model> places = null)
{
Image pinImg = new Image();
MapPinModel pin = this.CreatePin(type, places, pinImg);
@@ -197,58 +127,6 @@ namespace CampusAppWP8.Model.Campusmap
return pinImg;
}
/// <summary> Convert a coordinates to coordinates which address pixels. </summary>
/// <remarks> Stubbfel, 27.08.2013. </remarks>
/// <param name="x"> the x-coordinate. </param>
/// <param name="y"> the y-coordinate. </param>
/// <returns> Point in pixel-size. </returns>
public Point ConverToPixelPoint(double x, double y)
{
Point p = new Point { X = this.ScaleX * x, Y = this.ScaleY * y };
return p;
}
/// <summary> Convert a coordinates to coordinates which address pixels. </summary>
/// <remarks> Stubbfel, 14.10.2013. </remarks>
/// <param name="point"> not scaled point. </param>
/// <returns> Point in pixel-size. </returns>
public Point ConverToPixelPoint(Point point)
{
return this.ConverToPixelPoint(point.X, point.Y);
}
/// <summary> Convert a coordinates to coordinates which address mapPoint. </summary>
/// <remarks> Stubbfel, 14.10.2013. </remarks>
/// <param name="x"> the x-coordinate. </param>
/// <param name="y"> the y-coordinate. </param>
/// <returns> Point in pixel-size. </returns>
public Point ConverToMapPoint(double x, double y)
{
return new Point { X = x - this.GeoOffsetX, Y = y - this.GeoOffsetY };
}
/// <summary> Convert a coordinates to coordinates which address mapPoint. </summary>
/// <remarks> Stubbfel, 14.10.2013. </remarks>
/// <param name="point"> not scaled point. </param>
/// <returns> Point in pixel-size. </returns>
public Point ConverToMapPoint(Point point)
{
return this.ConverToMapPoint(point.X, point.Y);
}
#endregion
#region protected
/// <summary> Loads the spatial object </summary>
/// <remarks> Stubbfel, 19.08.2013. </remarks>
/// <param name="placeList"> list of places. </param>
protected virtual void LoadSpatials(List<PlaceWp8Model> placeList)
{
this.Spatial = new SpsWp8Model();
this.Spatial.AddPlaces(placeList);
}
#endregion
#region private

View File

@@ -6,10 +6,12 @@
// <date>14.10.2013</date>
// <summary>Implements the click able place pin model class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWP8.Model.Campusmap
namespace CampusAppWP8.Model.Campusmap.Pin
{
using System.Collections.Generic;
using CampusAppWP8.Model.GeoDb;
using CampusAppWP8.Model.Campusmap.Map;
using CampusAppWPortalLib8.Model.Campusmap.Pin;
/// <summary> abstract class for click abel bins. </summary>
/// <remarks> Stubbfel, 14.10.2013. </remarks>
@@ -20,7 +22,7 @@ namespace CampusAppWP8.Model.Campusmap
/// <summary> Gets or sets Callback Function, to show place information of the Pin. </summary>
/// <value> The call back. </value>
public MapModel.MapInfos CallBack { get; set; }
public MapWp8Model.MapInfos CallBack { get; set; }
/// <summary> Gets or sets place which are associative with this pin. </summary>
/// <value> The associated places. </value>

View File

@@ -6,10 +6,12 @@
// <date>14.10.2013</date>
// <summary>Implements the current position pin model class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWP8.Model.Campusmap
namespace CampusAppWP8.Model.Campusmap.Pin
{
using System.Windows;
using CampusAppWP8.Resources;
using CampusAppWPortalLib8.Model.Utility;
using CampusAppWPortalLib8.Model.Campusmap.Pin;
/// <summary> Current position pin model. </summary>
/// <remarks> Stubbfel, 27.08.2013. </remarks>
@@ -25,8 +27,7 @@ namespace CampusAppWP8.Model.Campusmap
this.ImageSource = Icons.CurrentPosition;
this.ImageWidth = 60;
this.ImageHeight = 60;
this.PinImageOffsetX = -25;
this.PinImageOffsetY = -34;
this.PinImageOffsetPoint = new MapPoint(-25, -34);
this.Tag = MapPinModel.CurrentPositionPlacePinString;
this.ZIndex = 3;
}

View File

@@ -6,7 +6,8 @@
// <date>14.10.2013</date>
// <summary>Implements the hidden pin place model class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWP8.Model.Campusmap
using CampusAppWPortalLib8.Model.Campusmap.Pin;
namespace CampusAppWP8.Model.Campusmap.Pin
{
/// <summary> Hidden pin place model. </summary>
/// <remarks> Stubbfel, 27.08.2013. </remarks>

View File

@@ -6,9 +6,10 @@
// <date>14.10.2013</date>
// <summary>Implements the information lab place pin model class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWP8.Model.Campusmap
namespace CampusAppWP8.Model.Campusmap.Pin
{
using CampusAppWP8.Resources;
using CampusAppWPortalLib8.Model.Utility;
/// <summary> Search pin place model. </summary>
/// <remarks> Stubbfel, 27.08.2013. </remarks>
@@ -24,8 +25,7 @@ namespace CampusAppWP8.Model.Campusmap
this.ImageSource = Icons.PlaceLab;
this.ImageWidth = 40;
this.ImageHeight = 40;
this.PinImageOffsetX = -20;
this.PinImageOffsetY = -15;
this.PinImageOffsetPoint = new MapPoint(-10, -15);
this.ZIndex += 1;
}

View File

@@ -6,9 +6,10 @@
// <date>14.10.2013</date>
// <summary>Implements the information place access pin model class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWP8.Model.Campusmap
namespace CampusAppWP8.Model.Campusmap.Pin
{
using CampusAppWP8.Resources;
using CampusAppWPortalLib8.Model.Utility;
/// <summary> Search pin place model. </summary>
/// <remarks> Stubbfel, 27.08.2013. </remarks>
@@ -24,8 +25,7 @@ namespace CampusAppWP8.Model.Campusmap
this.ImageSource = Icons.PlaceInfoAccess;
this.ImageWidth = 40;
this.ImageHeight = 40;
this.PinImageOffsetX = -10;
this.PinImageOffsetY = -35;
this.PinImageOffsetPoint = new MapPoint(-10, -15);
}
#endregion

View File

@@ -6,9 +6,11 @@
// <date>14.10.2013</date>
// <summary>Implements the information place pin model class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWP8.Model.Campusmap
namespace CampusAppWP8.Model.Campusmap.Pin
{
using CampusAppWP8.Resources;
using CampusAppWPortalLib8.Model.Campusmap.Pin;
using CampusAppWPortalLib8.Model.Utility;
/// <summary> Search pin place model. </summary>
/// <remarks> Stubbfel, 27.08.2013. </remarks>
@@ -24,8 +26,7 @@ namespace CampusAppWP8.Model.Campusmap
this.ImageSource = Icons.PlaceInfo;
this.ImageWidth = 60;
this.ImageHeight = 60;
this.PinImageOffsetX = -25;
this.PinImageOffsetY = -27;
this.PinImageOffsetPoint = new MapPoint(-25, -27);
this.Tag = MapPinModel.PinTypeToString(PinType.InfoPlace);
this.ZIndex = 1;
}

View File

@@ -6,9 +6,11 @@
// <date>14.10.2013</date>
// <summary>Implements the information place red pin model class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWP8.Model.Campusmap
namespace CampusAppWP8.Model.Campusmap.Pin
{
using CampusAppWP8.Resources;
using CampusAppWPortalLib8.Model.Campusmap.Pin;
using CampusAppWPortalLib8.Model.Utility;
/// <summary> A data Model for the information place red pin. </summary>
/// <remarks> Stubbfel, 14.10.2013. </remarks>
@@ -24,8 +26,7 @@ namespace CampusAppWP8.Model.Campusmap
this.ImageSource = Icons.PlaceRearchRed;
this.ImageWidth = 60;
this.ImageHeight = 60;
this.PinImageOffsetX = -25;
this.PinImageOffsetY = -27;
this.PinImageOffsetPoint = new MapPoint(-25, -27);
this.ZIndex += 1;
this.Tag = MapPinModel.InfoRedPlacePinString;
}

View File

@@ -6,9 +6,10 @@
// <date>14.10.2013</date>
// <summary>Implements the information place wc pin model class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWP8.Model.Campusmap
namespace CampusAppWP8.Model.Campusmap.Pin
{
using CampusAppWP8.Resources;
using CampusAppWPortalLib8.Model.Utility;
/// <summary> Search pin place model. </summary>
/// <remarks> Stubbfel, 27.08.2013. </remarks>
@@ -24,8 +25,7 @@ namespace CampusAppWP8.Model.Campusmap
this.ImageSource = Icons.PlaceInfoWc;
this.ImageWidth = 40;
this.ImageHeight = 40;
this.PinImageOffsetX = 0;
this.PinImageOffsetY = -10;
this.PinImageOffsetPoint = new MapPoint(0, -10);
this.ZIndex += 1;
}

View File

@@ -6,9 +6,11 @@
// <date>14.10.2013</date>
// <summary>Implements the search place pin model class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWP8.Model.Campusmap
namespace CampusAppWP8.Model.Campusmap.Pin
{
using CampusAppWP8.Resources;
using CampusAppWPortalLib8.Model.Campusmap.Pin;
using CampusAppWPortalLib8.Model.Utility;
/// <summary> Search pin place model. </summary>
/// <remarks> Stubbfel, 27.08.2013. </remarks>
@@ -26,8 +28,7 @@ namespace CampusAppWP8.Model.Campusmap
this.ImageSource = Icons.SearchPlace;
this.ImageWidth = 60;
this.ImageHeight = 60;
this.PinImageOffsetX = -25;
this.PinImageOffsetY = -27;
this.PinImageOffsetPoint = new MapPoint(-25, -27);
this.Tag = MapPinModel.SearchPlacePinString;
this.ZIndex = 4;
}

View File

@@ -8,6 +8,18 @@
//-----------------------------------------------------------------------
namespace CampusAppWP8.Pages.Campusmap
{
using CampusAppWP8.File.Places;
using CampusAppWP8.Model.Campusmap.Map;
using CampusAppWP8.Model.Campusmap.Pin;
using CampusAppWP8.Model.GeoDb;
using CampusAppWP8.Resources;
using CampusAppWP8.Utility;
using CampusAppWP8.Utility.Lui.MessageBoxes;
using CampusAppWP8.Utility.NDEF;
using CampusAppWPortalLib8.Model.Campusmap.Pin;
using CampusAppWPortalLib8.Model.Utility;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using System;
using System.Collections.Generic;
using System.Device.Location;
@@ -19,15 +31,6 @@ namespace CampusAppWP8.Pages.Campusmap
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Navigation;
using CampusAppWP8.File.Places;
using CampusAppWP8.Model.Campusmap;
using CampusAppWP8.Model.GeoDb;
using CampusAppWP8.Resources;
using CampusAppWP8.Utility;
using CampusAppWP8.Utility.Lui.MessageBoxes;
using CampusAppWP8.Utility.NDEF;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using Windows.Networking.Proximity;
/// <summary> Class for the campusMap page. </summary>
@@ -623,7 +626,7 @@ namespace CampusAppWP8.Pages.Campusmap
/// </param>
private void AddPin(double x, double y, MapPinModel.PinType type, bool scroll = true, List<PlaceWp8Model> assocPlaces = null)
{
Point scrollPoint = this.campusMap.GetScrollPoint(this.campusMap.ConverToPixelPoint(this.campusMap.ConverToMapPoint(x, y)));
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));
MapScroller.UpdateLayout();

View File

@@ -23,6 +23,9 @@ namespace CampusAppWP8.Pages.Campusmap
using CampusAppWP8.Utility.Lui.MessageBoxes;
using CampusAppWPortalLib8.Model.Utility;
using Microsoft.Phone.Controls;
using CampusAppWP8.Model.Campusmap.Map;
using CampusAppWP8.Model.Campusmap.Pin;
using CampusAppWPortalLib8.Model.Campusmap.Pin;
/// <summary> Class of the RoomListPage. </summary>
/// <remarks> Stubbfel, 14.10.2013. </remarks>
@@ -43,10 +46,10 @@ namespace CampusAppWP8.Pages.Campusmap
private bool pinchRun = false;
/// <summary> The MapPoint. </summary>
private Point mappoint;
private MapPoint mappoint;
/// <summary> The offset point. </summary>
private Point offsetPoint;
private MapPoint offsetPoint;
/// <summary> The layer list picker. </summary>
private ListPickerItemListModel layerListPicker;
@@ -153,8 +156,9 @@ namespace CampusAppWP8.Pages.Campusmap
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);
MapPoint roompoint = this.buildingMap.GetScrollPoint(this.buildingMap.ConverToPixelPoint(this.buildingMap.ConverToMapPoint(x, y)));
MapPoint viewPoint = roompoint - mappoint + offsetPoint;
MapCanvas.Children.Add(this.buildingMap.AddPin(viewPoint, MapPinModel.PinType.InfoRedPlace, new List<PlaceWp8Model> { room }));
}
@@ -298,8 +302,8 @@ namespace CampusAppWP8.Pages.Campusmap
{
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);
MapPoint roompoint = this.buildingMap.GetScrollPoint(this.buildingMap.ConverToPixelPoint(this.buildingMap.ConverToMapPoint(x, y)));
MapPoint viewPoint = roompoint - mappoint + offsetPoint;
MapPinModel.PinType type;
@@ -324,7 +328,7 @@ namespace CampusAppWP8.Pages.Campusmap
MapCanvas.Children.Add(this.buildingMap.AddPin(viewPoint, type, new List<PlaceWp8Model> { room }));
}
// MapCanvas.Children.Add(this.buildingMap.AddPin(offsetPoint, MapPinModel.PinType.SearchPlace));
// MapCanvas.Children.Add(this.buildingMap.AddPin(offsetPoint, MapPinModel.PinType.SearchPlace));
}
/// <summary> Shows the layer places. </summary>
@@ -350,7 +354,7 @@ namespace CampusAppWP8.Pages.Campusmap
double y = this.building.Building.GeoRefPoint.Latitude;
double x = this.building.Building.GeoRefPoint.Longitude;
this.mappoint = this.buildingMap.GetScrollPoint(this.buildingMap.ConverToPixelPoint(this.buildingMap.ConverToMapPoint(x, y)));
this.offsetPoint = new Point(-this.buildingMap.MapImageOffsetX, -this.buildingMap.MapImageOffsetY);
this.offsetPoint = -this.buildingMap.MapImageOffsetPoint;// new Point(-this.buildingMap.MapImageOffsetX, -this.buildingMap.MapImageOffsetY);
this.MapCanvas.DataContext = this.buildingMap;

View File

@@ -528,9 +528,6 @@
<data name="PathCampusmap_RoomListPage" xml:space="preserve">
<value>/Pages/Campusmap/RoomListPage.xaml</value>
</data>
<data name="PisInformationName_Layer" xml:space="preserve">
<value>Ebene</value>
</data>
<data name="PisInformationName_Accesbility" xml:space="preserve">
<value>Barrierefreiheit</value>
</data>

View File

@@ -1131,15 +1131,6 @@ namespace CampusAppWP8.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 Name ähnelt.
/// </summary>

View File

@@ -18,28 +18,15 @@ namespace CampusAppWP8.Utility
using CampusAppWP8.Resources;
using CampusAppWPortalLib8.Model;
using CampusAppWPortalLib8.Model.Settings;
using CampusAppWPortalLib8.Model.Utility;
using CampusAppWPortalLib8.Utility;
using Microsoft.Phone.Net.NetworkInformation;
using CampusAppWPortalLib8.Model.Campusmap.Map;
/// <summary> Collection of utility functions. </summary>
/// <remarks> Stubbfel, 14.10.2013. </remarks>
public static class Utilities
{
#region member
/// <summary> The north campus of cottbus. </summary>
private static GeoCoordinate northCB = new GeoCoordinate(51.77670359509875,14.293908825617);
/// <summary> The middle campus of cottbus. </summary>
private static GeoCoordinate midCB = new GeoCoordinate(51.76737987049448,14.324056352976152);
/// <summary> The south campus of cottbus. </summary>
private static GeoCoordinate southCB = new GeoCoordinate(51.72668339740452,14.319497377197282);
/// <summary> The middle campus of senftenberg. </summary>
private static GeoCoordinate midSFB = new GeoCoordinate(51.522217168257356,13.986618441187698);
#endregion
#region Enums
/// <summary> Comparison types. </summary>
@@ -416,16 +403,18 @@ namespace CampusAppWP8.Utility
return result;
}
Point currentPoint = new Point(log, lat);
MapPoint currentPoint = new MapPoint(log, lat);
MapPoint tmpCampus = CampusMapPoints.NorthCB;
double minDistance = Utilities.CalcDistance(currentPoint, new Point(Utilities.northCB.Longitude, Utilities.northCB.Latitude));
double minDistance = MapPoint.CalcDistance(currentPoint, tmpCampus);
if (minDistance < 0.01)
{
result = Campus.CB_NORTH;
}
double tmpDistance = Utilities.CalcDistance(currentPoint, new Point(Utilities.midCB.Longitude, Utilities.midCB.Latitude));
tmpCampus = CampusMapPoints.MidCB;
double tmpDistance = MapPoint.CalcDistance(currentPoint, tmpCampus);
if (tmpDistance < 0.01 && tmpDistance < minDistance)
{
@@ -433,16 +422,16 @@ namespace CampusAppWP8.Utility
result = Campus.CB_MAIN;
}
tmpDistance = Utilities.CalcDistance(currentPoint, new Point(Utilities.southCB.Longitude, Utilities.southCB.Latitude));
tmpCampus = CampusMapPoints.SouthCB;
tmpDistance = MapPoint.CalcDistance(currentPoint, tmpCampus);
if (tmpDistance < 0.01 && tmpDistance < minDistance)
{
minDistance = tmpDistance;
result = Campus.CB_SOUTH;
}
tmpDistance = Utilities.CalcDistance(currentPoint, new Point(Utilities.midSFB.Longitude, Utilities.midSFB.Latitude));
tmpCampus = CampusMapPoints.MidSFB;
tmpDistance = MapPoint.CalcDistance(currentPoint, tmpCampus);
if (tmpDistance < 0.01 && tmpDistance < minDistance)
{
minDistance = tmpDistance;
@@ -452,19 +441,6 @@ namespace CampusAppWP8.Utility
return result;
}
/// <summary> Calculates the distance. </summary>
/// <remarks> Stubbfel, 14.10.2013. </remarks>
/// <param name="src"> the source point. </param>
/// <param name="dst"> the destination Point. </param>
/// <returns> The calculated distance. </returns>
public static double CalcDistance(Point src, Point dst)
{
double xPow = Math.Pow(dst.X - src.X, 2);
double yPow = Math.Pow(dst.Y - src.Y, 2);
double result = Math.Sqrt(xPow + yPow);
return Math.Sqrt(Math.Pow(dst.X - src.X, 2) + Math.Pow(dst.Y - src.Y, 2));
}
#endregion
}
}

View File

@@ -33,6 +33,9 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Compile Include="Model\Campusmap\Maps\CampusMapPoints.cs" />
<Compile Include="Model\Campusmap\Maps\MapModel.cs" />
<Compile Include="Model\Campusmap\Pins\MapPinModel.cs" />
<Compile Include="Model\Departments\ChairModel.cs" />
<Compile Include="Model\Departments\DepartmentModel.cs" />
<Compile Include="Model\Departments\FacultyModel.cs" />
@@ -80,6 +83,7 @@
<Compile Include="Model\Utility\DegreeListPickerItemListModel.cs" />
<Compile Include="Model\Utility\ListPickerItemListModel.cs" />
<Compile Include="Model\Utility\ListPickerItemModel.cs" />
<Compile Include="Model\Utility\MapPoint.cs" />
<Compile Include="Model\Utility\RoleListPickerItemListModel.cs" />
<Compile Include="Model\Utility\SemesterListPickerItemListModel.cs">
<ExcludeFromStyleCop>True</ExcludeFromStyleCop>
@@ -119,6 +123,7 @@
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.

View File

@@ -0,0 +1,52 @@
using CampusAppWPortalLib8.Model.Utility;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CampusAppWPortalLib8.Model.Campusmap.Map
{
public class CampusMapPoints
{
#region member
/// <summary> The north campus of cottbus. </summary>
private static MapPoint northCB = new MapPoint(14.293908825617, 51.77670359509875);
/// <summary> The middle campus of cottbus. </summary>
private static MapPoint midCB = new MapPoint(14.324056352976152,51.76737987049448);
/// <summary> The south campus of cottbus. </summary>
private static MapPoint southCB = new MapPoint(14.319497377197282,51.72668339740452);
/// <summary> The middle campus of senftenberg. </summary>
private static MapPoint midSFB = new MapPoint(13.986618441187698,51.522217168257356);
#endregion
#region porperty
public static MapPoint MidSFB
{
get { return CampusMapPoints.midSFB; }
}
public static MapPoint SouthCB
{
get { return CampusMapPoints.southCB; }
}
public static MapPoint MidCB
{
get { return CampusMapPoints.midCB; }
}
public static MapPoint NorthCB
{
get { return CampusMapPoints.northCB; }
}
#endregion
}
}

View File

@@ -0,0 +1,174 @@
//-----------------------------------------------------------------------
// <copyright file="MapModel.cs" company="BTU/IIT">
// The MIT License (MIT). Copyright (c) 2013 BTU/IIT.
// </copyright>
// <author>Stubbfel</author>
// <date>14.10.2013</date>
// <summary>Implements the map model class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWPortalLib8.Model.Campusmap.Map
{
using CampusAppWPortalLib8.Model.GeoDb;
using CampusAppWPortalLib8.Model.Utility;
using System.Collections.Generic;
/// <summary> This Class manage the properties of a Map. </summary>
/// <remarks> Stubbfel, 14.10.2013. </remarks>
public class MapModel<T, V>
where V : PlaceModel
where T : SpsModel<V>, new()
{
#region Constructors
/// <summary> Initializes a new instance of the <see cref="MapModel" /> class. </summary>
/// <remarks> Stubbfel, 14.10.2013. </remarks>
public MapModel()
{
this.IsReady = false;
}
/// <summary> Initializes a new instance of the <see cref="MapModel" /> class. </summary>
/// <remarks> Stubbfel, 14.10.2013. </remarks>
/// <param name="placeList"> list of places. </param>
public MapModel(List<V> placeList)
{
this.IsReady = false;
this.LoadSpatials(placeList);
this.IsReady = true;
}
#endregion
#region Property
/// <summary> Gets or sets a value indicating whether the map is ready or not. </summary>
/// <value> true if this object is ready, false if not. </value>
public bool IsReady { get; protected set; }
/// <summary> Gets or sets the ImageSource of the map. </summary>
/// <value> The image source. </value>
public string ImageSource { get; set; }
/// <summary> Gets or sets the ImageWidth of the map. </summary>
/// <value> The width of the image. </value>
public double ImageWidth { get; set; }
/// <summary> Gets or sets the ImageHeight of the map. </summary>
/// <value> The height of the image. </value>
public double ImageHeight { get; set; }
/// <summary> Gets or sets the ImageOffsetX of the map. </summary>
/// <value> The map image offset x coordinate. </value>
public MapPoint MapImageOffsetPoint { get; set; }
/// <summary> Gets or sets the GeoOffsetX of the map. </summary>
/// <value> The geo offset x coordinate. </value>
public MapPoint GeoOffsetPoint { get; set; }
/// <summary> Gets or sets the Scale (to pixel) of the map. </summary>
/// <value> The scale x coordinate. </value>
public MapPoint ScalePoint { get; set; }
/// <summary> Gets or sets the spatial of the map. </summary>
/// <value> The spatial. </value>
public T Spatial { get; set; }
/// <summary> Gets or sets the reference point. </summary>
/// <value> The reference point. </value>
public MapPoint RefPoint { get; set; }
public MapPoint MapRefPoint
{
get
{
return this.MapImageOffsetPoint + this.RefPoint;
}
}
#endregion
#region Methods
#region public
/// <summary> Gets scroll point. </summary>
/// <remarks> Stubbfel, 21.10.2013. </remarks>
/// <param name="point"> The point. </param>
/// <returns> The scroll point. </returns>
public MapPoint GetScrollPoint(MapPoint point)
{
MapPoint result = this.MapRefPoint;
result.X += point.X;
result.Y -= point.Y;
return result;
}
/// <summary> Gets scroll point. </summary>
/// <remarks> Stubbfel, 21.10.2013. </remarks>
/// <param name="x"> The x coordinate. </param>
/// <param name="y"> The y coordinate. </param>
/// <returns> The scroll point. </returns>
public MapPoint GetScrollPoint(double x, double y)
{
return this.GetScrollPoint(new MapPoint(x, y));
}
/// <summary> Convert a coordinates to coordinates which address pixels. </summary>
/// <remarks> Stubbfel, 27.08.2013. </remarks>
/// <param name="x"> the x-coordinate. </param>
/// <param name="y"> the y-coordinate. </param>
/// <returns> Point in pixel-size. </returns>
public MapPoint ConverToPixelPoint(double x, double y)
{
return this.ConverToPixelPoint(new MapPoint(x,y));
}
/// <summary> Convert a coordinates to coordinates which address pixels. </summary>
/// <remarks> Stubbfel, 14.10.2013. </remarks>
/// <param name="point"> not scaled point. </param>
/// <returns> Point in pixel-size. </returns>
public MapPoint ConverToPixelPoint(MapPoint point)
{
return point * this.ScalePoint;
}
/// <summary> Convert a coordinates to coordinates which address mapPoint. </summary>
/// <remarks> Stubbfel, 14.10.2013. </remarks>
/// <param name="x"> the x-coordinate. </param>
/// <param name="y"> the y-coordinate. </param>
/// <returns> Point in pixel-size. </returns>
public MapPoint ConverToMapPoint(double x, double y)
{
return this.ConverToMapPoint(new MapPoint(x, y));
}
/// <summary> Convert a coordinates to coordinates which address mapPoint. </summary>
/// <remarks> Stubbfel, 14.10.2013. </remarks>
/// <param name="point"> not scaled point. </param>
/// <returns> Point in pixel-size. </returns>
public MapPoint ConverToMapPoint(MapPoint point)
{
MapPoint result = point - this.GeoOffsetPoint;
return result;
}
#endregion
#region protected
/// <summary> Loads the spatial object </summary>
/// <remarks> Stubbfel, 19.08.2013. </remarks>
/// <param name="placeList"> list of places. </param>
protected virtual void LoadSpatials(List<V> placeList)
{
this.Spatial = new T();
this.Spatial.AddPlaces(placeList);
}
#endregion
#endregion
}
}

View File

@@ -6,11 +6,10 @@
// <date>14.10.2013</date>
// <summary>Implements the map pin model class</summary>
//-----------------------------------------------------------------------
namespace CampusAppWP8.Model.Campusmap
namespace CampusAppWPortalLib8.Model.Campusmap.Pin
{
using System.Windows;
using System.Windows.Input;
using CampusAppWP8.Resources;
using CampusAppWPortalLib8.Model.Utility;
using CampusAppWPortalLib8.Resources;
/// <summary> This Class manage the properties of a MapPin. </summary>
/// <remarks> Stubbfel, 14.10.2013. </remarks>
@@ -43,7 +42,7 @@ namespace CampusAppWP8.Model.Campusmap
private static string infoRedPlacePinString = MapPinModel.PinTypeToString(PinType.InfoRedPlace);
/// <summary> Variable of the actual position of the pin. </summary>
private Point position;
private MapPoint position;
#endregion
@@ -163,17 +162,19 @@ namespace CampusAppWP8.Model.Campusmap
/// <value> The z coordinate index. </value>
public int ZIndex { get; set; }
/// <summary> Gets or sets the ImageOffsetX of the pin. </summary>
/// <value> The pin image offset x coordinate. </value>
public double PinImageOffsetX { get; set; }
/// <summary> Gets or sets the pin image offset point. </summary>
/// <value> The pin image offset point. </value>
public MapPoint PinImageOffsetPoint { get; set; }
/// <summary> Gets or sets the ImageOffsetY of the pin. </summary>
/// <value> The pin image offset y coordinate. </value>
public double PinImageOffsetY { get; set; }
/// <summary> Gets or sets the tag of the pin. </summary>
/// <value> The tag. </value>
public object Tag { get; set; }
#region Property
/// <summary> Gets or sets position of the pin. </summary>
/// <value> The position. </value>
public Point Position
public MapPoint Position
{
get
{
@@ -194,24 +195,15 @@ namespace CampusAppWP8.Model.Campusmap
return;
}
// check the x-value
if (value.X + this.PinImageOffsetX != this.position.X)
MapPoint newPoint = value + this.PinImageOffsetPoint;
if (!newPoint.Equals(this.position))
{
this.position.X = value.X + this.PinImageOffsetX;
}
// check the y-value
if (value.Y + this.PinImageOffsetY != this.position.Y)
{
this.position.Y = value.Y + this.PinImageOffsetY;
this.position = newPoint;
}
}
}
/// <summary> Gets or sets the tag of the pin. </summary>
/// <value> The tag. </value>
public object Tag { get; set; }
#endregion
#endregion
#region Method

View File

@@ -0,0 +1,78 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CampusAppWPortalLib8.Model.Utility
{
public class MapPoint : IEquatable<MapPoint>
{
#region Constructor
public MapPoint(double x, double y)
{
this.X = x;
this.Y = y;
}
#endregion
#region property
public double X { get; set; }
public double Y { get; set; }
#endregion
#region method
public static MapPoint operator +(MapPoint mp1, MapPoint mp2)
{
return new MapPoint(mp1.X + mp2.X, mp1.Y + mp2.Y);
}
public static MapPoint operator -(MapPoint mp1, MapPoint mp2)
{
return new MapPoint(mp1.X - mp2.X, mp1.Y - mp2.Y);
}
public static MapPoint operator -(MapPoint mp1)
{
return new MapPoint(-mp1.X, -mp1.Y);
}
public static MapPoint operator *(MapPoint mp1, MapPoint mp2)
{
return new MapPoint(mp1.X * mp2.X, mp1.Y * mp2.Y);
}
public static MapPoint operator /(MapPoint mp1, MapPoint mp2)
{
return new MapPoint(mp1.X / mp2.X, mp1.Y / mp2.Y);
}
public bool Equals(MapPoint other)
{
if (other != null && this.X == other.X && this.Y == other.Y)
{
return true;
}
return false;
}
public static double CalcDistance(MapPoint src, MapPoint dst)
{
MapPoint subPoint = dst - src;
subPoint *= subPoint;
double result = Math.Sqrt(subPoint.X + subPoint.Y);
return result;
}
#endregion
}
}

View File

@@ -129,6 +129,30 @@
<data name="PathNews_NewsIndexPage" xml:space="preserve">
<value>/Pages/News/NewsIndexPage.xaml</value>
</data>
<data name="PinType_CurrentPosition" xml:space="preserve">
<value>CurrentPositionPin</value>
</data>
<data name="PinType_Hidden" xml:space="preserve">
<value>HiddenPin</value>
</data>
<data name="PinType_Info" xml:space="preserve">
<value>InfoPin</value>
</data>
<data name="PinType_InfoAccess" xml:space="preserve">
<value>InfoAccesPin</value>
</data>
<data name="PinType_InfoLab" xml:space="preserve">
<value>InfoLabPin</value>
</data>
<data name="PinType_InfoRed" xml:space="preserve">
<value>InfoRedPin</value>
</data>
<data name="PinType_InfoWC" xml:space="preserve">
<value>InfoWCPin</value>
</data>
<data name="PinType_Search" xml:space="preserve">
<value>SearchPin</value>
</data>
<data name="PisInformationName_Layer" xml:space="preserve">
<value>Ebene</value>
</data>

View File

@@ -97,6 +97,78 @@ namespace CampusAppWPortalLib8.Resources {
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die CurrentPositionPin ähnelt.
/// </summary>
public static string PinType_CurrentPosition {
get {
return ResourceManager.GetString("PinType_CurrentPosition", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die HiddenPin ähnelt.
/// </summary>
public static string PinType_Hidden {
get {
return ResourceManager.GetString("PinType_Hidden", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die InfoPin ähnelt.
/// </summary>
public static string PinType_Info {
get {
return ResourceManager.GetString("PinType_Info", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die InfoAccesPin ähnelt.
/// </summary>
public static string PinType_InfoAccess {
get {
return ResourceManager.GetString("PinType_InfoAccess", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die InfoLabPin ähnelt.
/// </summary>
public static string PinType_InfoLab {
get {
return ResourceManager.GetString("PinType_InfoLab", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die InfoRedPin ähnelt.
/// </summary>
public static string PinType_InfoRed {
get {
return ResourceManager.GetString("PinType_InfoRed", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die InfoWCPin ähnelt.
/// </summary>
public static string PinType_InfoWC {
get {
return ResourceManager.GetString("PinType_InfoWC", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die SearchPin ähnelt.
/// </summary>
public static string PinType_Search {
get {
return ResourceManager.GetString("PinType_Search", resourceCulture);
}
}
/// <summary>
/// Sucht eine lokalisierte Zeichenfolge, die Ebene ähnelt.
/// </summary>