public static function printPDF(mainMap:Map, overviewMap:Map, legendTitle:String, popData:DataPopup, popAbout:AboutWindow):void { CursorManager.setBusyCursor(); var date:Date = new Date(); var legendImage:Class; var legendLength:Number; var h:Number = mainMap.measuredHeight; var w:Number = mainMap.measuredWidth; var ovH:Number = overviewMap.measuredHeight; var ovW:Number = overviewMap.measuredWidth; var fullWidth:Number = w + ovW + 126; var fullHeight:Number = h + 144; var legendY:Number = ovH + 132; var minHeight:Number = ovH + 42 + 72; // overview map + header to legend + logos var scaleArray:Array = [110000,64000,32000,16000,8000,4000,2000]; // if (h1 < 650) {h1 = 650;} mainMap.zoomSliderVisible = false; try { if (legendTitle != null) { switch (legendTitle) { case "Boundaries": legendImage = popData.legendBoundary; legendLength = 16; break; case "Structure": legendImage = popData.legendStructure; legendLength = 279; break; case "Biological Cover": legendImage = popData.legendCover; legendLength = 244; break; case "Coral Cover": legendImage = popData.legendDensity; legendLength = 68; break; case "Zone": legendImage = popData.legendZone; legendLength = 172; break; } minHeight = minHeight + legendLength + 7; } if (popData.chkDive.selected) {minHeight = minHeight + 103 + 7;} if (popData.chkROV.selected) {minHeight = minHeight + 13 + 7;} if (popData.chkMPA.selected) {minHeight = minHeight + 33 + 7;} if (popData.chkModImagery.selected) {minHeight = minHeight + 53 + 7;} if (minHeight > h) {fullHeight = fullHeight + minHeight - h;} var myPDF:PDF = new PDF(Orientation.LANDSCAPE, Unit.POINT, new Size([fullHeight,fullWidth],"dynamicSize",[(fullHeight)/96,(fullWidth)/96],[(fullHeight)*3.779527559,(fullWidth)*3.779527559])); myPDF.setDisplayMode(Display.FULL_PAGE, Layout.SINGLE_PAGE); myPDF.addPage(); myPDF.addImage(mainMap, 54, ((fullHeight - 108 - h) / 2) + 72 , 0, 0, ImageFormat.PNG); myPDF.lineStyle(new RGBColor(0x000000),1); myPDF.drawRect(new Rectangle(54, ((fullHeight - 108 - h) / 2) + 72, w - 2, h - 2)); // map border myPDF.lineStyle(new RGBColor(0x00529E),1); myPDF.drawRect(new Rectangle(36,36,fullWidth - 72, fullHeight - 72)); // page border myPDF.beginFill(new RGBColor(0x00529E)); myPDF.drawRect(new Rectangle(36,36,fullWidth - 72,36)); // header box // myPDF.drawPolygone([36,36, w + fullwidth - 64,36, w + fullwidth - 64,72, 36,72, 36,36]); // header box myPDF.endFill(); myPDF.setFont(FontFamily.ARIAL,Style.BOLD,22); myPDF.textStyle(new RGBColor(0xFFFFFF)); myPDF.addText("U.S. Virgin Islands (St. John): Shallow-water Benthic Habitats",((fullWidth - 72) / 2) - 320,63); // myPDF.setFont(FontFamily.ARIAL,Style.NORMAL,7); // myPDF.textStyle(new RGBColor(0x000000)); // myPDF.addText("http://ccma.nos.noaa.gov/ecosystems/coralreef/benthic_usvi.html",13.275,10.2425); myPDF.addImage(overviewMap, w + 72, 90 ,0 , 0); myPDF.lineStyle(new RGBColor(0x000000),1); // myPDF.drawRect(new Rectangle(w + 72, 90,ovW - 2,ovH - 2)); // overview map border myPDF.textStyle(new RGBColor(0x000000)); if (legendTitle != null) { myPDF.setFont(FontFamily.ARIAL,Style.BOLD,18); myPDF.addText(legendTitle, w + 72, ovH + 120); myPDF.addImageStream(new legendImage as ByteArray, w + 74, legendY); legendY = legendY + legendLength + 7; } if (popData.chkDive.selected) { myPDF.addImageStream(new popData.legendDives as ByteArray, w + 74, legendY); legendY = legendY + 103 + 7; } if (popData.chkROV.selected) { myPDF.addImageStream(new popData.legendROV as ByteArray, w + 74, legendY); legendY = legendY + 13 + 7; } if (popData.chkMPA.selected) { myPDF.addImageStream(new popData.legendMPA as ByteArray, w + 74, legendY); legendY = legendY + 36 + 7 } if (popData.chkModImagery.selected) { if (popData.radBackscatter.selected) {myPDF.addImageStream(new popData.legendBackscatter as ByteArray, w + 74, legendY);} if (popData.radBathymetry.selected) {myPDF.addImageStream(new popData.legendBathy as ByteArray, w + 74, legendY);} if (popData.radSlope.selected) {myPDF.addImageStream(new popData.legendSlope as ByteArray, w + 74, legendY);} } // myPDF.setFont(FontFamily.ARIAL,Style.NORMAL, 14); // myPDF.addText("Minimum Mapping Unit",w + 110, fullHeight - 145); // myPDF.addText("(0.25 acre, 0.1012 ha)",w + 110, fullHeight - 131); myPDF.addImageStream(new popAbout.NOAAClass as ByteArray, w + 70, fullHeight - 108, 30, 28); myPDF.addImageStream(new popAbout.NPSClass as ByteArray, w + 70 + 198, fullHeight - 110, 23, 29); myPDF.setFont(FontFamily.ARIAL,Style.NORMAL, 7); myPDF.addText("Data prepared by the National Ocean Service,", w + 54 + 57, fullHeight - 98); myPDF.addText("Biogeography Branch, in cooperation with", w + 54 + 64, fullHeight - 90); myPDF.addText("the National Park Service. 2009", w + 54 + 77, fullHeight - 82); myPDF.setFont(FontFamily.ARIAL,Style.BOLD, 7); myPDF.addText("http://ccma.nos.noaa.gov/ecosystems/coralreef/benthic_usvi.html", w + 72, fullHeight - 56); // myPDF.addLink(w + 80, fullHeight - 56, 20, 5, "http://ccma.nos.noaa.gov/ecosystems/coralreef/benthic_usvi.html"); myPDF.save(Method.REMOTE,"http://ccma.nos.noaa.gov/gv_stjohn/create.php", Download.INLINE); } catch (e:Error) { Alert.show(e.message) } mainMap.zoomSliderVisible = true; CursorManager.removeBusyCursor(); }
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.