Merge branch 'feature/#176' into develop

This commit is contained in:
stubbfel
2013-08-27 14:12:08 +02:00
15 changed files with 215 additions and 50 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

View File

@@ -105,6 +105,9 @@
<Compile Include="Feed\Mensa\MensaFeedCBNorth.cs" />
<Compile Include="Feed\Mensa\MensaFeedCBMain.cs" />
<Compile Include="Model\Campusmap\CBMainMapModel.cs" />
<Compile Include="Model\Campusmap\CurrentPositionPinModel.cs" />
<Compile Include="Model\Campusmap\HiddenPinPlaceModel.cs" />
<Compile Include="Model\Campusmap\SearchPlacePinModel.cs" />
<Compile Include="Model\GeoDb\PlaceInformation.cs" />
<Compile Include="Model\GeoDb\PlaceModel.cs" />
<Compile Include="Model\GeoDb\PlaceService.cs" />
@@ -391,15 +394,18 @@
<Content Include="Assets\Icons\DarkTheme\add_159.png" />
<Content Include="Assets\Icons\DarkTheme\btulogo_159.png" />
<Content Include="Assets\Icons\DarkTheme\campus_159.png" />
<Content Include="Assets\Icons\DarkTheme\current_position_159.png" />
<Content Include="Assets\Icons\DarkTheme\delete_159.png" />
<Content Include="Assets\Icons\DarkTheme\favorite_159.png" />
<Content Include="Assets\Icons\DarkTheme\info_159.png" />
<Content Include="Assets\Icons\DarkTheme\phone_159.png" />
<Content Include="Assets\Icons\DarkTheme\search_place_159.png" />
<Content Include="Assets\Icons\DarkTheme\update_159.png" />
<Content Include="Assets\Icons\LightTheme\add_159.png" />
<Content Include="Assets\Icons\LightTheme\btulogo_159.png" />
<Content Include="Assets\Icons\LightTheme\campus_159.png" />
<Content Include="Assets\Icons\DarkTheme\departments_159.png" />
<Content Include="Assets\Icons\LightTheme\current_position_159.png" />
<Content Include="Assets\Icons\LightTheme\delete_159.png" />
<Content Include="Assets\Icons\LightTheme\departments_159.png" />
<Content Include="Assets\Icons\DarkTheme\homework_159.png" />
@@ -422,6 +428,7 @@
<Content Include="Assets\Icons\DarkTheme\search_159.png" />
<Content Include="Assets\Icons\LightTheme\search_159.png" />
<Content Include="Assets\Icons\DarkTheme\student_council_159.png" />
<Content Include="Assets\Icons\LightTheme\search_place_159.png" />
<Content Include="Assets\Icons\LightTheme\student_council_159.png" />
<Content Include="Assets\Icons\DarkTheme\webmail_159.png" />
<Content Include="Assets\Icons\LightTheme\update_159.png" />

View File

@@ -0,0 +1,29 @@
//-----------------------------------------------------------------------
// <copyright file="CurrentPositionPinModel.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>stubbfel</author>
// <sience>27.08.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8.Model.Campusmap
{
using System.Windows;
using CampusAppWP8.Resources;
/// <summary>Current position pin model.</summary>
/// <remarks>Stubbfel, 27.08.2013.</remarks>
public class CurrentPositionPinModel : MapPinModel
{
/// <summary>Initializes a new instance of the CurrentPositionPinModel class.</summary>
/// <remarks>Stubbfel, 27.08.2013.</remarks>
public CurrentPositionPinModel()
{
this.ImageSource = Icons.CurrentPosition;
this.ImageWidth = 60;
this.ImageHeight = 60;
this.PinImageOffsetX = -25;
this.PinImageOffsetY = -34;
}
}
}

View File

@@ -0,0 +1,15 @@
//-----------------------------------------------------------------------------
// <copyright file="HiddenPinPlaceModel.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>fiedlchr</author>
// <sience>13.08.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Model.Campusmap
{
/// <summary>Hidden pin place model.</summary>
/// <remarks>Stubbfel, 27.08.2013.</remarks>
public class HiddenPinPlaceModel : MapPinModel
{
}
}

