User Tools

Site Tools


map_suite_wpf_desktop_edition_interactiveoverlays_samples

Map Suite Wpf Desktop Edition InteractiveOverlays Samples

Note: The page was created before Map Suite 10. Map Suite 10.0 organized many classes into new namespaces and assemblies as well as had a few minor breaks in compatibility. The majority of previously built code should work without modification assuming the new namespaces are added. For guidance on upgrading your existing code, please check out MapSuite 10 Upgrade Guide.

Canceling TrackOverlay

no_screenshot.jpg

This project shows how to implement aborting a trackshape with Esc key as you could do it in MapSuite 2.x.
As with Dynamic Info on TrackShape project, it shows how TrackOverlay can be extended to add some custom functionalities.
You will see how to handle some events of the map such as KeyDown and how to manipulate TrackOverlay.


Custom Track Line

map_suite_wpf_desktop_edition_sample_custom_track_line.jpg

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.


Custom Track Polygon

map_suite_wpf_desktop_edition_sample_custom_track_polygon.jpg

In the project “Custom Track Line”, we saw how to extend the TrackInteractiveOverlay to have the behavior of deleting the last added vertex when right click on a track line. In today’s project, we show how to implement this same behavior for tracking polygon.


Drag Select Vertices As Group

map_suite_desktop_edition_sample_drag_select_vertices_as_group.jpg

With EditInteractiveOverlay, we know how to drag a feature such as polygon as a whole. We also know how to drag an individual vertex by setting the appropriate properties. Here we go a little further and we show how to create an inherited class from EditInteractiveOverlay to implement the logic for selecting vertices and dragging them as a group. See how the protected methods MouseDownCore, MouseUpCore, MouseClickCore and MouseMoveCore were overridden for that purpose. This is a Desktop app that also applies to Wpf.


Dragged Point Style

map_suite_wpf_desktop_edition_sample_dragged_point_style.jpg

In the Discussion Forum Post “Snapping help needed”, we show the solution to have a dragged vertex snapping to a vertex of another layer. You can see that by default the control point being dragged turns yellow. In this project, we focus our attention on how to have control on the style of the control points. You will see how to override the DrawCore function of EditInteractiveOverlay. This is a project for the Desktop edition.


Dragged Point Style Advanced

map_suite_desktop_edition_sample_dragged_point_style_advanced.jpg

This project is another example of how extendible 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 have the vertex snap to any feature. Thanks to the protected override functions such as KeyDownCore, KeyUpCore, MouseUpCore and DrawCore, these functionalities can be easily implemented by inheriting from EditInteractiveOverlay.


Dragged PointStyle with Label

map_suite_wpf_desktop_edition_sample_dragged_point_style_with_label.jpg

In our series of projects dedicated to EditInteractiveOverlay, today 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 experience of the user, the closest point of the reference shape is also shown varying as the control point is dragged around.

In the GIS field, enterprises have different needs on how they edit there data and on how smooth the editing should be allowing the maximum control and precision to the technician editing the data. This example on how to use the EditInteractiveOverlay demonstrates how powerful and flexible editing is with Map Suite map control.


Dragging Icon

map_suite_wpf_desktop_edition_sample_dragging_icon.jpg

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.


Dragging Icon Advanced

map_suite_wpf_desktop_edition_sample_dragging_icon_advanced.jpg

This project is a more complete version of a previous project “Dragging Icon”. In addition to showing how to use EditInteractiveOverlay for dragging and dropping features represented by an icon, we also show how to add new features on the map by left double clicking on the map. You will also see how to remove a feature by right double clicking on its icon.


Dragging Vertex

map_suite_wpf_desktop_edition_sample_dragging_vertex.jpg

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.

To run this Desktop project, you will need the version 4.0.66.0 or later of the development daily build for MapSuiteCore and DesktopEdition dlls. And do not forget to add a reference to WindowsBase.dll.

This improvement is currently only in the development branch, it will be added to the production branch at the next major release in November.


Dynamic Info On TrackShapes

map_suite_wpf_desktop_edition_sample_dynamic_info_on_trackshapes.jpg

This project is for the Desktop version and it shows how to handle TrackOverlay to obtain dynamic information about the shape being tracked.

In this example, you will see displayed in a groupbox, properties such as perimeter and area as the shape is being tracked.

In this project, you will learn how to handle events such as TrackStarted, MouseMoved and TrackEnded of TrackOverlay for that purpose.

Getting dynamic info of a shape being tracked can be handy in situation where before committing to get the completed shape, you want to know more about the shape. For example, if you are tracking a search zone, you get dynamically info about its area.

This project will be followed by other related projects. One will show how to create one’s own inherited TrackOverlay for having the possibility to abort tracking by pressing a key. Another project will show how to display dynamic info inside the shape itself instead of using a separate control.


Editing Rectangles

