Merge branch 'release/#51' into develmaster
This commit is contained in:
BIN
CampusAppWP8/CampusAppWP8/Assets/testmap.png
Normal file
BIN
CampusAppWP8/CampusAppWP8/Assets/testmap.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
@@ -97,6 +97,8 @@
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="LocalizedStrings.cs" />
|
||||
<Compile Include="Model\Campusmap\MapModel.cs" />
|
||||
<Compile Include="Model\Campusmap\MapPinModel.cs" />
|
||||
<Compile Include="Model\Departments\ChairModel.cs" />
|
||||
<Compile Include="Model\Departments\DepartmentModel.cs" />
|
||||
<Compile Include="Model\Departments\DepartmentViewModel.cs" />
|
||||
@@ -289,6 +291,7 @@
|
||||
<Content Include="Assets\Icons\LightTheme\student_council_159.png" />
|
||||
<Content Include="Assets\Icons\DarkTheme\webmail_159.png" />
|
||||
<Content Include="Assets\Icons\LightTheme\webmail_159.png" />
|
||||
<Content Include="Assets\testmap.png" />
|
||||
<Content Include="Assets\Tiles\FlipCycleTileLarge.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
||||
177
CampusAppWP8/CampusAppWP8/Model/Campusmap/MapModel.cs
Normal file
177
CampusAppWP8/CampusAppWP8/Model/Campusmap/MapModel.cs
Normal file
@@ -0,0 +1,177 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="MapModel.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>24.06.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Model.Campusmap
|
||||
{
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
/// <summary>
|
||||
/// This Class manage the properties of a Map
|
||||
/// </summary>
|
||||
public class MapModel
|
||||
{
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MapModel" /> class.
|
||||
/// </summary>
|
||||
public MapModel()
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Property
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ImageSource of the map
|
||||
/// </summary>
|
||||
public string ImageSource { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ImageWidth of the map
|
||||
/// </summary>
|
||||
public double ImageWidth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ImageHeight of the map
|
||||
/// </summary>
|
||||
public double ImageHeight { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ImageOffsetX of the map
|
||||
/// </summary>
|
||||
public double MapImageOffsetX { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ImageOffsetY of the map
|
||||
/// </summary>
|
||||
public double MapImageOffsetY { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the GeoOffsetX of the map
|
||||
/// </summary>
|
||||
public double GeoOffsetX { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the GeoOffsetY of the map
|
||||
/// </summary>
|
||||
public double GeoOffsetY { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Scale (to pixel) of the map
|
||||
/// </summary>
|
||||
public double Scale { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the reference point
|
||||
/// </summary>
|
||||
public Point RefPoint { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// Method calculate the coordinates of ScrollToOffsets point
|
||||
/// </summary>
|
||||
/// <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>
|
||||
/// <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)
|
||||
{
|
||||
Point position = new Point(x, y);
|
||||
return this.AddPin(position);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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)
|
||||
{
|
||||
Point position = new Point(this.RefPoint.X + x, this.RefPoint.Y - y);
|
||||
return this.AddPin(position);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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)
|
||||
{
|
||||
return this.AddPinFromRefPoint(position.X, position.Y);
|
||||
}
|
||||
|
||||
/// <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)
|
||||
{
|
||||
MapPinModel pin = new MapPinModel() { Position = position };
|
||||
Image pinImg = new Image() { Source = new BitmapImage(new Uri(pin.ImageSource, UriKind.Relative)), Width = pin.ImageWidth };
|
||||
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>
|
||||
public Point ConverToPixelPoint(double x, double y)
|
||||
{
|
||||
return new Point { X = this.Scale * x, Y = this.Scale * y };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert a coordinates to coordinates which address pixels
|
||||
/// </summary>
|
||||
/// <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);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
106
CampusAppWP8/CampusAppWP8/Model/Campusmap/MapPinModel.cs
Normal file
106
CampusAppWP8/CampusAppWP8/Model/Campusmap/MapPinModel.cs
Normal file
@@ -0,0 +1,106 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="MapPinModel.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>24.06.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Model.Campusmap
|
||||
{
|
||||
using System.Windows;
|
||||
|
||||
/// <summary>
|
||||
/// This Class manage the properties of a MapPin
|
||||
/// </summary>
|
||||
public class MapPinModel
|
||||
{
|
||||
#region Member
|
||||
|
||||
/// <summary>
|
||||
/// Variable of the actual position of the pin
|
||||
/// </summary>
|
||||
private Point position;
|
||||
|
||||
#endregion
|
||||
#region Constructor
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MapPinModel" /> class.
|
||||
/// </summary>
|
||||
public MapPinModel()
|
||||
{
|
||||
this.ImageSource = "/Assets/icons/search_159_light.png";
|
||||
this.ImageWidth = 60;
|
||||
this.ImageHeight = 60;
|
||||
this.PinImageOffsetX = -24;
|
||||
this.PinImageOffsetY = -24;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Property
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ImageSource of the pin
|
||||
/// </summary>
|
||||
public string ImageSource { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ImageWidth of the pin
|
||||
/// </summary>
|
||||
public double ImageWidth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ImageHeight of the pin
|
||||
/// </summary>
|
||||
public double ImageHeight { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ImageOffsetX of the pin
|
||||
/// </summary>
|
||||
public double PinImageOffsetX { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the ImageOffsetY of the pin
|
||||
/// </summary>
|
||||
public double PinImageOffsetY { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets position of the pin
|
||||
/// </summary>
|
||||
public Point Position
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.position;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
// null assert
|
||||
if (value == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.position == null)
|
||||
{
|
||||
this.position = value;
|
||||
return;
|
||||
}
|
||||
|
||||
// check the x-value
|
||||
if (value.X + this.PinImageOffsetX != this.position.X)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -35,17 +35,25 @@
|
||||
<Grid Grid.Row="0">
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBox Grid.Column="0" />
|
||||
<Image Grid.Column="1" Source="/Toolkit.Content/ApplicationBar.Check.png" />
|
||||
<TextBox Name="XPoint" Grid.Column="0" Text="0" />
|
||||
<TextBox Name="YPoint" Grid.Column="1" Text="0"/>
|
||||
<Button Grid.Column="2" Click="Button_Click">
|
||||
<Image Source="{Binding Path=ThemelizedIcon.Search, Source={StaticResource ThemelizedIcons}}" Width="60"/>
|
||||
</Button>
|
||||
</Grid>
|
||||
<Controls:Map Grid.Row="1" ZoomLevel="16">
|
||||
<Controls:Map.Center>
|
||||
<Location:GeoCoordinate Altitude="NaN" Course="NaN" HorizontalAccuracy="NaN" Longitude="14.3242" Latitude="51.7662" Speed="NaN" VerticalAccuracy="NaN"/>
|
||||
</Controls:Map.Center>
|
||||
</Controls:Map>
|
||||
<ScrollViewer Name="MapScroller" Grid.Row="1" HorizontalScrollBarVisibility="Auto" RenderTransformOrigin="0,0">
|
||||
<Canvas Name="MapCanvas" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto" Height="{Binding ImageHeight}" Width="{Binding ImageWidth}">
|
||||
<Canvas.Background>
|
||||
<ImageBrush Stretch="Fill" ImageSource="{Binding ImageSource}">
|
||||
|
||||
</ImageBrush>
|
||||
</Canvas.Background>
|
||||
</Canvas>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
|
||||
@@ -7,18 +7,45 @@ using System.Windows.Controls;
|
||||
using System.Windows.Navigation;
|
||||
using Microsoft.Phone.Controls;
|
||||
using Microsoft.Phone.Shell;
|
||||
using System.Windows.Media;
|
||||
using CampusAppWP8.Model.Campusmap;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace CampusAppWP8.Pages.Campusmap
|
||||
{
|
||||
public partial class CampusMapPage : PhoneApplicationPage
|
||||
{
|
||||
private MapModel map;
|
||||
public CampusMapPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.map = new MapModel() { ImageSource = "/Assets/testmap.png", ImageWidth = 2000, ImageHeight = 2000, MapImageOffsetX = -228, MapImageOffsetY = -300, RefPoint = new Point(1000, 1000), Scale = 20};
|
||||
this.MapCanvas.DataContext = map;
|
||||
|
||||
}
|
||||
|
||||
private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Methods overrides the OnNavigatedTo-Method
|
||||
/// </summary>
|
||||
/// <param name="e">some NavigationEventArgs</param>
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
base.OnNavigatedTo(e);
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MapCanvas.Children.Clear();
|
||||
Point scrollPoint = map.GetScrollPoint(map.ConverToPixelPoint(double.Parse(XPoint.Text), double.Parse(YPoint.Text)));
|
||||
MapCanvas.Children.Add(map.AddPinFromRefPoint(map.ConverToPixelPoint(double.Parse(XPoint.Text), double.Parse(YPoint.Text))));
|
||||
|
||||
MapScroller.ScrollToVerticalOffset(scrollPoint.Y);
|
||||
MapScroller.ScrollToHorizontalOffset(scrollPoint.X);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -159,8 +159,7 @@
|
||||
</Border>
|
||||
<Border BorderBrush="{StaticResource PhoneBorderBrush}" BorderThickness="0,2,0,0" Grid.Row="5">
|
||||
<Button Name="SearchButton" Click="SendRequest">
|
||||
<Image Name="SearchButtonImg" Source="/Assets/icons/search_159_light.png" Width="100">
|
||||
</Image>
|
||||
<Image Name="SearchButtonImg" Source="{Binding Path=ThemelizedIcon.Search, Source={StaticResource ThemelizedIcons}}" Width="100" />
|
||||
</Button>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
@@ -50,10 +50,6 @@ namespace CampusAppWP8.Pages.Lecture
|
||||
this.InitializeComponent();
|
||||
this.LoadPageModel();
|
||||
this.SetupListPickers();
|
||||
if ((Visibility)Application.Current.Resources["PhoneDarkThemeVisibility"] == Visibility.Visible)
|
||||
{
|
||||
this.SearchButtonImg.Source = new BitmapImage(new Uri("/Assets/icons/search_159_dark.png", UriKind.Relative));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user