View File

@@ -114,60 +114,73 @@ namespace CampusAppWP8.Model.Campusmap
return new Point(x, y);
}
/// <summary>
/// Method create in image, which can show at a certain position
/// </summary>
/// <param name="x">the x- coordinate</param>
/// <param name="y">the y-coordinate</param>
/// <returns>image of the pin</returns>
public Image AddPin(double x, double 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>
/// <param name="y"> the y-coordinate.</param>
/// <param name="type">The type.</param>
/// <returns>image of the pin.</returns>
public Image AddPin(double x, double y, MapPinModel.PinType type)
{
Point position = new Point(x, y);
return this.AddPin(position);
return this.AddPin(position, type);
}
/// <summary>
/// Method create in image, which can show at a certain position depend of the <see cref="RefPoint" />
/// Method create in image, which can show at a certain position depend of the
/// <see cref="RefPoint" />
/// </summary>
/// <param name="x">the x-coordinate</param>
/// <param name="y">the y-coordinate</param>
/// <returns>image of the pin</returns>
public Image AddPinFromRefPoint(double x, double y)
/// <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>
/// <returns>image of the pin.</returns>
public Image AddPinFromRefPoint(double x, double y, MapPinModel.PinType type)
{
Point position = new Point(this.RefPoint.X + x, this.RefPoint.Y - y);
return this.AddPin(position);
return this.AddPin(position, type);
}
/// <summary>
/// Method create in image, which can show at a certain position depend of the <see cref="RefPoint" />
/// Method create in image, which can show at a certain position depend of the
/// <see cref="RefPoint" />
/// </summary>
/// <param name="position">input point</param>
/// <returns>image of the pin</returns>
public Image AddPinFromRefPoint(Point position)
/// <remarks>Stubbfel, 27.08.2013.</remarks>
/// <param name="position">input point.</param>
/// <param name="type"> The type.</param>
/// <returns>image of the pin.</returns>
public Image AddPinFromRefPoint(Point position, MapPinModel.PinType type)
{
return this.AddPinFromRefPoint(position.X, position.Y);
return this.AddPinFromRefPoint(position.X, position.Y, type);
}
/// <summary>
/// Method create in image, which can show at a certain position
/// </summary>
/// <param name="position">input point</param>
/// <returns>image of the pin</returns>
public Image AddPin(Point position)
/// <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>
/// <returns>image of the pin.</returns>
public Image AddPin(Point position, MapPinModel.PinType type)
{
MapPinModel pin = new MapPinModel() { Position = position };
Image pinImg = new Image() { Source = new BitmapImage(new Uri(pin.ImageSource, UriKind.Relative)), Width = pin.ImageWidth };
MapPinModel pin = this.CreatePin(type);
pin.Position = position;
Image pinImg = new Image();
if (pin.ImageSource != null)
{
pinImg.Source = new BitmapImage(new Uri(pin.ImageSource, UriKind.Relative));
pinImg.Width = pin.ImageWidth;
pinImg.Height = pin.ImageHeight;
}
Canvas.SetTop(pinImg, pin.Position.Y);
Canvas.SetLeft(pinImg, pin.Position.X);
return pinImg;
}
/// <summary>
/// Convert a coordinates to coordinates which address pixels
/// </summary>
/// <param name="x">the x-coordinate</param>
/// <param name="y">the y-coordinate</param>
/// <returns>Point in pixel-size</returns>
/// <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 };
@@ -210,6 +223,29 @@ namespace CampusAppWP8.Model.Campusmap
protected virtual void LoadSpatials()
{
}
/// <summary>Creates a pin.</summary>
/// <remarks>Stubbfel, 27.08.2013.</remarks>
/// <param name="type">The type.</param>
/// <returns>The new pin.</returns>
private MapPinModel CreatePin(MapPinModel.PinType type)
{
MapPinModel pin;
switch (type)
{
case MapPinModel.PinType.CurrentPosition:
pin = new CurrentPositionPinModel();
break;
case MapPinModel.PinType.SearchPlace:
pin = new SearchPlacePinModel();
break;
default:
pin = new HiddenPinPlaceModel();
break;
}
return pin;
}
#endregion
}
}

