User Tools

Site Tools


map_suite_desktop_for_winforms_all_samples

This is an old revision of the document!


Table of Contents

WinForms Samples

QuickstartSample-forWinForms

The Winforms QuickStart Guide will guide you through the process of creating a sample application and will help you become familiar with Map Suite. This QuickStart Guide supports Map Suite 10.0.0.0 and higher and will show you how to create a Winforms application.

Screenshot

View this sample on Github

Line Style With Increment Sample for WinForms

In this WinForms desktop project, we show how to create a custom LineStyle for showing distance increment at a regular interval (every tenth kilometer). Having this LineStyle can be very handy when dealing with line networks, such as roads or railways.

Screenshot

View this sample on Github

Distance Query On Projected Layers Sample for WinForms

This sample shows how to use the method GetFeaturesWithDistanceOf when the data is projected. We just input the unit which is projected to, do not need to mind what the real unit is for the internal data before projection. It works fine with Map Suite Assemblies 4.5.54.0 or later.

Screenshot

View this sample on Github

Editing Rectangles Sample for WinForms

This sample shows how to extend the EditInteractiveOverlay rectangles as shapes, rather than polygon shapes, by setting special column values. For features (both *Well Known Text* and *Well Known Binary*), the concept of a rectangle is not supported and typically rectangles are handled as polygons. This feature allows users to modify the rectangle but requires that the modification keep a rectangular form. The rectangle doesn't need to be straight as long as all of the corner angles are at 90 degrees relative to each other.

Screenshot

View this sample on Github

Create GRID Sample for WinForms

Today’s sample shows the new feature available in this may release Map Suite 5 for creating GRID files. A GRID is a raster format that defines a geographic space as an array of equally sized squares (cells) arranged in rows and columns. Each cell stores a numeric value that represents an attribute (such as elevation, surface slope, soil pH etc.) for that unit of space. Each GRID cell is referenced by its x, y coordinate location. Typically a GRID file is created based on some sample points with known values. In today’s sample, we take the example of creating a GRID file based on a point based shapefile representing soil pH values of some sample locations in a field. Using the Inverse Weighted Distance algorithm for interpolation, we create the GRID with the pH value for the entire extent of the field. Look at the code and comments for more details on how GRID files get generated and displayed on the map. This sample is a Desktop application but GRID can be used in all the editions of Map Suite.

Screenshot

View this sample on Github

Track Overlay With Esc Sample for WinForms

This project shows how to implement aborting a trackshape with Esc key as you could do it in MapSuite 2.x.

Screenshot

View this sample on Github

GPS to Google Map Desktop Sample for WinForms

This project shows how to display on Google Map point data coming from some GPS reading in Geodetic (Longitude/Latitude). It also shows how to set the extent of the map so that it is centered on the GPS point.

Screenshot

View this sample on Github

Multiple Labels Sample for WinForms

This sample shows how you can display multiple labels for a given point or feature. You can do this by setting a single TextStyle or multiple TextStyles. If you use a single TextStyle, you can simply use a pattern like “[ColumnName1][ColumnName2]…” and when Map Suite displays the text it will combine the values of the columns in your pattern. If you use a different styling method, you will need to manually control the offset of each piece of text to avoid overlapping.

Screenshot

View this sample on Github

WorldStreetsVectorLayerSDK-ForWinForms

The World Streets Vector Layer Explorer is a tool that enables you to view the SQLite World Streets data using Map Suite WinForms and provides complete performance metrics.

This project requires a full or evaluation version of Map Suite WinForms Edition.

This sample passed on Linux with Mono Runtime. On Windows platform, it is required to replace the ThinkGeo.MapSuite.Layers.SqliteForLinux with ThinkGeo.MapSuite.Layers.Sqlite package.

To run the sample, please unzip the database file at WorldStreetsVectorLayerSample/App_Data/DallasCounty-3857-20170218.zip, and change the connection string in WorldStreetsVectorLayerSample/App.config to connect database that you extracted to.

Working…

Screenshot

View this sample on Github

Dragging Icon Sample for WinForms

In today’s sample, we show how to drag icons representing vehicle on the map. This is a handy feature if you want to give your users the ability to drag and drop some non stationary features such as vehicles. You can see that to accomplish this functionality, you can use EditInteractiveOverlay as it already has all the necessary logic for dragging purposes. Look at the code to see how to set up that overlay to have the expected behavior.

Screenshot

