Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 2499 → Rev 2500

/MKLiveView/v1.0/Source/MKLiveView/GMapCustomMarkers/Circle.xaml
0,0 → 1,8
<UserControl x:Class="MKLiveView.GMapCustomMarkers.Circle"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Height="300" Width="300" Background="Transparent">
<Grid>
<Ellipse x:Name="e" Stroke="Red" Opacity="0.44" StrokeThickness="4" />
</Grid>
</UserControl>
/MKLiveView/v1.0/Source/MKLiveView/GMapCustomMarkers/Circle.xaml.cs
0,0 → 1,108
///============================================================================
/// MKLiveView
/// Copyright © 2016 Steph
///
///This file is part of MKLiveView.
///
///MKLiveView is free software: you can redistribute it and/or modify
///it under the terms of the GNU General Public License as published by
///the Free Software Foundation, either version 3 of the License, or
///(at your option) any later version.
///
///MKLiveView is distributed in the hope that it will be useful,
///but WITHOUT ANY WARRANTY; without even the implied warranty of
///MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
///GNU General Public License for more details.
///
///You should have received a copy of the GNU General Public License
///along with cssRcon. If not, see <http://www.gnu.org/licenses/>.
///
///============================================================================
///Credits:
 
/// radioman (http://www.codeplex.com/site/users/view/radioman)
/// for his really GreatMaps! (http://greatmaps.codeplex.com/)
///
/// I made some changes to the source, so You need all files from this project here in order to compile and run
///
/// JOHN C. MACDONALD at Ira A. Fulton College of Engineering and Technology
/// for his MIKROKOPTER SERIAL CONTROL TUTORIAL (http://hdl.lib.byu.edu/1877/2747)
/// and the sourcecode (http://hdl.lib.byu.edu/1877/2748)
/// By his work I finally managed to get the communication with the Mikrokopter controllers to run
/// Some of his code was used in this programm like the SimpelSerialPort class (with lots of changes)
/// and the FilghtControllerMessage class
///
///============================================================================
/// DISCLAIMER
/// ===========
///
/// I created this software with my best knowledge and belief.
///
/// IN NO EVENT, UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING,
/// SHALL I, OR ANY PERSON BE LIABLE FOR ANY LOSS, EXPENSE OR DAMAGE,
/// OF ANY TYPE OR NATURE ARISING OUT OF THE USE OF,
/// OR INABILITY TO USE THIS SOFTWARE OR PROGRAM,
/// INCLUDING, BUT NOT LIMITED TO, CLAIMS, SUITS OR CAUSES OF ACTION
/// INVOLVING ALLEGED INFRINGEMENT OF COPYRIGHTS,
/// PATENTS, TRADEMARKS, TRADE SECRETS, OR UNFAIR COMPETITION.
///
/// This means: use it & have fun (but @ Your own risk...)
/// ===========================================================================
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using GMap.NET;
 