View File

@@ -8,12 +8,11 @@
namespace CampusAppWP8.Model.Campusmap
{
using System.Windows;
using CampusAppWP8.Resources;
/// <summary>
/// This Class manage the properties of a MapPin
/// </summary>
public class MapPinModel
public abstract class MapPinModel
{
#region Member
@@ -30,15 +29,26 @@ namespace CampusAppWP8.Model.Campusmap
/// </summary>
public MapPinModel()
{
this.ImageSource = Icons.Search;
this.ImageWidth = 60;
this.ImageHeight = 60;
this.PinImageOffsetX = -25;
this.PinImageOffsetY = -27;
}
#endregion
#region enums
/// <summary>Values that represent PinType.</summary>
/// <remarks>Stubbfel, 27.08.2013.</remarks>
public enum PinType
{
/// <summary>An enum constant representing the hidden option.</summary>
Hidden = 0,
/// <summary>An enum constant representing the search place option.</summary>
SearchPlace = 1,
/// <summary>An enum constant representing the current position option.</summary>
CurrentPosition = 2
}
#endregion
#region Property
/// <summary>

View File

@@ -0,0 +1,31 @@
//-----------------------------------------------------------------------
// <copyright file="SearchPlacePinModel.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>stubbfel</author>
// <sience>27.08.2013</sience>
//----------------------------------------------------------------------
namespace CampusAppWP8.Model.Campusmap
{
using System.Windows;
using CampusAppWP8.Resources;
/// <summary>Search pin place model.</summary>
/// <remarks>Stubbfel, 27.08.2013.</remarks>
public class SearchPlacePinModel : MapPinModel
{
/// <summary>
/// Initializes a new instance of the <see cref="SearchPlacePinModel" /> class.
/// </summary>
/// <remarks>Stubbfel, 27.08.2013.</remarks>
public SearchPlacePinModel()
{
this.ImageSource = Icons.SearchPlace;
this.ImageWidth = 60;
this.ImageHeight = 60;
this.PinImageOffsetX = -25;
this.PinImageOffsetY = -27;
}
}
}

View File

@@ -46,15 +46,19 @@ namespace CampusAppWP8.Pages.Campusmap
{
MapCanvas.Children.Clear();
string alias = "campus";
bool scroll = true;
string alias = "campus";
if (NavigationContext.QueryString.ContainsKey(Constants.ParamModelMap_SearchTermAlias))
{
alias = NavigationContext.QueryString[Constants.ParamModelMap_SearchTermAlias];
this.AddPins(this.SearchPlaces(alias), MapPinModel.PinType.SearchPlace);
scroll = false;
}
else
{
this.AddPins(this.SearchPlaces(alias), MapPinModel.PinType.Hidden);
}
this.AddPins(this.SearchPlaces(alias));
this.ShowCurrentPositionDispatcher(scroll);
}
}
@@ -82,7 +86,7 @@ namespace CampusAppWP8.Pages.Campusmap
}
MapCanvas.Children.Clear();
this.AddPins(this.SearchPlaces(query));
this.AddPins(this.SearchPlaces(query), MapPinModel.PinType.SearchPlace);
}
/// <summary>Searches for the first places.</summary>
@@ -97,15 +101,16 @@ namespace CampusAppWP8.Pages.Campusmap
/// <summary>Adds the pins.</summary>
/// <remarks>Stubbfel, 19.08.2013.</remarks>
/// <param name="places">The places.</param>
/// <param name="type"> The type.</param>
/// <param name="scroll">(Optional) the scroll.</param>
private void AddPins(List<PlaceModel> places, bool scroll = true)
private void AddPins(List<PlaceModel> places, MapPinModel.PinType type, bool scroll = true)
{
foreach (PlaceModel place in places)
{
GeoCoordinate coor = place.GeoRefPoint;
if (coor != null)
{
this.AddPin(coor.Longitude, coor.Latitude, scroll);
this.AddPin(coor.Longitude, coor.Latitude, type, scroll);
}
}
}
@@ -114,11 +119,12 @@ namespace CampusAppWP8.Pages.Campusmap
/// <remarks>Stubbfel, 19.08.2013.</remarks>
/// <param name="x"> longitude parameter.</param>
/// <param name="y"> latitude parameter.</param>
/// <param name="type"> The type.</param>
/// <param name="scroll">(Optional) the scroll.</param>
private void AddPin(double x, double y, bool scroll = true)
private void AddPin(double x, double y, MapPinModel.PinType type, bool scroll = true)
{
Point scrollPoint = this.map.GetScrollPoint(this.map.ConverToPixelPoint(this.map.ConverToMapPoint(x, y)));
MapCanvas.Children.Add(this.map.AddPinFromRefPoint(this.map.ConverToPixelPoint(this.map.ConverToMapPoint(x, y))));
MapCanvas.Children.Add(this.map.AddPinFromRefPoint(this.map.ConverToPixelPoint(this.map.ConverToMapPoint(x, y)), type));
MapScroller.UpdateLayout();
if (scroll)
@@ -174,15 +180,16 @@ namespace CampusAppWP8.Pages.Campusmap
{
string lat = App.LoadFromAppState<string>(Constants.GeoWatch_CurrentPosition_Lat);
string log = App.LoadFromAppState<string>(Constants.GeoWatch_CurrentPosition_Long);
this.SetPinToPosition(lat, log, scroll);
this.SetPinToPosition(lat, log, MapPinModel.PinType.CurrentPosition, scroll);
}
/// <summary>Sets pin to position.</summary>
/// <remarks>Stubbfel, 27.08.2013.</remarks>
/// <param name="latitude"> The latitude.</param>
/// <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, bool scroll = true)
private void SetPinToPosition(string latitude, string longitude, MapPinModel.PinType type, bool scroll = true)
{
double x;
double y;
@@ -191,7 +198,7 @@ namespace CampusAppWP8.Pages.Campusmap
return;
}
this.AddPin(x, y, scroll);
this.AddPin(x, y, type, scroll);
ProgressBar.Visibility = Visibility.Collapsed;
}
}