View this sample on Github

Dragged Point Style Sample for WinForms

In this project, we focus our attention on how to control the style of the control points. You will see how to override the DrawCore function of EditInteractiveOverlay.

Screenshot

View this sample on Github

Ecw Sample for WinForms

The Ecw Sample template represents an ECW file for drawing on the map.

ECW: ECW is a wavelet image compression system developed by ER Mapper.It allows you to combine and compress large sets of satellite images into a single file. The images can be accessed very quickly at a variety of scales. It is very popular in the GIS community.

Screenshot

View this sample on Github

Custom Track Polygon Sample for WinForms

Learn how to extend the TrackInteractiveOverlay to add behaviors, like deleting the last added vertex when right-clicking the track line.

Screenshot

View this sample on Github

Select Vertices Sample for WinForms

The purpose of this sample is to help you, the developer understand some intricacies of inheriting from EditInteractiveOverlay when implementing your own editing logic. Here we show how to keep control points drawing as selected even after the dragging operation is finished. For this purpose, we need to override three protected functions, OnControlPointSelected, MouseUpCore and DrawCore. Please, read carefully the comments to understand the inner workings of EditInteractiveOverlay.

Screenshot

View this sample on Github

Custom Track Line Sample for WinForms

In today’s project, we are going to see how to extend the TrackInteractiveOverlay in the Desktop edition to have the desired behavior when tracking a line. In this case, we show how to override the MouseDownCore function to have the line being tracked at left mouse click and have the last vertex added deleted at right mouse click.

Screenshot

View this sample on Github

Labeling Based On Size Sample for WinForms

This project shows some advanced uses of the ClassBreakStyle to show how to label countries based on the area. You will notice that we also take advantage of the various zoom level sets for labeling purposes. The result is an eye pleasing labeling of the countries, with the size proportionate to the countries’ area, with more countries' labels appearing as you zoom in.

Screenshot

View this sample on Github

Graphic Logo Adornment Sample for WinForms

This sample shows how you can display your logo on the map using an AdornmentLayer. The advantage of using an Adornment is that the graphic stays in place and doesn't move as you pan your map. The sample should work for various kinds of logos and allow you to change the position using the AdornmentLayer's properties.

Screenshot

View this sample on Github

US Demographic Map Sample Template for WinForms

The Demographic and Lifestyle sample template gives you a head start on your statistics project, which includes details about race, age, gender, land usage, and more for all the states in U.S. The template contains pre-styled layers that can be used as-is, or as the foundation for adding your own map notes and layers.

Screenshot

View this sample on Github

Open Street Map Sample for WinForms

OpenStreetMap (OSM) is a collaborative project to create free geographic data for the entire world. It can be thought of as a “Free Wiki World Map”. The latest version of MapSuite now supports this.

Screenshot

View this sample on Github

Centering On Moving Vehicle With Tolerance Sample for WinForms

In the previous project, we showed how to center the map on a moving vehicle. While this is great, it has the disadvantage of having to refresh the map each time the vehicle changes position. In this project, we respond to this inconvenience by using a set tolerance used for determining if the map needs to be refreshed or not. If the vehicle moves within a rectangle of a certain size located in the center of the current extent of the map, the map will not refresh and only the moving vehicle will. If it moves outside the tolerance area, the entire map will be refreshed and the tolerance recalculated.

Screenshot

View this sample on Github

Get Features Clicked On Sample for WinForms

The purpose of this project is to show the technique for finding the feature the user clicked on. To give the user the expected behavior, a buffer in screen coordinates needs to be set so that the feature gets selected within a constant distance in screen coordinates to where the user clicked, regardless of the zoom level.

Screenshot

View this sample on Github

Intersect Line Sample for WinForms

In today’s project, we show how to split a line based on an intersecting line. To accomplish this task, basically two steps are needed. First, you need to find the crossing point using the GetCrossing function and then you split the line based on the crossing point using the GetLineOnLine function. If you are in the utilities industry working with electric network, gas pipes etc, you will find this project useful.

Screenshot

View this sample on Github

MrSid Sample for WinForms

MrSID (pronounced Mister Sid) is an acronym that stands for multiresolution seamless image database. In order to run this sample, development build 10.0.0.0 or later is required.

This sample includes a map with MrSID as base overlay, the MrSID shows the image data of the world range.

Screenshot

Known issue: The screenshot is taken under Linux, but it not well tested, maybe sometimes runs to exception.

