ThinkGeo.com    |     Documentation    |     Premium Support

Panning does not respond when restrctedExtent is set

Greetings!


I applied restricted extent in script section and pan fuctionality does not respond.


<text> <script language ="javascript" >
  Map1.restrictedExtent = new OpenLayers.Bounds(-51, 121, 149, -13)
</text>
</script> </text>


The restricted extent is the same as current extent.


Zoom in and zoom out works as expected.


When I zoom in and then try to pan  with mouse - no response.


What is required to make pan with mouse responsive?


I added another InMemoryFeatureLayer just to show extent



Dim extentLayer As New InMemoryFeatureLayer
extentLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.StandardColors.Transparent, GeoColor.StandardColors.Red)                            
extentLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20
extentLayer.InternalFeatures.Add("Extent", New Feature(New RectangleShape(-51, 121, 149, -13)))                                                        
overlay.Layer(extentLayer)

 


Not sure why extent rectangle does not draw completely.


As you can see there is a space between extent rectangle and the map edges.




In desktop edition if I set Map ZoomLevelSnapping = ZoomLevelSnappingMode.None then space disappears.


Is it possible to eliminate space in MVC edition?


 


 


 


 


Here is sample code based on CreateAnInMemoryFeatureLayer.vbhtml


 


 


@Imports ThinkGeo.MapSuite.Core


@Imports ThinkGeo.MapSuite.MvcEdition


 


<div class="four columns" id="navigation">


    @Code 


        Html.RenderPartial("SourceCode")        


    End Code


    <div id="instrux-body">


        <div id="instrux-text">


            This sample simply adds an InMemoryFeatureLayer.


        div>


    div>


div>


<div class="twelve columns" id="main">


    <div>


        @Code


            With Html.ThinkGeo().Map("Map1", New System.Web.UI.WebControls.Unit(100, System.Web.UI.WebControls.UnitType.Percentage), 510)


                .MapBackground(New BackgroundLayer(New GeoSolidBrush(GeoColor.FromHtml("#E5E3DF"))))


                .MapUnit(GeographyUnit.DecimalDegree)


                .CurrentExtent(-51, 121, 149, -13)


            .StaticOverlay(Sub(overlay)


                               Dim inMemoryLayer As InMemoryFeatureLayer = New InMemoryFeatureLayer()


                               inMemoryLayer.InternalFeatures.Add("Polygon", New Feature(BaseShape.CreateShapeFromWellKnownData("POLYGON((10 60,40 70,30 85, 10 60))")))


                               inMemoryLayer.InternalFeatures.Add("Multipoint", New Feature(BaseShape.CreateShapeFromWellKnownData("MULTIPOINT(12 20, 30 20,40 20, 12 30, 30 30, 40 30)")))


                               inMemoryLayer.InternalFeatures.Add("Line", New Feature(BaseShape.CreateShapeFromWellKnownData("LINESTRING(60 60, 70 70,75 60, 80 70, 85 60,95 80)")))


                               inMemoryLayer.InternalFeatures.Add("Rectangle", New Feature(New RectangleShape(65, 30, 90, 15)))


                                                                                                                                                        


                               inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.FillSolidBrush.Color = GeoColor.FromArgb(100, GeoColor.StandardColors.RoyalBlue)


                               inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.Color = GeoColor.StandardColors.Blue


                               inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle.OuterPen = New GeoPen(GeoColor.FromArgb(200, GeoColor.StandardColors.Red), 5)


                               inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.SymbolPen = New GeoPen(GeoColor.FromArgb(255, GeoColor.StandardColors.Green), 8)


                               inMemoryLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20


 


                               overlay.Layer(inMemoryLayer)


                               


                               Dim extentLayer As New InMemoryFeatureLayer


                               extentLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.StandardColors.Transparent, GeoColor.StandardColors.Red)


                               


                               extentLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20


                               extentLayer.InternalFeatures.Add("Extent", New Feature(New RectangleShape(-51, 121, 149, -13)))


                                                              


                               overlay.Layer(extentLayer)


                           End Sub


            ).Render()


            End With


          End Code


 


          <script language ="javascript" >


            Map1.restrictedExtent = new OpenLayers.Bounds(-51, 121, 149, -13)


          script>


    div>


div>


 


 


 


 



Panning works fine with iPad using 2 fingers. 
  
 It does not work using windows browser and it explains why - it requires 2 inputs. 


Hello Sergei, 
  
 Thanks for your post and code, with this, we have noticed we don’t have the RestrictedExtent in our MapBuilder, now we add this in, and you can directly set it without using javascript and openlayer. 
  
 Also when I test with your code, I got the exception WKT is invalid, so I didn’t recreate your problem, but I think it’s possible because of openlayer, can you upgrade to the newest dlls(6.0.176.0) which contain the RestrictedExtent and have another try? 
  
 Regards, 
  
 Gary

Gary, 
  
 Thanks for reply. 
 Where I can download 6.0.176.0 version. 
  
 Daily development build has following: MvcEditionFull5.5.138.0DllPackage.zip 
 Daily production build has none for mvc edition. 
  
 I need the latest stable production build. 
  
 Best wishes, 
 Sergei.

Hi Sergei,  
  
 Thanks for your patience. The MvcFull Editions Production builds are now available via the HelpDesk.