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