View File

@@ -66,6 +66,17 @@ namespace CampusAppWP8.Resources
}
}
/// <summary>
/// Gets the uri string of the CurrentPosition icon.
/// </summary>
public static string CurrentPosition
{
get
{
return Themerize("current_position_159.png");
}
}
/// <summary>
/// Gets the uri string of the Delete icon.
/// </summary>
@@ -264,6 +275,17 @@ namespace CampusAppWP8.Resources
}
}
/// <summary>
/// Gets the uri string of the SearchPlace icon.
/// </summary>
public static string SearchPlace
{
get
{
return Themerize("search_place_159.png");
}
}
/// <summary>
/// Gets the uri string of the StudentCouncil icon.
/// </summary>

View File

@@ -129,6 +129,9 @@
<data name="CowPig" xml:space="preserve">
<value>info_159.png</value>
</data>
<data name="CurrentPosition" xml:space="preserve">
<value>current_position_159.png</value>
</data>
<data name="Delete" xml:space="preserve">
<value>delete_159.png</value>
</data>
@@ -183,6 +186,9 @@
<data name="Search" xml:space="preserve">
<value>search_159.png</value>
</data>
<data name="SearchPlace" xml:space="preserve">
<value>search_place_159.png</value>
</data>
<data name="StudentCouncil" xml:space="preserve">
<value>student_council_159.png</value>
</data>

View File

@@ -1,6 +1,7 @@
<StyleCopSettings Version="105">
<GlobalSettings>
<CollectionProperty Name="RecognizedWords">
<Value>enum</Value>
<Value>Stubbfel</Value>
</CollectionProperty>
</GlobalSettings>

View File

@@ -78,6 +78,7 @@ namespace CampusAppWP8.Utility.Lui.Button
{
urlString += "?" + Constants.ParamModelMap_SearchTermAlias + "=" + this.SearchTerm;
}
Uri url = new Uri(urlString as string, UriKind.Relative);
Page page = App.RootFrame.Content as Page;
page.NavigationService.Navigate(url);