ThinkGeo.com    |     Documentation    |     Premium Support

Zoom in and Zoom out using MouseWheel and MouseClick Event in Desktop Edition

Hi,


    I have few problems in Zoom in and Zoom out using mouse wheel and mouse click event. I am using mouse wheel and mouse click for zoom in and zoom out it will take time for zoom in and zoom out. It take very slow. Not able to zoom fastly. Please guide me for fast zoom in desktop edition.  I attached My Code given below.


 


private void Form1_Load(object sender, EventArgs e)

        {

            City1.SelectedItem = "--Select--";

            BindStreet();

            BindPOI();

            lbllatitude.Text = string.Empty;

            lbllongitude.Text = string.Empty;

            winformsMap2.MapUnit = GeographyUnit.DecimalDegree;

            winformsMap2.MapClick += new EventHandler<MapClickWinformsMapEventArgs>(winformsMap2_MapClick);

            winformsMap2.MouseWheel += new System.Windows.Forms.MouseEventHandler(winformsMap2_MouseWheel);

            ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(@"C:\Program Files\ThinkGeo\Map Suite Desktop Evaluation Edition 5.0\Samples\SampleData\Data\Countries02.shp");

            worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1;

            worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            ShapeFileFeatureLayer capitalLayer = new ShapeFileFeatureLayer(@"C:\Program Files\ThinkGeo\Map Suite Desktop Evaluation Edition 5.0\Samples\SampleData\Data\WorldCapitals.shp");

            capitalLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColor.StandardColors.White, 7, GeoColor.StandardColors.Brown);

            capitalLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level05;

            capitalLayer.ZoomLevelSet.ZoomLevel06.DefaultPointStyle = PointStyles.Capital3;

            capitalLayer.ZoomLevelSet.ZoomLevel06.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            ShapeFileFeatureLayer StreetsLabelLayer = new ShapeFileFeatureLayer(@"C:\Program Files\ThinkGeo\Map Suite Desktop Evaluation Edition 5.0\Samples\SampleData\Data\WorldCapitals.shp");

            StreetsLabelLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(TextStyles.LocalRoad1("CITY_NAME"));

            StreetsLabelLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            StreetsLabelLayer.ZoomLevelSet.ZoomLevel06.DefaultTextStyle = TextStyles.Capital3("CITY_NAME");

            StreetsLabelLayer.ZoomLevelSet.ZoomLevel06.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            StreetsLabelLayer.DrawingMarginPercentage = 50;

            ShapeFileFeatureLayer POILabelLayer = new ShapeFileFeatureLayer(@"C:\Program Files\ThinkGeo\Map Suite Desktop Evaluation Edition 5.0\Samples\SampleData\Data\RIYADH_POI.shp");

            POILabelLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColor.StandardColors.White, 7, GeoColor.StandardColors.Red);

            POILabelLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level05;

            POILabelLayer.ZoomLevelSet.ZoomLevel06.DefaultPointStyle = PointStyles.City3;

            POILabelLayer.ZoomLevelSet.ZoomLevel06.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            ShapeFileFeatureLayer POILabelNameLayer = new ShapeFileFeatureLayer(@"C:\Program Files\ThinkGeo\Map Suite Desktop Evaluation Edition 5.0\Samples\SampleData\Data\RIYADH_POI.shp");

            POILabelNameLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(TextStyles.LocalRoad1("Name_Lang2"));

            POILabelNameLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            POILabelNameLayer.ZoomLevelSet.ZoomLevel06.DefaultTextStyle = TextStyles.Capital3("Name_Lang2");

            POILabelNameLayer.ZoomLevelSet.ZoomLevel06.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            POILabelNameLayer.DrawingMarginPercentage = 50;

            ShapeFileFeatureLayer HwyLabelLayer = new ShapeFileFeatureLayer(@"C:\Program Files\ThinkGeo\Map Suite Desktop Evaluation Edition 5.0\Samples\SampleData\Data\MajHwys.shp");

            HwyLabelLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(TextStyles.Highway2("Name_Lang2"));

            HwyLabelLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            HwyLabelLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(LineStyles.Highway1);

            ShapeFileFeatureLayer SwyLabelLayer = new ShapeFileFeatureLayer(@"C:\Program Files\ThinkGeo\Map Suite Desktop Evaluation Edition 5.0\Samples\SampleData\Data\SecHwys.shp");

            SwyLabelLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(TextStyles.Highway2("Name_Lang2"));

            SwyLabelLayer.ZoomLevelSet.ZoomLevel15.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            SwyLabelLayer.ZoomLevelSet.ZoomLevel15.CustomStyles.Add(LineStyles.Highway1);

            LayerOverlay staticOverlay = new LayerOverlay();

            staticOverlay.Layers.Add("worldLayer", worldLayer);

            staticOverlay.Layers.Add("capitalLayer", capitalLayer);

            staticOverlay.Layers.Add("StreetsLabelLayer", StreetsLabelLayer);

            staticOverlay.Layers.Add("POILabelLayer", POILabelLayer);

            staticOverlay.Layers.Add("POILabelNameLayer", POILabelNameLayer);

            staticOverlay.Layers.Add("HwyLabelLayer", HwyLabelLayer);

            staticOverlay.Layers.Add("SwyLabelLayer", SwyLabelLayer);

            winformsMap2.Overlays.Add(staticOverlay);

            // Xmin , Ymax ,Xmax,Ymin 

            winformsMap2.CurrentExtent = new RectangleShape(42.2883299998541, 27.2102700001565, 47.5584099995663, 18.8629799998474);

            winformsMap2.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean);

            MarkerLayer markerLayer = new MarkerLayer();

            staticOverlay.Layers.Add("MarkerLayer", markerLayer);

            SimpleMarkerOverlay markerOverlay = new SimpleMarkerOverlay();

            markerOverlay.Markers.Add(marker);

            winformsMap2.ContextMenuStrip = contextMenuStrip1;

            markerOverlay.MapControl = winformsMap2;

            winformsMap2.Overlays.Add("MarkerOverlay", markerOverlay);

            winformsMap2.MaximumScale = winformsMap2.CurrentScale;

            winformsMap2.Refresh();

        }


 


Regards Yakub



Yakub,


 It could be a vast number of reasons why your map is taking so long to refresh after changing zoom level. You may display to many features at once, you may have your labeling set unefficiently etc. By just looking at your code, we cannot determine where the performance loss is ocurring. We would need a sample from you that we can run and see the problem happening. If the sample is too large to be attached in this post, you can contact our support team at support@thinkgeo.com and they will direct you on how to send it to our FTP. Thank you.



Hi Val, 
  
            I already sent my source file and shp file to Support team. But no body give proper reply till now. Its very very urgent for zoom in and zoom out functionality. Because of your reply only we will able to purchase your product. Please do needful 
  
 Regards 
 Yakub

Hi Yakub,  
  
 I double-checked the support inbox but we did not receive any e-mails containing shapefiles from your e-mail address. Please check your e-mail for instructions on an alternate way of providing us your shapefiles.

Hi Ryan, 
  
             This is my link for Zoom in and Zoom out using MouseWheel and MouseClick Event. 
  
 helpdesk.thinkgeo.com/TicketEdit?ticketId=ac6ca01f-8973-43da-a1be-010fb8c2b34d 
  
 Regards 
  
 Yakub

Thanks Yakub, we have your sample and shapefiles and will answer your question in the customer portal shortly. 
  
 Thanks!