finish day2
This commit is contained in:
BIN
CampusAppWP8/CampusAppWP8/Assets/testmzg.png
Normal file
BIN
CampusAppWP8/CampusAppWP8/Assets/testmzg.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 99 KiB |
@@ -113,6 +113,7 @@
|
||||
<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" />
|
||||
@@ -507,6 +508,7 @@
|
||||
<Content Include="Assets\Lens.Screen-WVGA.png" />
|
||||
<Content Include="Assets\Lens.Screen-WXGA.png" />
|
||||
<Content Include="Assets\testmap.png" />
|
||||
<Content Include="Assets\testmzg.png" />
|
||||
<Content Include="Assets\Tiles\FlipCycleTileLarge.png">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
@@ -525,6 +527,7 @@
|
||||
<Content Include="Assets\Tiles\kachel_large.png" />
|
||||
<Content Include="Assets\Tiles\kachel_medium.png" />
|
||||
<Content Include="Assets\Tiles\kachel_small.png" />
|
||||
<Content Include="File\Campusmap\BuildingsMaps.xml" />
|
||||
<Content Include="File\Campusmap\Offlinemap.xml">
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
|
||||
17
CampusAppWP8/CampusAppWP8/File/Campusmap/BuildingsMaps.xml
Normal file
17
CampusAppWP8/CampusAppWP8/File/Campusmap/BuildingsMaps.xml
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<root>
|
||||
<place id="122" parentId="1" refpoint="POINT(14.321714914733889 51.76608468494122)">
|
||||
<placeInformation placeInformationName="Kurzbeschreibung">Das Mehrzweckgebäude ist Sitz verschiedener Lehrsühle der BTU u.a. des Lehrstuhls Kraftwerkstechnik und des Lehrstuhls Industrielle Informationstechnik.</placeInformation>
|
||||
<placeInformation placeInformationName="Kurzname">MZG</placeInformation>
|
||||
<placeInformation placeInformationName="Name">Mehrzweckgebäude</placeInformation>
|
||||
<placeInformation placeInformationName="Typ">Mehrzweck</placeInformation>
|
||||
<placeInformation placeInformationName="ImageSource">/Assets/testmzg.png</placeInformation>
|
||||
<placeInformation placeInformationName="ImageWidth">480</placeInformation>
|
||||
<placeInformation placeInformationName="ImageHeight">781</placeInformation>
|
||||
<placeInformation placeInformationName="MapImageOffsetX">-288</placeInformation>
|
||||
<placeInformation placeInformationName="MapImageOffsetY">-390</placeInformation>
|
||||
<placeInformation placeInformationName="MapRefPoint">Point(260 380)</placeInformation>
|
||||
<placeInformation placeInformationName="ScaleX">517932</placeInformation>
|
||||
<placeInformation placeInformationName="ScaleY">790594</placeInformation>
|
||||
</place>
|
||||
</root>
|
||||
@@ -0,0 +1,80 @@
|
||||
using CampusAppWP8.Model.GeoDb;
|
||||
using CampusAppWP8.Resources;
|
||||
using CampusAppWPortalLib8.Utility;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace CampusAppWP8.Model.Campusmap
|
||||
{
|
||||
public class BuildingMapModel : MapModel
|
||||
{
|
||||
public BuildingMapModel(string id)
|
||||
{
|
||||
SpsModel buildings = XmlManager.DeserializationFileToModel<SpsModel>(Constants.FileMap_BuildingsMap);
|
||||
PlaceModel building = buildings.GetPlaceById(id);
|
||||
if (buildings == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.ImageSource = building.GetInformationsValue("ImageSource");
|
||||
double tmpVal;
|
||||
if (double.TryParse(building.GetInformationsValue("ImageWidth"), NumberStyles.Number, CultureInfo.InvariantCulture, out tmpVal))
|
||||
{
|
||||
this.ImageWidth = tmpVal;
|
||||
}
|
||||
|
||||
if (double.TryParse(building.GetInformationsValue("ImageHeight"), NumberStyles.Number, CultureInfo.InvariantCulture, out tmpVal))
|
||||
{
|
||||
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(')');
|
||||
string[] coord = pointString.Split(' ');
|
||||
if (coord == null || coord.Length != 2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
double x;
|
||||
double 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);
|
||||
|
||||
if (double.TryParse(building.GetInformationsValue("ScaleX"), NumberStyles.Number, CultureInfo.InvariantCulture, out tmpVal))
|
||||
{
|
||||
this.ScaleX = tmpVal;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -44,24 +44,6 @@ 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
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,21 +16,12 @@ namespace CampusAppWP8.Model.Campusmap
|
||||
/// <summary>
|
||||
/// Class for the MapModel of the mainCampus of cottbus
|
||||
/// </summary>
|
||||
public class CBMainMapRoomModel : CBMainMapModel
|
||||
public class CBMainMapRoomModel
|
||||
{
|
||||
#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
|
||||
|
||||
@@ -7,24 +7,31 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:lui="clr-namespace:CampusAppWP8.Utility.Lui.Button"
|
||||
mc:Ignorable="d"
|
||||
xmlns:header="clr-namespace:CampusAppWP8.Utility.Lui.Header"
|
||||
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||
Foreground="{StaticResource PhoneForegroundBrush}"
|
||||
SupportedOrientations="Portrait" Orientation="Portrait"
|
||||
SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
|
||||
mc:Ignorable="d"
|
||||
shell:SystemTray.IsVisible="True">
|
||||
|
||||
<!--LayoutRoot ist das Stammraster, in dem alle anderen Seiteninhalte platziert werden-->
|
||||
<Grid x:Name="LayoutRoot" Background="Transparent">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"></RowDefinition>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<!--Pivotsteuerelement-->
|
||||
<ViewportControl Grid.Row="0" VerticalAlignment="Top" HorizontalAlignment="Left" Height="800" Width="480">
|
||||
<Canvas Name="MapCanvas" Height="8000" Width=" 8000" VerticalAlignment="Top" HorizontalAlignment="Left">
|
||||
<StackPanel Grid.Row="0">
|
||||
<ProgressBar Name="ProgressBar" Visibility="Collapsed" IsIndeterminate="True"/>
|
||||
<header:DefaultHeader HeaderName="{Binding Path=LocalizedResources.ExaminationApp_Header, Source={StaticResource LocalizedStrings}}"/>
|
||||
</StackPanel>
|
||||
<ViewportControl Name="VPC" Grid.Row="1" VerticalAlignment="Top" HorizontalAlignment="Left" Height="653" Width="480" Bounds="0,0,480,800">
|
||||
<Canvas Name="MapCanvas" Height="800" Width="480" VerticalAlignment="Top" HorizontalAlignment="Left" ManipulationDelta="MapCanvas_ManipulationDelta" ManipulationStarted="MapCanvas_ManipulationStarted" ManipulationCompleted="MapCanvas_ManipulationCompleted" Margin="-200">
|
||||
<Image Name="imgMap" Height="{Binding ImageHeigh}" Width="{Binding ImageWidth}" Source="{Binding ImageSource}" HorizontalAlignment="Left" VerticalAlignment="Top" >
|
||||
</Image>
|
||||
|
||||
<Canvas.RenderTransform>
|
||||
<ScaleTransform/>
|
||||
</Canvas.RenderTransform>
|
||||
</Canvas>
|
||||
</ViewportControl>
|
||||
</Grid>
|
||||
|
||||
@@ -21,6 +21,8 @@ namespace CampusAppWP8.Pages.Campusmap
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using CampusAppWP8.Utility;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
|
||||
/// <summary>
|
||||
/// Class of the RoomListPage
|
||||
@@ -39,7 +41,9 @@ namespace CampusAppWP8.Pages.Campusmap
|
||||
private CampusBuildingModel building;
|
||||
|
||||
/// <summary>Variable for the map model.</summary>
|
||||
private CampusMapModel campusMap;
|
||||
private BuildingMapModel buildingMap;
|
||||
|
||||
private bool pinchRun = false;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -50,8 +54,8 @@ namespace CampusAppWP8.Pages.Campusmap
|
||||
public RoomListPage()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
this.campusMap = new CBMainMapRoomModel();
|
||||
this.campusMap.ShowMapInfos += new CBMainMapModel.MapInfos(this.ShowMapInfo);
|
||||
this.buildingMap = new BuildingMapModel("122");
|
||||
this.buildingMap.ShowMapInfos += new CBMainMapModel.MapInfos(this.ShowMapInfo);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -112,24 +116,24 @@ namespace CampusAppWP8.Pages.Campusmap
|
||||
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)));
|
||||
Point mappoint = this.buildingMap.GetScrollPoint(this.buildingMap.ConverToPixelPoint(this.buildingMap.ConverToMapPoint(x, y)));
|
||||
|
||||
this.MapCanvas.DataContext = campusMap;
|
||||
this.MapCanvas.DataContext = buildingMap;
|
||||
|
||||
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));
|
||||
Point offsetPoint = new Point(-this.buildingMap.MapImageOffsetX, -this.buildingMap.MapImageOffsetY);
|
||||
// MapCanvas.Children.Add(this.buildingMap.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 roompoint = this.buildingMap.GetScrollPoint(this.buildingMap.ConverToPixelPoint(this.buildingMap.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}));
|
||||
MapCanvas.Children.Add(this.buildingMap.AddPin(viewPoint, MapPinModel.PinType.InfoPlace, new List<PlaceModel> { room }));
|
||||
}
|
||||
this.LayoutRoot.UpdateLayout();
|
||||
|
||||
@@ -143,11 +147,15 @@ namespace CampusAppWP8.Pages.Campusmap
|
||||
{
|
||||
MessageBoxes.ShowMainModelErrorMessageBox(AppResources.MsgBox_ErrorMainModelLoad);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void ShowMapInfo(List<PlaceModel> places)
|
||||
{
|
||||
if (this.pinchRun)
|
||||
{
|
||||
return;
|
||||
}
|
||||
string msgText = string.Empty;
|
||||
if (places == null)
|
||||
{
|
||||
@@ -227,8 +235,52 @@ namespace CampusAppWP8.Pages.Campusmap
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
private void MapCanvas_ManipulationDelta(object sender, System.Windows.Input.ManipulationDeltaEventArgs e)
|
||||
{
|
||||
PinchManipulation pinch = e.PinchManipulation;
|
||||
if (pinch == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ScaleTransform scale = MapCanvas.RenderTransform as ScaleTransform;
|
||||
|
||||
if (scale == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
double scaleVal = pinch.CumulativeScale;
|
||||
if (scaleVal < 1)
|
||||
{
|
||||
|
||||
scaleVal = 1;
|
||||
}
|
||||
|
||||
scale.ScaleX = scaleVal;
|
||||
scale.ScaleY = scaleVal;
|
||||
|
||||
|
||||
|
||||
var newCenter = e.PinchManipulation.Current.Center;
|
||||
scale.CenterX = newCenter.X;
|
||||
scale.CenterY = newCenter.Y;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void MapCanvas_ManipulationStarted(object sender, ManipulationStartedEventArgs e)
|
||||
{
|
||||
this.pinchRun = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
private void MapCanvas_ManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
|
||||
{
|
||||
this.pinchRun = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -558,4 +558,7 @@
|
||||
<data name="ParamName" xml:space="preserve">
|
||||
<value>name</value>
|
||||
</data>
|
||||
<data name="FileMap_BuildingsMap" xml:space="preserve">
|
||||
<value>File/Campusmap/BuildingsMaps.xml</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -285,6 +285,15 @@ namespace CampusAppWP8.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die File/Campusmap/BuildingsMaps.xml ähnelt.
|
||||
/// </summary>
|
||||
public static string FileMap_BuildingsMap {
|
||||
get {
|
||||
return ResourceManager.GetString("FileMap_BuildingsMap", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sucht eine lokalisierte Zeichenfolge, die /Assets/campusmap.png ähnelt.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user