use of com.sldeditor.common.data.StyleWrapper in project sldeditor by robward-scisys.
the class RenderSymbolTest method createSLD.
/**
* Creates the sld.
*
* @return the styled layer descriptor
*/
private StyledLayerDescriptor createSLD() {
String sldContents = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>" + "<StyledLayerDescriptor version=\"1.0.0\" " + " xsi:schemaLocation=\"http://www.opengis.net/sld StyledLayerDescriptor.xsd\" " + " xmlns=\"http://www.opengis.net/sld\" " + " xmlns:ogc=\"http://www.opengis.net/ogc\" " + " xmlns:xlink=\"http://www.w3.org/1999/xlink\" " + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" + " <NamedLayer>" + " <Name>Attribute-based point</Name>" + " <UserStyle>" + " <Title>GeoServer SLD Cook Book: Attribute-based point</Title>" + " <FeatureTypeStyle>" + " <Rule>" + " <Name>SmallPop</Name>" + " <Title>1 to 50000</Title>" + " <ogc:Filter>" + " <ogc:PropertyIsLessThan>" + " <ogc:PropertyName>pop</ogc:PropertyName>" + " <ogc:Literal>50000</ogc:Literal>" + " </ogc:PropertyIsLessThan>" + " </ogc:Filter>" + " <PointSymbolizer>" + " <Graphic>" + " <Mark>" + " <WellKnownName>star</WellKnownName>" + " <Fill>" + " <CssParameter name=\"fill\">#0033CC</CssParameter>" + " </Fill>" + " </Mark>" + " <Rotation>" + " <ogc:PropertyName>angle</ogc:PropertyName>" + " </Rotation>" + " <Size>" + " <ogc:PropertyName>size</ogc:PropertyName>" + " </Size>" + " </Graphic>" + " </PointSymbolizer>" + " </Rule>" + " <Rule>" + " <Name>MediumPop</Name>" + " <Title>50000 to 500000</Title>" + " <ogc:Filter>" + " <ogc:PropertyIsLessThan>" + " <ogc:PropertyName>pop</ogc:PropertyName>" + " <ogc:Literal>500000</ogc:Literal>" + " </ogc:PropertyIsLessThan>" + " </ogc:Filter>" + " <PointSymbolizer>" + " <Graphic>" + " <Mark>" + " <WellKnownName>star</WellKnownName>" + " <Fill>" + " <CssParameter name=\"fill\">#0033CC</CssParameter>" + " </Fill>" + " </Mark>" + " <Rotation>" + " <ogc:PropertyName>angle</ogc:PropertyName>" + " </Rotation>" + " <Size>" + " <ogc:PropertyName>size</ogc:PropertyName>" + " </Size>" + " </Graphic>" + " </PointSymbolizer>" + " <PointSymbolizer>" + " <Graphic>" + " <Mark>" + " <WellKnownName>circle</WellKnownName>" + " <Fill>" + " <CssParameter name=\"fill\">#123456</CssParameter>" + " </Fill>" + " </Mark>" + " <Rotation>" + " <ogc:PropertyName>angle</ogc:PropertyName>" + " </Rotation>" + " <Size>" + " <ogc:PropertyName>size</ogc:PropertyName>" + " </Size>" + " </Graphic>" + " </PointSymbolizer>" + " </Rule>" + " <Rule>" + " <Name>LargePop</Name>" + " <Title>500000 to 900000</Title>" + " <ogc:Filter>" + " <ogc:PropertyIsLessThan>" + " <ogc:PropertyName>pop</ogc:PropertyName>" + " <ogc:Literal>900000</ogc:Literal>" + " </ogc:PropertyIsLessThan>" + " </ogc:Filter>" + " <PointSymbolizer>" + " <Graphic>" + " <Mark>" + " <WellKnownName>star</WellKnownName>" + " <Fill>" + " <CssParameter name=\"fill\">#0033CC</CssParameter>" + " </Fill>" + " </Mark>" + " <Rotation>" + " <ogc:PropertyName>angle</ogc:PropertyName>" + " </Rotation>" + " <Size>" + " <ogc:PropertyName>size</ogc:PropertyName>" + " </Size>" + " </Graphic>" + " </PointSymbolizer>" + " </Rule>" + " </FeatureTypeStyle>" + " </UserStyle>" + " </NamedLayer>" + "</StyledLayerDescriptor>";
SLDData sldData = new SLDData(new StyleWrapper(null, "test.sld"), sldContents);
sldData.setDataSourceProperties(DataSourceConnectorFactory.getNoDataSource());
StyledLayerDescriptor sld = SLDUtils.createSLDFromString(sldData);
return sld;
}
use of com.sldeditor.common.data.StyleWrapper in project sldeditor by robward-scisys.
the class RuleRenderVisitorTest method createSLD.
/**
* Creates the sld.
*
* @return the styled layer descriptor
*/
private StyledLayerDescriptor createSLD() {
String sldContents = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>" + "<StyledLayerDescriptor version=\"1.0.0\" " + " xsi:schemaLocation=\"http://www.opengis.net/sld StyledLayerDescriptor.xsd\" " + " xmlns=\"http://www.opengis.net/sld\" " + " xmlns:ogc=\"http://www.opengis.net/ogc\" " + " xmlns:xlink=\"http://www.w3.org/1999/xlink\" " + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">" + " <NamedLayer>" + " <Name>Attribute-based point</Name>" + " <UserStyle>" + " <Title>GeoServer SLD Cook Book: Attribute-based point</Title>" + " <FeatureTypeStyle>" + " <Rule>" + " <Name>SmallPop</Name>" + " <Title>1 to 50000</Title>" + " <ogc:Filter>" + " <ogc:PropertyIsLessThan>" + " <ogc:PropertyName>pop</ogc:PropertyName>" + " <ogc:Literal>50000</ogc:Literal>" + " </ogc:PropertyIsLessThan>" + " </ogc:Filter>" + " <PointSymbolizer>" + " <Graphic>" + " <Mark>" + " <WellKnownName>star</WellKnownName>" + " <Fill>" + " <CssParameter name=\"fill\">#0033CC</CssParameter>" + " </Fill>" + " </Mark>" + " <Rotation>" + " <ogc:PropertyName>angle</ogc:PropertyName>" + " </Rotation>" + " <Size>" + " <ogc:PropertyName>size</ogc:PropertyName>" + " </Size>" + " </Graphic>" + " </PointSymbolizer>" + " </Rule>" + " <Rule>" + " <Name>MediumPop</Name>" + " <Title>50000 to 500000</Title>" + " <ogc:Filter>" + " <ogc:PropertyIsLessThan>" + " <ogc:PropertyName>pop</ogc:PropertyName>" + " <ogc:Literal>500000</ogc:Literal>" + " </ogc:PropertyIsLessThan>" + " </ogc:Filter>" + " <PointSymbolizer>" + " <Graphic>" + " <Mark>" + " <WellKnownName>star</WellKnownName>" + " <Fill>" + " <CssParameter name=\"fill\">#0033CC</CssParameter>" + " </Fill>" + " </Mark>" + " <Rotation>" + " <ogc:PropertyName>angle</ogc:PropertyName>" + " </Rotation>" + " <Size>" + " <ogc:PropertyName>size</ogc:PropertyName>" + " </Size>" + " </Graphic>" + " </PointSymbolizer>" + " <PointSymbolizer>" + " <Graphic>" + " <Mark>" + " <WellKnownName>circle</WellKnownName>" + " <Fill>" + " <CssParameter name=\"fill\">#123456</CssParameter>" + " </Fill>" + " </Mark>" + " <Rotation>" + " <ogc:PropertyName>angle</ogc:PropertyName>" + " </Rotation>" + " <Size>" + " <ogc:PropertyName>size</ogc:PropertyName>" + " </Size>" + " </Graphic>" + " </PointSymbolizer>" + " </Rule>" + " <Rule>" + " <Name>LargePop</Name>" + " <Title>500000 to 900000</Title>" + " <ogc:Filter>" + " <ogc:PropertyIsLessThan>" + " <ogc:PropertyName>pop</ogc:PropertyName>" + " <ogc:Literal>900000</ogc:Literal>" + " </ogc:PropertyIsLessThan>" + " </ogc:Filter>" + " <PointSymbolizer>" + " <Graphic>" + " <Mark>" + " <WellKnownName>star</WellKnownName>" + " <Fill>" + " <CssParameter name=\"fill\">#0033CC</CssParameter>" + " </Fill>" + " </Mark>" + " <Rotation>" + " <ogc:PropertyName>angle</ogc:PropertyName>" + " </Rotation>" + " <Size>" + " <ogc:PropertyName>size</ogc:PropertyName>" + " </Size>" + " </Graphic>" + " </PointSymbolizer>" + " </Rule>" + " </FeatureTypeStyle>" + " </UserStyle>" + " </NamedLayer>" + "</StyledLayerDescriptor>";
SLDData sldData = new SLDData(new StyleWrapper(null, "test.sld"), sldContents);
sldData.setDataSourceProperties(DataSourceConnectorFactory.getNoDataSource());
StyledLayerDescriptor sld = SLDUtils.createSLDFromString(sldData);
return sld;
}
use of com.sldeditor.common.data.StyleWrapper in project sldeditor by robward-scisys.
the class GeoServerReadProgress method refreshWorkspace.
/**
* Refresh workspace.
*
* @param connection the connection
* @param workspaceNode the workspace node
*/
private void refreshWorkspace(GeoServerConnection connection, GeoServerWorkspaceNode workspaceNode) {
workspaceNode.removeAllChildren();
Map<String, List<StyleWrapper>> styleMap = geoServerStyleMap.get(connection);
List<StyleWrapper> styleList = styleMap.get(workspaceNode.getWorkspaceName());
for (StyleWrapper styleWrapper : styleList) {
GeoServerStyleNode childNode = new GeoServerStyleNode(this.handler, connection, styleWrapper);
// It is key to invoke this on the TreeModel, and NOT DefaultMutableTreeNode
treeModel.insertNodeInto(childNode, workspaceNode, workspaceNode.getChildCount());
}
treeModel.reload(workspaceNode);
}
use of com.sldeditor.common.data.StyleWrapper in project sldeditor by robward-scisys.
the class GeoServerClient method updateLayerStyles.
/**
* Update layer styles.
*
* @param layer the original layer
* @return true, if successful
*/
@Override
public boolean updateLayerStyles(GeoServerLayer layer) {
if (layer == null) {
return false;
}
StyleWrapper updatedStyle = layer.getStyle();
boolean ok = false;
GeoServerRESTManager manager = GeoServerRESTManagerFactory.getManager(connection);
GeoServerRESTPublisher publisher = manager.getPublisher();
if (publisher != null) {
GSLayerEncoder layerEncoder = new GSLayerEncoder();
String defaultStyle;
if (isDefaultWorkspace(updatedStyle.getWorkspace())) {
defaultStyle = updatedStyle.getStyle();
} else {
defaultStyle = updatedStyle.getWorkspace() + ":" + updatedStyle.getStyle();
}
layerEncoder.setDefaultStyle(defaultStyle);
ok = publisher.configureLayer(layer.getLayerWorkspace(), layer.getLayerName(), layerEncoder);
}
return ok;
}
use of com.sldeditor.common.data.StyleWrapper in project sldeditor by robward-scisys.
the class GeoServerClient method parseStyleInDefaultWorkspace.
/**
* Parses the style in default workspace.
*
* @param reader the reader
* @param count the count
* @param styleList the style list
* @return the int
*/
private int parseStyleInDefaultWorkspace(GeoServerRESTReader reader, int count, List<StyleWrapper> styleList) {
// Read styles not in a workspace
RESTStyleList geoServerStyleList = reader.getStyles();
for (String style : geoServerStyleList.getNames()) {
StyleWrapper newStyleWrapper = new StyleWrapper(DEFAULT_WORKSPACE_NAME, style);
styleList.add(newStyleWrapper);
if (parentObj != null) {
parentObj.readStylesProgress(connection, count, count);
}
count++;
}
return count;
}
Aggregations