This sample shows how to extend the EditInteractiveOverlay rectangles as shapes rather than polygon shapes by setting special column values. For features (Well Known Text and 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.
To activate the feature, you need to assign the value of the column called “Edit” to “rectangle”. The resize function will keep the ratio of width and height of the rectangle, otherwise it will use the original method.
For more information you can see the discussion forum post below:
http://gis.thinkgeo.com/Support/DiscussionForums/tabid/143/aff/21/aft/5822/afv/topic/Default.aspx


EditOverlay Styles

map_suite_wpf_desktop_edition_sample_editoverlay_styles.jpg

In today’s Web project, we learn how to control the styles of the EditOverlay for both the default style and the editing style. In order to accomplish this, we write some javascript code. Look at the code in the “script” tag to see how we can control the fill color, the opacity, the border width etc of the features in the EditOverlay.


Connecting Two Shapes With Arraw Line Samples

map_suite_wpf_desktop_edition_sample_connecting_two_shapes.jpg

In this sample, two polygons are connected by a arrowline, and if the polygons are moved the connecting arrowline will be moved automatically as well.


Preset Vertex To Tracked Polygon

map_suite_desktop_edition_sample_preset_vertex_to_tracked_polygon.jpg

This Desktop sample shows how to extend TrackInteractiveOverlay to give the ability to add a preset vertex to a track polygon while tracking. This can be handy in the situations where you need to add a vertex outside the current extent of the map or when you need to add a vertex with precise X and Y values. In the custom PresetVertexTrackInteractiveOverlay, you can see how the protected function GetTrackingShapeCore was overridden to implement this tracking behavior of the polygon.


Select and Drag(wpf)

map_suite_wpf_desktop_edition_sample_select_and_drag.jpg

In this Wpf project, we show how to select a feature from a shapefile based on a column value using the GetFeaturesByColumnValue. We also show to setup the EditOverlay to give the user the ability to drag the selected feature. In this project, you can also see how to get the world coordinates at the mouse move event. Notice that the code for doing this is quite different in Wpf compared to the winforms edition.


Select Vertices

map_suite_desktop_edition_sample_select_vertices.jpg

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.


Select with Track Shape

map_suite_wpf_desktop_edition_sample_select_with_trackshape.jpg

In today’s Desktop project, we combine the skills we learned in the samples “Spatial Query A Feature Layer” and “Track And Edit Shapes”. You can see how we use the event TrackEnded to get the RectangleShape from the tracked shape of TrackOverlay to do the spatial query. In this example, we use a Rectangle but you could also very easily use another shape such as Polygon, Circle, etc.


Snap To Layer

map_suite_wpf_desktop_edition_sample_snap_to_layer.jpg

This project shows how you can apply snapping to an EditInteractiveOverlay. There are many aspects to snapping. Previously, we showed a project with the mouse pointer snapping to the closest vertex of an editable polygon. Today, we show the technique to drag a control point and have it snap to the closest vertex of a layer if within tolerance. The tolerance can be set in world (meter, feet etc) or screen (pixels) coordinates. Notice that we are also using the technique showed in the previous project “Dragged Point Style”.


Snapping to Layer2

map_suite_wpf_desktop_edition_sample_snaptolayer2.jpg

The purpose of this Wpf project is to address some limitations of the class SnapToLayerEditInteractiveOverlay found in a previous sample Snap To Layer.
This class allowed the snapping of the mouse pointer to the closest vertex of a polygon if it is within a set tolerance. While this worked great for simple polygons, there was a performance limitation with complex polygons made of many vertices. This Wpf sample addresses this limitation and allows responsive dragging and snapping of vertex regardless of the size of polygon to snap to.


Snapping to Vertex

map_suite_wpf_desktop_edition_sample_snapping_to_vertex.jpg

This project is the first one of a series that will be dedicated to snapping using InteractiveOverlay. In this project, we show how to snap the mouse pointer to the closest vertex of an editable polygon if it is within a set tolerance. The tolerance is shown as a circle around the vertices. This technique can also be applied to snapping vertices within the same shape, between different shapes or even based on a layer. Those different types of snapping will be the subject of future projects related to snapping using InteractiveOverlay.


Track Zoom In Without Shift

no_screenshot.jpg

This project is for DesktopEdition users. In Map Suite 2.x, different modes of the map are offered to the developer to choose what kind of behavior the map has at a mouse action. In Map Suite 3.x, we went away from modes to have a more flexible model using InteracticeOverlay. By default, track zoom in is done by clicking and dragging the mouse on the map while holding the Shift key. This is very convenient but what if you want to offer the users the same experience as with 2.x, where the same mouse action has different behavior such as TrackZoomIn and Pan through the use of modes.

In this project, we show how to build your own InteractiveOverlay to emulate in Map Suite 3.x the mode behavior 2.x has.


Tracked Shapes to File

map_suite_wpf_desktop_edtion_sample_tracked_shapes_to_file.jpg

In this Wpf sample, we show how to persist the tracked shapes by saving the WKT (Well Known Text) to a file using the TrackEnded event. Also, you can see how to retrieve the WKT from files to create the features for the TrackShapeLayer of the TrackOverlay when loading the map. You will need the MapSuiteCore.dll and WpfDesktopEdition.dll references for this sample.


Tracked Shapes to WKT

map_suite_wpf_desktop_edition_sample_tracked_shapes_to_wkt.jpg

In today’s project, we show how to save a tracked shape to WKT (Well Known Text). You will notice that we make the distinction between the shape being tracked and the finished tracked shape thanks to two different events of TrackOverlay, TrackEnding and TrackEnded.


TrackOverlay with ESC(New)

no_screenshot.jpg

This project is meant to respond to a limitation with aborting tracking a shape in the project TrackOverlay with Esc. Now we can abort the tracked shape from the first vertex being added. Notice how we used a new class CustomTrackInteractiveOverlay inheriting from TrackInteractiveOverlay for this purpose.


Vertex Tolerance

map_suite_wpf_desktop_edition_sample_vertex_tolerance.jpg

Basically, this project shows the opposite of yesterday’s project “Snap To Layer”. Instead of having the dragged control point snapping to a vertex if within a tolerance, we show how to not allow a control point get within a set tolerance. This technique can be handy to implement if you have a requirement to have vertices of a shape being no less than a certain distance between each others. To implement that technique, again we use the power and flexibility of the EditInteractiveOverlay of the Desktop edition.

map_suite_wpf_desktop_edition_interactiveoverlays_samples.txt · Last modified: 2017/03/17 02:12 by tgwikiupdate