/*---------------- FILE HEADER --------------------------------------- This file is part of Geoide. Copyright (C) 2005-2006 by: IDgis B.V. http://www.idgis.nl This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Contact: Herman Assink IDgis bv P.O. Box 15 7450 AA Holten The Netherlands E-Mail: herman.assink@idgis.nl * @version 1.4.0 * @author IDgis team * ------------------------------------------------------------------------*/ import nl.idgis.giclient.gui.legendviewer.LegendViewer; import nl.idgis.giclient.gis.CentreScale; import nl.idgis.giclient.geoma.Envelope; class nl.idgis.giclient.gui.printcomponent.PrintComponent { function printdoc(mapEnvelope:Envelope):Void { // create PrintJob object var my_pj:PrintJob = new PrintJob(); // display print dialog box my_pj.start(); // initiate print job var xScale:Number = my_pj.pageWidth/Stage.width * 100; var yScale:Number = my_pj.pageHeight/Stage.height * 100; var scale:Number = null; if (xScale <= yScale){ scale = xScale; } else { scale = yScale; } //NB WGS84 : geen meters! var mapScale:Number = ( mapEnvelope.getMaxX() - mapEnvelope.getMinX() ) / ( my_pj.pageWidth * 0.0254 / 72 ); //trace("mapEnvelope.getMaxX() = " + mapEnvelope.getMaxX() + " mapEnvelope.getMinX() = " + mapEnvelope.getMinX() + " my_pj.pageWidth = " + my_pj.pageWidth + " Stage.width = " + Stage.width + " mapScale = " + mapScale + " scale = " + scale) ; // var scaleField:TextField = _root.mapViewer.createTextField("scale", _root.mapViewer.getNextHighestDepth(), 400, 400, 150, 20); //scaleField.text = mapScale.toString(10); _root.mapViewer._xscale = scale; _root.mapViewer._yscale = scale; my_pj.addPage("_root.mapViewer",{xMin:0,xMax:Stage.width,yMin:0, yMax:Stage.height}, {printAsBitmap: true}); _root.mapViewer._xscale = 100; _root.mapViewer._yscale = 100; var legendHeight:Number =LegendViewer(_root.frameWork.frames.LegendViewerPane.scrollpane_mc.tmp_mc).getContentHeight(); _root.frameWork.frames.LegendViewerPane.scrollpane_mc.tmp_mc._xscale = 80; _root.frameWork.frames.LegendViewerPane.scrollpane_mc.tmp_mc._yscale = 80; my_pj.addPage("_root.frameWork.frames.LegendViewerPane.scrollpane_mc.tmp_mc",{xMin:0,xMax:450,yMin:0, yMax:legendHeight}); _root.frameWork.frames.LegendViewerPane.scrollpane_mc.tmp_mc._xscale = 100; _root.frameWork.frames.LegendViewerPane.scrollpane_mc.tmp_mc._yscale = 100; // send pages from the spooler to the printer my_pj.send(); // print page(s) // clean up delete my_pj; } }