Package org.locationtech.udig.printing.model

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


        boxes.add(mapBox);
        return mapBounds;
    }

    protected void addLegendBox( int xPos, int yPos, int legendWidth, int legendHeight ) {
        Box legendBox = ModelFactory.eINSTANCE.createBox();
        MapGraphicBoxPrinter legend = new MapGraphicBoxPrinter(page);
        legend.setMapGraphic(MapGraphicChooserDialog.findResource(LegendGraphic.class));
        legendBox.setBoxPrinter(legend);
        legendBox.setID("Legend Box"); //$NON-NLS-1$
        legendBox.setLocation(new Point(xPos, yPos));
        legendBox.setSize(new Dimension(legendWidth, legendHeight));
        boxes.add(legendBox);
    }
View Full Code Here


        addScale(height, scaleHeight, scaleWidth);
    }

    private void addScale( int height, int scaleHeight, int scaleWidth ) {
        Box scaleBox = ModelFactory.eINSTANCE.createBox();
        MapGraphicBoxPrinter scale = new MapGraphicBoxPrinter(null);
        scale.setMapGraphic(MapGraphicChooserDialog.findResource(ScalebarMapGraphic.class));
        scaleBox.setBoxPrinter(scale);
        scaleBox.setID("Scalebar Box"); //$NON-NLS-1$
        scaleBox.setLocation(new Point(MARGIN, height - MARGIN - scaleHeight));
        scaleBox.setSize(new Dimension(scaleWidth, scaleHeight));
        boxes.add(scaleBox);
    }
View Full Code Here

        scaleBox.setSize(new Dimension(scaleWidth, scaleHeight));
        boxes.add(scaleBox);
    }

    private int addLabelBox( Map map, int width, final int labelWidth) {
        Box labelBox = ModelFactory.eINSTANCE.createBox();
        LabelBoxPrinter labelBoxPrinter = new LabelBoxPrinter();
        labelBoxPrinter.setText(formatName(map.getName()));
        labelBoxPrinter.setHorizontalAlignment(SWT.CENTER);
        try {
            FontData data = Display.getDefault().getSystemFont().getFontData()[0];

            data.setHeight( 18 );
            data.setStyle( SWT.BOLD );
            Font font = AWTSWTImageUtils.swtFontToAwt(data);
            labelBoxPrinter.setFont(font);

        } catch (Exception e) {
            // oh well don't have that font type
        }
        labelBox.setBoxPrinter(labelBoxPrinter);
        labelBox.setID("Standard Label"); //$NON-NLS-1$
        // TODO base it on the font
        int labelHeight = 30+LabelBoxPrinter.INSET*2;
        labelBox.setSize(new Dimension(labelWidth, labelHeight));
        labelBox.setLocation(new Point((width - labelWidth) / 2, MARGIN));
        boxes.add(labelBox);
        return labelHeight;
    }
View Full Code Here

        return builder.toString();
    }

    private Rectangle addMapBox( Map map, int width, int height, final int labelHeight, int scaleHeight,
            int legendWidth ) {
        Box mapBox = ModelFactory.eINSTANCE.createBox();
        MapBoxPrinter mapBoxPrinter = new MapBoxPrinter();
        mapBox.setID("Standard Map Box"); //$NON-NLS-1$
        mapBox.setBoxPrinter(mapBoxPrinter);
        mapBoxPrinter.setMap(map);

        // calculate mapSize
        int bothMargins = (MARGIN * 2);
        int mapWidth = width - bothMargins - legendWidth-SPACING;
        int labelAndSpacing = labelHeight + SPACING;
        int scaleAndSpacing = scaleHeight + SPACING;
        int mapHeight = height - bothMargins - labelAndSpacing - scaleAndSpacing;

        int mapX = MARGIN;
        int mapY = MARGIN + labelAndSpacing;
       
        Rectangle mapBounds = new Rectangle(
                mapX,
                mapY,
                mapWidth,
                mapHeight);
        mapBox.setSize(new Dimension(mapBounds.width, mapBounds.height));

        mapBox.setLocation(new Point(mapBounds.x, mapBounds.y));
        boxes.add(mapBox);
        return mapBounds;
    }
View Full Code Here

        return mapBounds;
    }

    private void addLegendBox( int height, final int legendWidth, int legendHeight, int labelHeight,
            Rectangle mapBounds ) {
        Box legendBox = ModelFactory.eINSTANCE.createBox();
        MapGraphicBoxPrinter legend = new MapGraphicBoxPrinter(null);
        legend.setMapGraphic(MapGraphicChooserDialog.findResource(LegendGraphic.class));
        legendBox.setBoxPrinter(legend);
        legendBox.setID("Legend Box"); //$NON-NLS-1$
        legendBox.setLocation(new Point(MARGIN + mapBounds.width + SPACING, MARGIN+labelHeight+MARGIN));
        legendBox.setSize(new Dimension(legendWidth, legendHeight));
        boxes.add(legendBox);
    }
View Full Code Here

        graphics2d.translate(pageFormat.getImageableX(), pageFormat.getImageableY());

        Iterator<Box> iter = page.getBoxes().iterator();
        while( iter.hasNext() ) {

            Box box = iter.next();
            graphics2d = (Graphics2D) graphics.create(box.getLocation().x, box.getLocation().y, box
                    .getSize().width, box.getSize().height);

            box.getBoxPrinter().draw(graphics2d, monitor);

        }
       
        return Printable.PAGE_EXISTS;
    }
View Full Code Here

TOP

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

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.