Allow layers to be rendered without datasources.

This commit is contained in:
Young Hahn 2013-02-21 15:29:33 -05:00
parent 0e0bac0e5c
commit be78202e0b
5 changed files with 35 additions and 1 deletions

View File

@ -20,9 +20,11 @@ tree.LayerXML = function(obj, styles) {
styles.reverse().map(function(s) {
return '<StyleName>' + s + '</StyleName>';
}).join('\n ') +
(dsoptions.length ?
'\n <Datasource>\n ' +
dsoptions.join('\n ') +
'\n </Datasource>\n' +
'\n </Datasource>\n'
: '') +
' </Layer>\n';
};

View File

@ -0,0 +1,10 @@
{
"srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
"Stylesheet": [
"layer_nodatasource.mss"
],
"Layer": [{
"name": "world",
"srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over"
}]
}

View File

@ -0,0 +1,4 @@
#world {
polygon-fill: green;
line-color: hsl(30, 40%, 90%);
}

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE Map[]>
<Map srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over" maximum-extent="-20037508.34,-20037508.34,20037508.34,20037508.34">
<Style name="world" filter-mode="first">
<Rule>
<PolygonSymbolizer fill="#008000" />
<LineSymbolizer stroke="#f0e6db" />
</Rule>
</Style>
<Layer name="world"
srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over">
<StyleName>world</StyleName>
</Layer>
</Map>

View File

@ -195,6 +195,7 @@ helper.removeAbsoluteImages = function(xml) {
helper.removeAbsoluteDatasources = function(xml) {
xml.Map.forEach(function(map) {
if (map.Layer) map.Layer.forEach(function(layer) {
if (!layer.Datasource) return;
layer.Datasource.forEach(function(datasource) {
datasource.Parameter.forEach(function(param) {
if (param.name === 'file') {