Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Commit

Permalink
Version 1.1.5
Browse files Browse the repository at this point in the history
See changelog
  • Loading branch information
rbrundritt committed Mar 17, 2022
1 parent b20de9d commit d9940c0
Show file tree
Hide file tree
Showing 69 changed files with 4,198 additions and 331 deletions.
13 changes: 10 additions & 3 deletions BingMapsRESTToolkit.sln
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.16
# Visual Studio Version 16
VisualStudioVersion = 16.0.32228.343
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{EE7ACF1F-56D3-4A01-8262-A49A8B444639}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Source", "Source", "{A155C82A-42DC-4206-8DA8-C9C8CC3BFFE2}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{833D0345-46F0-486E-9BEF-5269405683F8}"
ProjectSection(SolutionItems) = preProject
..\..\..\..\Source\Repos\Bing-Maps-V8-TypeScript-Definitions\.gitignore = ..\..\..\..\Source\Repos\Bing-Maps-V8-TypeScript-Definitions\.gitignore
..\..\..\Source\Repos\Bing-Maps-V8-TypeScript-Definitions\.gitignore = ..\..\..\Source\Repos\Bing-Maps-V8-TypeScript-Definitions\.gitignore
CHANGELOG.md = CHANGELOG.md
CONTRIBUTING.md = CONTRIBUTING.md
LICENSE.md = LICENSE.md
Expand Down Expand Up @@ -42,6 +42,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docs", "Docs", "{5F797BB6-1
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TravellingSalesmenRouteSample", "Samples\WPF\TravellingSalesmenRouteSample\TravellingSalesmenRouteSample.csproj", "{5173922A-0160-4EE1-9AD8-F629B23CFE71}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MultiRouteOptimizationSample", "Samples\WPF\MultiRouteOptimizationSample\MultiRouteOptimizationSample.csproj", "{9AEB32AD-D999-4E5F-8CB7-B6A0727DA12A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -72,6 +74,10 @@ Global
{5173922A-0160-4EE1-9AD8-F629B23CFE71}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5173922A-0160-4EE1-9AD8-F629B23CFE71}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5173922A-0160-4EE1-9AD8-F629B23CFE71}.Release|Any CPU.Build.0 = Release|Any CPU
{9AEB32AD-D999-4E5F-8CB7-B6A0727DA12A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9AEB32AD-D999-4E5F-8CB7-B6A0727DA12A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9AEB32AD-D999-4E5F-8CB7-B6A0727DA12A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9AEB32AD-D999-4E5F-8CB7-B6A0727DA12A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -86,6 +92,7 @@ Global
{1BCB3853-DAFE-4B33-9888-23666A1040B9} = {80170A9E-5ACF-483A-8A8E-18CA7B0C9A34}
{5F797BB6-13E8-4A02-BC01-613FC791EB41} = {833D0345-46F0-486E-9BEF-5269405683F8}
{5173922A-0160-4EE1-9AD8-F629B23CFE71} = {26E65B0F-9554-408A-95D4-BDEC52945FC3}
{9AEB32AD-D999-4E5F-8CB7-B6A0727DA12A} = {26E65B0F-9554-408A-95D4-BDEC52945FC3}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C3DB70BA-969B-47D7-8A77-65B190E2CC81}
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
## Version 1.1.5 - 3/15/2022

* Added AutoSuggest, LocalSearch, LocalInsights, and OptimizeItineraryRequest APIs. Added samples for each.
* Added a visual sample for OptimizeItineraryRequest.
* Added support for regional travel summary in routes.
* Fixed backlog of issues and updates.
* Add helper methods to existing classes
- SimpleWaypoint and Coordinate classes - static Parse method.
- Resource class - static HasResource and GetFirstResouce methods.
- RoutePath class - method to retrieve route path as an array of coordinates.

## Version 1.1.4 - 3/9/2018

* Async support added to SnapToRoadRequest, thus allowing up to 1,000 points to be snapped in a single request.
Expand Down
143 changes: 140 additions & 3 deletions Docs/API Reference.md

Large diffs are not rendered by default.

