Giter Site home page Giter Site logo

hnjm / usewpfmapcontrolsample-forwinforms Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 5.98 MB

The wpf map control supports multi-thread to render map, so it performs better than winforms map control. This sample demonstrates how you can use wpf map control in your winforms applications.

C# 100.00%

usewpfmapcontrolsample-forwinforms's Introduction

Use Wpf Map Control Sample for WinForms

Description

The wpf map control supports multi-thread to render map, so it performs better than winforms map control. This sample demonstrates how you can use wpf map control in your winforms applications.

Please refer to Wiki for the details.

Screenshot

Requirements

This sample makes use of the following NuGet Packages

MapSuite 10.0.0

About the Code

/*===========================================
   Backgrounds for this sample are powered by ThinkGeo Cloud Maps and require
   a Client ID and Secret. These were sent to you via email when you signed up
   with ThinkGeo, or you can register now at https://cloud.thinkgeo.com.
===========================================*/

public Form1()
{
    InitializeComponent();

    // Initialize the WpfMap object and add it to the ElementHost. 
    map = new WpfMap();
    elementHost1.Child = map;
}

private void Form1_Load(object sender, EventArgs e)
{
    map.MapUnit = GeographyUnit.Meter;
    map.ZoomLevelSet = new ThinkGeoCloudMapsZoomLevelSet();

    ThinkGeoCloudRasterMapsOverlay thinkgeoBackgroundOverlay = new ThinkGeoCloudRasterMapsOverlay("ThinkGeoCloudClientId", "ThinkGeoCloudClientSecret");
    // Set up the TileCache for the background overlay. 
    thinkgeoBackgroundOverlay.TileCache = new XyzFileBitmapTileCache(".\\Cache");
    map.Overlays.Add(thinkgeoBackgroundOverlay);

    ShapeFileFeatureLayer shapeFileFeatureLayer = new ShapeFileFeatureLayer(@"..\..\Data\Countries.shp");
    shapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColors.Transparent, GeoColors.Black);
    shapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
    shapeFileFeatureLayer.FeatureSource.Projection = new Proj4Projection(Proj4Projection.GetDecimalDegreesParametersString(), Proj4Projection.GetSphericalMercatorParametersString());

    LayerOverlay layerOverlay = new LayerOverlay();
    layerOverlay.Layers.Add(shapeFileFeatureLayer);
    // Set up the TileCache for LayerOverlay.
    layerOverlay.TileCache = new FileBitmapTileCache(".\\Cache", "LayerOverlay");
    map.Overlays.Add(layerOverlay);

    map.CurrentExtent = new RectangleShape(-19489607.6157655, 12836528.7107853, 19293928.8244426, -8022830.44424083);
}

Getting Help

Map Suite Desktop for WinForms Wiki Resources

Map Suite Desktop for WinForms Product Description

ThinkGeo Community Site

ThinkGeo Web Site

Key APIs

This example makes use of the following APIs:

Working...

About Map Suite

Map Suite is a set of powerful development components and services for the .Net Framework.

About ThinkGeo

ThinkGeo is a GIS (Geographic Information Systems) company founded in 2004 and located in Frisco, TX. Our clients are in more than 40 industries including agriculture, energy, transportation, government, engineering, software development, and defense.

usewpfmapcontrolsample-forwinforms's People

Contributors

rex-thinkgeo avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.