ThinkGeo.com    |     Documentation    |     Premium Support

How to add dynamic layer to Map Suite Destop Edition 2x

Hi


I want no how to modify this code sutable for  Map Suite Destop Edition 2x. I try this code but it does not work.


Anjana


 


 



DynamicLayer customers = new DynamicLayer();

        //Create Customer Point for LA
        PointMapShape custLA = new PointMapShape(new PointShape(-118.24, 34.05));
        //Use a Graphic for the customer symbol
        PointSymbol symLA = new PointSymbol
            (new Bitmap(this.Server.MapPath("") + @"\images\customer.png"));
        custLA.ZoomLevel01.GeoStyle.SymbolRenderers.Add(new SymbolRenderer(symLA));
        //Label the customer icon
        custLA.ZoomLevel01.GeoTextStyle = GeoTextStyles.GetSimpleTextStyle
            (null, "Arial", 9, GeoFontStyle.Bold, GeoColor.KnownColors.Black);
        //Apply to all zoom levels
        custLA.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.ZoomLevel18;
        //Name the Customer
        custLA.Name = "LA Customer";
        //Add the customer to the Dynamic Data Layer
        customers.MapShapes.Add(custLA);
        
        //Create Customer Point for KC
        PointMapShape custKC = new PointMapShape(new PointShape(-94.62, 39.11));
        //Use a Graphic for the customer symbol
        PointSymbol symKC = new PointSymbol
            (new Bitmap(this.Server.MapPath("") + @"\images\customermale.png"));
        custKC.ZoomLevel01.GeoStyle.SymbolRenderers.Add(new SymbolRenderer(symKC));
        //Label the customer icon
        custKC.ZoomLevel01.GeoTextStyle = GeoTextStyles.GetSimpleTextStyle
            (null, "Arial", 9, GeoFontStyle.Bold, GeoColor.KnownColors.Black);
        //Apply to all zoom levels
        custKC.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.ZoomLevel18;
        //Name the Customer
        custKC.Name = "Kansas City Customer";
        //Add the customer to the Dynamic Data Layer
        customers.MapShapes.Add(custKC);
        
        //Add Dynamic Data Layer to Map Control
        Map1.DynamicLayers.Add(customers);

Anjana, 
  
 Here is the “translated” code which works fine in 3.0, please let me know for any queries about that. 
  
 
            //Create Customer Point for LA and add the customer to the Dynamic Data Layer
            InMemoryFeatureLayer custLA = new InMemoryFeatureLayer();
            custLA.InternalFeatures.Add("custLA", new Feature(-118.24, 34.05));

            //Use a Graphic for the customer symbol
            custLA.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.PointType = PointType.Bitmap;
            custLA.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.Image = new GeoImage(@"\images\customer.png");

            //Label the customer icon
            custLA.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.CreateSimpleTextStyle(null, "Arial", 9, DrawingFontStyles.Bold, GeoColor.SimpleColors.Black);
            //Apply to all zoom levels
            custLA.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            //Name the Customer
            custLA.Name = "LA Customer";

            //Create Customer Point for KC and add the customer to the Dynamic Data Layer
            InMemoryFeatureLayer custKC = new InMemoryFeatureLayer();
            custKC.InternalFeatures.Add("custKC", new Feature(-94.62, 39.11));

            //Use a Graphic for the customer symbol
            custKC.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.PointType = PointType.Bitmap;
            custKC.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.Image = new GeoImage(@"\images\customermale.png");

            //Label the customer icon
            custKC.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.CreateSimpleTextStyle(null, "Arial", 9, DrawingFontStyles.Bold, GeoColor.SimpleColors.Black);
            //Apply to all zoom levels
            custKC.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            //Name the Customer
            custKC.Name = "Kansas City Customer";

            //Add Dynamic Data Layer to Map Control
            Map1.DynamicOverlay.Layers.Add(custLA);
            Map1.DynamicOverlay.Layers.Add(custKC);
 
  
 Thanks, 
  
 Ben