Examples of TextSymbolizer


Examples of org.geotools.styling.TextSymbolizer

      style.featureTypeStyles().add(selectionStyle);
    }
    // apply the label style
    if (vectorLayerRasterizingInfo.isPaintLabels()) {
      // create the rule
      TextSymbolizer textSymbolizer = createTextSymbolizer(vectorLayerRasterizingInfo.getStyle().getLabelStyle(),
          layerType);
      Rule labelRule = styleBuilder.createRule(textSymbolizer);
      // create the style
      FeatureTypeStyle labelStyle = styleBuilder.createFeatureTypeStyle(typeName, labelRule);
      style.featureTypeStyles().add(labelStyle);
View Full Code Here

Examples of org.geotools.styling.TextSymbolizer

  }

  private TextSymbolizer createTextSymbolizer(LabelStyleInfo labelStyle, LayerType layerType) {
    Fill fontFill = styleBuilder.createFill(styleBuilder.literalExpression(labelStyle.getFontStyle().getColor()),
        styleBuilder.literalExpression(labelStyle.getFontStyle().getOpacity()));
    TextSymbolizer symbolizer = styleBuilder.createTextSymbolizer();
    symbolizer.setFill(fontFill);
    FontStyleInfo fontInfo = labelStyle.getFontStyle();
    symbolizer.setFont(styleBuilder.createFont(styleBuilder.literalExpression(fontInfo.getFamily()),
        styleBuilder.literalExpression(fontInfo.getStyle()),
        styleBuilder.literalExpression(fontInfo.getWeight()),
        styleBuilder.literalExpression(fontInfo.getSize())));
    symbolizer.setLabel(styleBuilder.attributeExpression(labelStyle.getLabelAttributeName()));
    Fill haloFill = styleBuilder.createFill(
        styleBuilder.literalExpression(labelStyle.getBackgroundStyle().getFillColor()),
        styleBuilder.literalExpression(labelStyle.getBackgroundStyle().getFillOpacity()));
    symbolizer.setHalo(styleBuilder.createHalo(haloFill, 1));
    // label placement : point at bottom-center of label (same as vectorized)
    switch (layerType) {
      case MULTIPOINT:
      case POINT:
        symbolizer.setLabelPlacement(styleBuilder.createPointPlacement(0.5, 0, 0));
        break;
      default:
        break;
    }
    return symbolizer;
View Full Code Here

Examples of org.geotools.styling.TextSymbolizer

        if (arg0 instanceof LineSymbolizer) {
            LineSymbolizer ps = (LineSymbolizer) arg0;
            ps.accept(this);
        }
        if (arg0 instanceof TextSymbolizer) {
            TextSymbolizer ps = (TextSymbolizer) arg0;
            ps.accept(this);
        }
        if (arg0 instanceof RasterSymbolizer) {
            RasterSymbolizer ps = (RasterSymbolizer) arg0;
            ps.accept(this);
        }
    }
View Full Code Here

Examples of org.geotools.styling.TextSymbolizer

        if (textSymbolizerWrapper == null) {
            widgetEnabled = false;
            /*
             * create a dummy local one to create the widgets
             */
            TextSymbolizer newSymbolizer = Utilities.createDefaultTextSymbolizer(SLD.LINE);
            textSymbolizerWrapper = new TextSymbolizerWrapper(newSymbolizer, null, SLD.LINE);
        }

        mainComposite = new Composite(parent, SWT.NONE);
        mainComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
View Full Code Here

Examples of org.geotools.styling.TextSymbolizer

        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

Examples of org.geotools.styling.TextSymbolizer

            // LABEL PARAMETERS
        case LABELENABLE: {
            boolean doEnable = Boolean.parseBoolean(value);
            if (doEnable) {
                if (textSymbolizerWrapper == null) {
                    TextSymbolizer textSymbolizer = Utilities.createDefaultTextSymbolizer(SLD.LINE);
                    ruleWrapper.addSymbolizer(textSymbolizer, TextSymbolizerWrapper.class);
                    labelsParametersComposite.update(ruleWrapper);
                }
            } else {
                ruleWrapper.removeTextSymbolizersWrapper();
View Full Code Here

Examples of org.geotools.styling.TextSymbolizer

        if (textSymbolizerWrapper == null) {
            widgetEnabled = false;
            /*
             * create a dummy local one to create the widgets
             */
            TextSymbolizer newSymbolizer = Utilities.createDefaultTextSymbolizer(SLD.POINT);
            textSymbolizerWrapper = new TextSymbolizerWrapper(newSymbolizer, null, SLD.POINT);
        }

        mainComposite = new Composite(parent, SWT.NONE);
        mainComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
View Full Code Here

Examples of org.geotools.styling.TextSymbolizer

        String name = DEFAULT_GEOMETRY;

        Stroke stroke = null;
        Fill fill = null;
        Graphic graphic = null;
        TextSymbolizer text = null;
        LabelPlacement placement = null;

        List<Rule> rules = fts.rules();
        if (rules.size() > 1) {
            // simple mode trimms away all but the first rule
            Rule keepRule = rules.get(0);
            rules.clear();
            rules.add(keepRule);
        }
        this.mode = determineMode(schema, true);

        if (mode == Mode.NONE) {
            pointMode.setSelection(false);
            polyMode.setSelection(false);
            lineMode.setSelection(false);
        } else if (mode == Mode.LINE) {
            lineMode.setSelection(true);
            LineSymbolizer sym = SLDs.lineSymbolizer(fts);
            stroke = SLDs.stroke(sym);
            placement = SLDs.getPlacement(SLDs.ALIGN_LEFT, SLDs.ALIGN_MIDDLE, 0);

            name = sym == null ? null : sym.getGeometryPropertyName();
        } else if (mode == Mode.POLYGON) {
            polyMode.setSelection(true);
            PolygonSymbolizer sym = SLDs.polySymbolizer(fts);
            stroke = SLDs.stroke(sym);
            fill = SLDs.fill(sym);
            placement = SLDs.getPlacement(SLDs.ALIGN_CENTER, SLDs.ALIGN_MIDDLE, 0);

            name = sym == null ? null : sym.getGeometryPropertyName();
        } else if (mode == Mode.POINT || mode == Mode.ALL) { // default to handling as Point
            pointMode.setSelection(true);

            PointSymbolizer sym = SLDs.pointSymbolizer(fts);
            stroke = SLDs.stroke(sym);
            fill = SLDs.fill(sym);
            graphic = SLDs.graphic(sym);
            placement = SLDs.getPlacement(SLDs.ALIGN_LEFT, SLDs.ALIGN_MIDDLE, 0);

            name = sym == null ? null : sym.getGeometryPropertyName();
        }
       
        text = SLDs.textSymbolizer(fts);
        if (text != null && placement != null) {
            text.setLabelPlacement(placement);
        }
       
        if (name == null) {
            name = DEFAULT_GEOMETRY;
            geometryName.getCombo().setText(name);
View Full Code Here

Examples of org.geotools.styling.TextSymbolizer

    /** Synchronize the SLD with the array of symbolizers */
    @Override
    public void synchronize() {
        List<Symbolizer> acquire = new ArrayList<Symbolizer>();
        TextSymbolizer textSym = this.label.get(this.build);

        SimpleFeatureType schema = getLayer().getSchema();
        this.mode = determineMode(schema, true);

        String geometryPropertyName = null;
View Full Code Here

Examples of org.geotools.styling.TextSymbolizer

        if (textSymbolizerWrapper == null) {
            widgetEnabled = false;
            /*
             * create a dummy local one to create the widgets
             */
            TextSymbolizer newSymbolizer = Utilities.createDefaultTextSymbolizer(SLD.POLYGON);
            textSymbolizerWrapper = new TextSymbolizerWrapper(newSymbolizer, null, SLD.POLYGON);
        }

        mainComposite = new Composite(parent, SWT.NONE);
        mainComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.