new roomlist

This commit is contained in:
stubbfel
2013-10-08 10:24:36 +02:00
parent 3869bbda5b
commit cefe681199
7 changed files with 148 additions and 28 deletions

View File

@@ -119,6 +119,7 @@
<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\SearchPlacePinModel.cs" />
<Compile Include="Model\Exams\ExamListWp8Model.cs" />
<Compile Include="Model\Exams\ExamWp8Model.cs" />

View File

@@ -44,6 +44,20 @@ namespace CampusAppWP8.Model.Campusmap
this.GeoOffsetY = 51.766548;
}
public CBMainMapModel()
{
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;
}
#endregion
#region Method

View File

@@ -0,0 +1,40 @@
//-----------------------------------------------------------------------------
// <copyright file="CBMainMapModel.cs" company="BTU/IIT">
// Company copyright tag.
// </copyright>
// <author>stubbfel</author>
// <sience>13.08.2013</sience>
//-----------------------------------------------------------------------------
namespace CampusAppWP8.Model.Campusmap
{
using System.Windows;
using CampusAppWP8.File.Places;
using CampusAppWP8.Model.GeoDb;
using CampusAppWP8.Resources;
using System.Collections.Generic;
/// <summary>
/// Class for the MapModel of the mainCampus of cottbus
/// </summary>
public class CBMainMapRoomModel : CBMainMapModel
{
#region Constructor
public CBMainMapRoomModel()
{
this.ImageSource = Constants.FileMap_CBMainMap;
this.ImageWidth = 4000;
this.ImageHeight = 2850;
this.MapImageOffsetX = 48;
this.MapImageOffsetY = 0;
this.RefPoint = new Point(2430, 1600);
this.ScaleX = 258966.8246445498;
this.ScaleY = 395297.7838532146;
this.GeoOffsetX = 14.327159;
this.GeoOffsetY = 51.766548;
}
#endregion
}
}

View File

@@ -30,6 +30,10 @@ namespace CampusAppWP8.Model.Campusmap
this.IsReady = true;
}
public CampusMapModel()
{
}
#endregion
#region property

View File