namespace MKLiveView.GMapCustomMarkers
{
/// <summary>
/// Interaction logic for Circle.xaml
/// </summary>
public partial class Circle : UserControl
{
public Circle()
{
InitializeComponent();
}
 
public PointLatLng Center;
public PointLatLng Bound;
public void setColor(string sColor)
{
switch (sColor)
{
case "red":
e.Stroke = new SolidColorBrush(Colors.Red);
break;
case "green":
e.Stroke = new SolidColorBrush(Colors.SpringGreen);
break;
case "blue":
e.Stroke = new SolidColorBrush(Colors.Cyan);
break;
case "yellow":
e.Stroke = new SolidColorBrush(Colors.Yellow);
break;
case "pink":
e.Stroke = new SolidColorBrush(Colors.Magenta);
break;
 
default:
e.Stroke = new SolidColorBrush(Colors.Red);
break;
}
}
}
 
}
/MKLiveView/v1.0/Source/MKLiveView/GMapCustomMarkers/CustomMarkerCopter.xaml
0,0 → 1,130
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ed="http://schemas.microsoft.com/expression/2010/drawing"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Class="MKLiveView.GMapCustomMarkers.CustomMarkerCopter"
mc:Ignorable="d"
Height="55.916" Width="123.182" Opacity="10">
<Grid RenderTransformOrigin="0.5,0.25">
<Grid>
<Grid.Effect>
<DropShadowEffect Direction="37" BlurRadius="3" Opacity="0.695" ShadowDepth="10"/>
</Grid.Effect>
<ed:Arc x:Name="s1" ArcThickness="20" ArcThicknessUnit="Pixel" EndAngle="360" Fill="#FFFF0074" HorizontalAlignment="Left" Height="4" Margin="11.958,12.25,0,0" Stretch="None" Stroke="Black" StrokeThickness="0" StartAngle="0" VerticalAlignment="Top" Width="4"/>
<ed:Arc x:Name="s2" ArcThickness="20" ArcThicknessUnit="Pixel" EndAngle="360" Fill="#FFFF0074" HorizontalAlignment="Left" Margin="11.958,36.292,0,0" Stretch="None" Stroke="Black" StrokeThickness="0" StartAngle="0" Width="4" Height="4" VerticalAlignment="Top"/>
<ed:Arc x:Name="s3" ArcThickness="20" ArcThicknessUnit="Pixel" EndAngle="360" Fill="#FFFF0074" HorizontalAlignment="Left" Height="4" Margin="36,12,0,0" Stretch="None" Stroke="Black" StrokeThickness="0" StartAngle="0" VerticalAlignment="Top" Width="4"/>
<ed:Arc x:Name="s4" ArcThickness="20" ArcThicknessUnit="Pixel" EndAngle="360" Fill="#FFFF0074" HorizontalAlignment="Left" Margin="36.25,36.292,0,0" Stretch="None" Stroke="Black" StrokeThickness="0" StartAngle="0" Width="4" Height="4" VerticalAlignment="Top"/>
<ed:RegularPolygon x:Name="f1" Fill="#FFFF0074" HorizontalAlignment="Left" InnerRadius="0.26" Margin="8,8,0,0" PointCount="4" Stretch="Fill" Stroke="Black" Width="36" RenderTransformOrigin="0.5,0.5" StrokeThickness="0" StrokeStartLineCap="Round" Height="36" VerticalAlignment="Top">
<ed:RegularPolygon.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle="45.403"/>
<TranslateTransform/>
</TransformGroup>
</ed:RegularPolygon.RenderTransform>
</ed:RegularPolygon>
<ed:RegularPolygon x:Name="f2" Fill="#FFFF0074" HorizontalAlignment="Left" InnerRadius="0.8" Margin="17,17,0,0" PointCount="4" Stretch="Fill" Stroke="#FFFF0074" Width="18" RenderTransformOrigin="0.5,0.5" StrokeThickness="0" Height="18" VerticalAlignment="Top">
<ed:RegularPolygon.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle="45"/>
<TranslateTransform/>
</TransformGroup>
</ed:RegularPolygon.RenderTransform>
</ed:RegularPolygon>
<ed:Arc x:Name="s5" ArcThickness="20" ArcThicknessUnit="Pixel" EndAngle="360" HorizontalAlignment="Left" Height="18.375" Margin="4.899,4.977,0,0" StrokeStartLineCap="Round" Stretch="None" Stroke="#FFFF0074" StartAngle="0" VerticalAlignment="Top" Width="18.5">
<ed:Arc.Effect>
<DropShadowEffect Direction="45" ShadowDepth="0"/>
</ed:Arc.Effect>
</ed:Arc>
<ed:Arc x:Name="s7" ArcThickness="20" ArcThicknessUnit="Pixel" EndAngle="360" HorizontalAlignment="Left" Margin="4.899,28.937,0,0" StrokeStartLineCap="Round" Stretch="None" Stroke="#FFFF0074" StartAngle="0" Width="18.5" Height="18.375" VerticalAlignment="Top">
<ed:Arc.Effect>
<DropShadowEffect Direction="45" ShadowDepth="0"/>
</ed:Arc.Effect>
</ed:Arc>
<ed:Arc x:Name="s8" ArcThickness="20" ArcThicknessUnit="Pixel" EndAngle="360" HorizontalAlignment="Left" Margin="28.897,28.937,0,0" StrokeStartLineCap="Round" Stretch="None" Stroke="#FFFF0074" StartAngle="0" Width="18.5" Height="18.375" VerticalAlignment="Top">
<ed:Arc.Effect>
<DropShadowEffect Direction="45" ShadowDepth="0"/>
</ed:Arc.Effect>
</ed:Arc>
<ed:Arc x:Name="s6" ArcThickness="20" ArcThicknessUnit="Pixel" EndAngle="360" HorizontalAlignment="Left" Height="18.375" Margin="28.897,4.977,0,0" StrokeStartLineCap="Round" Stretch="None" Stroke="#FFFF0074" StartAngle="0" VerticalAlignment="Top" Width="18.5">
<ed:Arc.Effect>
<DropShadowEffect Direction="45" ShadowDepth="0"/>
</ed:Arc.Effect>
</ed:Arc>
<Ellipse x:Name="f3" Fill="#FFFF0074" HorizontalAlignment="Left" Height="2" Margin="30,13,0,0" StrokeEndLineCap="Round" Stroke="Black" StrokeThickness="0" VerticalAlignment="Top" Width="16" RenderTransformOrigin="0.5,0.5">
<Ellipse.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle="46.114"/>
<TranslateTransform/>
</TransformGroup>
</Ellipse.RenderTransform>
</Ellipse>
<Ellipse x:Name="f4" Fill="#FFFF0074" HorizontalAlignment="Left" Height="2" Margin="6,37,0,0" StrokeEndLineCap="Round" Stroke="Black" StrokeThickness="0" VerticalAlignment="Top" Width="16" RenderTransformOrigin="0.5,0.5">
<Ellipse.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle="46.114"/>
<TranslateTransform/>
</TransformGroup>
</Ellipse.RenderTransform>
</Ellipse>
<Ellipse x:Name="f5" Fill="#FFFF0074" HorizontalAlignment="Left" Height="2" Margin="6,13,0,0" StrokeEndLineCap="Round" Stroke="Black" StrokeThickness="0" VerticalAlignment="Top" Width="16" RenderTransformOrigin="0.5,0.5">
<Ellipse.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle="-43.724"/>
<TranslateTransform/>
</TransformGroup>
</Ellipse.RenderTransform>
</Ellipse>
<Ellipse x:Name="f6" Fill="#FFFF0074" HorizontalAlignment="Left" Height="2" Margin="30,37,0,0" StrokeEndLineCap="Round" Stroke="Black" StrokeThickness="0" VerticalAlignment="Top" Width="16" RenderTransformOrigin="0.5,0.5">
<Ellipse.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle="-43.724"/>
<TranslateTransform/>
</TransformGroup>
</Ellipse.RenderTransform>
</Ellipse>
<ed:RegularPolygon x:Name="f7" Fill="#FFFB0072" HorizontalAlignment="Left" Margin="23,2,0,0" PointCount="4" Stretch="Fill" Stroke="#FFFDFDFD" Width="6" RenderTransformOrigin="0.495,1.011" Height="24" VerticalAlignment="Top" StrokeThickness="0">
<ed:RegularPolygon.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform x:Name="Rotate1" Angle="1"/>
<TranslateTransform/>
</TransformGroup>
</ed:RegularPolygon.RenderTransform>
<ed:RegularPolygon.Effect>
<DropShadowEffect Direction="0" ShadowDepth="0" BlurRadius="4"/>
</ed:RegularPolygon.Effect>
</ed:RegularPolygon>
</Grid>
<Image Name="icon" Source="CopterRed.png" HorizontalAlignment="Left" Width="56" Height="33" VerticalAlignment="Top" Stretch="UniformToFill" Margin="12,12,0,0" Visibility="Hidden" />
<Label x:Name="lbl" Content="Label" Margin="50,8,0,0" VerticalAlignment="Top" FontSize="10" Height="33" Foreground="White" HorizontalAlignment="Left" Width="73" Padding="0">
<Label.Effect>
<DropShadowEffect Direction="45" ShadowDepth="0.5" BlurRadius="2"/>
</Label.Effect>
</Label>
<Image x:Name="heading" Height="21" VerticalAlignment="Top" HorizontalAlignment="Left" Width="13" RenderTransformOrigin="0.5,1" Source="CopterHeadingPink.png" Margin="20,5,0,0" Visibility="Collapsed">
<Image.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform x:Name="Rotate" Angle="1"/>
<TranslateTransform X="-0.18" Y="0.84"/>
</TransformGroup>
</Image.RenderTransform>
</Image>
</Grid>
</UserControl>
/MKLiveView/v1.0/Source/MKLiveView/GMapCustomMarkers/CustomMarkerCopter.xaml.cs
0,0 → 1,251
///============================================================================
/// MKLiveView
/// Copyright © 2016 Steph
///
///This file is part of MKLiveView.
///
///MKLiveView is free software: you can redistribute it and/or modify
///it under the terms of the GNU General Public License as published by
///the Free Software Foundation, either version 3 of the License, or
///(at your option) any later version.
///
///MKLiveView is distributed in the hope that it will be useful,
///but WITHOUT ANY WARRANTY; without even the implied warranty of
///MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
///GNU General Public License for more details.
///
///You should have received a copy of the GNU General Public License
///along with cssRcon. If not, see <http://www.gnu.org/licenses/>.
///
///============================================================================
///Credits:
 
