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


Java Rule.setMaxScaleDenominator方法代码示例

本文整理汇总了Java中org.geotools.styling.Rule.setMaxScaleDenominator方法的典型用法代码示例。如果您正苦于以下问题:Java Rule.setMaxScaleDenominator方法的具体用法?Java Rule.setMaxScaleDenominator怎么用?Java Rule.setMaxScaleDenominator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.geotools.styling.Rule的用法示例。


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

示例1: testIsPresent

import org.geotools.styling.Rule; //导入方法依赖的package包/类
/**
 * Test method for {@link com.sldeditor.common.utils.ScaleUtil#isPresent(org.opengis.style.Rule)}.
 */
@Test
public void testIsPresent() {
    assertFalse(ScaleUtil.isPresent(null));

    Rule rule = DefaultSymbols.createNewRule();
    assertFalse(ScaleUtil.isPresent(rule));

    // Set max scale denominator
    rule.setMaxScaleDenominator(10000.0);
    assertTrue(ScaleUtil.isPresent(rule));

    // Set both min and max scale denominator
    rule.setMinScaleDenominator(100.0);
    assertTrue(ScaleUtil.isPresent(rule));

    // Set min scale denominator
    rule.setMaxScaleDenominator(0.0);
    assertTrue(ScaleUtil.isPresent(rule));
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:23,代码来源:ScaleUtilTest.java

示例2: updateScales

import org.geotools.styling.Rule; //导入方法依赖的package包/类
/**
 * Update scales.
 *
 * @param sldWriter the sld writer
 */
public boolean updateScales(SLDWriterInterface sldWriter) {
    boolean refreshUI = false;
    if (rule != null) {
        if (isMinimumScaleUpdated()) {
            rule.setMinScaleDenominator(minScale);
            minimumScaleUpdated = false;
        }

        if (isMaximumScaleUpdated()) {
            rule.setMaxScaleDenominator(maxScale);
            maximumScaleUpdated = false;
        }

        String sldContents = sldWriter.encodeSLD(null, this.sld);

        SLDDataInterface current = SLDEditorFile.getInstance().getSLDData();

        if (current.getSLDFile().equals(sldData.getSLDFile())
                || current.getSLDURL().equals(sldData.getSLDURL())) {
            Rule currentFule = SLDUtils.findRule(sld, rule,
                    SelectedSymbol.getInstance().getSld());
            if (currentFule != null) {
                currentFule.setMinScaleDenominator(minScale);
                currentFule.setMaxScaleDenominator(maxScale);
                refreshUI = true;
            }
        }

        sldData.updateSLDContents(sldContents);
    }

    return refreshUI;
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:39,代码来源:ScaleSLDData.java

示例3: convert

import org.geotools.styling.Rule; //导入方法依赖的package包/类
@Override
public StyledLayerDescriptor convert(JsonObject json, String layerName, double minScale, double maxScale, int transparency) {
    StyledLayerDescriptor sld = styleFactory.createStyledLayerDescriptor();

    NamedLayer namedLayer = styleFactory.createNamedLayer();

    String label = json.get(CommonRendererKeys.LABEL).getAsString();
    namedLayer.setName(label);
    sld.addStyledLayer(namedLayer);

    Style style = styleFactory.createStyle();
    namedLayer.addStyle(style);

    List<FeatureTypeStyle> ftsList = style.featureTypeStyles();

    // style.setAbstract(json.get(IntermediateFileKeys.DESCRIPTION).getAsString());

    FeatureTypeStyle fts = styleFactory.createFeatureTypeStyle();

    ftsList.add(fts);

    Rule rule = styleFactory.createRule();

    if(minScale > 0.0)
    {
        rule.setMinScaleDenominator(minScale);
    }

    if(maxScale > 0.0)
    {
        rule.setMaxScaleDenominator(maxScale);
    }

    JsonElement jsonElement = json.get(CommonRendererKeys.SYMBOL);
    rule.setName(label);
    SymbolManager.getInstance().convertSymbols(rule, layerName, transparency, jsonElement);

    fts.rules().add(rule);

    return sld;
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:42,代码来源:SimpleRenderer.java

示例4: convert

import org.geotools.styling.Rule; //导入方法依赖的package包/类
@Override
public void convert(List<Rule> labelRuleList, Rule rule, JsonElement json, int transparency)
{       
    if((json != null) && (rule != null) && (labelRuleList != null))
    {
        JsonObject jsonObj = json.getAsJsonObject();

        TextSymbolizer textSymbolizer = styleFactory.createTextSymbolizer();

        textSymbolizer.setUnitOfMeasure(NonSI.PIXEL);

        textSymbolizer.setLabel(extractExpression(jsonObj));
        JsonElement jsonElement = jsonObj.get(LabelEngineLayerPropertiesKey.SYMBOL);
        SymbolManager.getInstance().convertTextSymbols(textSymbolizer, transparency, jsonElement);

        // Yes, this really is round the wrong way
        double maxScale = extractDouble(jsonObj, LabelEngineLayerPropertiesKey.ANNOTATION_MINIMUM_SCALE);
        double minScale = extractDouble(jsonObj, LabelEngineLayerPropertiesKey.ANNOTATION_MAXIMUM_SCALE);
        
        if((minScale > 0.0) || (maxScale > 0.0))
        {
            Rule labelRule = styleFactory.createRule();

            labelRule.setName(extractString(jsonObj, LabelEngineLayerPropertiesKey.CLASS));
            if(minScale > 0.0)
            {
                labelRule.setMinScaleDenominator(minScale);
            }

            if(maxScale > 0.0)
            {
                labelRule.setMaxScaleDenominator(maxScale);
            }
            labelRule.symbolizers().add(textSymbolizer);
            
            labelRuleList.add(labelRule);
        }
        else
        {
            rule.symbolizers().add(textSymbolizer);
        }
    }
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:44,代码来源:LabelEngineLayerProperties.java


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