Updated SDK Exporting RadMap to an Image
This commit is contained in:
Родитель
ac9d67b371
Коммит
8a548e084e
|
@ -18,6 +18,8 @@ namespace RadMapToAnImage
|
|||
this.radMap1.Layers.Add(pinLayer);
|
||||
|
||||
OpenStreetMapProvider osmProvider = new OpenStreetMapProvider();
|
||||
MapTileDownloader tileDownloader = osmProvider.TileDownloader as MapTileDownloader;
|
||||
tileDownloader.WebHeaders.Add(System.Net.HttpRequestHeader.UserAgent, "your application name");
|
||||
osmProvider.InitializationComplete += OsmProvider_InitializationComplete;
|
||||
this.radMap1.MapElement.Providers.Add(osmProvider);
|
||||
}
|
||||
|
@ -46,7 +48,8 @@ namespace RadMapToAnImage
|
|||
}
|
||||
|
||||
object state = gg.SaveState();
|
||||
gg.TranslateTransform(-this.radMap1.MapElement.ViewportInPixels.X, -this.radMap1.MapElement.ViewportInPixels.Y);
|
||||
//As of R2 2021 calling TranslateTransform is not necessary
|
||||
//gg.TranslateTransform(-this.radMap1.MapElement.ViewportInPixels.X, -this.radMap1.MapElement.ViewportInPixels.Y);
|
||||
this.radMap1.MapElement.Layers["PinsLayer"].Paint(gg, this.radMap1.MapElement);
|
||||
|
||||
gg.RestoreState(state);
|
||||
|
|
|
@ -44,15 +44,21 @@
|
|||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Telerik.WinControls, Version=2018.3.529.40, Culture=neutral, PublicKeyToken=5bb2a467cbec794e, processorArchitecture=MSIL">
|
||||
<HintPath>C:\Program Files (x86)\Progress\Telerik UI for WinForms R3 2018\Bin40\Telerik.WinControls.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Reference Include="Telerik.WinControls, Version=2021.3.1123.40, Culture=neutral, PublicKeyToken=5bb2a467cbec794e, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\Users\dyordano\Desktop\DLL\Telerik_UI_For_WinForms_2021_3_1123_Dev_dlls\Bin40\Telerik.WinControls.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Telerik.WinControls.RadMap, Version=2018.3.529.40, Culture=neutral, PublicKeyToken=5bb2a467cbec794e, processorArchitecture=MSIL" />
|
||||
<Reference Include="Telerik.WinControls.UI, Version=2018.3.529.40, Culture=neutral, PublicKeyToken=5bb2a467cbec794e, processorArchitecture=MSIL" />
|
||||
<Reference Include="TelerikCommon, Version=2018.3.529.40, Culture=neutral, PublicKeyToken=5bb2a467cbec794e, processorArchitecture=MSIL">
|
||||
<HintPath>C:\Program Files (x86)\Progress\Telerik UI for WinForms R3 2018\Bin40\TelerikCommon.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Reference Include="Telerik.WinControls.RadMap, Version=2021.3.1123.40, Culture=neutral, PublicKeyToken=5bb2a467cbec794e, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\Users\dyordano\Desktop\DLL\Telerik_UI_For_WinForms_2021_3_1123_Dev_dlls\Bin40\Telerik.WinControls.RadMap.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Telerik.WinControls.UI, Version=2021.3.1123.40, Culture=neutral, PublicKeyToken=5bb2a467cbec794e, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\Users\dyordano\Desktop\DLL\Telerik_UI_For_WinForms_2021_3_1123_Dev_dlls\Bin40\Telerik.WinControls.UI.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="TelerikCommon, Version=2021.3.1123.40, Culture=neutral, PublicKeyToken=5bb2a467cbec794e, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\Users\dyordano\Desktop\DLL\Telerik_UI_For_WinForms_2021_3_1123_Dev_dlls\Bin40\TelerikCommon.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
Двоичные данные
Map/RadMapToAnImage/RadMapToAnImage/test.png
Двоичные данные
Map/RadMapToAnImage/RadMapToAnImage/test.png
Двоичный файл не отображается.
До Ширина: | Высота: | Размер: 135 KiB После Ширина: | Высота: | Размер: 537 KiB |
|
@ -12,6 +12,8 @@ Public Class MainForm
|
|||
Dim pinLayer As MapLayer = New MapLayer("PinsLayer")
|
||||
Me.RadMap1.Layers.Add(pinLayer)
|
||||
Dim osmProvider As OpenStreetMapProvider = New OpenStreetMapProvider()
|
||||
Dim tileDownloader As MapTileDownloader = TryCast(osmProvider.TileDownloader, MapTileDownloader)
|
||||
tileDownloader.WebHeaders.Add(System.Net.HttpRequestHeader.UserAgent, "your application name")
|
||||
AddHandler osmProvider.InitializationComplete, AddressOf OsmProvider_InitializationComplete
|
||||
Me.RadMap1.MapElement.Providers.Add(osmProvider)
|
||||
|
||||
|
@ -31,13 +33,12 @@ Public Class MainForm
|
|||
Dim bitmap As Bitmap = New Bitmap(CInt(Me.RadMap1.MapElement.ViewportInPixels.Size.Width), CInt(Me.RadMap1.MapElement.ViewportInPixels.Height))
|
||||
Dim g As Graphics = Graphics.FromImage(bitmap)
|
||||
Dim gg As RadGdiGraphics = New RadGdiGraphics(g)
|
||||
|
||||
For Each element As MapVisualElement In Me.RadMap1.MapElement.Providers(0).GetContent(Me.RadMap1.MapElement)
|
||||
element.Paint(gg, Me.RadMap1.MapElement)
|
||||
Next
|
||||
|
||||
Dim state As Object = gg.SaveState()
|
||||
gg.TranslateTransform(-Me.RadMap1.MapElement.ViewportInPixels.X, -Me.RadMap1.MapElement.ViewportInPixels.Y)
|
||||
'As of R2 2021 calling TranslateTransform is not necessary
|
||||
'gg.TranslateTransform(-Me.RadMap1.MapElement.ViewportInPixels.X, -Me.RadMap1.MapElement.ViewportInPixels.Y)
|
||||
Me.RadMap1.MapElement.Layers("PinsLayer").Paint(gg, Me.RadMap1.MapElement)
|
||||
gg.RestoreState(state)
|
||||
bitmap.Save("..\..\test.png", ImageFormat.Png)
|
||||
|
|
|
@ -58,18 +58,21 @@
|
|||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Telerik.WinControls, Version=2018.3.529.40, Culture=neutral, PublicKeyToken=5bb2a467cbec794e, processorArchitecture=MSIL">
|
||||
<HintPath>C:\Program Files (x86)\Progress\Telerik UI for WinForms R3 2018\Bin40\Telerik.WinControls.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Reference Include="Telerik.WinControls, Version=2021.3.1123.40, Culture=neutral, PublicKeyToken=5bb2a467cbec794e, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\Users\dyordano\Desktop\DLL\Telerik_UI_For_WinForms_2021_3_1123_Dev_dlls\Bin40\Telerik.WinControls.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Telerik.WinControls.RadMap, Version=2018.3.529.40, Culture=neutral, PublicKeyToken=5bb2a467cbec794e, processorArchitecture=MSIL" />
|
||||
<Reference Include="Telerik.WinControls.UI, Version=2018.3.529.40, Culture=neutral, PublicKeyToken=5bb2a467cbec794e, processorArchitecture=MSIL">
|
||||
<HintPath>C:\Program Files (x86)\Progress\Telerik UI for WinForms R3 2018\Bin40\Telerik.WinControls.UI.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Reference Include="Telerik.WinControls.RadMap, Version=2021.3.1123.40, Culture=neutral, PublicKeyToken=5bb2a467cbec794e, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\Users\dyordano\Desktop\DLL\Telerik_UI_For_WinForms_2021_3_1123_Dev_dlls\Bin40\Telerik.WinControls.RadMap.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="TelerikCommon, Version=2018.3.529.40, Culture=neutral, PublicKeyToken=5bb2a467cbec794e, processorArchitecture=MSIL">
|
||||
<HintPath>C:\Program Files (x86)\Progress\Telerik UI for WinForms R3 2018\Bin40\TelerikCommon.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Reference Include="Telerik.WinControls.UI, Version=2021.3.1123.40, Culture=neutral, PublicKeyToken=5bb2a467cbec794e, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\Users\dyordano\Desktop\DLL\Telerik_UI_For_WinForms_2021_3_1123_Dev_dlls\Bin40\Telerik.WinControls.UI.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="TelerikCommon, Version=2021.3.1123.40, Culture=neutral, PublicKeyToken=5bb2a467cbec794e, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\Users\dyordano\Desktop\DLL\Telerik_UI_For_WinForms_2021_3_1123_Dev_dlls\Bin40\TelerikCommon.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
Двоичные данные
Map/RadMapToAnImage/RadMapToAnImageVB/test.png
Двоичные данные
Map/RadMapToAnImage/RadMapToAnImageVB/test.png
Двоичный файл не отображается.
До Ширина: | Высота: | Размер: 456 KiB После Ширина: | Высота: | Размер: 506 KiB |
Загрузка…
Ссылка в новой задаче