ThinkGeo.com    |     Documentation    |     Premium Support

WPF Panning Behavior

When implementing a WPF application using Map Suite will it support continuous panning or will the map only render after the user performs a mouseup event?



We would like to begin development on a WPF app but would like to make sure it supports continuous panning first.


Thanks!



Steve, 
  
 We do not support continuous panning in the current version (3.0.199), neither on WPF Control nor Winforms one. We tried to add this feature in 3.0.184 with multithreading, but as it brought too much cross threading issues,  we have to give it up in 3.0.199 with single threading.  
  
 Continuous Panning will be one of our great features for desktop and my coworkers now busying working on the next release have made great progress on it. I think in the upcoming version, continuous panning will be available and you can use it on both Winforms and WPF.  
  
 Thanks! 
  
 Ben

Ben, 
  
    Resurrecting an older thread instead of creating a new one.  I am curious how things are coming with a smoother panning feature for WPF.  Has there been any breakthroughs yet?  Another feature we are looking for is bitmapcaching, I have heard that is another upcoming feature, is there any information you can share on that as well?

Jake,


 Thanks for your interests in WPF control!
 
We have supported Multi-threading and automatically caching system both in WinformsMap and WpfMap control since latest public RC release 3.0.307.
 
Here is the link you can download from:
gis.thinkgeo.com/Products/GI...fault.aspx
 
Any more question just let me know!
 
Thanks.
 
Yale

Thanks Yale, The auto caching works well, but I am looking specifically for manual caching, I believe the function will be BitmapCaching().  I am not sure when that will be available.

Jake,


Thanks for your post!
 
May I know the reason you want to do manual caching? I mean the basic purpose you want to build your own caching system for.
 
We did not provide classes or functions to do the manually caching system in last public release (3.0.307 RC).  While if you are very urgent, we can provide you some Temporary version which contains the classes you can build your own caching system based on.
 
At last, I am not very sure what’s your meaning you talking about BitmapCaching()? In later public release, we will probably have following class structure assisting caching system.
TileMatrix
TileCache : BitmapTileCache, NativeImageTileCache
BitmapTileCache: FileBitmapTileCahce , InmemoryBitmapTileCache
NativeImageTileCahce: TileNativeImageTileCache
 
Let me know if you have more questions!
 
Thanks.
 
Yale

In the latest release (.362), was bitmaptilecache enabled?  ClientCache tells me to look for that function in the API documentation. 
  
 "This class is obsolete and it will be removed in next version, please refer to use class BitmapTileCache"

Are there any samples/lessons available on how to use the new TileCache functions?


What we are looking for is the ability to draw and store our aerial data locally for each zoom level(we limit the number of zoom levels and use snap to zoomlevel so we will have a limited number of cached bitmaps).  There may be some other layers that we are interested in caching as well since they won't be updated by our program.



Posted By Jake on 07-24-2009 08:36 AM 

In the latest release (.362), was bitmaptilecache enabled? ClientCache tells me to look for that function in the API documentation. 



"This class is obsolete and it will be removed in next version, please refer to use class BitmapTileCache" 



 


Jake,


Thanks for your post! In the latest release (3.0.362), the BitmapTileCache is already included, there is a OverlayTileCache property in Overlay which attempt to replace the ClientCahce.


Let me know if any more questions!
 
Thanks.
 
Yale

Posted By Jake on 07-24-2009 03:16 PM 

Are there any samples/lessons available on how to use the new TileCache functions?


What we are looking for is the ability to draw and store our aerial data locally for each zoom level(we limit the number of zoom levels and use snap to zoomlevel so we will have a limited number of cached bitmaps).  There may be some other layers that we are interested in caching as well since they won’t be updated by our program.





 


Jake,
 
If you are interested, please take a look at the following samples, it shows how to use the Client side cache system.
 
HowDoISamples Getting Started\UsingTileCache
 
Let me know if any more questions!
 
Thanks.
 
Yale



 



