当前位置: 首页>>代码示例>>Java>>正文


Java Rule类代码示例

本文整理汇总了Java中org.opengis.style.Rule的典型用法代码示例。如果您正苦于以下问题:Java Rule类的具体用法?Java Rule怎么用?Java Rule使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Rule类属于org.opengis.style包,在下文中一共展示了Rule类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: editFilter

import org.opengis.style.Rule; //导入依赖的package包/类
/**
 * Edits the filter.
 *
 * @param filterFieldId the filter field id
 */
protected void editFilter(FieldIdEnum filterFieldId) {
    FilterPanelInterface filterPanel = ExpressionPanelFactory.getFilterPanel(null);

    String panelTitle = Localisation.getString(RuleDetails.class, "RuleDetails.panelTitle");
    filterPanel.configure(panelTitle, Object.class,
            SelectedSymbol.getInstance().isRasterSymbol());

    Rule rule = SelectedSymbol.getInstance().getRule();
    if (rule != null) {
        filterPanel.populate(rule.getFilter());
    }

    if (filterPanel.showDialog()) {
        originalFilter = filterPanel.getFilter();
        fieldConfigVisitor.populateTextField(filterFieldId, filterPanel.getFilterString());

        updateSymbol();
    }
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:25,代码来源:RuleDetails.java

示例2: isPresent

import org.opengis.style.Rule; //导入依赖的package包/类
/**
 * Checks if rule has minimum or maximum scale denominator set.
 * Returns false if rule is null.
 *
 * @param rule the rule
 * @return true, if minimum or maximum scale denominator set
 */
public static boolean isPresent(Rule rule) {
    if(rule == null)
    {
        return false;
    }

    return (!isNotSet(rule.getMinScaleDenominator()) || !isNotSet(rule.getMaxScaleDenominator()));
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:16,代码来源:ScaleUtil.java

示例3: populateStandardData

import org.opengis.style.Rule; //导入依赖的package包/类
/**
 * Populate standard data.
 *
 * @param rule the rule
 */
protected void populateStandardData(Rule rule) {
    StandardData standardData = new StandardData();

    if (rule != null) {
        standardData.name = rule.getName();
        standardData.description = (Description) rule.getDescription();
    }

    populateStandardData(standardData);
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:16,代码来源:StandardPanel.java

示例4: isPresent

import org.opengis.style.Rule; //导入依赖的package包/类
/**
 * Checks if rule has minimum or maximum scale denominator set. Returns false if rule is null.
 *
 * @param rule the rule
 * @return true, if minimum or maximum scale denominator set
 */
public static boolean isPresent(Rule rule) {
    if (rule == null) {
        return false;
    }

    return (!isNotSet(rule.getMinScaleDenominator())
            || !isNotSet(rule.getMaxScaleDenominator()));
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:15,代码来源:ScaleUtil.java

示例5: ruleInScale

import org.opengis.style.Rule; //导入依赖的package包/类
/**
 * This method evaluates the rule against the current scale denominator.
 *
 * @param rule the current rule to be checked
 * @param currentScaleDenominator the current scale denominator
 * @return true if the current rule matches to the current scale denominator, otherwise false
 */
private boolean ruleInScale(Rule rule, double currentScaleDenominator) {
    //true if within range or no cale denominator set
    boolean inScale = true;
    if (rule.getMinScaleDenominator() > 0 && currentScaleDenominator < rule.getMinScaleDenominator()) {
        inScale = false;
    }
    if (rule.getMaxScaleDenominator() < Double.POSITIVE_INFINITY && currentScaleDenominator > rule.getMaxScaleDenominator()) {
        inScale = false;
    }
    return inScale;
}
 
开发者ID:stefan0722,项目名称:gs-mvt,代码行数:19,代码来源:MVTWriter.java

示例6: populate

import org.opengis.style.Rule; //导入依赖的package包/类
/**
 * Populate.
 *
 * @param selectedSymbol the selected symbol
 */
/*
 * (non-Javadoc)
 * 
 * @see com.sldeditor.ui.iface.PopulateDetailsInterface#populate(com.sldeditor.ui.detail.selectedsymbol.SelectedSymbol)
 */
@Override
public void populate(SelectedSymbol selectedSymbol) {

    boolean rangeSet = false;
    String minScaleText = "";
    String maxScaleText = "";

    if (selectedSymbol != null) {
        Rule rule = selectedSymbol.getRule();

        if (rule != null) {
            populateStandardData(rule);

            originalFilter = rule.getFilter();
            String filterString = "";
            if (originalFilter != null) {
                try {
                    filterString = CQL.toCQL(originalFilter);
                } catch (Exception e) {
                    // Do nothing
                }
            }
            fieldConfigVisitor.populateTextField(FieldIdEnum.FILTER, filterString);

            rangeSet = ScaleUtil.isPresent(rule);
            minScaleText = ScaleUtil.getValue(rule.getMinScaleDenominator());
            maxScaleText = ScaleUtil.getValue(rule.getMaxScaleDenominator());

            fieldConfigVisitor.populateBooleanField(FieldIdEnum.ELSE_FILTER,
                    rule.isElseFilter());
        }
    }

    fieldConfigVisitor.populateTextField(FieldIdEnum.MINIMUM_SCALE, minScaleText);
    fieldConfigVisitor.populateTextField(FieldIdEnum.MAXIMUM_SCALE, maxScaleText);
    populateScaleRange(rangeSet);
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:48,代码来源:RuleDetails.java

示例7: updateSymbol

import org.opengis.style.Rule; //导入依赖的package包/类
/**
 * Update symbol.
 */
private void updateSymbol() {
    if (!Controller.getInstance().isPopulating()) {
        StandardData standardData = getStandardData();

        double minScale = getMinimumValue(fieldConfigManager.get(FieldIdEnum.MINIMUM_SCALE));
        double maxScale = getMaximumValue(fieldConfigManager.get(FieldIdEnum.MAXIMUM_SCALE));

        //
        // Read filter string
        //
        String filterText = fieldConfigVisitor.getText(FieldIdEnum.FILTER);
        Filter filter = originalFilter;
        if (originalFilter == null) {
            try {
                if (!filterText.isEmpty()) {
                    filter = CQL.toFilter(filterText);
                }
            } catch (CQLException e) {
                filter = originalFilter;
                ConsoleManager.getInstance().exception(this, e);
            }
        }

        //
        // Use existing symbolizers
        //
        org.geotools.styling.Rule existingRule = SelectedSymbol.getInstance().getRule();
        if (existingRule != null) {
            List<org.geotools.styling.Symbolizer> symbolizerList = existingRule.symbolizers();

            org.geotools.styling.Symbolizer[] symbolizerArray =
                    new org.geotools.styling.Symbolizer[symbolizerList
                    .size()];
            int index = 0;
            for (org.geotools.styling.Symbolizer symbolizer : symbolizerList) {
                symbolizerArray[index] = symbolizer;
                index++;
            }

            //
            // Legend
            //
            GraphicLegend existingLegend = existingRule.getLegend();
            Graphic[] legendGraphics = null;

            if (existingLegend != null) {
                int legendGraphicCount = existingLegend.graphicalSymbols().size();
                legendGraphics = new Graphic[legendGraphicCount];

                index = 0;
                for (GraphicalSymbol graphicalSymbol : existingLegend.graphicalSymbols()) {
                    legendGraphics[index] = (Graphic) graphicalSymbol;
                    index++;
                }
            } else {
                legendGraphics = new Graphic[0];
            }

            //
            // Else filter
            //
            boolean isElseFilter = fieldConfigVisitor.getBoolean(FieldIdEnum.ELSE_FILTER);

            //
            // Create new rule object
            //
            Rule rule = getStyleFactory().createRule(symbolizerArray, standardData.description,
                    legendGraphics, standardData.name, filter, isElseFilter, maxScale,
                    minScale);

            SelectedSymbol.getInstance().replaceRule((org.geotools.styling.Rule) rule);

            this.fireUpdateSymbol();
        }
    }
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:80,代码来源:RuleDetails.java

示例8: processSymbolizers

import org.opengis.style.Rule; //导入依赖的package包/类
/**
 * All geometries that are generated by this style with the symbolizers are returned by this method. If no
 * symbolizer has been defined the original geometry is returned.
 *
 * @param style the style for the feature containing all rules
 * @param feature the feature that should be rendered
 * @return all geometries that can be generated by the symbolizers or the original geometry if no symbolizers are defined
 */
private List<Geometry> processSymbolizers(Style style, SimpleFeature feature, double currentScaleDenominator) {
    List<Geometry> geometryList = new ArrayList<>();
    if (style != null && feature != null) {
        for (FeatureTypeStyle featureTypeStyle : style.featureTypeStyles()) {
            for (Rule rule : featureTypeStyle.rules()) {
                if (ruleInScale(rule, currentScaleDenominator)) {
                    Filter filter = rule.getFilter();
                    //If no filter is present or the feature evaluates positive against the filter
                    if (filter == null || filter.evaluate(feature)) {
                        Geometry geometry = null;
                        //If no symbolizers are present, get the default geometry
                        if (rule.symbolizers() == null || rule.symbolizers().isEmpty()) {
                            geometry = (Geometry) feature.getDefaultGeometry();
                            if (geometry != null) {
                                geometryList.add(geometry);
                            }
                            //If symbolizers are present get the geometry from the symbolizers (especially
                            //if geometric expressions have to be executed
                        } else {
                            for (Symbolizer symbolizer : rule.symbolizers()) {
                                if (symbolizer instanceof AbstractSymbolizer) {
                                    boolean duplicateGeometry = false;
                                    geometry = findGeometry(feature, (AbstractSymbolizer) symbolizer);
                                    //Check for duplicate geometries, e.g. if you use a ordinary wms style with
                                    //foreground and background rendering then the geometries could be duplicate.
                                    for (Geometry geometryInList : geometryList) {
                                        if (geometry.equals(geometryInList)) {
                                            duplicateGeometry = true;
                                        }
                                    }
                                    if (!duplicateGeometry && geometry != null) {
                                        geometryList.add(geometry);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    return geometryList;
}
 
开发者ID:stefan0722,项目名称:gs-mvt,代码行数:52,代码来源:MVTWriter.java


注:本文中的org.opengis.style.Rule类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。