From: Justin D. <jde...@un...> - 2005-12-09 21:37:51
|
Hi all, I have been looking at styling and come up with some issues. The first is with StyleFactory. As an example consider the schema definition of Stroke: <xsd:complexType> <xsd:sequence> <xsd:choice minOccurs="0"> <xsd:element ref="sld:GraphicFill"/> <xsd:element ref="sld:GraphicStroke"/> </xsd:choice> <xsd:element ref="sld:CssParameter" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> This definition implies that specifying the color of the stroke is optional. And indeed the spec says the default color is black when not explicitly specified. However the way StyleFactory is written one must supply a color. If I call: styleFactory.createStroke(null,...); An exception is thrown. It would be nice to have some notion of the defaults for a stroke. This could look like: interface Stroke { static final LiteralExpression COLOR = ConstantExpression.BLACK; static final LiteralExpression WIDTH = ConstantExpression.ONE; ... } Taking this a step further is coming up with an stroke implementation that contains nothing but defaults useful for types in which "Stroke" is optional. interface Stroke { static final static final Stroke STROKE = new ConstantStroke(){ public Expression getColor() { return COLOR; } public Expression getWidth() { return WIDTH; } ... } } Anyone have any thoughts -Justin -- Justin Deoliveira The Open Planning Project http://topp.openplans.org |