• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java SLDTransformer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: encodeSLD

import org.geotools.styling.SLDTransformer; //导入依赖的package包/类
/**
 * Encode sld to a string
 *
 * @param sld the sld
 * @return the string
 */
public String encodeSLD(StyledLayerDescriptor sld)
{
    String xml = "";

    if(sld != null)
    {
        SLDTransformer transformer = new SLDTransformer();
        transformer.setIndentation(2);
        try {
            xml = transformer.transform(sld);
        } catch (TransformerException e) {
            ConsoleManager.getInstance().exception(this, e);
        }
    }

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


示例2: convertToSLD_1_0

import org.geotools.styling.SLDTransformer; //导入依赖的package包/类
private void convertToSLD_1_0() {
	if (style == null) {
		JOptionPane.showMessageDialog(this, "Style not defined");
		return;
	}
	SLDTransformer aTransformer = new SLDTransformer();
	aTransformer.setIndentation(4);
	try {
		String document = aTransformer.transform(style);

		display(document, SLD_1_0);
	} catch (TransformerException e) {
		e.printStackTrace();
		return;
	}
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:17,代码来源:StyleConverter.java


示例3: encodeSLD

import org.geotools.styling.SLDTransformer; //导入依赖的package包/类
/**
 * Encode sld to a string.
 *
 * @param resourceLocator the resource locator
 * @param sld the sld
 * @return the string
 */
@Override
public String encodeSLD(URL resourceLocator, StyledLayerDescriptor sld) {
    String xml = "";

    if (sld != null) {
        InlineDatastoreVisitor duplicator = new InlineDatastoreVisitor();
        sld.accept(duplicator);
        StyledLayerDescriptor sldCopy = (StyledLayerDescriptor) duplicator.getCopy();

        if (resourceLocator != null) {
            SLDExternalImages.updateOnlineResources(resourceLocator, sldCopy);
        }

        SLDTransformer transformer = new SLDTransformer();
        transformer.setIndentation(2);
        try {
            xml = transformer.transform(sldCopy);
            if (xml.startsWith(START_OF_XML_HEADER)) {
                int pos = xml.indexOf(END_OF_XML_HEADER, 0);
                if (pos > 1) {
                    pos = pos + END_OF_XML_HEADER.length() + 1;
                    String xmlHeader = xml.substring(0, pos);
                    String sldBody = xml.substring(pos);

                    xml = xmlHeader + getHeader() + sldBody;
                }
            }
        } catch (TransformerException e) {
            ConsoleManager.getInstance().exception(this, e);
        }
    }

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


示例4: main

import org.geotools.styling.SLDTransformer; //导入依赖的package包/类
public static void main(String[] args) throws IOException {
JLegendPanel legend = new JLegendPanel();
File file = new File("../../data/states.shp");
ShapefileDataStore ds = new ShapefileDataStore(
	DataUtilities.fileToURL(file));
ContentFeatureCollection collection = ds.getFeatureSource()
	.getFeatures();

String[] pals = legend.getPalletes();
for (String p : pals)
    System.out.println(p);

for (String n : legend.getClassifiers()) {
    System.out.println(n);

    legend.setFunction(n);
    Style style = legend.getStyle(collection, "P_FEMALE");
    SLDTransformer tx = new SLDTransformer();

    tx.setIndentation(2);

    try {
	tx.transform(style, System.out);
    } catch (TransformerException e) {
	throw (IOException) new IOException("Error writing style")
		.initCause(e);
    }
}

   }
 
开发者ID:ianturton,项目名称:ShapefileViewer,代码行数:31,代码来源:JLegendPanel.java


示例5: styleToString

import org.geotools.styling.SLDTransformer; //导入依赖的package包/类
/**
 * Converts a style to its string representation to be written to file.
 * 
 * @param style
 *            the style to convert.
 * @return the style string.
 * @throws Exception
 */
public static String styleToString(final Style style) throws Exception {
	final StyledLayerDescriptor sld = sf.createStyledLayerDescriptor();
	final UserLayer layer = sf.createUserLayer();
	layer.setLayerFeatureConstraints(new FeatureTypeConstraint[] { null });
	sld.addStyledLayer(layer);
	layer.addUserStyle(style);

	final SLDTransformer aTransformer = new SLDTransformer();
	aTransformer.setIndentation(4);
	final String xml = aTransformer.transform(sld);
	return xml;
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:21,代码来源:SimpleStyleConfigurator.java


示例6: styleToString

import org.geotools.styling.SLDTransformer; //导入依赖的package包/类
/**
 * Converts a style to its string representation to be written to file.
 * 
 * @param style the style to convert.
 * @return the style string.
 * @throws Exception
 */
public static String styleToString(Style style) throws Exception {
    StyledLayerDescriptor sld = sf.createStyledLayerDescriptor();
    UserLayer layer = sf.createUserLayer();
    layer.setLayerFeatureConstraints(new FeatureTypeConstraint[] { null });
    sld.addStyledLayer(layer);
    layer.addUserStyle(style);

    SLDTransformer aTransformer = new SLDTransformer();
    aTransformer.setIndentation(4);
    String xml = aTransformer.transform(sld);
    return xml;
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:20,代码来源:SldUtilities.java


示例7: toXml

import org.geotools.styling.SLDTransformer; //导入依赖的package包/类
/**
 * Converts a style to its string representation to be written to file.
 * 
 * @param style the style to convert.
 * @return the style string.
 * @throws Exception
 */
public String toXml() throws Exception {
    StyledLayerDescriptor sld = sf.createStyledLayerDescriptor();
    UserLayer layer = sf.createUserLayer();
    layer.setLayerFeatureConstraints(new FeatureTypeConstraint[] { null });
    sld.addStyledLayer(layer);
    layer.addUserStyle(style);

    SLDTransformer aTransformer = new SLDTransformer();
    aTransformer.setIndentation(4);
    String xml = aTransformer.transform(sld);
    return xml;
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:20,代码来源:StyleWrapper.java


示例8: styleToString

import org.geotools.styling.SLDTransformer; //导入依赖的package包/类
/**
 * Converts a style to its string representation to be written to file.
 * 
 * @param style the style to convert.
 * @return the style string.
 * @throws Exception
 */
public static String styleToString( Style style ) throws Exception {
    StyledLayerDescriptor sld = sf.createStyledLayerDescriptor();
    UserLayer layer = sf.createUserLayer();
    layer.setLayerFeatureConstraints(new FeatureTypeConstraint[]{null});
    sld.addStyledLayer(layer);
    layer.addUserStyle(style);

    SLDTransformer aTransformer = new SLDTransformer();
    aTransformer.setIndentation(4);
    String xml = aTransformer.transform(sld);
    return xml;
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:20,代码来源:Utilities.java


示例9: convertValueToDom

import org.geotools.styling.SLDTransformer; //导入依赖的package包/类
@Override
public void convertValueToDom(Object value, DomElement parentElement) throws ConversionException {
    Style style = (Style) value;
    final SLDTransformer transformer = new SLDTransformer();
    transformer.setIndentation(2);
    try {
        final String s = transformer.transform(style);
        XppDomWriter domWriter = new XppDomWriter();
        new HierarchicalStreamCopier().copy(new XppReader(new StringReader(s)), domWriter);
        parentElement.addChild(new XppDomElement(domWriter.getConfiguration()));
    } catch (TransformerException e) {
        throw new IllegalArgumentException(e);
    }
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:15,代码来源:FeatureLayerType.java


示例10: getSuitabilityStyleXML

import org.geotools.styling.SLDTransformer; //导入依赖的package包/类
public String getSuitabilityStyleXML(String columnName)
    throws TransformerException {
  SLDTransformer transformer = new SLDTransformer();
  StyledLayerDescriptor suitabilityStyle = getSuitabilityStyle(columnName);
  return transformer.transform(suitabilityStyle);
}
 
开发者ID:AURIN,项目名称:online-whatif,代码行数:7,代码来源:GeodataStyler.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java EXTTextureMirrorClamp类代码示例发布时间:2022-05-22
下一篇:
Java RMWebApp类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap