Skip to content
Browse files

Allow layers to be rendered without datasources.

  • Loading branch information...
1 parent 0e0bac0 commit be78202e0bcf462861c8c7150d8e68e089719f6d @yhahn yhahn committed Feb 21, 2013
View
4 lib/carto/tree/layer.js
@@ -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
10 test/rendering/layer_nodatasource.mml
@@ -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
4 test/rendering/layer_nodatasource.mss
@@ -0,0 +1,4 @@
+#world {
+ polygon-fill: green;
+ line-color: hsl(30, 40%, 90%);
+}
View
17 test/rendering/layer_nodatasource.result
@@ -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
1 test/support/helper.js
@@ -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') {

0 comments on commit be78202

Please sign in to comment.
Something went wrong with that request. Please try again.