private function clickHandler() : void { var ovBMDat:BitmapData; if(dataTable){ if (dataTable.containsKey("ovMap")) { var recAC:ArrayCollection = dataTable.find("ovMap") as ArrayCollection; ovBMDat = recAC.getItemAt(0) as BitmapData var novBMDat:BitmapData = new BitmapData(ovBMDat.width + 2,ovBMDat.height + 2,true,0x000000); var srcRect:Rectangle = new Rectangle(0, 0, ovBMDat.width, ovBMDat.height); novBMDat.copyPixels(ovBMDat,srcRect,new Point(1,1)); } } var map:Map = SiteContainer.getInstance().controller.map; const decoder: JPEGEncoder = new JPEGEncoder(); map.logoVisible=false; map.scaleBarVisible=true; map.zoomSliderVisible = false; //SiteContainer.getInstance().mapManager.control.visible = false; //get the current background color of the map var currentMapColor:Object = map.getStyle("backgroundColor"); //set the background color to white map.setStyle("backgroundColor", "#CCCCCC"); //validate the changes map.validateNow(); var bmpDat:BitmapData = ImageSnapshot.captureBitmapData(map); if (novBMDat){ var pnt:Point = new Point((bmpDat.width - novBMDat.width), (bmpDat.height - novBMDat.height)); var rect:Rectangle = new Rectangle(0, 0, novBMDat.width, novBMDat.height); bmpDat.merge(novBMDat,rect,pnt,mult,mult,mult,mult); } const encoder: JPEGEncoder = new JPEGEncoder(80); map.logoVisible=true; map.scaleBarVisible=true; map.zoomSliderVisible = true; map.setStyle("backgroundColor", currentMapColor); //validate the changes map.validateNow(); const fileReference:FileReference = new FileReference(); fileReference.save(encoder.encode(bmpDat),"map.jpg"); }
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.