Yale, 
  
    Thanks for the response, but the sample isn’t really what I need.  It uses existing files from a specific location as the cache, which is what we need to do eventually.  But getting those tiles generated is my first concern.  Ideally we would create those cached files when a user opens the map up the first time and save them until the user wants to update them.  For our specific case we have aerial imagery in the background that shouldn’t change unless the user uploads a new image.  We want this to be tiled and saved locally.  Hopefully I can explain a little better what we need below. 
 Scenario: 
 1.  User opens map for first time at max zoom level, we generate the tiles for the background image at this zoom level 
 2.  User zooms in/pans around, we generate the new tiles for areas/zoom levels they are viewing the first time. 
 3.  User zooms back out/pans to existing areas, we grab the existing cached items 
 4.  User opens map they have viewed before, we grab the existing cached tiles. 
 5.  User uploads new aerial imagery outside of map program, we prompt to delete old cache files, effectively removing cache. 
  
 The sample really only covers scenario 4, and the API documentation on tiles/BitmapTileCache doesn’t explain it’s SaveTile/SaveTiles functionality

Jake,


Thanks for your post and questions!
 
What you need to is set the auto save functionality on, Try following code:

bitmapTileCache.ReadOnly = false;

Let me know if any more questions!


Thanks.
 
Yale

Yale, 
  
    Thanks for the help so far.  We have run into another issue, and we aren’t sure of how to proceed.  We have 2 overlays, 1 that holds the cached layers and 1 that holds the rest of the layers.  We want to be able to turn on and off the visibility of the cached layers.  We do this by setting the overlay property IsVisible to true/false.  This appears to work on areas that haven’t been cached in the current session, but we are seeing an issue when we go back to a tile that was cached in the current session, the cached tile appears to be loaded still.  What should we do to turn on/off the cached tiles?  We are hoping that we can quickly turn them on and off and not see any performance hits. 
  
    On a side note, we are seeing the cache being written to each new session, I believe there is a property that we can use to load from cache if it is already there?

Jake,


I think you forget to lock the overlay when you turn on or off the overlay by setting Invisible property.
 
Please try the following codes:
 

        private void DrawAndLabelANiceLookingRoad_Load(object sender, EventArgs e)
        {
            winformsMap1.MapUnit = GeographyUnit.DecimalDegree;
            winformsMap1.BackgroundOverlay.BackgroundBrush =new GeoSolidBrush(GeoColor.FromArgb(255, 233, 232, 214));

            ShapeFileFeatureLayer austinStreetsShapeLayer = new ShapeFileFeatureLayer(@"..\..\SampleData\Data\austinstreets.shp");
            austinStreetsShapeLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            austinStreetsShapeLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(LineStyles.LocalRoad1);

            ShapeFileFeatureLayer austinStreetsLabelLayer = new ShapeFileFeatureLayer(@"..\..\SampleData\Data\austinstreets.shp");
            austinStreetsLabelLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(TextStyles.LocalRoad1("FENAME"));
            austinStreetsLabelLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            LayerOverlay staticOverlay = new LayerOverlay();
            staticOverlay.Layers.Add("AustinStreetsShapeLayer", austinStreetsShapeLayer);

            LayerOverlay dynamicOverlay = new LayerOverlay();
            dynamicOverlay.Layers.Add("AustinStreetsLabelLayer", austinStreetsLabelLayer);
            dynamicOverlay.TileCache = new FileBitmapTileCache(@"C:\temp\MapSuiteCache");

            winformsMap1.Overlays.Add("StaticOverlay",staticOverlay);
            winformsMap1.Overlays.Add("DynamicOverlay",dynamicOverlay);

            winformsMap1.CurrentExtent = new RectangleShape(-97.749141617693908, 30.300592918607943, -97.741202279009826, 30.29492809316849);

            winformsMap1.Refresh();
        }



//Turn off.
        private void button1_Click(object sender, EventArgs e)
        {
            winformsMap1.Overlays["DynamicOverlay"].Lock.EnterWriteLock();
            try
            {
                winformsMap1.Overlays["DynamicOverlay"].IsVisible = false;
            }
            finally
            {
                winformsMap1.Overlays["DynamicOverlay"].Lock.ExitWriteLock();
            }

            winformsMap1.Refresh();
        }

        //Turn one.
        private void button2_Click(object sender, EventArgs e)
        {
            winformsMap1.Overlays["DynamicOverlay"].Lock.EnterWriteLock();
            try
            {
                winformsMap1.Overlays["DynamicOverlay"].IsVisible =true;
            }
            finally
            {
                winformsMap1.Overlays["DynamicOverlay"].Lock.ExitWriteLock();
            }

            winformsMap1.Refresh();
        }


 

Let me know if you have any more questions.
 
Thanks.
 
Yale