/// radioman (http://www.codeplex.com/site/users/view/radioman)
/// for his really GreatMaps! (http://greatmaps.codeplex.com/)
///
/// I made some changes to the source, so You need all files from this project here in order to compile and run
///
/// JOHN C. MACDONALD at Ira A. Fulton College of Engineering and Technology
/// for his MIKROKOPTER SERIAL CONTROL TUTORIAL (http://hdl.lib.byu.edu/1877/2747)
/// and the sourcecode (http://hdl.lib.byu.edu/1877/2748)
/// By his work I finally managed to get the communication with the Mikrokopter controllers to run
/// Some of his code was used in this programm like the SimpelSerialPort class (with lots of changes)
/// and the FilghtControllerMessage class
///
///============================================================================
/// DISCLAIMER
/// ===========
///
/// I created this software with my best knowledge and belief.
///
/// IN NO EVENT, UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING,
/// SHALL I, OR ANY PERSON BE LIABLE FOR ANY LOSS, EXPENSE OR DAMAGE,
/// OF ANY TYPE OR NATURE ARISING OUT OF THE USE OF,
/// OR INABILITY TO USE THIS SOFTWARE OR PROGRAM,
/// INCLUDING, BUT NOT LIMITED TO, CLAIMS, SUITS OR CAUSES OF ACTION
/// INVOLVING ALLEGED INFRINGEMENT OF COPYRIGHTS,
/// PATENTS, TRADEMARKS, TRADE SECRETS, OR UNFAIR COMPETITION.
///
/// This means: use it & have fun (but @ Your own risk...)
/// ===========================================================================
 
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Media;
using GMap.NET.WindowsPresentation;
using System.Diagnostics;
 