@@ -692,6 +692,11 @@ namespace CampusAppWP8.Pages.Campusmap
/// <param name="places">List of places</param>
private void ShowMapInfo(List<PlaceModel> places)
{
if (places == null)
{
return;
}
string msgText = string.Empty;
foreach (PlaceModel place in places)
{

View File

@@ -16,33 +16,17 @@
<!--LayoutRoot ist das Stammraster, in dem alle anderen Seiteninhalte platziert werden-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<!--Pivotsteuerelement-->
<phone:Pivot Name="RoomPivot" Title="{Binding LocalizedResources.CampusMapApp_Title, Source={StaticResource LocalizedStrings}}">
<phone:Pivot.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding Key}" />
</DataTemplate>
</phone:Pivot.HeaderTemplate>
<phone:Pivot.ItemTemplate>
<DataTemplate>
<ListBox ItemsSource="{Binding Value.Rooms.Places}">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<lui:GoToMapButton SearchTerm="{Binding PlaceId}" Style="{StaticResource ListButtonStyle}">
<TextBlock Text="{Binding Caption}"/>
</lui:GoToMapButton>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</DataTemplate>
</phone:Pivot.ItemTemplate>
</phone:Pivot>
<ViewportControl Grid.Row="0" VerticalAlignment="Top" HorizontalAlignment="Left" Height="800" Width="480">
<Canvas Name="MapCanvas" Height="8000" Width=" 8000" VerticalAlignment="Top" HorizontalAlignment="Left">
<Image Name="imgMap" Height="{Binding ImageHeigh}" Width="{Binding ImageWidth}" Source="{Binding ImageSource}" HorizontalAlignment="Left" VerticalAlignment="Top" >
</Image>
</Canvas>
</ViewportControl>
</Grid>
</phone:PhoneApplicationPage>

View File

@@ -17,6 +17,10 @@ namespace CampusAppWP8.Pages.Campusmap
using CampusAppWP8.Resources;
using Microsoft.Phone.Controls;
using CampusAppWP8.Utility.Lui.MessageBoxes;
using CampusAppWP8.Model.Campusmap;
using System.Windows;
using System.Windows.Controls;
using CampusAppWP8.Utility;
/// <summary>
/// Class of the RoomListPage
@@ -34,6 +38,9 @@ namespace CampusAppWP8.Pages.Campusmap
/// </summary>
private CampusBuildingModel building;
/// <summary>Variable for the map model.</summary>
private CampusMapModel campusMap;
#endregion
#region Constructor
@@ -43,6 +50,8 @@ namespace CampusAppWP8.Pages.Campusmap
public RoomListPage()
{
this.InitializeComponent();
this.campusMap = new CBMainMapRoomModel();
this.campusMap.ShowMapInfos += new CBMainMapModel.MapInfos(this.ShowMapInfo);
}
#endregion
@@ -100,8 +109,30 @@ namespace CampusAppWP8.Pages.Campusmap
if (this.building != null && this.building.Layers != null && this.building.Layers.Count > 0)
{
this.SetCaptionsToRooms();
this.RoomPivot.ItemsSource = this.GetSortedLayers(this.building);
Dictionary<string, CampusBuildingLayerModel> layers = this.GetSortedLayers(this.building);
double y = this.building.Building.GeoRefPoint.Latitude;
double x = this.building.Building.GeoRefPoint.Longitude;
Point mappoint = this.campusMap.GetScrollPoint(this.campusMap.ConverToPixelPoint(this.campusMap.ConverToMapPoint(x, y)));
this.MapCanvas.DataContext = campusMap;
Canvas.SetLeft(this.imgMap, -1 * mappoint.X);
Canvas.SetTop(this.imgMap, -1 * mappoint.Y);
Canvas.SetZIndex(this.imgMap, 0);
Point offsetPoint = new Point(240, 0);
MapCanvas.Children.Add(this.campusMap.AddPin(offsetPoint, MapPinModel.PinType.SearchPlace));
CampusBuildingLayerModel layer = layers.Values.ToList()[0];
foreach (PlaceModel room in layer.Rooms.Places)
{
x = room.GeoRefPoint.Longitude;
y = room.GeoRefPoint.Latitude;
Point roompoint = this.campusMap.GetScrollPoint(this.campusMap.ConverToPixelPoint(this.campusMap.ConverToMapPoint(x, y)));
Point viewPoint = new Point(roompoint.X - mappoint.X + offsetPoint.X, roompoint.Y - mappoint.Y + offsetPoint.Y);
MapCanvas.Children.Add(this.campusMap.AddPin(viewPoint, MapPinModel.PinType.InfoPlace, new List<PlaceModel>{room}));
}
this.LayoutRoot.UpdateLayout();
}
else
{
@@ -115,6 +146,47 @@ namespace CampusAppWP8.Pages.Campusmap
}
private void ShowMapInfo(List<PlaceModel> places)
{
string msgText = string.Empty;
if (places == null)
{
return;
}
foreach (PlaceModel place in places)
{
msgText += AppResources.PlaceLabel_Name + ": ";
msgText += place.GetInformationsValue(Constants.PisInformationName_Name);
msgText = Wp8StringManager.AddNewLine(msgText);
string type = place.GetInformationsValue(Constants.PisInformationName_Typ);
if (type != null)
{
msgText += AppResources.PlaceLabel_Type + ": ";
msgText += type;
msgText = Wp8StringManager.AddNewLine(msgText);
}
string shortDesc = place.GetInformationsValue(Constants.PisInformationName_ShortDesc);
if (shortDesc != null)
{
msgText += AppResources.PlaceLabel_ShortDesc + ": ";
msgText += shortDesc;
msgText = Wp8StringManager.AddNewLine(msgText);
}
string access = place.GetInformationsValue(Constants.PisInformationName_Accesbility);
if (access != null)
{
msgText += AppResources.PlaceLabel_Accessbility + ": ";
msgText += access;
msgText = Wp8StringManager.AddNewLine(msgText);
}
}
MessageBoxes.ShowMainModelInfoMessageBox(msgText);
}
/// <summary>
/// Method sorts the Layers
/// </summary>