Package org.geomajas.configuration

Examples of org.geomajas.configuration.NamedStyleInfo


          }
          String layerName = (namedStyle.getSldLayerName() != null ? namedStyle.getSldLayerName() : layer
              .getId());
          String styleName = (namedStyle.getSldStyleName() != null ? namedStyle.getSldStyleName() : layer
              .getId());
          NamedStyleInfo sldStyle = styleConverterService.convert(namedStyle.getStyledLayerInfo(),
              info.getFeatureInfo(), layerName, styleName);
          namedStyle.setFeatureStyles(sldStyle.getFeatureStyles());
          namedStyle.setLabelStyle(sldStyle.getLabelStyle());
        }
      }
      // apply defaults to all styles
      for (NamedStyleInfo namedStyle : info.getNamedStyleInfos()) {
        for (FeatureStyleInfo featureStyle : namedStyle.getFeatureStyles()) {
View Full Code Here


    pip.put(PipelineCode.MAX_RESULT_SIZE_KEY, limit);

    pip.put(PipelineCode.FILTER_KEY, Filter.INCLUDE);
    pip.put(PipelineCode.FEATURE_INCLUDES_KEY, 0);
    pip.put(PipelineCode.LAYER_ID_KEY, testLayer.getId());
    pip.put(PipelineCode.STYLE_KEY, new NamedStyleInfo());

    return pip;
  }
View Full Code Here

    pip.put(PipelineCode.MAX_RESULT_SIZE_KEY, limit);

    pip.put(PipelineCode.FILTER_KEY, Filter.INCLUDE);
    pip.put(PipelineCode.FEATURE_INCLUDES_KEY, 0);
    pip.put(PipelineCode.LAYER_ID_KEY, testLayer.getId());
    pip.put(PipelineCode.STYLE_KEY, new NamedStyleInfo());

    return pip;
  }
View Full Code Here

    }
    if (userStyleInfo == null) {
      throw new LayerException(ExceptionCode.INVALID_SLD, styledLayerDescriptorInfo.getName(), layerName);
    }

    NamedStyleInfo namedStyleInfo = convert(userStyleInfo, featureInfo);
    if (namedStyleInfo.getName() == null) {
      namedStyleInfo.setName(styleName);
    }
    for (FeatureStyleInfo featureStyleInfo : namedStyleInfo.getFeatureStyles()) {
      if (featureStyleInfo.getName() == null) {
        featureStyleInfo.setName(namedLayerInfo.getName());
      }
      featureStyleInfo.setStyleId(namedStyleInfo.getName() + featureStyleInfo.getIndex());
    }
    return namedStyleInfo;
  }
View Full Code Here

    }
    return namedStyleInfo;
  }

  private NamedStyleInfo convert(UserStyleInfo userStyle, FeatureInfo featureInfo) {
    NamedStyleInfo namedStyleInfo = new NamedStyleInfo();
    LabelStyleInfo labelStyleInfo = new LabelStyleInfo();
    List<FeatureStyleInfo> featureStyleInfos = new ArrayList<FeatureStyleInfo>();
    for (FeatureTypeStyleInfo featureTypeStyleInfo : userStyle.getFeatureTypeStyleList()) {
      int styleIndex = 0;
      for (RuleInfo ruleInfo : featureTypeStyleInfo.getRuleList()) {
        FeatureStyleInfo featureStyleInfo = new FeatureStyleInfo();
        if (ruleInfo.getChoice() != null) {
          if (ruleInfo.getChoice().ifFilter()) {
            featureStyleInfo.setFormula(convertFormula(ruleInfo.getChoice().getFilter(), featureInfo));
          }
        }
        for (SymbolizerTypeInfo symbolizerTypeInfo : ruleInfo.getSymbolizerList()) {
          if (symbolizerTypeInfo instanceof PointSymbolizerInfo) {
            PointSymbolizerInfo pointInfo = (PointSymbolizerInfo) symbolizerTypeInfo;
            convertSymbol(featureStyleInfo, pointInfo);
          } else if (symbolizerTypeInfo instanceof LineSymbolizerInfo) {
            LineSymbolizerInfo lineInfo = (LineSymbolizerInfo) symbolizerTypeInfo;
            convertStroke(featureStyleInfo, lineInfo.getStroke());
          } else if (symbolizerTypeInfo instanceof PolygonSymbolizerInfo) {
            PolygonSymbolizerInfo polygonInfo = (PolygonSymbolizerInfo) symbolizerTypeInfo;
            convertFill(featureStyleInfo, polygonInfo.getFill());
            convertStroke(featureStyleInfo, polygonInfo.getStroke());
          } else if (symbolizerTypeInfo instanceof TextSymbolizerInfo) {
            TextSymbolizerInfo textInfo = (TextSymbolizerInfo) symbolizerTypeInfo;
            labelStyleInfo.setFontStyle(convertFont(textInfo.getFont()));
            for (ExpressionInfo expr : textInfo.getLabel().getExpressionList()) {
              labelStyleInfo.setLabelAttributeName(expr.getValue());
            }
            convertFontFill(labelStyleInfo.getFontStyle(), textInfo.getFill());
            FeatureStyleInfo background = new FeatureStyleInfo();
            if (textInfo.getHalo() != null) {
              convertFill(background, textInfo.getHalo().getFill());
            }
            labelStyleInfo.setBackgroundStyle(background);
          }
        }
        if (featureStyleInfo.getStrokeColor() == null && featureStyleInfo.getFillColor() != null) {
          // avoid default stroke by setting invisible
          featureStyleInfo.setStrokeColor("black");
          featureStyleInfo.setStrokeOpacity(0);
          featureStyleInfo.setStrokeWidth(0);
        }
        featureStyleInfo.setIndex(styleIndex++);
        featureStyleInfo.setName(ruleInfo.getTitle() != null ? ruleInfo.getTitle() : ruleInfo.getName());
        featureStyleInfos.add(featureStyleInfo);
      }
    }
    namedStyleInfo.setName(userStyle.getTitle() != null ? userStyle.getTitle() : userStyle.getName());
    namedStyleInfo.setFeatureStyles(featureStyleInfos);
    namedStyleInfo.setLabelStyle(labelStyleInfo);
    return namedStyleInfo;
  }
View Full Code Here

TOP

Related Classes of org.geomajas.configuration.NamedStyleInfo

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.