namespace MKLiveView.GMapCustomMarkers
{
/// <summary>
/// Interaction logic for CustomMarkerCopter.xaml
/// </summary>
public partial class CustomMarkerCopter
{
//Popup Popup;
//Label Label;
GMapMarker Marker;
MainWindow MainWindow;
 
public CustomMarkerCopter(MainWindow window, GMapMarker marker, string title, string sColor)
{
this.InitializeComponent();
 
this.MainWindow = window;
this.Marker = marker;
 
//Popup = new Popup();
//Label = new Label();
 
this.Unloaded += new RoutedEventHandler(CustomMarkerCopter_Unloaded);
this.Loaded += new RoutedEventHandler(CustomMarkerCopter_Loaded);
this.SizeChanged += new SizeChangedEventHandler(CustomMarkerCopter_SizeChanged);
//this.MouseEnter += new MouseEventHandler(MarkerControl_MouseEnter);
//this.MouseLeave += new MouseEventHandler(MarkerControl_MouseLeave);
//this.MouseMove += new MouseEventHandler(CustomMarkerCopter_MouseMove);
//this.MouseLeftButtonUp += new MouseButtonEventHandler(CustomMarkerCopter_MouseLeftButtonUp);
//this.MouseLeftButtonDown += new MouseButtonEventHandler(CustomMarkerCopter_MouseLeftButtonDown);
 
//Popup.Placement = PlacementMode.Mouse;
//{
// Label.Background = Brushes.Blue;
// Label.Foreground = Brushes.White;
// Label.BorderBrush = Brushes.WhiteSmoke;
// Label.BorderThickness = new Thickness(2);
// Label.Padding = new Thickness(5);
// Label.FontSize = 22;
// Label.Content = title;
//}
//Popup.Child = Label;
lbl.Content = title;
}
void CustomMarkerCopter_Loaded(object sender, RoutedEventArgs e)
{
//if (icon.Source.CanFreeze)
//{
// icon.Source.Freeze();
//}
}
 
void CustomMarkerCopter_Unloaded(object sender, RoutedEventArgs e)
{
this.Unloaded -= new RoutedEventHandler(CustomMarkerCopter_Unloaded);
this.Loaded -= new RoutedEventHandler(CustomMarkerCopter_Loaded);
this.SizeChanged -= new SizeChangedEventHandler(CustomMarkerCopter_SizeChanged);
//this.MouseEnter -= new MouseEventHandler(MarkerControl_MouseEnter);
//this.MouseLeave -= new MouseEventHandler(MarkerControl_MouseLeave);
//this.MouseMove -= new MouseEventHandler(CustomMarkerCopter_MouseMove);
//this.MouseLeftButtonUp -= new MouseButtonEventHandler(CustomMarkerCopter_MouseLeftButtonUp);
//this.MouseLeftButtonDown -= new MouseButtonEventHandler(CustomMarkerCopter_MouseLeftButtonDown);
 
Marker.Shape = null;
//icon.Source = null;
//icon = null;
//Popup = null;
//Label = null;
}
public double rotate
{
set { Rotate1.Angle = value; }
get { return Rotate1.Angle; }
}
 
public void setText(string s)
{
lbl.Content = s;
}
public void setCopterColor(string sColor)
{
switch (sColor)
{
case "red":
s1.Stroke = s2.Stroke = s3.Stroke = s4.Stroke = s5.Stroke = s6.Stroke = s7.Stroke = s8.Stroke =
f1.Fill = f2.Fill = f3.Fill = f4.Fill = f5.Fill = f6.Fill = new SolidColorBrush(Colors.Red);
// icon.Source = new System.Windows.Media.Imaging.BitmapImage(new System.Uri("CopterRed.png", System.UriKind.Relative));
break;
case "green":
s1.Stroke = s2.Stroke = s3.Stroke = s4.Stroke = s5.Stroke = s6.Stroke = s7.Stroke = s8.Stroke =
f1.Fill = f2.Fill = f3.Fill = f4.Fill = f5.Fill = f6.Fill = new SolidColorBrush(Colors.SpringGreen);
// icon.Source = new System.Windows.Media.Imaging.BitmapImage(new System.Uri("CopterGreen.png", System.UriKind.Relative));
break;
case "blue":
// icon.Source = new System.Windows.Media.Imaging.BitmapImage(new System.Uri("CopterBlue.png", System.UriKind.Relative));
s1.Stroke = s2.Stroke = s3.Stroke = s4.Stroke = s5.Stroke = s6.Stroke = s7.Stroke = s8.Stroke =
f1.Fill = f2.Fill = f3.Fill = f4.Fill = f5.Fill = f6.Fill = new SolidColorBrush(Colors.Cyan);
break;
case "yellow":
// icon.Source = new System.Windows.Media.Imaging.BitmapImage(new System.Uri("CopterYellow.png", System.UriKind.Relative));
s1.Stroke = s2.Stroke = s3.Stroke = s4.Stroke = s5.Stroke = s6.Stroke = s7.Stroke = s8.Stroke =
f1.Fill = f2.Fill = f3.Fill = f4.Fill = f5.Fill = f6.Fill = new SolidColorBrush(Colors.Yellow);
break;
case "pink":
// icon.Source = new System.Windows.Media.Imaging.BitmapImage(new System.Uri("CopterPink.png", System.UriKind.Relative));
s1.Stroke = s2.Stroke = s3.Stroke = s4.Stroke = s5.Stroke = s6.Stroke = s7.Stroke = s8.Stroke =
f1.Fill = f2.Fill = f3.Fill = f4.Fill = f5.Fill = f6.Fill = new SolidColorBrush(Colors.Magenta);
break;
 
default:
s1.Stroke = s2.Stroke = s3.Stroke = s4.Stroke = s5.Stroke = s6.Stroke = s7.Stroke = s8.Stroke =
f1.Fill = f2.Fill = f3.Fill = f4.Fill = f5.Fill = f6.Fill = new SolidColorBrush(Colors.Red);
// icon.Source = new System.Windows.Media.Imaging.BitmapImage(new System.Uri("CopterRed.png", System.UriKind.Relative));
break;
}
}
public void setHeadingColor(string sColor)
{
switch (sColor)
{
case "red":
f7.Fill = new SolidColorBrush(Colors.Red);
// heading.Source = new System.Windows.Media.Imaging.BitmapImage(new System.Uri("CopterHeadingRed.png", System.UriKind.Relative));
break;
case "green":
f7.Fill = new SolidColorBrush(Colors.SpringGreen);
// heading.Source = new System.Windows.Media.Imaging.BitmapImage(new System.Uri("CopterHeadingGreen.png", System.UriKind.Relative));
break;
case "blue":
f7.Fill = new SolidColorBrush(Colors.Cyan);
// heading.Source = new System.Windows.Media.Imaging.BitmapImage(new System.Uri("CopterHeadingBlue.png", System.UriKind.Relative));
break;
case "yellow":
f7.Fill = new SolidColorBrush(Colors.Yellow);
// heading.Source = new System.Windows.Media.Imaging.BitmapImage(new System.Uri("CopterHeadingYellow.png", System.UriKind.Relative));
break;
case "pink":
f7.Fill = new SolidColorBrush(Colors.Magenta);
// heading.Source = new System.Windows.Media.Imaging.BitmapImage(new System.Uri("CopterHeadingPink.png", System.UriKind.Relative));
break;
 
default:
f7.Fill = new SolidColorBrush(Colors.Red);
// heading.Source = new System.Windows.Media.Imaging.BitmapImage(new System.Uri("CopterHeadingRed.png", System.UriKind.Relative));
break;
}
}
void CustomMarkerCopter_SizeChanged(object sender, SizeChangedEventArgs e)
{
// Marker.Offset = new Point(-e.NewSize.Width / 4, -e.NewSize.Height /2);
}
 
void CustomMarkerCopter_MouseMove(object sender, MouseEventArgs e)
{
if (e.LeftButton == MouseButtonState.Pressed && IsMouseCaptured)
{
Point p = e.GetPosition(MainWindow.MainMap);
Marker.Position = MainWindow.MainMap.FromLocalToLatLng((int)(p.X), (int)(p.Y));
}
}
 
void CustomMarkerCopter_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
if (!IsMouseCaptured)
{
Mouse.Capture(this);
}
}
 
void CustomMarkerCopter_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
if (IsMouseCaptured)
{
Mouse.Capture(null);
}
}
 
void MarkerControl_MouseLeave(object sender, MouseEventArgs e)
{
Marker.ZIndex -= 10000;
//Popup.IsOpen = false;
}
 
void MarkerControl_MouseEnter(object sender, MouseEventArgs e)
{
Marker.ZIndex += 10000;
//Popup.IsOpen = true;
}
 
}
}
/MKLiveView/v1.0/Source/MKLiveView/GMapCustomMarkers/CustomMarkerHome.xaml
0,0 → 1,15
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="MKLiveView.GMapCustomMarkers.CustomMarkerHome"
Height="33" Width="112.515" Opacity="10">
<Grid RenderTransformOrigin="0.146,0.499">
<Image Name="icon" Source="home1.png" HorizontalAlignment="Left" Width="33" Height="33" VerticalAlignment="Top"/>
<Label x:Name="lbl" Content="Label" Margin="37,0,0,0" VerticalAlignment="Top" FontSize="10" Height="33" Foreground="White" HorizontalAlignment="Left" Width="73" Padding="0" Grid.RowSpan="2">
<Label.Effect>
<DropShadowEffect Direction="45" ShadowDepth="0.5" BlurRadius="2"/>
</Label.Effect>
</Label>
 
</Grid>
</UserControl>
/MKLiveView/v1.0/Source/MKLiveView/GMapCustomMarkers/CustomMarkerHome.xaml.cs
0,0 → 1,177
///============================================================================
/// MKLiveView
/// Copyright © 2016 Steph
///
///This file is part of MKLiveView.
///
///MKLiveView is free software: you can redistribute it and/or modify
///it under the terms of the GNU General Public License as published by
///the Free Software Foundation, either version 3 of the License, or
///(at your option) any later version.
///
///MKLiveView is distributed in the hope that it will be useful,
///but WITHOUT ANY WARRANTY; without even the implied warranty of
///MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
///GNU General Public License for more details.
///
///You should have received a copy of the GNU General Public License
///along with cssRcon. If not, see <http://www.gnu.org/licenses/>.
///
///============================================================================
///Credits:
 
/// radioman (http://www.codeplex.com/site/users/view/radioman)
/// for his really GreatMaps! (http://greatmaps.codeplex.com/)
///
/// I made some changes to the source, so You need all files from this project here in order to compile and run
///
/// JOHN C. MACDONALD at Ira A. Fulton College of Engineering and Technology
/// for his MIKROKOPTER SERIAL CONTROL TUTORIAL (http://hdl.lib.byu.edu/1877/2747)
/// and the sourcecode (http://hdl.lib.byu.edu/1877/2748)
/// By his work I finally managed to get the communication with the Mikrokopter controllers to run
/// Some of his code was used in this programm like the SimpelSerialPort class (with lots of changes)
/// and the FilghtControllerMessage class
///
///============================================================================
/// DISCLAIMER
/// ===========
///
/// I created this software with my best knowledge and belief.
///
/// IN NO EVENT, UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING,
/// SHALL I, OR ANY PERSON BE LIABLE FOR ANY LOSS, EXPENSE OR DAMAGE,
/// OF ANY TYPE OR NATURE ARISING OUT OF THE USE OF,
/// OR INABILITY TO USE THIS SOFTWARE OR PROGRAM,
/// INCLUDING, BUT NOT LIMITED TO, CLAIMS, SUITS OR CAUSES OF ACTION
/// INVOLVING ALLEGED INFRINGEMENT OF COPYRIGHTS,
/// PATENTS, TRADEMARKS, TRADE SECRETS, OR UNFAIR COMPETITION.
///
/// This means: use it & have fun (but @ Your own risk...)
/// ===========================================================================
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Media;
using GMap.NET.WindowsPresentation;
using System.Diagnostics;
 
namespace MKLiveView.GMapCustomMarkers
{
/// <summary>
/// Interaction logic for CustomMarkerCopter.xaml
/// </summary>
public partial class CustomMarkerHome
{
//Popup Popup;
//Label Label;
GMapMarker Marker;
MainWindow MainWindow;
 
public CustomMarkerHome(MainWindow window, GMapMarker marker, string title)
{
this.InitializeComponent();
 
this.MainWindow = window;
this.Marker = marker;
 
//Popup = new Popup();
//Label = new Label();
 
this.Unloaded += new RoutedEventHandler(CustomMarkerHome_Unloaded);
this.Loaded += new RoutedEventHandler(CustomMarkerHome_Loaded);
this.SizeChanged += new SizeChangedEventHandler(CustomMarkerHome_SizeChanged);
//this.MouseEnter += new MouseEventHandler(MarkerControl_MouseEnter);
//this.MouseLeave += new MouseEventHandler(MarkerControl_MouseLeave);
//this.MouseMove += new MouseEventHandler(CustomMarkerCopter_MouseMove);
//this.MouseLeftButtonUp += new MouseButtonEventHandler(CustomMarkerCopter_MouseLeftButtonUp);
//this.MouseLeftButtonDown += new MouseButtonEventHandler(CustomMarkerCopter_MouseLeftButtonDown);
 
//Popup.Placement = PlacementMode.Mouse;
//{
// Label.Background = Brushes.Blue;
// Label.Foreground = Brushes.White;
// Label.BorderBrush = Brushes.WhiteSmoke;
// Label.BorderThickness = new Thickness(2);
// Label.Padding = new Thickness(5);
// Label.FontSize = 22;
// Label.Content = title;
//}
//Popup.Child = Label;
lbl.Content = title;
}
void CustomMarkerHome_Loaded(object sender, RoutedEventArgs e)
{
if (icon.Source.CanFreeze)
{
icon.Source.Freeze();
}
}
 
void CustomMarkerHome_Unloaded(object sender, RoutedEventArgs e)
{
this.Unloaded -= new RoutedEventHandler(CustomMarkerHome_Unloaded);
this.Loaded -= new RoutedEventHandler(CustomMarkerHome_Loaded);
this.SizeChanged -= new SizeChangedEventHandler(CustomMarkerHome_SizeChanged);
//this.MouseEnter -= new MouseEventHandler(MarkerControl_MouseEnter);
//this.MouseLeave -= new MouseEventHandler(MarkerControl_MouseLeave);
//this.MouseMove -= new MouseEventHandler(CustomMarkerCopter_MouseMove);
//this.MouseLeftButtonUp -= new MouseButtonEventHandler(CustomMarkerCopter_MouseLeftButtonUp);
//this.MouseLeftButtonDown -= new MouseButtonEventHandler(CustomMarkerCopter_MouseLeftButtonDown);
 
Marker.Shape = null;
icon.Source = null;
icon = null;
//Popup = null;
//Label = null;
}
public void setText(string s)
{
lbl.Content = s;
}
 
void CustomMarkerHome_SizeChanged(object sender, SizeChangedEventArgs e)
{
// Marker.Offset = new Point(-e.NewSize.Width / 4, -e.NewSize.Height /2);
}
 
void CustomMarkerHome_MouseMove(object sender, MouseEventArgs e)
{
if (e.LeftButton == MouseButtonState.Pressed && IsMouseCaptured)
{
Point p = e.GetPosition(MainWindow.MainMap);
Marker.Position = MainWindow.MainMap.FromLocalToLatLng((int)(p.X), (int)(p.Y));
}
}
 
void CustomMarkerHome_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
if (!IsMouseCaptured)
{
Mouse.Capture(this);
}
}
 
void CustomMarkerHome_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
if (IsMouseCaptured)
{
Mouse.Capture(null);
}
}
 
void MarkerControl_MouseLeave(object sender, MouseEventArgs e)
{
Marker.ZIndex -= 10000;
//Popup.IsOpen = false;
}
 
void MarkerControl_MouseEnter(object sender, MouseEventArgs e)
{
Marker.ZIndex += 10000;
//Popup.IsOpen = true;
}
 
}
}
/MKLiveView/v1.0/Source/MKLiveView/GMapCustomMarkers/CustomMarkerWP.xaml
0,0 → 1,61
<UserControl x:Class="MKLiveView.GMapCustomMarkers.CustomMarkerWP"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Height="23" Width="23">
<Grid>
<Grid x:Name="gLanding" Margin="-7,-7,-3,-5">
<Ellipse x:Name="landing" Stroke="Magenta" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" StrokeThickness="2" Margin="4,4,0,2" Width="29" Height="29">
<Ellipse.Fill>
<RadialGradientBrush>
<GradientStop Color="#FF660066" Offset="1"/>
<GradientStop Color="#FFFD00CF" Offset="0.908"/>
<GradientStop Color="#665B4F59" Offset="0.796"/>
</RadialGradientBrush>
</Ellipse.Fill>
<Ellipse.Effect>
<DropShadowEffect Direction="40" Opacity="0.79" Color="#FF342E2E" ShadowDepth="3"/>
</Ellipse.Effect>
</Ellipse>
<TextBox Height="27" Text="H" Width="27" Background="{x:Null}" BorderBrush="{x:Null}" Foreground="{Binding Stroke, ElementName=landing}" HorizontalContentAlignment="Center" FontSize="22" FontWeight="ExtraBold" VerticalContentAlignment="Stretch" Margin="5,2,1,6" AllowDrop="False" IsReadOnly="True" IsUndoEnabled="False" Focusable="False" IsHitTestVisible="False" IsTabStop="False">
<TextBox.Effect>
<DropShadowEffect BlurRadius="2" ShadowDepth="0"/>
</TextBox.Effect>
</TextBox>
</Grid>
<Ellipse x:Name="ellipse" Stroke="Magenta" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" StrokeThickness="2" Visibility="Hidden">
<Ellipse.Fill>
<RadialGradientBrush>
<GradientStop Color="#FF660066" Offset="1"/>
<GradientStop Color="#FFFD00CF"/>
</RadialGradientBrush>
</Ellipse.Fill>
<Ellipse.Effect>
<DropShadowEffect BlurRadius="9" Direction="40" Opacity="0.79" Color="#FF342E2E"/>
</Ellipse.Effect>
</Ellipse>
<Rectangle x:Name="rect" HorizontalAlignment="Left" Height="21" Margin="1,1,0,0" Stroke="Red" VerticalAlignment="Top" Width="21" RenderTransformOrigin="0.5,0.5" RadiusY="1.978" RadiusX="1.978" StrokeThickness="1.6" Visibility="Hidden">
<Rectangle.Effect>
<DropShadowEffect Direction="64" ShadowDepth="2" BlurRadius="11"/>
</Rectangle.Effect>
<Rectangle.Fill>
<RadialGradientBrush>
<GradientStop Color="#FF660000" Offset="1"/>
<GradientStop Color="#FFFD0000" Offset="0.417"/>
</RadialGradientBrush>
</Rectangle.Fill>
<Rectangle.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle="45"/>
<TranslateTransform/>
</TransformGroup>
</Rectangle.RenderTransform>
</Rectangle>
<TextBox x:Name="text" HorizontalAlignment="Center" Height="18" Margin="-2,2,-2,3" TextWrapping="Wrap" Text="P25" VerticalAlignment="Center" Width="27" Background="{x:Null}" BorderBrush="{x:Null}" Foreground="#FFFFFEFE" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" FontSize="11" AllowDrop="False" Focusable="False" IsReadOnly="True" IsUndoEnabled="False" IsTabStop="False" IsHitTestVisible="False">
<TextBox.Effect>
<DropShadowEffect BlurRadius="0" ShadowDepth="1" Direction="-45.2"/>
</TextBox.Effect>
</TextBox>
</Grid>
</UserControl>
/MKLiveView/v1.0/Source/MKLiveView/GMapCustomMarkers/CustomMarkerWP.xaml.cs
0,0 → 1,321
///============================================================================
/// MKLiveView
/// Copyright © 2016 Steph
///
///This file is part of MKLiveView.
///
///MKLiveView is free software: you can redistribute it and/or modify
///it under the terms of the GNU General Public License as published by
///the Free Software Foundation, either version 3 of the License, or
///(at your option) any later version.
///
///MKLiveView is distributed in the hope that it will be useful,
///but WITHOUT ANY WARRANTY; without even the implied warranty of
///MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
///GNU General Public License for more details.
///
///You should have received a copy of the GNU General Public License
///along with cssRcon. If not, see <http://www.gnu.org/licenses/>.
///
///============================================================================
///Credits:
 
/// radioman (http://www.codeplex.com/site/users/view/radioman)
/// for his really GreatMaps! (http://greatmaps.codeplex.com/)
///
/// I made some changes to the source, so You need all files from this project here in order to compile and run
///
/// JOHN C. MACDONALD at Ira A. Fulton College of Engineering and Technology
/// for his MIKROKOPTER SERIAL CONTROL TUTORIAL (http://hdl.lib.byu.edu/1877/2747)
/// and the sourcecode (http://hdl.lib.byu.edu/1877/2748)
/// By his work I finally managed to get the communication with the Mikrokopter controllers to run
/// Some of his code was used in this programm like the SimpelSerialPort class (with lots of changes)
/// and the FilghtControllerMessage class
///
///============================================================================
/// DISCLAIMER
/// ===========
///
/// I created this software with my best knowledge and belief.
///
/// IN NO EVENT, UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING,
/// SHALL I, OR ANY PERSON BE LIABLE FOR ANY LOSS, EXPENSE OR DAMAGE,
/// OF ANY TYPE OR NATURE ARISING OUT OF THE USE OF,
/// OR INABILITY TO USE THIS SOFTWARE OR PROGRAM,
/// INCLUDING, BUT NOT LIMITED TO, CLAIMS, SUITS OR CAUSES OF ACTION
/// INVOLVING ALLEGED INFRINGEMENT OF COPYRIGHTS,
/// PATENTS, TRADEMARKS, TRADE SECRETS, OR UNFAIR COMPETITION.
///
/// This means: use it & have fun (but @ Your own risk...)
/// ===========================================================================
 
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Media;
using GMap.NET.WindowsPresentation;
using System.Diagnostics;
 
