protected int addLabelBox( String text, int xPos, int yPos, int labelWidth, int labelHeight, int fontSize, float scaleFactor) { Box labelBox = ModelFactory.eINSTANCE.createBox(); labelBox.setSize(new Dimension(labelWidth, labelHeight)); labelBox.setLocation(new Point(xPos, yPos)); LabelBoxPrinter labelBoxPrinter = new LabelBoxPrinter(scaleFactor); labelBox.setBoxPrinter(labelBoxPrinter); labelBox.setID("Standard Label"); // $NON-NLS-1$ labelBoxPrinter.setText(text); labelBoxPrinter.setHorizontalAlignment(SWT.CENTER); try { FontData data = Display.getDefault().getSystemFont().getFontData()[0]; data.setHeight(fontSize); data.setStyle(SWT.BOLD); Font font = AWTSWTImageUtils.swtFontToAwt(data); labelBoxPrinter.setFont(font); } catch (Exception e) { // oh well don't have that font type } boxes.add(labelBox); return labelHeight; }
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); }
protected void addScale(int xPos, int yPos, int scaleWidth, int scaleHeight) { Box scaleBox = ModelFactory.eINSTANCE.createBox(); MapGraphicBoxPrinter scale = new MapGraphicBoxPrinter(page); scale.setMapGraphic(MapGraphicChooserDialog.findResource(ScalebarMapGraphic.class)); scaleBox.setBoxPrinter(scale); scaleBox.setID("Scalebar Box"); // $NON-NLS-1$ scaleBox.setLocation(new Point(xPos, yPos)); scaleBox.setSize(new Dimension(scaleWidth, scaleHeight)); boxes.add(scaleBox); }
protected Rectangle addMapBox( Map map, int xPos, int yPos, int mapWidth, int mapHeight, Dimension paperSize) { Box mapBox = ModelFactory.eINSTANCE.createBox(); MapBoxPrinter mapBoxPrinter = new MapBoxPrinter(); mapBox.setID("Standard Map Box"); // $NON-NLS-1$ mapBox.setBoxPrinter(mapBoxPrinter); mapBoxPrinter.setMap(map); Rectangle mapBounds = new Rectangle(xPos, yPos, mapWidth, mapHeight); mapBox.setSize(new Dimension(mapBounds.width, mapBounds.height)); mapBox.setPaperSize(paperSize); mapBox.setLocation(new Point(mapBounds.x, mapBounds.y)); boxes.add(mapBox); return mapBounds; }