Created
December 5, 2013 18:52
-
-
Save ca0v/7811059 to your computer and use it in GitHub Desktop.
Here's a typescript interface definition generated from poly_landmarks.sld then modified to eliminate the layer name from the definition.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
///<reference path="../../ref.d.ts"/> | |
interface IStyleLayerDescriptorFilter { | |
type?: string; | |
property?: string; | |
value?: string; | |
filters?: Array<IStyleLayerDescriptorFilter>; | |
} | |
// TODO: requires id to be optional for validation to succeed..report as TS defect? | |
interface IStyledLayerDescriptorRule { | |
id?: string; | |
filter?: IStyleLayerDescriptorFilter; | |
symbolizer?: { | |
Polygon?: { | |
fill: boolean; | |
stroke: boolean; | |
fillColor: string; | |
fillOpacity: string; | |
strokeColor: string; | |
}; | |
Text?: { | |
label: string; | |
fontFamily: string; | |
fontStyle: string; | |
fontSize: string; | |
fontWeight: string; | |
labelAnchorPointX: string; | |
labelAnchorPointY: string; | |
haloRadius: string; | |
haloColor: string; | |
haloOpacity: string; | |
fill: boolean; | |
fontColor: string; | |
}; | |
}; | |
} | |
interface IStyledLayerDescriptorLayer { | |
name: string; | |
namedStyles: Array<any>; | |
userStyles: Array< { | |
id: string; | |
layerName: string; | |
defaultsPerSymbolizer: boolean; | |
rules: Array<IStyledLayerDescriptorRule>; | |
propertyStyles: { | |
label: boolean; | |
}; | |
defaultStyle: { | |
fillColor: string; | |
fillOpacity: number; | |
strokeColor: string; | |
strokeOpacity: number; | |
strokeWidth: number; | |
strokeDashstyle: string; | |
pointRadius: number; | |
graphicName: string; | |
}; | |
}>; | |
} | |
interface IStyledLayerDescriptorLayers { | |
[property: string]: IStyledLayerDescriptorLayer; | |
} | |
interface IStyledLayerDescriptor { | |
namedLayers: IStyledLayerDescriptorLayers; | |
version: string; | |
} | |
define(<IStyledLayerDescriptor>{ | |
"namedLayers": { | |
"arealandmarks": { | |
"userStyles": [{ | |
"defaultsPerSymbolizer": true, | |
"rules": [{ | |
"symbolizer": { | |
"Polygon": { | |
"fill": true, | |
"stroke": true, | |
"fillColor": "#B4DFB4", | |
"fillOpacity": "1", | |
"strokeColor": "#88B588" | |
} | |
}, | |
"id": "OpenLayers_Rule_2", | |
"filter": { | |
"filters": [{ | |
"filters": [{ | |
"filters": [{ | |
"type": "==", | |
"property": "CFCC", | |
"value": "D82" | |
}, | |
{ | |
"type": "==", | |
"property": "CFCC", | |
"value": "D83" | |
}], | |
"type": "||" | |
}, | |
{ | |
"type": "==", | |
"property": "CFCC", | |
"value": "D84" | |
}], | |
"type": "||" | |
}, | |
{ | |
"type": "==", | |
"property": "CFCC", | |
"value": "D85" | |
}], | |
"type": "||" | |
} | |
}, | |
{ | |
"symbolizer": { | |
"Polygon": { | |
"fill": true, | |
"stroke": true, | |
"fillColor": "#8AA9D1", | |
"fillOpacity": "1", | |
"strokeColor": "#436C91" | |
} | |
}, | |
"id": "OpenLayers_Rule_3", | |
"filter": { | |
"filters": [{ | |
"filters": [{ | |
"filters": [{ | |
"type": "==", | |
"property": "CFCC", | |
"value": "H11" | |
}, | |
{ | |
"type": "==", | |
"property": "CFCC", | |
"value": "H31" | |
}], | |
"type": "||" | |
}, | |
{ | |
"type": "==", | |
"property": "CFCC", | |
"value": "H41" | |
}], | |
"type": "||" | |
}, | |
{ | |
"type": "==", | |
"property": "CFCC", | |
"value": "H51" | |
}], | |
"type": "||" | |
} | |
}, | |
{ | |
"symbolizer": { | |
"Polygon": { | |
"fill": true, | |
"stroke": true, | |
"fillColor": "#A5A5A5", | |
"fillOpacity": "1", | |
"strokeColor": "#6E6E6E" | |
} | |
}, | |
"id": "OpenLayers_Rule_4", | |
"filter": { | |
"filters": [{ | |
"filters": [{ | |
"filters": [{ | |
"filters": [{ | |
"filters": [{ | |
"type": "==", | |
"property": "CFCC", | |
"value": "D31" | |
}, | |
{ | |
"type": "==", | |
"property": "CFCC", | |
"value": "D43" | |
}], | |
"type": "||" | |
}, | |
{ | |
"type": "==", | |
"property": "CFCC", | |
"value": "D64" | |
}], | |
"type": "||" | |
}, | |
{ | |
"type": "==", | |
"property": "CFCC", | |
"value": "D65" | |
}], | |
"type": "||" | |
}, | |
{ | |
"type": "==", | |
"property": "CFCC", | |
"value": "D90" | |
}], | |
"type": "||" | |
}, | |
{ | |
"type": "==", | |
"property": "CFCC", | |
"value": "E23" | |
}], | |
"type": "||" | |
} | |
}, | |
{ | |
"symbolizer": { | |
"Text": { | |
"label": "${LANAME}", | |
"fontFamily": "Times New Roman", | |
"fontStyle": "Normal", | |
"fontSize": "14", | |
"fontWeight": "bold", | |
"labelAnchorPointX": "0.5", | |
"labelAnchorPointY": "0.5", | |
"haloRadius": "2", | |
"haloColor": "#FDE5A5", | |
"haloOpacity": "0.75", | |
"fill": true, | |
"fontColor": "#000000" | |
} | |
}, | |
"id": "OpenLayers_Rule_5" | |
}], | |
"propertyStyles": { | |
"label": true | |
}, | |
"defaultStyle": { | |
"fillColor": "#808080", | |
"fillOpacity": 1, | |
"strokeColor": "#000000", | |
"strokeOpacity": 1, | |
"strokeWidth": 1, | |
"strokeDashstyle": "solid", | |
"pointRadius": 3, | |
"graphicName": "square" | |
}, | |
"id": "OpenLayers_Style_6", | |
"layerName": " area landmarks " | |
}], | |
"namedStyles": [], | |
"name": " area landmarks " | |
} | |
}, | |
"version": "1.0.0" | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment