C# 如何在visualstudio中实现三次插值

C# 如何在visualstudio中实现三次插值,c#,wpf,visual-studio,C#,Wpf,Visual Studio,我使用visual studio 2015 c#从网站教程中创建了多段线解决方案 xaml文件如下所示: <Window x:Class="WPFTestApplication.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:m="clr-namespace:M

我使用visual studio 2015 c#从网站教程中创建了多段线解决方案

xaml文件如下所示:

<Window x:Class="WPFTestApplication.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:m="clr-namespace:Microsoft.Maps.MapControl.WPF;assembly=Microsoft.Maps.MapControl.WPF"
Width="1024" Height="768">
<Grid x:Name="LayoutRoot" Background="White">
    <m:Map x:Name="myMap" CredentialsProvider="Insert_Your_Bing_Maps_Key" Center="47.740,-122.125" ZoomLevel="11">
        <m:MapPolyline Stroke="Blue" StrokeThickness="5" 
             Locations="47.6424,-122.3219 47.8424,-122.1747 47.5814,-122.1747 47.67856,-122.130994" 
             Opacity="0.7"/>
    </m:Map>
</Grid>
</Window>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
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 Microsoft.Maps.MapControl.WPF;

using Microsoft.Maps.MapControl.WPF.Design;


namespace WPFTestApplication
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();


                MapPolyline polyline = new MapPolyline();
                polyline.Stroke = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Blue);
                polyline.StrokeThickness = 5;
                polyline.Opacity = 0.7;
               polygon.Locations = new LocationCollection() { 
    new Location(47.6424,-122.3219), 
    new Location(47.8424,-122.1747), 
    new Location(47.5814,-122.1747)
    };


                myMap.Children.Add(polyline);



        }


    }
}

xaml.cs文件如下所示:

<Window x:Class="WPFTestApplication.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:m="clr-namespace:Microsoft.Maps.MapControl.WPF;assembly=Microsoft.Maps.MapControl.WPF"
Width="1024" Height="768">
<Grid x:Name="LayoutRoot" Background="White">
    <m:Map x:Name="myMap" CredentialsProvider="Insert_Your_Bing_Maps_Key" Center="47.740,-122.125" ZoomLevel="11">
        <m:MapPolyline Stroke="Blue" StrokeThickness="5" 
             Locations="47.6424,-122.3219 47.8424,-122.1747 47.5814,-122.1747 47.67856,-122.130994" 
             Opacity="0.7"/>
    </m:Map>
</Grid>
</Window>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
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 Microsoft.Maps.MapControl.WPF;

using Microsoft.Maps.MapControl.WPF.Design;


namespace WPFTestApplication
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();


                MapPolyline polyline = new MapPolyline();
                polyline.Stroke = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Blue);
                polyline.StrokeThickness = 5;
                polyline.Opacity = 0.7;
               polygon.Locations = new LocationCollection() { 
    new Location(47.6424,-122.3219), 
    new Location(47.8424,-122.1747), 
    new Location(47.5814,-122.1747)
    };


                myMap.Children.Add(polyline);



        }


    }
}
使用系统;
使用System.Collections.Generic;
使用System.Linq;
使用系统文本;
使用System.Threading.Tasks;
使用System.Windows;
使用System.Windows.Controls;
使用System.Windows.Data;
使用System.Windows.Documents;
使用System.Windows.Input;
使用System.Windows.Media;
使用System.Windows.Media.Imaging;
使用System.Windows.Navigation;
使用System.Windows.Shapes;
使用Microsoft.Maps.MapControl.WPF;
使用Microsoft.Maps.MapControl.WPF.Design;
命名空间WPFTestApplication
{
/// 
///MainWindow.xaml的交互逻辑
/// 
公共部分类主窗口:窗口
{
公共主窗口()
{
初始化组件();
MapPolyline polyline=新的MapPolyline();
polyline.Stroke=new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Blue);
折线.StrokeThickness=5;
多段线。不透明度=0.7;
polygon.Locations=新位置集合(){
新位置(47.6424,-122.3219),
新位置(47.8424,-122.1747),
新位置(47.5814,-122.1747)
};
myMap.Children.Add(多段线);
}
}
}
输出显示如下:

<Window x:Class="WPFTestApplication.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:m="clr-namespace:Microsoft.Maps.MapControl.WPF;assembly=Microsoft.Maps.MapControl.WPF"
Width="1024" Height="768">
<Grid x:Name="LayoutRoot" Background="White">
    <m:Map x:Name="myMap" CredentialsProvider="Insert_Your_Bing_Maps_Key" Center="47.740,-122.125" ZoomLevel="11">
        <m:MapPolyline Stroke="Blue" StrokeThickness="5" 
             Locations="47.6424,-122.3219 47.8424,-122.1747 47.5814,-122.1747 47.67856,-122.130994" 
             Opacity="0.7"/>
    </m:Map>
</Grid>
</Window>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
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 Microsoft.Maps.MapControl.WPF;

using Microsoft.Maps.MapControl.WPF.Design;


namespace WPFTestApplication
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();


                MapPolyline polyline = new MapPolyline();
                polyline.Stroke = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Blue);
                polyline.StrokeThickness = 5;
                polyline.Opacity = 0.7;
               polygon.Locations = new LocationCollection() { 
    new Location(47.6424,-122.3219), 
    new Location(47.8424,-122.1747), 
    new Location(47.5814,-122.1747)
    };


                myMap.Children.Add(polyline);



        }


    }
}
经度、纬度点由地图上的多段线连接。多段线是一条直线

我可以使用三次/样条插值连接经度、纬度点,形成平滑曲线。在这段代码中可以实现三次/样条插值吗?有内置的功能吗


谢谢。

如果您想使用与wpf不同的东西,请参阅允许您绘制平滑曲线的工具

如果您需要样条曲线上的点进行进一步计算,或者希望坚持使用MapPolyline,快速浏览google似乎会带来一些项目,例如。首先必须自己计算样条曲线,然后取适当数量的点并将其添加到多段线对象中(以获得所需的平滑度) 对于绘制多边形,您使用的类(MapPolyline)更多或更少,因此一系列点由一条直线连接(如您所经历的)