ThinkGeo.com    |     Documentation    |     Premium Support

Understanding InteractiveOverlay

OK I am a slow learner at times. 


I want to control the mouse wheel functionality. 


From what I understand I need to create an InteractiveOverlay . 


Ok I looked at it. But how do I use it? 


Here is how I create my overlay  now


Jpeg2000RasterLayer jpeg2000RasterLayer = new Jpeg2000RasterLayer(jpegFileName); 

jpeg2000RasterLayer.UpperThreshold = 10000000; 

jpeg2000RasterLayer.LowerThreshold = 0; 

LayerOverlay imageOverlay = new LayerOverlay(); 

FileBitmapTileCache fileBitmapTileCache = new FileBitmapTileCache(cacheDirectory, 

string.Empty); 

fileBitmapTileCache.TileMatrix.TileWidth = 512; 

fileBitmapTileCache.TileMatrix.TileHeight = 512; 

fileBitmapTileCache.TileAccessMode = TileAccessMode.ReadAdd; 

imageOverlay.TileCache = fileBitmapTileCache; 

imageOverlay.Layers.Add("JpegImageLayer", jpeg2000RasterLayer); // winformsMap1.InteractiveOverlays.Add(imageOverlay); 

winformsMap1.Overlays.Add(imageOverlay);


How would I convert this thing to an InteractiveOverlay ??


Thanks



 You are using ImageOverlay to add Raster layers to your map. This overlay is for displaying raster layers and I don't think you want to use the mouse wheel at this level. I suspect that you want to do is control the mouse wheel for changing the extent of the map. So, you need to leave ImageOverlay alone and look at winformsMap1.ExtentOverlay which is an InteractiveOverlay for controling the extent. For example, you have the property:



winformsMap1.ExtentOverlay.MouseWheelMode


If you want to have full control of the mouse wheel for extent behavior (for example by what percentage the map is going to zoom at each mouse wheel etc), you need to create a new class inheriting from ExtentInteractiveOverlay and implement your self the exact behavior you expect overriding MouseWheelCore function. It is a lot of Object Oriented Programming concepts to master but once you understand it, you have full flexibility for the desired functionalities.


There is another post with  a similar question:


gis.thinkgeo.com/Support/Dis...fault.aspx


Is it something like that you are expecting? If so, we can publish this week a sample in the Code Community that shows how to do that but before I want to make sure this is indeed what you are looking for. Thank you.


 As it has been reminded to us many times by concerned users of Map Suite, we currently don't have the documentation to explain high level, 101 type of topics such as explaining how to extent Map Suite. We have had in plan to have such a documentation for a long time. Soon, we will start working on that and the documentation will be in a Wikipedia format. 

 In the meantime, I suggest you check out the following video explaining a little bit how Overlays/Layers work.


gis.thinkgeo.com/Products/GI...fault.aspx


 




Bob,


Thanks for your post.


Maybe I did express myself clear. My suggestion is probably you need to create your own ExtentIntartiveOverlay. Following is the simple prototype, hope it helps.



    public class MyExtentInterativeOverlay : ExtentInteractiveOverlay
    {
        public MyExtentInterativeOverlay()
            : base()
        { }

        protected override InteractiveResult MouseWheelCore(InteractionArguments interactionArguments)
        {
            // Put your logic here instead of use the base logic.
            return base.MouseWheelCore(interactionArguments);
        }
    }

The most difficult part is overriding the MouseWheelCore, which depends on your own logic.


Any more questions just feel free to let me know.


Thanks.


Yale

 



Thanks everyone. I really appreciate it. Sorry for being so dense. I am just starting to get the idea from your posts.  
 Thanks again…  
  


I am glad you are making progress in understanding our products. And, don’t hesitate to check the Code Community. New samples are added almost every day.

Here is an idea for you.   
 If I could type in a function name into a query to find what is in the Code Community that would help.  
 Like keyword search for the code. Thats a pretty general request but it would be easier for folks to  
 know what example I should download and poke at.    Some were obvious and to be honest I just  
 didnt remember to look there. If it makes you feel any better I am getting close to completion and your  
 stuff has really worked well so hats off. And with the recent builds to help speed up the repaint things 
 are going much better.  
 I have a general question. Is the WPF control going to pan like the Silverlight product does?  
 If you didnt understand this. Is it going to allow for panning with out the missing pieces that are filled in 
 later? Just asking.  
 thanks…  
  
  
  


Bob, 
  
   You hit on what we like to think of is the holy grail.  We are brainstorming on how to make things more accessible and close the gap between the How Do I samples and the Code Community.  We also want to get the searching to also include the code.  I just wanted to let you know we are thinking the same things. 
  
   For the WPF side of things we have a beta coming down the pipe in the next few weeks that is exactly what you mentioned.  It is a group up WPF control that looks very similar to the Silverlight edition.  We started used the same panning and drawing system as in Silverlight the the results are awesome.  In beta it will be a separate control however we are striving to make it compatible so you just switch out the canvas on your form and the rest should work.  There are a few small places of incompatibility but those will be easy to find and in most cases just removed because the property is no longer used. 
  
 David