namespace MKLiveView.GMapCustomMarkers
{
public partial class CustomMarkerWP
{
//Popup Popup;
//Label Label;
GMapMarker Marker;
MainWindow MainWindow;
int _type = 0;
public event positionChangedEventHandler positionChanged;
public delegate void positionChangedEventHandler(CustomMarkerWP wp);
public event newPositionEventHandler newPosition;
public delegate void newPositionEventHandler(CustomMarkerWP wp);
public event mouseCapturedEventHandler mouseCaptured;
public delegate void mouseCapturedEventHandler(bool isCaptured);
 
public CustomMarkerWP(MainWindow window, GMapMarker marker, string title, int type)
{
this.InitializeComponent();
 
this.MainWindow = window;
this.Marker = marker;
_type = type;
 
//Popup = new Popup();
//Label = new Label();
 
//this.Unloaded += new RoutedEventHandler(CustomMarkerWP_Unloaded);
this.Loaded += new RoutedEventHandler(CustomMarkerWP_Loaded);
this.SizeChanged += new SizeChangedEventHandler(CustomMarkerWP_SizeChanged);
this.MouseEnter += new MouseEventHandler(MarkerControl_MouseEnter);
this.MouseLeave += new MouseEventHandler(MarkerControl_MouseLeave);
this.MouseMove += new MouseEventHandler(CustomMarkerWP_MouseMove);
this.MouseLeftButtonUp += new MouseButtonEventHandler(CustomMarkerWP_MouseLeftButtonUp);
this.MouseLeftButtonDown += new MouseButtonEventHandler(CustomMarkerWP_MouseLeftButtonDown);
StylusEnter += CustomMarkerWP_StylusEnter;
StylusLeave += CustomMarkerWP_StylusLeave;
StylusDown += CustomMarkerWP_StylusDown;
StylusMove += CustomMarkerWP_StylusMove;
StylusUp += CustomMarkerWP_StylusUp;
 
//Popup.Placement = PlacementMode.Mouse;
//{
// Label.Background = Brushes.Blue;
// Label.Foreground = Brushes.White;
// Label.BorderBrush = Brushes.WhiteSmoke;
// Label.BorderThickness = new Thickness(2);
// Label.Padding = new Thickness(5);
// Label.FontSize = 22;
// Label.Content = title;
//}
//Popup.Child = Label;
text.Text = title;
setType();
}
 
private void CustomMarkerWP_StylusUp(object sender, StylusEventArgs e)
{
if (IsStylusCaptured)
{
Stylus.Capture(null);
newPosition(this);
mouseCaptured(false);
}
}
 
private void CustomMarkerWP_StylusMove(object sender, StylusEventArgs e)
{
if (IsStylusCaptured)
{
Point p = e.GetPosition(MainWindow.MainMap);
Marker.Position = MainWindow.MainMap.FromLocalToLatLng((int)(p.X), (int)(p.Y));
if (positionChanged != null)
positionChanged(this);
}
}
 
private void CustomMarkerWP_StylusDown(object sender, StylusDownEventArgs e)
{
if (!IsStylusCaptured)
{
Stylus.Capture(this);
mouseCaptured(true);
}
}
 
private void CustomMarkerWP_StylusLeave(object sender, StylusEventArgs e)
{
Marker.ZIndex -= 10000;
}
 
private void CustomMarkerWP_StylusEnter(object sender, StylusEventArgs e)
{
Marker.ZIndex += 10000;
}
 
void setType()
{
if (_type == 0)
{
gLanding.Visibility = Visibility.Hidden;
rect.Visibility = Visibility.Hidden;
ellipse.Visibility = Visibility.Visible;
}
if (_type == 1 | _type == 2)
{
gLanding.Visibility = Visibility.Hidden;
ellipse.Visibility = Visibility.Hidden;
rect.Visibility = Visibility.Visible;
}
if (_type == 3)
{
gLanding.Visibility = Visibility.Visible;
ellipse.Visibility = Visibility.Hidden;
rect.Visibility = Visibility.Hidden;
}
 
}
void CustomMarkerWP_Loaded(object sender, RoutedEventArgs e)
{
//if (icon.Source.CanFreeze)
//{
// icon.Source.Freeze();
//}
}
 
void CustomMarkerWP_Unloaded(object sender, RoutedEventArgs e)
{
//this.Unloaded -= new RoutedEventHandler(CustomMarkerWP_Unloaded);
//this.Loaded -= new RoutedEventHandler(CustomMarkerWP_Loaded);
this.SizeChanged -= new SizeChangedEventHandler(CustomMarkerWP_SizeChanged);
this.MouseEnter -= new MouseEventHandler(MarkerControl_MouseEnter);
this.MouseLeave -= new MouseEventHandler(MarkerControl_MouseLeave);
this.MouseMove -= new MouseEventHandler(CustomMarkerWP_MouseMove);
this.MouseLeftButtonUp -= new MouseButtonEventHandler(CustomMarkerWP_MouseLeftButtonUp);
this.MouseLeftButtonDown -= new MouseButtonEventHandler(CustomMarkerWP_MouseLeftButtonDown);
StylusEnter -= CustomMarkerWP_StylusEnter;
StylusLeave -= CustomMarkerWP_StylusLeave;
StylusDown -= CustomMarkerWP_StylusDown;
StylusMove -= CustomMarkerWP_StylusMove;
StylusUp -= CustomMarkerWP_StylusUp;
 
Marker.Shape = null;
//icon.Source = null;
//icon = null;
//Popup = null;
//Label = null;
}
public string WPText
{
get { return text.Text; }
set { text.Text = value; }
}
public int WPType
{
get { return _type; }
set
{
_type = value;
setType();
}
}
 
public void setColor(string sColor)
{
RadialGradientBrush rgb = new RadialGradientBrush();
GradientStop gs0 = new GradientStop(Color.FromArgb(0xFF, 0xFD, 0x00, 0x00),0), gs1 = new GradientStop(Color.FromArgb(0xFF, 0x66, 0x1B, 0x1B),1);
switch (sColor)
{
case "red":
ellipse.Stroke = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0x3A, 0x00));
rect.Stroke = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0x3A, 0x00));
landing.Stroke = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0x3A, 0x00));
gs0 = new GradientStop(Color.FromArgb(0xFF, 0xFD, 0x00, 0x00),0);
gs1 = new GradientStop(Color.FromArgb(0xFF, 0x66, 0x1B, 0x1B),1);
break;
case "green":
ellipse.Stroke = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0xFF, 0x00));
rect.Stroke = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0xFF, 0x00));
landing.Stroke = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0xFF, 0x00));
gs0 = new GradientStop(Color.FromArgb(0xFF, 0x00, 0xFD, 0x50),0);
gs1 = new GradientStop(Color.FromArgb(0xFF, 0x66, 0x2F, 0x1B),1);
break;
case "yellow":
ellipse.Stroke = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0xFF, 0x00));
rect.Stroke = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0xFF, 0x00));
landing.Stroke = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0xFF, 0x00));
gs0 = new GradientStop(Color.FromArgb(0xFF, 0xFD, 0xFD, 0x00),0);
gs1 = new GradientStop(Color.FromArgb(0xFF, 0x66, 0x5F, 0x1B),1);
break;
case "blue":
ellipse.Stroke = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0xFF, 0xFF));
rect.Stroke = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0xFF, 0xFF));
landing.Stroke = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0xFF, 0xFF));
gs0 = new GradientStop(Color.FromArgb(0xFF, 0x00, 0xDB, 0xFD),0);
gs1 = new GradientStop(Color.FromArgb(0xFF, 0x00, 0x66, 0x5C),1);
break;
case "pink":
ellipse.Stroke = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0x00, 0xFF));
rect.Stroke = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0x00, 0xFF));
landing.Stroke = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0x00, 0xFF));
gs0 = new GradientStop(Color.FromArgb(0xFF, 0xFD, 0x00, 0xCF),0);
gs1 = new GradientStop(Color.FromArgb(0xFF, 0x66, 0x00, 0x66),1);
break;
}
rgb.GradientStops.Add(gs0);
rgb.GradientStops.Add(gs1);
ellipse.Fill = rgb;
rect.Fill = rgb;
landing.Fill = rgb;
 
}
 
void CustomMarkerWP_SizeChanged(object sender, SizeChangedEventArgs e)
{
// Marker.Offset = new Point(-e.NewSize.Width / 4, -e.NewSize.Height /2);
}
 
void CustomMarkerWP_MouseMove(object sender, MouseEventArgs e)
{
if (e.LeftButton == MouseButtonState.Pressed && IsMouseCaptured)
{
Point p = e.GetPosition(MainWindow.MainMap);
Marker.Position = MainWindow.MainMap.FromLocalToLatLng((int)(p.X), (int)(p.Y));
if(positionChanged != null)
positionChanged(this);
}
}
 
void CustomMarkerWP_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
if (!IsMouseCaptured)
{
Mouse.Capture(this);
mouseCaptured(true);
}
}
 
void CustomMarkerWP_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
if (IsMouseCaptured)
{
Mouse.Capture(null);
newPosition(this);
mouseCaptured(false);
}
}
 
void MarkerControl_MouseLeave(object sender, MouseEventArgs e)
{
Marker.ZIndex -= 10000;
//Popup.IsOpen = false;
}
 
void MarkerControl_MouseEnter(object sender, MouseEventArgs e)
{
Marker.ZIndex += 10000;
//Popup.IsOpen = true;
}
 
}
}
/MKLiveView/v1.0/Source/MKLiveView/GMapCustomMarkers/CustomMarkerWPActive.xaml
0,0 → 1,20
<UserControl x:Class="MKLiveView.GMapCustomMarkers.CustomMarkerWPActive"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Height="36" Width="36">
<Grid RenderTransformOrigin="0,0" Margin="0,0,0,0">
<Ellipse x:Name="ellipse" Stroke="Magenta" StrokeThickness="0">
<Ellipse.Fill>
<RadialGradientBrush>
<GradientStop Color="#FFAC3F00" Offset="0.691"/>
<GradientStop Color="#FFFFE800" Offset="0.82"/>
<GradientStop Offset="0.655"/>
<GradientStop Color="#FFFF6060" Offset="0.993"/>
</RadialGradientBrush>
</Ellipse.Fill>
<Ellipse.Effect>
<DropShadowEffect BlurRadius="9" Direction="40" Opacity="0.79" Color="#FF342E2E"/>
</Ellipse.Effect>
</Ellipse>
</Grid>
</UserControl>
/MKLiveView/v1.0/Source/MKLiveView/GMapCustomMarkers/CustomMarkerWPActive.xaml.cs
0,0 → 1,88
///============================================================================
/// MKLiveView
/// Copyright © 2016 Steph
///
///This file is part of MKLiveView.
///
///MKLiveView is free software: you can redistribute it and/or modify
///it under the terms of the GNU General Public License as published by
///the Free Software Foundation, either version 3 of the License, or
///(at your option) any later version.
///
///MKLiveView is distributed in the hope that it will be useful,
///but WITHOUT ANY WARRANTY; without even the implied warranty of
///MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
///GNU General Public License for more details.
///
///You should have received a copy of the GNU General Public License
///along with cssRcon. If not, see <http://www.gnu.org/licenses/>.
///
///============================================================================
///Credits:
 
/// radioman (http://www.codeplex.com/site/users/view/radioman)
/// for his really GreatMaps! (http://greatmaps.codeplex.com/)
///
/// I made some changes to the source, so You need all files from this project here in order to compile and run
///
/// JOHN C. MACDONALD at Ira A. Fulton College of Engineering and Technology
/// for his MIKROKOPTER SERIAL CONTROL TUTORIAL (http://hdl.lib.byu.edu/1877/2747)
/// and the sourcecode (http://hdl.lib.byu.edu/1877/2748)
/// By his work I finally managed to get the communication with the Mikrokopter controllers to run
/// Some of his code was used in this programm like the SimpelSerialPort class (with lots of changes)
/// and the FilghtControllerMessage class
///
///============================================================================
/// DISCLAIMER
/// ===========
///
/// I created this software with my best knowledge and belief.
///
/// IN NO EVENT, UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING,
/// SHALL I, OR ANY PERSON BE LIABLE FOR ANY LOSS, EXPENSE OR DAMAGE,
/// OF ANY TYPE OR NATURE ARISING OUT OF THE USE OF,
/// OR INABILITY TO USE THIS SOFTWARE OR PROGRAM,
/// INCLUDING, BUT NOT LIMITED TO, CLAIMS, SUITS OR CAUSES OF ACTION
/// INVOLVING ALLEGED INFRINGEMENT OF COPYRIGHTS,
/// PATENTS, TRADEMARKS, TRADE SECRETS, OR UNFAIR COMPETITION.
///
/// This means: use it & have fun (but @ Your own risk...)
/// ===========================================================================
 
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Media;
using GMap.NET.WindowsPresentation;
using System.Diagnostics;
 
namespace MKLiveView.GMapCustomMarkers
{
public partial class CustomMarkerWPActive
{
//Popup Popup;
//Label Label;
GMapMarker Marker;
MainWindow MainWindow;
int _type = 0;
 
public CustomMarkerWPActive(MainWindow window, GMapMarker marker, string title, int type)
{
this.InitializeComponent();
 
this.MainWindow = window;
this.Marker = marker;
_type = type;
}
void CustomMarkerWPActive_Unloaded(object sender, RoutedEventArgs e)
{
Marker.Shape = null;
}
public int WPType
{
get { return _type; }
set { _type = value; }
}
}
}
/MKLiveView/v1.0/Source/MKLiveView/GMapCustomMarkers/home.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/MKLiveView/v1.0/Source/MKLiveView/GMapCustomMarkers/home1.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property