16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
![Bing Maps Logo](https://github.com/Microsoft/Bing-Maps-V8-TypeScript-Definitions/blob/master/images/BingMapsLogoTeal.png)

![Local version](https://img.shields.io/badge/Local%20version-1.1.5-green.svg)
[![NuGet](https://img.shields.io/badge/NuGet-1.1.4-blue.svg)](https://www.nuget.org/packages/BingMapsRESTToolkit)
[![license](https://img.shields.io/badge/license-MIT-yellow.svg)](https://github.com/Microsoft/BingMapsRESTToolkit/blob/master/LICENSE.md)

# Bing Maps REST Toolkit for .NET

This is a portable .NET class library which provides a set of tools that make it easy to access the Bing Maps REST services in .NET based apps. Take a look at the [Getting Started documentation](https://github.com/Microsoft/BingMapsRESTToolkit/blob/master/Docs/Getting%20Started.md). The Bing Maps REST Services provides the following functionality:

* **Autosuggest**
* **Forward and reverse geocoding**
* **Route calculations** - for driving, walking, transit and truck
* **Distance matricies** - time and distance based matrices between a set of origins and destinations. Optionally retrieve this data over a period of time using predictive traffic data
Expand All @@ -15,10 +17,8 @@ This is a portable .NET class library which provides a set of tools that make it
* **Traffic incident data**
* **Elevation data**
* **Static map imagery and metadata**

## What's New

* September 2018: Requests for [Location Recognition](https://msdn.microsoft.com/en-US/library/mt847173.aspx) and the [Time Zone API](https://msdn.microsoft.com/en-us/library/mt829726.aspx), including Data Contracts, are now available.
* **Local search**
* And much more!

## Toolkit Features

Expand All @@ -31,6 +31,12 @@ This is a portable .NET class library which provides a set of tools that make it
* **Travelling Salesmen** algorithms that tie into the distance matrix API [documentation](https://github.com/Microsoft/BingMapsRESTToolkit/blob/master/Docs/Getting%20Started.md#TravellingSalesmen).
* **Truck routing based Distance Matricies** - The Bing Maps distance matric API does not support truck routing based matricies. This library adds support for this by wrapping the truck routing API.

## Reference locally

The NuGet package is not updated as frequently as the source code in this repo. You can use the latest version by
downloading the source code and copying the contents of the `Source` folder into your solution folder.
Then in your solution add an "Existing project" and select the "BingMapsRESTToolkit.csproj" file.

## NuGet Package

The Bing Maps REST Services Toolkit is available as a [NuGet package](https://www.nuget.org/packages/BingMapsRESTToolkit). If using Visual Studio, open the nuget package manager, select the Browse tab and search for "Bing Maps REST". This should reduce the list of results enough to find the "BingMapsRESTToolkit" package. The owner of the package is bingmaps and the author is Microsoft.
Expand Down Expand Up @@ -82,4 +88,4 @@ This project has adopted the [Microsoft Open Source Code of Conduct](https://ope

MIT

See [License](LICENSE.md) for full license text.
See [License](LICENSE.md) for full license text.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
<add key="BingMapsKey" value="YOUR_API_KEY_HERE"/>
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
</startup>
</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,17 @@ private Resource[] GetResourcesFromRequest(BaseRestRequest rest_request)
public void AutoSuggestTest()
{
Console.WriteLine("Running Autosuggest Test");
CoordWithRadius ul = new CoordWithRadius() { Latitude = 47.668697, Longitude = -122.376373, Radius = 5 };
var ul = new CircularView(47.668697, -122.376373, 5);

var request = new AutosuggestRequest()
{
BingMapsKey = _ApiKey,
Query = "El Bur",
UserLoc = ul
UserLocation = ul,
};
Console.WriteLine(request.GetRequestUrl());
var resources = GetResourcesFromRequest(request);
var entities = (resources[0] as AutosuggestResource);
var entities = (resources[0] as Autosuggest);

foreach (var entity in entities.Value)
Console.Write($"Entity of type {entity.Type} returned.");
Expand Down Expand Up @@ -167,7 +167,7 @@ public void LocationRecogTest()

if (r.BusinessAtLocation != null)
{
foreach (LocalBusiness business in r.BusinessAtLocation)
foreach (BusinessAtLocation business in r.BusinessAtLocation)
{
Console.WriteLine($"Business:\n{business.BusinessInfo.EntityName}");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<OutputType>Exe</OutputType>
<RootNamespace>RESTToolkitTestConsoleApp.NetStandard</RootNamespace>
<AssemblyName>RESTToolkitTestConsoleApp.NetStandard</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
Expand Down
28 changes: 1 addition & 27 deletions Samples/Console/RESTToolkitTestConsoleApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,32 +48,6 @@ static private Resource[] GetResourcesFromRequest(BaseRestRequest rest_request)
return r.ResourceSets[0].Resources;
}

/*
*
* Pending review.
*
static public void AutoSuggestTest()
{
Console.WriteLine("Running Autosuggest Test");
CoordWithRadius ul = new CoordWithRadius() { Latitude = 47.668697, Longitude = -122.376373, Radius = 5 };
var request = new AutosuggestRequest()
{
BingMapsKey = _ApiKey,
Query = "El Bur",
UserLoc = ul
};
Console.WriteLine(request.GetRequestUrl());
var resources = GetResourcesFromRequest(request);
var entities = (resources[0] as AutosuggestResource);
foreach (var entity in entities.Value)
Console.Write($"Entity of type {entity.Type} returned.");
Console.ReadLine();
}
*/

/// <summary>
/// Convert Time Zone Test
/// https://msdn.microsoft.com/en-us/library/mt829733.aspx
Expand Down Expand Up @@ -194,7 +168,7 @@ static public void LocationRecogTest()

if (r.BusinessAtLocation != null)
{
foreach (LocalBusiness business in r.BusinessAtLocation)
foreach (BusinessAtLocation business in r.BusinessAtLocation)
{
Console.WriteLine($"Business:\n{business.BusinessInfo.EntityName}");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Source\BingMapsRESTToolkit.csproj" />
<Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Core" />
Expand Down Expand Up @@ -80,6 +79,12 @@
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Source\BingMapsRESTToolkit.csproj">
<Project>{ac15ccac-63b7-43eb-a1cb-25925f04398b}</Project>
<Name>BingMapsRESTToolkit</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand All @@ -88,4 +93,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
9 changes: 9 additions & 0 deletions Samples/WPF/MultiRouteOptimizationSample/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Application x:Class="MultiRouteOptimizationSample.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:MultiRouteOptimizationSample"
StartupUri="MainWindow.xaml">
<Application.Resources>

</Application.Resources>
</Application>
17 changes: 17 additions & 0 deletions Samples/WPF/MultiRouteOptimizationSample/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace MultiRouteOptimizationSample
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}
10 changes: 10 additions & 0 deletions Samples/WPF/MultiRouteOptimizationSample/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Windows;

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
106 changes: 106 additions & 0 deletions Samples/WPF/MultiRouteOptimizationSample/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<Window x:Class="MultiRouteOptimizationSample.MainWindow"
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:MultiRouteOptimizationSample"
xmlns:m="clr-namespace:Microsoft.Maps.MapControl.WPF;assembly=Microsoft.Maps.MapControl.WPF"
mc:Ignorable="d"
Title="Multi-route itinerary optimization sample" Height="800" Width="1200">

<Window.Resources>
<Style x:Key="CustomInfoboxStyle" TargetType="ToolTip">
<Setter Property="OverridesDefaultStyle" Value="true" />
<Setter Property="VerticalOffset" Value="15" />
<Setter Property="HorizontalOffset" Value="155" />
<Setter Property="Placement" Value="Top" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToolTip">
<StackPanel>
<Grid Width="200" MinHeight="50" HorizontalAlignment="Left">
<Border Background="Black"/>
<StackPanel Margin="5">
<ContentPresenter Margin="5" Content="{TemplateBinding Content}"/>
</StackPanel>
</Grid>

<Polygon HorizontalAlignment="Left" Fill="Black">
<Polygon.Points>
<Point X="0" Y="0"/>
<Point X="20" Y="0"/>
<Point X="30" Y="30"/>
</Polygon.Points>
</Polygon>
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>

<Grid>
<TabControl>
<TabItem Header="Main">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="250"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>

<StackPanel Margin="5">
<Button Content="Instructions" Click="InstructionsBtn_Clicked" />
<Button Content="Calculate itinerary" Click="CalculateBtn_Clicked" />
<Button Name="CalculateRoutePathBtn" Content="Calculate route path" Click="CalculateRoutePathBtn_Clicked" IsEnabled="False" />

<TextBlock Text="Output" FontWeight="Bold" Margin="0,10"/>
<TextBox Name="OutputTbx" Height="200" Grid.Column="1" VerticalScrollBarVisibility="Auto" TextWrapping="Wrap" Margin="0,0,0,10"/>

<Button Content="Export request" Click="ExportRequestBtn_Clicked" />
<Button Content="Import request" Click="ImportRequestBtn_Clicked" />
<Button Content="Export result" Click="ExportResultBtn_Clicked" />
<Button Content="Import result" Click="ImportResultBtn_Clicked" />
</StackPanel>

<m:Map Name="MyMap" Grid.Column="1"/>

<StackPanel Grid.Column="1" Background="White" Width="100" Height="100" Margin="10" VerticalAlignment="Bottom" HorizontalAlignment="Left">
<TextBlock Text="Legend" FontSize="16" FontWeight="Bold" Margin="5"/>

<StackPanel Orientation="Horizontal">
<Rectangle Width="10" Height="10" Margin="5" Fill="Blue"/>
<TextBlock Text="Agent 1"/>
</StackPanel>

<StackPanel Orientation="Horizontal">
<Rectangle Width="10" Height="10" Margin="5" Fill="Orange"/>
<TextBlock Text="Agent 2"/>
</StackPanel>

<StackPanel Orientation="Horizontal">
<Rectangle Width="10" Height="10" Margin="5" Fill="Red"/>
<TextBlock Text="Agent 3"/>
</StackPanel>
</StackPanel>
</Grid>
</TabItem>

<TabItem Header="Request details">
<StackPanel>
<TextBlock Text="Agents" Margin="0,10" FontSize="14" FontWeight="Bold"/>
<DataGrid Name="AgentTable" CanUserAddRows="False" CanUserResizeColumns="True" CanUserSortColumns="True" IsReadOnly="True" />
<TextBlock Text="Initerary stops" Margin="0,10" FontSize="14" FontWeight="Bold"/>
<DataGrid Name="IniteraryStopTable" CanUserAddRows="False" CanUserResizeColumns="True" CanUserSortColumns="True" IsReadOnly="True" />
</StackPanel>
</TabItem>
</TabControl>


<Grid Name="LoadingScreen" Background="#55000000" Visibility="Collapsed" Grid.ColumnSpan="2">
<TextBlock FontSize="20" VerticalAlignment="Center" HorizontalAlignment="Center" Text="Calculating..." Foreground="White"/>
</Grid>
</Grid>
</Window>
Loading

0 comments on commit d9940c0

Please sign in to comment.