Package org.geotools.styling

Examples of org.geotools.styling.Font$Style


    File outputFile = new File(ServletContextParameterMap.getParameterValue(ContextParameter.USER_DIRECTORY_PATH) + "KML/" + worksheet.getTitle() + ".kml");
    final Kml kml = KmlFactory.createKml();
    final Folder folder = kml.createAndSetFolder()
        .withName(worksheet.getTitle()).withOpen(true);

    Style style = folder.createAndAddStyle().withId("karma");
   
    if(randomCounter++%2 == 0)
      style.createAndSetIconStyle().withScale(1.399999976158142).withIcon(new Icon().withHref("http://maps.google.com/mapfiles/ms/icons/blue-pushpin.png"));
    else
      style.createAndSetIconStyle().withScale(1.399999976158142).withIcon(new Icon().withHref("http://maps.google.com/mapfiles/ms/icons/red-pushpin.png"));

    for (edu.isi.karma.geospatial.Point point : points) {
      folder.createAndAddPlacemark()
          .withDescription(point.getHTMLDescription())
          .withVisibility(true)
View Full Code Here


        @Override
        public Feature decorate(Feature feature, KmlEncodingContext context) {
            Placemark pm = (Placemark) feature;
            // while it's possible to have more than one style object, GE will only paint
            // the first one
            Style style = pm.createAndAddStyle();
            List<Symbolizer> symbolizers = context.getCurrentSymbolizers();
            SimpleFeature sf = context.getCurrentFeature();
            if (symbolizers.size() > 0 && sf.getDefaultGeometry() != null) {
                // sort by point, text, line and polygon
                Map<Class, List<Symbolizer>> classified = classifySymbolizers(symbolizers);
View Full Code Here

     * @param symbolizer Text symbolizer information.
     * @return FontData[] of the font's fill, or null if unavailable.
     */
    public static FontData[] textFont( TextSymbolizer symbolizer ) {

        Font font = font(symbolizer);
        if (font == null)
            return null;
        // FIXME: font style isn't being set properly here...seems screwy so leaving till later
        // String fontStyle = font[0].getFontStyle().toString();
        // if(fontStyle == null) return null;
        // else if(fontStyle.equalsIgnoreCase("italic"))

        FontData[] tempFD = new FontData[1];
        Expression fontFamilyExpression = font.getFamily().get(0);
        Expression sizeExpression = font.getSize();
        if (sizeExpression == null || fontFamilyExpression == null)
            return null;

        Double size = sizeExpression.evaluate(null, Double.class);

View Full Code Here

    }

    public static Font font( TextSymbolizer symbolizer ) {
        if (symbolizer == null)
            return null;
        Font font = symbolizer.getFont();
        return font;
    }
View Full Code Here

                break;
            }
            String name = values[0];
            int style = Integer.parseInt(values[1]);
            int height = Integer.parseInt(values[2]);
            Font font = sb.createFont(name, style == SWT.ITALIC, style == SWT.BOLD, height);

            textSymbolizerWrapper.setFont(font);
            break;
        }
        case LABELCOLOR: {
View Full Code Here

        default:
            throw new IllegalArgumentException();
        }

        Font font = sb.createFont("Arial", false, false, 12); //$NON-NLS-1$
        TextSymbolizer textSymbolizer = sf.createTextSymbolizer(sf.createFill(ff.literal(DEFAULT_COLOR)), new Font[]{font}, null,
                ff.literal("dummy"), labelPlacement, null);

        return textSymbolizer;
    }
View Full Code Here

                break;
            }
            String name = values[0];
            int style = Integer.parseInt(values[1]);
            int height = Integer.parseInt(values[2]);
            Font font = sb.createFont(name, style == SWT.ITALIC, style == SWT.BOLD, height);

            textSymbolizerWrapper.setFont(font);
            break;
        }
        case LABELCOLOR: {
View Full Code Here

                break;
            }
            String name = values[0];
            int style = Integer.parseInt(values[1]);
            int height = Integer.parseInt(values[2]);
            Font font = sb.createFont(name, style == SWT.ITALIC, style == SWT.BOLD, height);

            textSymbolizerWrapper.setFont(font);
            break;
        }
        case LABELCOLOR: {
View Full Code Here

        String fontName = this.font[0].getName();
        boolean fontBold = (this.font[0].getStyle() == SWT.BOLD);
        boolean fontItalic = (this.font[0].getStyle() == SWT.ITALIC);
        double fontSize = this.font[0].getHeight();
        Font gtFont = build.createFont(
                fontName, fontItalic, fontBold, fontSize);
        Fill fill = build.createFill(this.colour);
       
        LabelPlacement placement;
        if (pointPlacement) {
View Full Code Here

        transformer.transform(symbolizer)// test that it can be written to xml correctly

        assertFill(1.0, fontColor, symbolizer.getFill());
        assertEquals("name", valueOf(symbolizer.getLabel()));

        final Font font = symbolizer.getFont();
        final List<Expression> family = font.getFamily();
        assertEquals(1, family.size());
        assertEquals(fontFamily, valueOf(family.get(0)));
        assertEquals(12, valueOf(font.getSize()));
        assertEquals(fontStyle, valueOf(font.getStyle()));
        assertEquals(fontWeight, valueOf(font.getWeight()));

        PointPlacement placement = (PointPlacement) symbolizer.getLabelPlacement();
        assertEquals(45.0, valueOf(placement.getRotation()));
        assertEquals(0.5, valueOf(placement.getAnchorPoint().getAnchorPointX()));
        assertEquals(0.5, valueOf(placement.getAnchorPoint().getAnchorPointY()));
View Full Code Here

TOP

Related Classes of org.geotools.styling.Font$Style

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.