View this sample on Github

An early project of the Code Community, “Vehicle Direction”, showed how to rotate the icon of a moving vehicle based on the direction. In today’s project, we are going one step further and we are showing how to display dynamically a bread crumb trail as a trailing tail behind the moving vehicle. For this purpose, we are creating a new LineShape with the latest points at every new position.

Screenshot

View this sample on Github

Lat Long Graticule Sample for WinForms

After the projects on North Arrow and Compass, we created another project related to Adornment Layer to have a more stylish map and give more information to the user navigating the map.

Screenshot

View this sample on Github

Kml Extension Sample Sample for WinForms

KML is the file format for displaying geographic data in a Google Earth browser such as Google Earth. Now, you can also display such a file on a Map Suite control. Thanks to its flexible architecture to extent to new file formats, in today’s project we wrote the logic for supporting KML. Look at the class KmlfeatureSource inheriting from FeatureSource to see how the logic for reading FML files was implemented. As well, you can see the class KmlStyle inheriting from Style for the drawing logic. And feel free to modify and improve those classes with your own implementations.

Screenshot

View this sample on Github

Detect GPS Desktop Sample for WinForms

Upon request of our users, today we publish a project that is the Desktop version of “Detect GPS” for Web. Notice how we use ValueStyle and change the column value of the feature based on the Spatial Query feature at each new position. We chose this structure so that you can have more flexibility for adding more than one moving vehicle features to the InMemoryFeatureLayer. For that, you can pretty much keep the same code and just add an outer loop for looping thru all the moving features.

Screenshot

View this sample on Github

Dynamic Track Shapes Sample for WinForms

This Desktop project shows how to handle TrackOverlay to obtain dynamic information about the shape being tracked.

Screenshot

View this sample on Github

Geocoding Samples for WinForms

Vehicle Tracking Sample Template for WinForms

The Vehicle Tracking sample template gives you a head start on your next tracking project. With a working code example to draw from, you can spend more of your time implementing the features you care about and less time thinking about how to accomplish the basic functionality of a tracking system.

Screenshot

View this sample on Github

Us Earthquake Statistics Sample Template for WinForms

The Earthquake Statistics sample template is a statistical report system for earthquakes that have occurred in the past few years across the United States. It can help you generate infographics and analyze the severely afflicted areas, or used as supporting evidence when recommending measures to minimize the damage in future quakes.

Screenshot

View this sample on Github

GetZoomLevelSample-ForWinForms

This example demonstrates how to get the zoom level of the map each time we change its extent. Using custom zoom levels, you will see how to get the zoom level with its characteristics such as the upper and lower scale defining it. You can read the comments inside the project to better understand the relationship of scales with zoom levels.

Screenshot

View this sample on Github

Dragging Vertex Sample for WinForms

The purpose of today’s project is not so much as show a new technology as to show an improvement in an existing one. We are already familiar with EditInteractiveOverlay with projects such as “Dragged PointStyle with Label”, “Snap To Layer” and “Snapping to Vertex”. But those projects showed EditInteractiveOverlay on small shapes. Using EditIntercticeOverlay on complex shapes became not very responsive. We improved that and now you can drag, resize, rotate and drag individual vertex of a complex polygon made of thousand of vertices with good responsiveness as you can see in this example.

Screenshot

View this sample on Github

Draw Custom Exception Sample for WinForms

This sample shows how you can suppress and draw exceptions in desktop overlays instead of throwing them. There is a little-known feature in the Map Suite Desktop Edition Overlay class that allows you to draw an exception in the event an exception is thrown during the drawing process. We have a default image we draw in this case; however, you can override this using the DrawExceptionCore method and draw whatever you want. By default we always throw expections, but to start drawing them you can use the Overlay.DrawExceptionMode property.

Screenshot

View this sample on Github

Dragging Vertex Sample for WinForms

The purpose of today’s project is not so much as show a new technology as to show an improvement in an existing one. We are already familiar with EditInteractiveOverlay with projects such as “Dragged PointStyle with Label”, “Snap To Layer” and “Snapping to Vertex”. But those projects showed EditInteractiveOverlay on small shapes. Using EditIntercticeOverlay on complex shapes became not very responsive. We improved that and now you can drag, resize, rotate and drag individual vertex of a complex polygon made of thousand of vertices with good responsiveness as you can see in this example.

Screenshot

View this sample on Github

Feature Ids To Exclude Sample for WinForms

The purpose of this project is to show how to use the FeatureIdsToExclude collection of FeatureLayer. In the project, you will see how you can exclude some features from being part of the GetFeaturesNearestTo function. Using that collection is a handy method for not taking into account some features in doing spatial queries, searching and even drawing without having to change the structure of the layer or create another layer.

Screenshot

View this sample on Github

Jpeg2000 Sample for WinForms

The Jpeg2000 Sample template represents a .JP2 (JPEG2000) image type to be drawn on the map.

Screenshot

View this sample on Github

Heat Map Sample for WinForms

Heat maps is a technique increasingly used in various fields such in biology and other fields. See http://en.wikipedia.org/wiki/Heat_map. They are also used for displaying areas of webs page most frequently scanned by users. http://csscreme.com/heat-maps/.

At ThinkGeo, we are taking this concept to GIS and applying it to geographic maps. Heat maps are a great way to give the users a visually compelling representation of the distribution and intensity of geographic phenomenon.

Screenshot

View this sample on Github

Edit Geometry Of Shapefile Sample for WinForms

The purpose of this sample is to show how to update the geometry of a feature of a shapefile in one step. This sample is useful for anyone wanting to actualize the geometry part of its data. You can see how only a few lines of code are necessary for this process, and that the spatial index gets automatically updated after calling the committing the change.

Screenshot

View this sample on Github

Earth Quakes Heat Map Sample for WinForms

After the project on displaying swine flu data using the heat map technique, here you learn how to apply parameters other than strictly spatial distribution to affect the coloring of the map.

Screenshot

View this sample on Github

Site Selection Sample Template for WinForms

The Site Selection sample template allows you to view, understand, interpret, and visualize spatial data in many ways that reveal relationships, patterns, and trends. In the example illustrated, the user can apply the features of GIS to analyze spatial data to efficiently choose a suitable site for a new retail outlet.

Screenshot

View this sample on Github

Earth Quakes Heat Map Sample for WinForms

After the project on displaying swine flu data using the heat map technique, here you learn how to apply parameters other than strictly spatial distribution to affect the coloring of the map.

Screenshot

View this sample on Github

Heat Map Sample for WinForms

Heat maps is a technique increasingly used in various fields such in biology and other fields. See http://en.wikipedia.org/wiki/Heat_map. They are also used for displaying areas of webs page most frequently scanned by users. http://csscreme.com/heat-maps/.

At ThinkGeo, we are taking this concept to GIS and applying it to geographic maps. Heat maps are a great way to give the users a visually compelling representation of the distribution and intensity of geographic phenomenon.

Screenshot

View this sample on Github

Dragged Point Style With Label Sample for WinForms

In this project, dedicated to EditInteractiveOverlay, you will see how easy it is to add some labeling to your dragged control point, showing dynamic information. Here we show how to display the distance from the dragged control point to the closest point of a reference shape. Also, to augment the user experience, the closest point of the reference shape is also shown varying as the control point is dragged around.

Screenshot

View this sample on Github

SqliteLayerSampleOnLinux-ForWinForms

The purpose of this sample is to show how to use SQLite as map data source.

screen

View this sample on Github

Edit Geometry Of Shapefile Sample for WinForms

The purpose of this sample is to show how to update the geometry of a feature of a shapefile in one step. This sample is useful for anyone wanting to actualize the geometry part of its data. You can see how only a few lines of code are necessary for this process, and that the spatial index gets automatically updated after calling the committing the change.

Screenshot

View this sample on Github ==== Routing Sample for WinForms

<img src=“https://www.iconfinder.com/icons/103529/download/png/20” align=center /> [Sample Data Download](http://wiki.thinkgeo.com/wiki/_media/routing/routing_howdoi_samples_data.zip) ====

Samples

Working…

Screenshot

View this sample on Github

Dragged Point Style Advanced Sample for WinForms

This project is an example of how extensible EditInteractiveOverlay is for the editing needs of the user. You can see how to change the styles of the vertex being dragged based on the Shift key, and how to have the vertex snap to any feature.

Thanks to the protected override functions such as KeyDownCore, KeyUpCore, MouseUpCore and DrawCore, these functionalities can easily be implemented by inheriting from EditInteractiveOverlay.

Screenshot

View this sample on Github

map_suite_desktop_for_winforms_all_samples.1488437864.txt.gz · Last modified: 2017/03/02 08:31 (external edit)