Package org.locationtech.udig.printing.model

Examples of org.locationtech.udig.printing.model.Page


     */
    public Collection getChildren( Object object ) {
        if (children == null) {
            children = new ArrayList();
           
            Page page = (Page) object;
            Iterator iter = page.getBoxes().iterator();
            while (iter.hasNext()) {
                BoxPrinter box = ((Box) iter.next()).getBoxPrinter();
                if (box instanceof MapBoxPrinter) {
                    Map map = ((MapBoxPrinter)box ).getMap();
//                    children.add(new MapItemProvider(adapterFactory, map));
View Full Code Here


    public Page getModel() {
        return (Page) super.getModel();
    }

    protected void refreshVisuals() {
        Page page = getModel();

        Point loc = new Point(0, 0);
        Dimension size = page.getSize();
        Rectangle rectangle = new Rectangle(loc, size);

        // this should trigger all the resize in PageImpl
        IFigure fig = getFigure();
        // Dimension fSize = fig.getSize();
View Full Code Here

                Object result = caseElement(element);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case ModelPackage.PAGE: {
                Page page = (Page)theEObject;
                Object result = casePage(page);
                if (result == null) result = caseElement(page);
                if (result == null) result = caseIProjectElement(page);
                if (result == null) result = defaultCase(theEObject);
                return result;
View Full Code Here

                T result = caseElement(element);
                if (result == null) result = defaultCase(theEObject);
                return result;
            }
            case ModelPackage.PAGE: {
                Page page = (Page)theEObject;
                T result = casePage(page);
                if (result == null) result = caseElement(page);
                if (result == null) result = caseProjectElement(page);
                if (result == null) result = caseIProjectElement(page);
                if (result == null) result = caseProject_IAdaptable(page);
View Full Code Here

    }

    private float getScaleFactor() {
        if (Float.isNaN(scaleFactor)) {
            // try to get it from the page
            Page page = getBox().getPage();
            if (page != null) {
                scaleFactor = (float) page.getSize().width / (float) page.getPaperSize().height;
            }
        }
        return scaleFactor;
    }
View Full Code Here

    }

    private float getScaleFactor() {
        if (Float.isNaN(scaleFactor)) {
            // try to get it from the page
            Page page = getBox().getPage();
            if (page != null) {
                scaleFactor = (float) page.getSize().width / (float) page.getPaperSize().height;
            }
        }
        return scaleFactor;
    }
View Full Code Here

                //sets the active page
                template.setActivePage(i);
               
                PdfContentByte cb = writer.getDirectContent();    
               
                Page page = makePage(pageSize, document, template);
               
                graphics = cb.createGraphics(pageSize.getWidth(), pageSize.getHeight());
                        
                //instantiate a PrinterEngine (pass in the Page instance)
                PrintingEngine engine = new PrintingEngine(page);
View Full Code Here

            template.setZoomToSelectionHint(true);
            template.setMapScaleHint(currentViewportScaleDenom);
       
       
        //3. make the page itself
        Page page = ModelFactory.eINSTANCE.createPage();
        page.setSize(new Dimension((int)pageSize.getWidth(), (int)pageSize.getHeight()));

        //page name stuff not required, because this page will just get discarded
        MessageFormat formatter = new MessageFormat(Messages.CreatePageAction_newPageName, Locale.getDefault());
        if (page.getName() == null || page.getName().length() == 0) {
            page.setName(formatter.format(new Object[] { mapNoRasterLayers.getName() }));
        }

        template.init(page, mapNoRasterLayers);
       
        if (page1.getRasterEnabled()) {
            //make another copy with only raster layers
            mapOnlyRasterLayers = (Map) ApplicationGIS.copyMap(map);
            List<Layer> layersOnlyRasters = mapOnlyRasterLayers.getLayersInternal();
            List<Layer> toRemove2 = new ArrayList<Layer>();
            for (Layer layer : layersOnlyRasters ) {
                for (IGeoResource resource : layer.getGeoResources()) {
                    if (!resource.canResolve(GridCoverageReader.class)) {
                        toRemove2.add(layer);
                    }
                }
            }
            layersOnlyRasters.removeAll(toRemove2);
           
            //set bounds to match the other map
            SetViewportBBoxCommand cmdBbox = new SetViewportBBoxCommand(mapNoRasterLayers.getViewportModel().getBounds());
            mapOnlyRasterLayers.sendCommandSync(cmdBbox);
           
            if (layersNoRasters.size() > 0) {
                writeRasterLayersOnlyToDocument(mapOnlyRasterLayers, template.getMapBounds(), doc, page.getSize(), /*currentViewportScaleDenom*/mapNoRasterLayers.getViewportModel().getScaleDenominator());
            }
        }
       
        //copy the boxes from the template into the page
        Iterator<Box> iter = template.iterator();       
        while (iter.hasNext()) {
            page.getBoxes().add(iter.next());
        }
        return page;
       
       
        //TODO Throw some sort of exception if the page can't be created
View Full Code Here

     * @return the scale of the map on the current paper type.
     */
    private double calculateScale() {
        IViewportModel viewportModel = getMapBoxPrinter().getMap().getViewportModel();
        // get page size in pixels and in mm
        Page page = getMapBoxPrinter().getBox().getPage();
        org.eclipse.draw2d.geometry.Dimension pageSize = page.getSize();
        org.eclipse.draw2d.geometry.Dimension paperSize = page.getPaperSize();
        // map box size in pixels
        org.eclipse.draw2d.geometry.Dimension mapSize = owner.getBoxPrinter().getBox().getSize();
        // map box size in points and then in meters on paper
        float mapPaperWidthPoints = (float) paperSize.width * (float) mapSize.width
                / (float) pageSize.width;
View Full Code Here

     * @param scale the scale to apply to the map.
     */
    private void applyNewScale( double scale ) {
        ViewportModel viewportModel = getMapBoxPrinter().getMap().getViewportModelInternal();
        // get page size in pixels and in mm
        Page page = getMapBoxPrinter().getBox().getPage();
        org.eclipse.draw2d.geometry.Dimension pageSize = page.getSize();
        org.eclipse.draw2d.geometry.Dimension paperSize = page.getPaperSize();
        // map box size in pixels
        org.eclipse.draw2d.geometry.Dimension mapSize = owner.getBoxPrinter().getBox().getSize();
        // map box size in points and then in meters on paper
        float mapPaperWidthPoints = (float) paperSize.width * (float) mapSize.width
                / (float) pageSize.width;
View Full Code Here

TOP

Related Classes of org.locationtech.udig.printing.model.Page

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.