001    //$HeadURL: svn+ssh://rbezema@svn.wald.intevation.org/deegree/base/branches/2.2_testing/src/org/deegree/graphics/sld/StyleFactory.java $
002    /*----------------    FILE HEADER  ------------------------------------------
003     
004     This file is part of deegree.
005     Copyright (C) 2001-2008 by:
006     EXSE, Department of Geography, University of Bonn
007     http://www.giub.uni-bonn.de/deegree/
008     lat/lon GmbH
009     http://www.lat-lon.de
010     
011     The basic version of this class was taken from the Geotools2 
012     project (StyleBuilder.java):
013     Geotools2 - OpenSource mapping toolkit
014     http://geotools.org
015     (C) 2002, Geotools Project Managment Committee (PMC)
016     
017     This library is free software; you can redistribute it and/or
018     modify it under the terms of the GNU Lesser General Public
019     License as published by the Free Software Foundation; either
020     version 2.1 of the License, or (at your option) any later version.
021    
022     This library is distributed in the hope that it will be useful,
023     but WITHOUT ANY WARRANTY; without even the implied warranty of
024     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
025     Lesser General Public License for more details.
026    
027     You should have received a copy of the GNU Lesser General Public
028     License along with this library; if not, write to the Free Software
029     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
030    
031     Contact:
032    
033     Andreas Poth
034     lat/lon GmbH
035     Aennchenstr. 19
036     53115 Bonn
037     Germany
038     E-Mail: poth@lat-lon.de
039    
040     Prof. Dr. Klaus Greve
041     Department of Geography
042     University of Bonn
043     Meckenheimer Allee 166
044     53115 Bonn
045     Germany
046     E-Mail: greve@giub.uni-bonn.de
047    
048     
049     ---------------------------------------------------------------------------*/
050    package org.deegree.graphics.sld;
051    
052    import java.awt.Color;
053    import java.net.MalformedURLException;
054    import java.net.URL;
055    import java.util.HashMap;
056    
057    import org.deegree.framework.util.ColorUtils;
058    import org.deegree.model.filterencoding.Expression;
059    import org.deegree.model.filterencoding.Filter;
060    import org.deegree.ogcbase.PropertyPath;
061    
062    /**
063     * An utility class designed to easy creation of style by convinience methods.
064     * 
065     * @author <a href="mailto:poth@lat-lon.de">Andreas Poth </a>
066     */
067    public class StyleFactory {
068    
069        /**
070         * creates a <tt>ParameterValueType</tt> instance with a <tt>String</tt> as value
071         * 
072         * @param value
073         *            value of the <tt>ParameterValueType</tt>
074         * 
075         * @return the ParameterValueType created
076         */
077        public static ParameterValueType createParameterValueType( String value ) {
078            return new ParameterValueType( new Object[] { value } );
079        }
080    
081        /**
082         * creates a <tt>ParameterValueType</tt> instance with a <tt>int</tt> as value
083         * 
084         * @param value
085         *            value of the <tt>ParameterValueType</tt>
086         * 
087         * @return the ParameterValueType created
088         */
089        public static ParameterValueType createParameterValueType( int value ) {
090            return new ParameterValueType( new Object[] { "" + value } );
091        }
092    
093        /**
094         * creates a <tt>ParameterValueType</tt> instance with a <tt>String</tt> as value
095         * 
096         * @param value
097         *            value of the <tt>ParameterValueType</tt>
098         * 
099         * @return the ParameterValueType created
100         */
101        public static ParameterValueType createParameterValueType( double value ) {
102            return new ParameterValueType( new Object[] { "" + value } );
103        }
104    
105        /**
106         * creates a <tt>ParameterValueType</tt> instance with an array of <tt>Expression</tt> s as
107         * value
108         * 
109         * @param expressions
110         * 
111         * @return the the ParameterValueType created
112         */
113        public static ParameterValueType createParameterValueType( Expression[] expressions ) {
114            return new ParameterValueType( expressions );
115        }
116    
117        /**
118         * creates a CssParameter with a name and a value
119         * 
120         * @param name
121         *            name of the css parameter
122         * @param value
123         *            value of the css parameter
124         * 
125         * @return the CssParameter created
126         */
127        public static CssParameter createCssParameter( String name, String value ) {
128            ParameterValueType pvt = createParameterValueType( value );
129            return new CssParameter( name, pvt );
130        }
131    
132        /**
133         * creates a CssParameter with a name and a value
134         * 
135         * @param name
136         *            name of the css parameter
137         * @param value
138         *            value of the css parameter
139         * 
140         * @return the CssParameter created
141         */
142        public static CssParameter createCssParameter( String name, int value ) {
143            ParameterValueType pvt = createParameterValueType( value );
144            return new CssParameter( name, pvt );
145        }
146    
147        /**
148         * creates a CssParameter with a name and a value
149         * 
150         * @param name
151         *            name of the css parameter
152         * @param value
153         *            value of the css parameter
154         * 
155         * @return the CssParameter created
156         */
157        public static CssParameter createCssParameter( String name, double value ) {
158            ParameterValueType pvt = createParameterValueType( value );
159            return new CssParameter( name, pvt );
160        }
161    
162        /**
163         * creates a <tt>GraphicStroke</tt> from a <tt>Graphic</tt> object
164         * 
165         * @param graphic
166         *            <tt>Graphic</tt object
167         *
168         * @return the GraphicStroke created
169         */
170        public static GraphicStroke createGraphicStroke( Graphic graphic ) {
171            return new GraphicStroke( graphic );
172        }
173    
174        /**
175         * creates a <tt>GraphicFill</tt> from a <tt>Graphic</tt> object
176         * 
177         * @param graphic
178         *            <tt>Graphic</tt object
179         *
180         * @return the GraphicFill created
181         */
182        public static GraphicFill createGraphicFill( Graphic graphic ) {
183            return new GraphicFill( graphic );
184        }
185    
186        /**
187         * create a default Stroke that black, 1 pixel width, complete opaque, with round linejoin and
188         * square line cap
189         * 
190         * @return the Stroke created
191         */
192        public static Stroke createStroke() {
193            return createStroke( Color.BLACK, 1, "round", "square" );
194        }
195    
196        /**
197         * create a default stroke with the supplied width
198         * 
199         * @param width
200         *            the width of the line
201         * 
202         * @return the stroke created
203         */
204        public static Stroke createStroke( double width ) {
205            return createStroke( Color.BLACK, width );
206        }
207    
208        /**
209         * Create a default stroke with the supplied color
210         * 
211         * @param color
212         *            the color of the line
213         * 
214         * @return the created stroke
215         */
216        public static Stroke createStroke( Color color ) {
217            return createStroke( color, 1 );
218        }
219    
220        /**
221         * create a stroke with the passed width and color
222         * 
223         * @param color
224         *            the color of the line
225         * @param width
226         *            the width of the line
227         * 
228         * @return the created stroke
229         */
230        public static Stroke createStroke( Color color, double width ) {
231            return createStroke( color, width, "round", "square" );
232        }
233    
234        /**
235         * create a stroke with color, width, linejoin type and lineCap type.
236         * 
237         * @param color
238         *            the color of the line
239         * @param width
240         *            the width of the line
241         * @param lineJoin
242         *            the type of join to be used at points along the line
243         * @param lineCap
244         *            the type of cap to be used at the end of the line
245         * 
246         * @return the stroke created
247         */
248        public static Stroke createStroke( Color color, double width, String lineJoin, String lineCap ) {
249            return createStroke( color, width, 1, null, lineJoin, lineCap );
250        }
251    
252        /**
253         * create a stroke with color, width, linejoin type and lineCap type.
254         * 
255         * @param color
256         *            the color of the line
257         * @param width
258         *            the width of the line
259         * @param opacity
260         *            the opacity or <I>see throughness </I> of the line, 0 - is transparent, 1 is
261         *            completely drawn
262         * @param lineJoin
263         *            the type of join to be used at points along the line
264         * @param lineCap
265         *            the type of cap to be used at the end of the line
266         * 
267         * @return the stroke created
268         */
269        public static Stroke createStroke( Color color, double width, double opacity, float[] dashArray, String lineJoin,
270                                           String lineCap ) {
271            HashMap<String,Object> cssParams = new HashMap<String,Object>();
272    
273            CssParameter stroke = createCssParameter( "stroke", ColorUtils.toHexCode( "#", color ) );
274            cssParams.put( "stroke", stroke );
275            CssParameter strokeOp = createCssParameter( "stroke-opacity", opacity );
276            cssParams.put( "stroke-opacity", strokeOp );
277            CssParameter strokeWi = createCssParameter( "stroke-width", width );
278            cssParams.put( "stroke-width", strokeWi );
279            CssParameter strokeLJ = createCssParameter( "stroke-linejoin", lineJoin );
280            cssParams.put( "stroke-linejoin", strokeLJ );
281            CssParameter strokeCap = createCssParameter( "stroke-linecap", lineCap );
282            cssParams.put( "stroke-linecap", strokeCap );
283    
284            if ( dashArray != null ) {
285                String s = "";
286                for ( int i = 0; i < dashArray.length - 1; i++ ) {
287                    s = s + dashArray[i] + ",";
288                }
289                s = s + dashArray[dashArray.length - 1];
290                CssParameter strokeDash = createCssParameter( "stroke-dasharray", s );
291                cssParams.put( "stroke-dasharray", strokeDash );
292            }
293    
294            return new Stroke( cssParams, null, null );
295        }
296    
297        /**
298         * create a dashed line of color and width
299         * 
300         * @param color
301         *            the color of the line
302         * @param width
303         *            the width of the line
304         * @param dashArray
305         *            an array of floats describing the length of line and spaces
306         * 
307         * @return the stroke created
308         */
309        public static Stroke createStroke( Color color, double width, float[] dashArray ) {
310            HashMap<String,Object> cssParams = new HashMap<String,Object>();
311    
312            CssParameter stroke = createCssParameter( "stroke", ColorUtils.toHexCode( "#", color ) );
313            cssParams.put( "stroke", stroke );
314            CssParameter strokeOp = createCssParameter( "stroke-opacity", "1" );
315            cssParams.put( "stroke-opacity", strokeOp );
316            CssParameter strokeWi = createCssParameter( "stroke-width", width );
317            cssParams.put( "stroke-width", strokeWi );
318            CssParameter strokeLJ = createCssParameter( "stroke-linejoin", "mitre" );
319            cssParams.put( "stroke-linejoin", strokeLJ );
320            CssParameter strokeCap = createCssParameter( "stroke-linecap", "butt" );
321            cssParams.put( "stroke-linecap", strokeCap );
322    
323            if ( dashArray != null ) {
324                String s = "";
325                for ( int i = 0; i < dashArray.length - 1; i++ ) {
326                    s = s + dashArray[i] + ",";
327                }
328                s = s + dashArray[dashArray.length - 1];
329                CssParameter strokeDash = createCssParameter( "stroke-dasharray", s );
330                cssParams.put( "stroke-dasharray", strokeDash );
331            }
332    
333            return new Stroke( cssParams, null, null );
334        }
335    
336        /**
337         * create a stroke with color, width and opacity supplied
338         * 
339         * @param color
340         *            the color of the line
341         * @param width
342         *            the width of the line
343         * @param opacity
344         *            the opacity or <I>see throughness </I> of the line, 0 - is transparent, 1 is
345         *            completely drawn
346         * 
347         * @return the stroke created
348         */
349        public static Stroke createStroke( Color color, double width, double opacity ) {
350            return createStroke( color, width, opacity, null, "mitre", "butt" );
351        }
352    
353        /**
354         * create a default fill 50% gray
355         * 
356         * @return the fill created
357         */
358        public static Fill createFill() {
359            return createFill( Color.GRAY, 1d, null );
360        }
361    
362        /**
363         * create a fill of color
364         * 
365         * @param color
366         *            the color of the fill
367         * 
368         * @return the fill created
369         */
370        public static Fill createFill( Color color ) {
371            return createFill( color, 1d, null );
372        }
373    
374        /**
375         * create a fill with the supplied color and opacity
376         * 
377         * @param color
378         *            the color to fill with
379         * @param opacity
380         *            the opacity of the fill 0 - transparent, 1 - completly filled
381         * 
382         * @return the fill created
383         */
384        public static Fill createFill( Color color, double opacity ) {
385            return createFill( color, opacity, null );
386        }
387    
388        /**
389         * create a fill with color and opacity supplied and uses the graphic fill supplied for the fill
390         * 
391         * @param color
392         *            the foreground color
393         * @param opacity
394         *            the opacity of the fill
395         * @param fill
396         *            the graphic object to use to fill the fill
397         * 
398         * @return the fill created
399         */
400        public static Fill createFill( Color color, double opacity, GraphicFill fill ) {
401            HashMap<String,Object> cssParams = new HashMap<String,Object>();
402            CssParameter fillCo = createCssParameter( "fill", ColorUtils.toHexCode( "#", color ) );
403            cssParams.put( "fill", fillCo );
404            CssParameter fillOp = createCssParameter( "fill-opacity", opacity );
405            cssParams.put( "fill-opacity", fillOp );
406            return new Fill( cssParams, fill );
407        }
408    
409        /**
410         * create the named mark
411         * 
412         * @param wellKnownName
413         *            the wellknown name of the mark
414         * 
415         * @return the mark created
416         */
417        public static Mark createMark( String wellKnownName ) {
418            return new Mark( wellKnownName, createStroke(), createFill() );
419        }
420    
421        /**
422         * create the named mark with the colors etc supplied
423         * 
424         * @param wellKnownName
425         *            the well known name of the mark
426         * @param fillColor
427         *            the color of the mark
428         * @param borderColor
429         *            the outline color of the mark
430         * @param borderWidth
431         *            the width of the outline
432         * 
433         * @return the mark created
434         */
435        public static Mark createMark( String wellKnownName, Color fillColor, Color borderColor, double borderWidth ) {
436            Stroke stroke = createStroke( borderColor, borderWidth );
437            Fill fill = createFill( fillColor );
438            return new Mark( wellKnownName, stroke, fill );
439        }
440    
441        /**
442         * create a mark with default fill (50% gray) and the supplied outline
443         * 
444         * @param wellKnownName
445         *            the well known name of the mark
446         * @param borderColor
447         *            the outline color
448         * @param borderWidth
449         *            the outline width
450         * 
451         * @return the mark created
452         */
453        public static Mark createMark( String wellKnownName, Color borderColor, double borderWidth ) {
454            Stroke stroke = createStroke( borderColor, borderWidth );
455            Fill fill = createFill();
456            return new Mark( wellKnownName, stroke, fill );
457        }
458    
459        /**
460         * create a mark of the supplied color and a default outline (black)
461         * 
462         * @param wellKnownName
463         *            the well known name of the mark
464         * @param fillColor
465         *            the color of the mark
466         * 
467         * @return the created mark
468         */
469        public static Mark createMark( String wellKnownName, Color fillColor ) {
470            Stroke stroke = createStroke();
471            Fill fill = createFill( fillColor );
472            return new Mark( wellKnownName, stroke, fill );
473        }
474    
475        /**
476         * create a mark with the supplied fill and stroke
477         * 
478         * @param wellKnownName
479         *            the well known name of the mark
480         * @param fill
481         *            the fill to use
482         * @param stroke
483         *            the stroke to use
484         * 
485         * @return the mark created
486         */
487        public static Mark createMark( String wellKnownName, Fill fill, Stroke stroke ) {
488            return new Mark( wellKnownName, stroke, fill );
489        }
490    
491        /**
492         * wrapper for stylefactory method
493         * 
494         * @param uri
495         *            the uri of the image
496         * @param format
497         *            mime type of the image
498         * 
499         * @return the external graphic
500         */
501        public static ExternalGraphic createExternalGraphic( String uri, String format )
502                                throws MalformedURLException {
503            return createExternalGraphic( new URL( uri ), format );
504        }
505    
506        /**
507         * wrapper for stylefactory method
508         * 
509         * @param url
510         *            the url of the image
511         * @param format
512         *            mime type of the image
513         * 
514         * @return the external graphic
515         */
516        public static ExternalGraphic createExternalGraphic( java.net.URL url, String format ) {
517            return new ExternalGraphic( format, url );
518        }
519    
520        /**
521         * creates a graphic object
522         * 
523         * @param externalGraphic
524         *            an external graphic to use if displayable
525         * @param mark
526         *            a mark to use
527         * @param opacity -
528         *            the opacity of the graphic
529         * @param size -
530         *            the size of the graphic
531         * @param rotation -
532         *            the rotation from the top of the page of the graphic
533         * 
534         * @return the graphic created
535         */
536        public static Graphic createGraphic( ExternalGraphic externalGraphic, Mark mark, double opacity, double size,
537                                             double rotation ) {
538    
539            Object[] mae = null;
540            if ( externalGraphic != null && mark != null ) {
541                mae = new Object[] { externalGraphic, mark };
542            } else if ( externalGraphic != null ) {
543                mae = new Object[] { externalGraphic };
544            } else if ( mark != null ) {
545                mae = new Object[] { mark };
546            }
547            ParameterValueType op_pvt = createParameterValueType( opacity );
548            ParameterValueType sz_pvt = createParameterValueType( size );
549            ParameterValueType ro_pvt = createParameterValueType( rotation );
550            return new Graphic( mae, op_pvt, sz_pvt, ro_pvt );
551        }
552    
553        /**
554         * wrapper round Stylefactory Method
555         * 
556         * @return the default pointplacement
557         */
558        public static PointPlacement createPointPlacement() {
559            return new PointPlacement();
560        }
561    
562        /**
563         * wrapper round Stylefactory Method
564         * 
565         * @param anchorX -
566         *            the X coordinate
567         * @param anchorY -
568         *            the Y coordinate
569         * @param rotation -
570         *            the rotaion of the label
571         * 
572         * @return the pointplacement created
573         */
574        public static PointPlacement createPointPlacement( double anchorX, double anchorY, double rotation ) {
575            ParameterValueType pvt1 = createParameterValueType( anchorX );
576            ParameterValueType pvt2 = createParameterValueType( anchorY );
577            ParameterValueType[] anchorPoint = new ParameterValueType[] { pvt1, pvt2 };
578            ParameterValueType rot = createParameterValueType( rotation );
579            return new PointPlacement( anchorPoint, null, rot, false );
580        }
581    
582        /**
583         * wrapper round Stylefactory Method
584         * 
585         * @param anchorX -
586         *            the X coordinate
587         * @param anchorY -
588         *            the Y coordinate
589         * @param displacementX -
590         *            the X distance from the anchor
591         * @param displacementY -
592         *            the Y distance from the anchor
593         * @param rotation -
594         *            the rotaion of the label
595         * 
596         * @return the pointplacement created
597         */
598        public static PointPlacement createPointPlacement( double anchorX, double anchorY, double displacementX,
599                                                           double displacementY, double rotation ) {
600            ParameterValueType pvt1 = createParameterValueType( anchorX );
601            ParameterValueType pvt2 = createParameterValueType( anchorY );
602            ParameterValueType[] anchorPoint = new ParameterValueType[] { pvt1, pvt2 };
603    
604            ParameterValueType pvt3 = createParameterValueType( displacementX );
605            ParameterValueType pvt4 = createParameterValueType( displacementY );
606            ParameterValueType[] displacement = new ParameterValueType[] { pvt3, pvt4 };
607    
608            ParameterValueType rot = createParameterValueType( rotation );
609            return new PointPlacement( anchorPoint, displacement, rot, false );
610        }
611    
612        /**
613         * @param anchorX -
614         *            the X coordinate
615         * @param anchorY -
616         *            the Y coordinate
617         * @param displacementX -
618         *            the X distance from the anchor
619         * @param displacementY -
620         *            the Y distance from the anchor
621         * @param rotation -
622         *            the rotaion of the label
623         * @param auto -
624         *            auto positioning of the label
625         * 
626         * @return the pointplacement created
627         */
628        public static PointPlacement createPointPlacement( double anchorX, double anchorY, double displacementX,
629                                                           double displacementY, double rotation, boolean auto ) {
630            ParameterValueType pvt1 = createParameterValueType( anchorX );
631            ParameterValueType pvt2 = createParameterValueType( anchorY );
632            ParameterValueType[] anchorPoint = new ParameterValueType[] { pvt1, pvt2 };
633    
634            ParameterValueType pvt3 = createParameterValueType( displacementX );
635            ParameterValueType pvt4 = createParameterValueType( displacementY );
636            ParameterValueType[] displacement = new ParameterValueType[] { pvt3, pvt4 };
637    
638            ParameterValueType rot = createParameterValueType( rotation );
639            return new PointPlacement( anchorPoint, displacement, rot, auto );
640        }
641    
642        /**
643         * creates a <tt>LinePlacement</tt> with a user defined distance between the labels and the
644         * lines. A positive value indicates a position above the line, a negative value indicates a
645         * position below. The line width is asumed to be 2 pixel and the gap between the labels is set
646         * to factor 10 of the label width.
647         * 
648         * @param offset -
649         *            the distance between the line and the label
650         * 
651         * @return the LinePlacement created
652         */
653        public static LinePlacement createLinePlacement( double offset ) {
654    
655            ParameterValueType perpendicularOffset = createParameterValueType( offset );
656            ParameterValueType lineWidth = createParameterValueType( 2 );
657            ParameterValueType gap = createParameterValueType( 10 );
658    
659            return new LinePlacement( perpendicularOffset, lineWidth, gap );
660        }
661    
662        /**
663         * creates a <tt>LinePlacement</tt> with a relative position of the label according to the
664         * line the lines. The line width is asumed to be 2 pixel and the gap between the labels is set
665         * to factor 10 of the label width.
666         * 
667         * @param position
668         *            of the label relative to the line
669         * 
670         * @return the LinePlacement created
671         */
672        public static LinePlacement createLinePlacement( String position ) {
673    
674            ParameterValueType perpendicularOffset = createParameterValueType( position );
675            ParameterValueType lineWidth = createParameterValueType( 2 );
676            ParameterValueType gap = createParameterValueType( 10 );
677    
678            return new LinePlacement( perpendicularOffset, lineWidth, gap );
679        }
680    
681        /**
682         * creates a <tt>LinePlacement</tt> with a user defined distance between the labels and the
683         * lines. A positive value indicates a position above the line, a negative value indicates a
684         * position below.
685         * 
686         * @param offset -
687         *            the distance between the line and the label
688         * @param lineWidth -
689         *            assumed lineWidth
690         * @param gap -
691         *            gap between the labels measured in label width
692         * 
693         * @return the LinePlacement created
694         */
695        public static LinePlacement createLinePlacement( double offset, double lineWidth, int gap ) {
696    
697            ParameterValueType perpendicularOffset = createParameterValueType( offset );
698            ParameterValueType lineWidth_ = createParameterValueType( lineWidth );
699            ParameterValueType gap_ = createParameterValueType( gap );
700    
701            return new LinePlacement( perpendicularOffset, lineWidth_, gap_ );
702        }
703    
704        /**
705         * creates a <tt>LinePlacement</tt> with a user defined distance between the labels and the
706         * lines. A positive value indicates a position above the line, a negative value indicates a
707         * position below.
708         * 
709         * @param position -
710         *            relative position of the label to the line
711         * @param lineWidth -
712         *            assumed lineWidth
713         * @param gap -
714         *            gap between the labels measured in label width
715         * 
716         * @return the LinePlacement created
717         */
718        public static LinePlacement createLinePlacement( String position, double lineWidth, int gap ) {
719    
720            ParameterValueType perpendicularOffset = createParameterValueType( position );
721            ParameterValueType lineWidth_ = createParameterValueType( lineWidth );
722            ParameterValueType gap_ = createParameterValueType( gap );
723    
724            return new LinePlacement( perpendicularOffset, lineWidth_, gap_ );
725        }
726    
727        /**
728         * creates a label placement that is orientated on a line
729         * 
730         * @param linePlacement
731         *            description of the line where the lable will be orientated on
732         * @return created LabelPlacement
733         */
734        public static LabelPlacement createLabelPlacement( LinePlacement linePlacement ) {
735            return new LabelPlacement( linePlacement );
736        }
737    
738        /**
739         * creates a label placement that is orientated on a point
740         * 
741         * @param pointPlacement
742         *            description of the point where the lable will be orientated on
743         * @return created LabelPlacement
744         */
745        public static LabelPlacement createLabelPlacement( PointPlacement pointPlacement ) {
746            return new LabelPlacement( pointPlacement );
747        }
748    
749        /**
750         * create a geotools font object from a java font
751         * 
752         * @param font -
753         *            the font to be converted
754         * 
755         * @return - the deegree sld font
756         */
757        public static Font createFont( java.awt.Font font ) {
758            return createFont( font.getFamily(), font.isItalic(), font.isBold(), font.getSize() );
759        }
760    
761        /**
762         * create font of supplied family and size
763         * 
764         * @param fontFamily -
765         *            the font family
766         * @param fontSize -
767         *            the size of the font in points
768         * 
769         * @return the font object created
770         */
771        public static Font createFont( String fontFamily, double fontSize ) {
772            return createFont( fontFamily, false, false, fontSize );
773        }
774    
775        /**
776         * create font of supplied family, size and weight/style
777         * 
778         * @param fontFamily -
779         *            the font family
780         * @param italic -
781         *            should the font be italic?
782         * @param bold -
783         *            should the font be bold?
784         * @param fontSize -
785         *            the size of the font in points
786         * 
787         * @return the new font object
788         */
789        public static Font createFont( String fontFamily, boolean italic, boolean bold, double fontSize ) {
790            HashMap<String,Object> cssParams = new HashMap<String,Object>();
791    
792            cssParams.put( "font-family", createCssParameter( "font-family", fontFamily ) );
793            cssParams.put( "font-size", createCssParameter( "font-size", "" + fontSize ) );
794            if ( bold ) {
795                cssParams.put( "font-weight", createCssParameter( "font-weight", "bold" ) );
796            } else {
797                cssParams.put( "font-weight", createCssParameter( "font-weight", "normal" ) );
798            }
799            if ( italic ) {
800                cssParams.put( "font-style", createCssParameter( "font-style", "italic" ) );
801            } else {
802                cssParams.put( "font-style", createCssParameter( "font-style", "normal" ) );
803            }
804    
805            return new Font( cssParams );
806        }
807    
808        /**
809         * wrapper round StyleFactory method to create default halo
810         * 
811         * @return the new halo
812         */
813        public static Halo createHalo() {
814            return createHalo( createFill(), createStroke(), -1 );
815        }
816    
817        /**
818         * wrapper round StyleFactory method to create halo
819         * 
820         * @param color -
821         *            the color of the halo
822         * @param radius -
823         *            the radius of the halo use a value <= 0 for rectangle
824         * 
825         * @return the new halo
826         */
827        public static Halo createHalo( Color color, double radius ) {
828            return createHalo( createFill( color ), createStroke(), radius );
829        }
830    
831        /**
832         * wrapper round StyleFactory method to create halo
833         * 
834         * @param fillColor -
835         *            the fill color of the halo
836         * @param opacity -
837         *            the opacity of the halo fill 0 - transparent 1 - solid
838         * @param strokeColor -
839         *            the stroke color of the halo
840         * @param radius -
841         *            the radius of the halo use a value <= 0 for rectangle
842         * 
843         * @return the new halo
844         */
845        public static Halo createHalo( Color fillColor, double opacity, Color strokeColor, double radius ) {
846            Fill fill = createFill( fillColor, opacity );
847            Stroke stroke = createStroke( strokeColor );
848            return createHalo( fill, stroke, radius );
849        }
850    
851        /**
852         * wrapper round StyleFactory method to create halo
853         * 
854         * @param fill -
855         *            the fill of the halo
856         * @param stroke -
857         *            the stroke of the halo
858         * @param radius -
859         *            the radius of the halo use a value <= 0 for rectangle
860         * 
861         * @return the new halo
862         */
863        public static Halo createHalo( Fill fill, Stroke stroke, double radius ) {
864            ParameterValueType pvt = null;
865            if ( radius > 0 ) {
866                pvt = createParameterValueType( radius );
867            }
868            return new Halo( pvt, fill, stroke );
869        }
870    
871        /**
872         * create a default line symboliser
873         * 
874         * @return the new line symbolizer
875         */
876        public static LineSymbolizer createLineSymbolizer() {
877            return createLineSymbolizer( createStroke( 1 ), null );
878        }
879    
880        /**
881         * create a new line symbolizer
882         * 
883         * @param width
884         *            the width of the line
885         * 
886         * @return the new line symbolizer
887         */
888        public static LineSymbolizer createLineSymbolizer( double width ) {
889            return createLineSymbolizer( createStroke( width ), null );
890        }
891    
892        /**
893         * create a LineSymbolizer
894         * 
895         * @param color -
896         *            the color of the line
897         * 
898         * @return the new line symbolizer
899         */
900        public static LineSymbolizer createLineSymbolizer( Color color ) {
901            return createLineSymbolizer( createStroke( color ), null );
902        }
903    
904        /**
905         * create a LineSymbolizer
906         * 
907         * @param color -
908         *            the color of the line
909         * @param width -
910         *            the width of the line
911         * 
912         * @return the new line symbolizer
913         */
914        public static LineSymbolizer createLineSymbolizer( Color color, double width ) {
915            return createLineSymbolizer( createStroke( color, width ), null );
916        }
917    
918        /**
919         * create a LineSymbolizer
920         * 
921         * @param color -
922         *            the color of the line
923         * @param width -
924         *            the width of the line
925         * @param geometryPropertyName -
926         *            the name of the geometry to be drawn
927         * 
928         * @return the new line symbolizer
929         */
930        public static LineSymbolizer createLineSymbolizer( Color color, double width, PropertyPath geometryPropertyName ) {
931            return createLineSymbolizer( createStroke( color, width ), geometryPropertyName );
932        }
933    
934        /**
935         * create a LineSymbolizer
936         * 
937         * @param stroke -
938         *            the stroke to be used to draw the line
939         * 
940         * @return the new line symbolizer
941         */
942        public static LineSymbolizer createLineSymbolizer( Stroke stroke ) {
943            return createLineSymbolizer( stroke, null );
944        }
945    
946        /**
947         * create a LineSymbolizer
948         * 
949         * @param stroke -
950         *            the stroke to be used to draw the line
951         * @param geometryPropertyName -
952         *            the name of the geometry to be drawn
953         * 
954         * @return the new line symbolizer
955         */
956        public static LineSymbolizer createLineSymbolizer( Stroke stroke, PropertyPath geometryPropertyName ) {
957            return createLineSymbolizer( stroke, geometryPropertyName, 0, Double.MAX_VALUE );
958        }
959    
960        /**
961         * create a LineSymbolizer
962         * 
963         * @param stroke -
964         *            the stroke to be used to draw the line
965         * @param geometryPropertyName -
966         *            the name of the geometry to be drawn
967         * @param min
968         *            min scale denominator
969         * @param max
970         *            max scale denominator
971         * 
972         * @return the new line symbolizer
973         */
974        public static LineSymbolizer createLineSymbolizer( Stroke stroke, PropertyPath geometryPropertyName, double min,
975                                                           double max ) {
976            Geometry geom = null;
977            if ( geometryPropertyName != null ) {
978                geom = new Geometry( geometryPropertyName, null );
979            }
980            return new LineSymbolizer( stroke, geom, min, max );
981        }
982    
983        /**
984         * create a default polygon symbolizer
985         * 
986         * @return the new polygon symbolizer
987         */
988        public static PolygonSymbolizer createPolygonSymbolizer() {
989            return createPolygonSymbolizer( createStroke(), createFill() );
990        }
991    
992        /**
993         * create a polygon symbolizer
994         * 
995         * @param fillColor -
996         *            the color to fill the polygon
997         * 
998         * @return the new polygon symbolizer
999         */
1000        public static PolygonSymbolizer createPolygonSymbolizer( Color fillColor ) {
1001            return createPolygonSymbolizer( createStroke(), createFill( fillColor ) );
1002        }
1003    
1004        /**
1005         * create a polygon symbolizer
1006         * 
1007         * @param fillColor -
1008         *            the color to fill the polygon
1009         * @param borderColor -
1010         *            the outline color of the polygon
1011         * @param borderWidth -
1012         *            the width of the outline
1013         * 
1014         * @return the new polygon symbolizer
1015         */
1016        public static PolygonSymbolizer createPolygonSymbolizer( Color fillColor, Color borderColor, double borderWidth ) {
1017            return createPolygonSymbolizer( createStroke( borderColor, borderWidth ), createFill( fillColor ) );
1018        }
1019    
1020        /**
1021         * create a polygon symbolizer
1022         * 
1023         * @param borderColor -
1024         *            the outline color of the polygon
1025         * @param borderWidth -
1026         *            the width of the outline
1027         * 
1028         * @return the new polygon symbolizer
1029         */
1030        public static PolygonSymbolizer createPolygonSymbolizer( Color borderColor, double borderWidth ) {
1031            Stroke stroke = createStroke( borderColor, borderWidth );
1032            return createPolygonSymbolizer( stroke, createFill() );
1033        }
1034    
1035        /**
1036         * create a polygon symbolizer
1037         * 
1038         * @param stroke -
1039         *            the stroke to use to outline the polygon
1040         * @param fill -
1041         *            the fill to use to color the polygon
1042         * 
1043         * @return the new polygon symbolizer
1044         */
1045        public static PolygonSymbolizer createPolygonSymbolizer( Stroke stroke, Fill fill ) {
1046            return createPolygonSymbolizer( stroke, fill, null );
1047        }
1048    
1049        /**
1050         * create a polygon symbolizer
1051         * 
1052         * @param stroke -
1053         *            the stroke to use to outline the polygon
1054         * @param fill -
1055         *            the fill to use to color the polygon
1056         * @param geometryPropertyName -
1057         *            the name of the geometry to be drawn
1058         * 
1059         * @return the new polygon symbolizer
1060         */
1061        public static PolygonSymbolizer createPolygonSymbolizer( Stroke stroke, Fill fill, PropertyPath geometryPropertyName ) {
1062            return createPolygonSymbolizer( stroke, fill, geometryPropertyName, 0, Double.MAX_VALUE );
1063        }
1064    
1065        /**
1066         * create a polygon symbolizer
1067         * 
1068         * @param stroke -
1069         *            the stroke to use to outline the polygon
1070         * @param fill -
1071         *            the fill to use to color the polygon
1072         * @param geometryPropertyName -
1073         *            the name of the geometry to be drawn
1074         * @param min
1075         *            min scale denominator
1076         * @param max
1077         *            max scale denominator
1078         * 
1079         * @return the new polygon symbolizer
1080         */
1081        public static PolygonSymbolizer createPolygonSymbolizer( Stroke stroke, Fill fill,
1082                                                                 PropertyPath geometryPropertyName, double min, double max ) {
1083            Geometry geom = null;
1084            if ( geometryPropertyName != null ) {
1085                geom = new Geometry( geometryPropertyName, null );
1086            }
1087            return new PolygonSymbolizer( fill, stroke, geom, min, max );
1088        }
1089    
1090        /**
1091         * create a default point symbolizer
1092         * 
1093         * @return the new point symbolizer
1094         */
1095        public static PointSymbolizer createPointSymbolizer() {
1096            Graphic graphic = createGraphic( null, null, 1, 5, 0 );
1097            return createPointSymbolizer( graphic );
1098        }
1099    
1100        /**
1101         * create a point symbolizer
1102         * 
1103         * @param graphic -
1104         *            the graphic object to draw at the point
1105         * 
1106         * @return the new point symbolizer
1107         */
1108        public static PointSymbolizer createPointSymbolizer( Graphic graphic ) {
1109            return createPointSymbolizer( graphic, null );
1110        }
1111    
1112        /**
1113         * create a point symbolizer
1114         * 
1115         * @param graphic -
1116         *            the graphic object to draw at the point
1117         * @param geometryPropertyName -
1118         *            the name of the geometry to be drawn
1119         * 
1120         * @return the new point symbolizer
1121         */
1122        public static PointSymbolizer createPointSymbolizer( Graphic graphic, PropertyPath geometryPropertyName ) {
1123            return createPointSymbolizer( graphic, geometryPropertyName, 0, Double.MAX_VALUE );
1124        }
1125    
1126        /**
1127         * create a point symbolizer
1128         * 
1129         * @param graphic -
1130         *            the graphic object to draw at the point
1131         * @param geometryPropertyName -
1132         *            the name of the geometry to be drawn
1133         * @param min
1134         *            min scale denominator
1135         * @param max
1136         *            max scale denominator
1137         * 
1138         * @return the new point symbolizer
1139         */
1140        public static PointSymbolizer createPointSymbolizer( Graphic graphic, PropertyPath geometryPropertyName,
1141                                                             double min, double max ) {
1142            Geometry geom = null;
1143            if ( geometryPropertyName != null ) {
1144                geom = new Geometry( geometryPropertyName, null );
1145            }
1146            return new PointSymbolizer( graphic, geom, min, max );
1147        }
1148    
1149        /**
1150         * create a textsymbolizer
1151         * 
1152         * @param color
1153         *            the color of the text
1154         * @param font
1155         *            the font to use
1156         * @param attributeName
1157         *            the attribute to use for the label
1158         * 
1159         * @return the new textsymbolizer
1160         * 
1161         */
1162        public static TextSymbolizer createTextSymbolizer( Color color, Font font, String attributeName,
1163                                                           LabelPlacement labelPlacement ) {
1164            ParameterValueType label = createParameterValueType( attributeName );
1165            Fill fill = createFill( color );
1166            Halo halo = createHalo();
1167            return createTextSymbolizer( null, label, font, labelPlacement, halo, fill, 0, Double.MAX_VALUE );
1168        }
1169    
1170        /**
1171         * create a textsymbolizer
1172         * 
1173         * @param geometryPropertyName
1174         *            geometry assigned to the TextSymbolizer
1175         * @param attribute
1176         *            attribute to draw/print
1177         * @param labelPlacement
1178         *            defines the placement of the text
1179         * 
1180         * @return the new textsymbolizer
1181         * 
1182         */
1183        public static TextSymbolizer createTextSymbolizer( PropertyPath geometryPropertyName, String attribute,
1184                                                           LabelPlacement labelPlacement ) {
1185            Font font = createFont( java.awt.Font.decode( "Sans Serif" ) );
1186            return createTextSymbolizer( geometryPropertyName, attribute, font, labelPlacement, createHalo(), createFill(),
1187                                         0, Double.MAX_VALUE );
1188        }
1189    
1190        /**
1191         * create a textsymbolizer
1192         * 
1193         * @param geometryPropertyName
1194         *            geometry assigned to the TextSymbolizer
1195         * @param attribute
1196         *            attribute to draw/print
1197         * @param font
1198         *            font to use for the text
1199         * @param labelPlacement
1200         *            defines the placement of the text
1201         * @param halo
1202         *            halo/backgroud of the text
1203         * @param fill
1204         *            color, opacity of the text
1205         * @param min
1206         *            min scale denominator
1207         * @param max
1208         *            max scale denominator
1209         * 
1210         * @return the new textsymbolizer
1211         * 
1212         */
1213        public static TextSymbolizer createTextSymbolizer( PropertyPath geometryPropertyName, String attribute, Font font,
1214                                                           LabelPlacement labelPlacement, Halo halo, Fill fill, double min,
1215                                                           double max ) {
1216            Geometry geom = null;
1217            if ( geometryPropertyName != null ) {
1218                geom = new Geometry( geometryPropertyName, null );
1219            }
1220            ParameterValueType label = createParameterValueType( attribute );
1221            return createTextSymbolizer( geom, label, font, labelPlacement, halo, fill, min, max );
1222        }
1223    
1224        /**
1225         * create a textsymbolizer
1226         * 
1227         * @param geometry
1228         *            geometry assigned to the TextSymbolizer
1229         * @param label
1230         *            attribute to draw/print
1231         * @param font
1232         *            font to use for the text
1233         * @param labelPlacement
1234         *            defines the placement of the text
1235         * @param halo
1236         *            halo/backgroud of the text
1237         * @param fill
1238         *            color, opacity of the text
1239         * @param min
1240         *            min scale denominator
1241         * @param max
1242         *            max scale denominator
1243         * 
1244         * @return the new textsymbolizer
1245         * 
1246         */
1247        public static TextSymbolizer createTextSymbolizer( Geometry geometry, ParameterValueType label, Font font,
1248                                                           LabelPlacement labelPlacement, Halo halo, Fill fill, double min,
1249                                                           double max ) {
1250            return new TextSymbolizer( geometry, label, font, labelPlacement, halo, fill, min, max );
1251        }
1252    
1253        /**
1254         * create a textsymbolizer which doesn't change
1255         * 
1256         * @param color
1257         *            the color of the text
1258         * @param font
1259         *            the font to use
1260         * @param label
1261         *            the label to use
1262         * 
1263         * @return the new textsymbolizer
1264         */
1265        public static TextSymbolizer createStaticTextSymbolizer( Color color, Font font, String label ) {
1266            throw new UnsupportedOperationException( "method createStaticTextSymbolizer is not implemented yet" );
1267        }
1268    
1269        /**
1270         * create a textsymbolizer which doesn't change
1271         * 
1272         * @param color
1273         *            the color of the text
1274         * @param fonts
1275         *            an array of fonts to use from the first to last
1276         * @param label
1277         *            the label to use
1278         * 
1279         * @return the new textsymbolizer
1280         */
1281        public static TextSymbolizer createStaticTextSymbolizer( Color color, Font[] fonts, String label ) {
1282            throw new UnsupportedOperationException( "method createStaticTextSymbolizer is not implemented yet" );
1283        }
1284    
1285        /**
1286         * create a simple styling rule
1287         * 
1288         * @param symbolizer -
1289         *            the symbolizer to use
1290         * 
1291         * @return the new rule
1292         */
1293        public static Rule createRule( Symbolizer symbolizer ) {
1294            return createRule( symbolizer, 0, Double.MAX_VALUE );
1295        }
1296    
1297        /**
1298         * reate a simple styling rule
1299         * 
1300         * @param symbolizers -
1301         *            an array of symbolizers to use
1302         * 
1303         * @return the new rule
1304         */
1305        public static Rule createRule( Symbolizer[] symbolizers ) {
1306            return createRule( symbolizers, 0, Double.MAX_VALUE );
1307        }
1308    
1309        /**
1310         * create a simple styling rule, see the SLD Spec for more details of scaleDenominators
1311         * 
1312         * @param symbolizer -
1313         *            the symbolizer to use
1314         * @param minScaleDenominator -
1315         *            the minimim scale to draw the feature at
1316         * @param maxScaleDenominator -
1317         *            the maximum scale to draw the feature at
1318         * 
1319         * @return the new rule
1320         */
1321        public static Rule createRule( Symbolizer symbolizer, double minScaleDenominator, double maxScaleDenominator ) {
1322            return createRule( new Symbolizer[] { symbolizer }, minScaleDenominator, maxScaleDenominator );
1323        }
1324    
1325        /**
1326         * create a simple styling rule, see the SLD Spec for more details of scaleDenominators
1327         * 
1328         * @param symbolizers -
1329         *            an array of symbolizers to use
1330         * @param minScaleDenominator -
1331         *            the minimim scale to draw the feature at
1332         * @param maxScaleDenominator -
1333         *            the maximum scale to draw the feature at
1334         * 
1335         * @return the new rule
1336         */
1337        public static Rule createRule( Symbolizer[] symbolizers, double minScaleDenominator, double maxScaleDenominator ) {
1338            return createRule( symbolizers, "default", "default", "default", minScaleDenominator, maxScaleDenominator );
1339        }
1340    
1341        /**
1342         * create a simple styling rule, see the SLD Spec for more details of scaleDenominators
1343         * 
1344         * @param symbolizers -
1345         *            an array of symbolizers to use
1346         * @param name -
1347         *            name of the rule
1348         * @param title -
1349         *            title of the rule
1350         * @param abstract_ -
1351         *            text describing throws rule
1352         * @param minScaleDenominator -
1353         *            the minimim scale to draw the feature at
1354         * @param maxScaleDenominator -
1355         *            the maximum scale to draw the feature at
1356         * 
1357         * @return the new rule
1358         */
1359        public static Rule createRule( Symbolizer[] symbolizers, String name, String title, String abstract_,
1360                                       double minScaleDenominator, double maxScaleDenominator ) {
1361            return createRule( symbolizers, name, title, abstract_, null, null, false, minScaleDenominator,
1362                               maxScaleDenominator );
1363        }
1364    
1365        /**
1366         * create a complex styling rule, see the SLD Spec for more details of scaleDenominators
1367         * 
1368         * @param symbolizers -
1369         *            an array of symbolizers to use
1370         * @param name -
1371         *            name of the rule
1372         * @param title -
1373         *            title of the rule
1374         * @param abstract_ -
1375         *            text describing throws rule
1376         * @param filter -
1377         *            filter to use with the rule
1378         * @param elseFilter -
1379         *            true if the passed is an ElseFilter (see SLD spec)
1380         * @param minScaleDenominator -
1381         *            the minimim scale to draw the feature at
1382         * @param maxScaleDenominator -
1383         *            the maximum scale to draw the feature at
1384         * 
1385         * @return the new rule
1386         */
1387        public static Rule createRule( Symbolizer[] symbolizers, String name, String title, String abstract_,
1388                                       LegendGraphic legendGraphic, Filter filter, boolean elseFilter,
1389                                       double minScaleDenominator, double maxScaleDenominator ) {
1390            return new Rule( symbolizers, name, title, abstract_, legendGraphic, filter, elseFilter, minScaleDenominator,
1391                             maxScaleDenominator );
1392        }
1393    
1394        /**
1395         * create a Feature type styler
1396         * 
1397         * @param symbolizer -
1398         *            the symbolizer to use
1399         * 
1400         * @return the new feature type styler
1401         */
1402        public static FeatureTypeStyle createFeatureTypeStyle( Symbolizer symbolizer ) {
1403            return createFeatureTypeStyle( null, symbolizer, 0, Double.MAX_VALUE );
1404        }
1405    
1406        /**
1407         * create a Feature type styler see the SLD Spec for more details of scaleDenominators
1408         * 
1409         * @param symbolizer -
1410         *            the symbolizer to use
1411         * @param minScaleDenominator -
1412         *            the minimim scale to draw the feature at
1413         * @param maxScaleDenominator -
1414         *            the maximum scale to draw the feature at
1415         * 
1416         * @return the new feature type styler
1417         */
1418        public static FeatureTypeStyle createFeatureTypeStyle( Symbolizer symbolizer, double minScaleDenominator,
1419                                                               double maxScaleDenominator ) {
1420            return createFeatureTypeStyle( null, symbolizer, minScaleDenominator, maxScaleDenominator );
1421        }
1422    
1423        /**
1424         * create a Feature type styler see the SLD Spec for more details of scaleDenominators
1425         * 
1426         * @param symbolizers -
1427         *            an array of symbolizers to use
1428         * @param minScaleDenominator -
1429         *            the minimim scale to draw the feature at
1430         * @param maxScaleDenominator -
1431         *            the maximum scale to draw the feature at
1432         * 
1433         * @return the new feature type styler
1434         */
1435        public static FeatureTypeStyle createFeatureTypeStyle( Symbolizer[] symbolizers, double minScaleDenominator,
1436                                                               double maxScaleDenominator ) {
1437            return createFeatureTypeStyle( null, symbolizers, minScaleDenominator, maxScaleDenominator );
1438        }
1439    
1440        /**
1441         * create a Feature type styler
1442         * 
1443         * @param featureTypeStyleName -
1444         *            name for the feature type styler
1445         * @param symbolizer -
1446         *            the symbolizer to use
1447         * 
1448         * @return the new feature type styler
1449         */
1450        public static FeatureTypeStyle createFeatureTypeStyle( String featureTypeStyleName, Symbolizer symbolizer ) {
1451            return createFeatureTypeStyle( featureTypeStyleName, symbolizer, 0, Double.MAX_VALUE );
1452        }
1453    
1454        /**
1455         * create a Feature type styler
1456         * 
1457         * @param featureTypeStyleName -
1458         *            name for the feature type styler
1459         * @param symbolizers -
1460         *            an array of symbolizers to use
1461         * 
1462         * @return the new feature type styler
1463         */
1464        public static FeatureTypeStyle createFeatureTypeStyle( String featureTypeStyleName, Symbolizer[] symbolizers ) {
1465            return createFeatureTypeStyle( featureTypeStyleName, symbolizers, 0, Double.MAX_VALUE );
1466        }
1467    
1468        /**
1469         * create a Feature type styler see the SLD Spec for more details of scaleDenominators
1470         * 
1471         * @param featureTypeStyleName -
1472         *            name for the feature type styler
1473         * @param symbolizer -
1474         *            the symbolizer to use
1475         * @param minScaleDenominator -
1476         *            the minimim scale to draw the feature at
1477         * @param maxScaleDenominator -
1478         *            the maximum scale to draw the feature at
1479         * 
1480         * @return the new feature type styler
1481         */
1482        public static FeatureTypeStyle createFeatureTypeStyle( String featureTypeStyleName, Symbolizer symbolizer,
1483                                                               double minScaleDenominator, double maxScaleDenominator ) {
1484            return createFeatureTypeStyle( featureTypeStyleName, new Symbolizer[] { symbolizer }, minScaleDenominator,
1485                                           maxScaleDenominator );
1486        }
1487    
1488        /**
1489         * create a Feature type styler see the SLD Spec for more details of scaleDenominators
1490         * 
1491         * @param featureTypeStyleName -
1492         *            name for the feature type styler
1493         * @param symbolizers -
1494         *            an array of symbolizers to use
1495         * @param minScaleDenominator -
1496         *            the minimim scale to draw the feature at
1497         * @param maxScaleDenominator -
1498         *            the maximum scale to draw the feature at
1499         * 
1500         * @return the new feature type styler
1501         */
1502        public static FeatureTypeStyle createFeatureTypeStyle( String featureTypeStyleName, Symbolizer[] symbolizers,
1503                                                               double minScaleDenominator, double maxScaleDenominator ) {
1504            Rule rule = createRule( symbolizers, minScaleDenominator, maxScaleDenominator );
1505    
1506            return createFeatureTypeStyle( featureTypeStyleName, rule );
1507        }
1508    
1509        /**
1510         * create a Feature type styler
1511         * 
1512         * @param rule -
1513         *            rule contained in the featureTypeStyle
1514         * 
1515         * @return the new feature type styler
1516         */
1517        public static FeatureTypeStyle createFeatureTypeStyle( Rule rule ) {
1518    
1519            return createFeatureTypeStyle( new Rule[] { rule } );
1520        }
1521    
1522        /**
1523         * create a Feature type styler
1524         * 
1525         * @param rules -
1526         *            rules contained in the featureTypeStyle
1527         * 
1528         * @return the new feature type styler
1529         */
1530        public static FeatureTypeStyle createFeatureTypeStyle( Rule[] rules ) {
1531    
1532            return createFeatureTypeStyle( null, rules );
1533        }
1534    
1535        /**
1536         * create a Feature type styler
1537         * 
1538         * @param featureTypeStyleName -
1539         *            name for the feature type styler
1540         * @param rule -
1541         *            rule contained in the featureTypeStyle
1542         * 
1543         * @return the new feature type styler
1544         */
1545        public static FeatureTypeStyle createFeatureTypeStyle( String featureTypeStyleName, Rule rule ) {
1546    
1547            return createFeatureTypeStyle( featureTypeStyleName, new Rule[] { rule } );
1548        }
1549    
1550        /**
1551         * create a Feature type styler
1552         * 
1553         * @param featureTypeStyleName -
1554         *            name for the feature type styler
1555         * @param rules -
1556         *            rules contained in the featureTypeStyle
1557         * 
1558         * @return the new feature type styler
1559         */
1560        public static FeatureTypeStyle createFeatureTypeStyle( String featureTypeStyleName, Rule[] rules ) {
1561    
1562            return createFeatureTypeStyle( featureTypeStyleName, null, null, null, rules );
1563        }
1564    
1565        /**
1566         * create a Feature type styler
1567         * 
1568         * @param featureTypeStyleName -
1569         *            name for the feature type styler
1570         * @param featureTypeName -
1571         *            name of the feature type the Feature type style shall be assigned to
1572         * @param title -
1573         *            title of the FeatureTypeStyle
1574         * @param abstract_ -
1575         *            text describing the FeatureTypeStyle
1576         * @param rules -
1577         *            rules contained in the featureTypeStyle
1578         * 
1579         * @return the new feature type styler
1580         */
1581        public static FeatureTypeStyle createFeatureTypeStyle( String featureTypeStyleName, String title, String abstract_,
1582                                                               String featureTypeName, Rule[] rules ) {
1583    
1584            return new FeatureTypeStyle( featureTypeStyleName, title, abstract_, featureTypeName, null, rules );
1585        }
1586    
1587        /**
1588         * create a new style
1589         * 
1590         * @param symbolizer -
1591         *            the symbolizer to use
1592         * 
1593         * @return the new style
1594         */
1595        public static AbstractStyle createStyle( Symbolizer symbolizer ) {
1596            return createStyle( null, symbolizer, 0, Double.MAX_VALUE );
1597        }
1598    
1599        /**
1600         * create a new style with name 'default'
1601         * 
1602         * @param symbolizer -
1603         *            the symbolizer to use
1604         * @param minScaleDenominator -
1605         *            the minimim scale to draw the feature at
1606         * @param maxScaleDenominator -
1607         *            the maximum scale to draw the feature at
1608         * 
1609         * @return the new style
1610         */
1611        public static AbstractStyle createStyle( Symbolizer symbolizer, double minScaleDenominator,
1612                                                 double maxScaleDenominator ) {
1613            return createStyle( "default", symbolizer, minScaleDenominator, maxScaleDenominator );
1614        }
1615    
1616        /**
1617         * create a new style
1618         * 
1619         * @param name -
1620         *            the name of the style
1621         * @param symbolizer -
1622         *            the symbolizer to use
1623         * 
1624         * @return the new style
1625         */
1626        public static AbstractStyle createStyle( String name, Symbolizer symbolizer ) {
1627            return createStyle( name, symbolizer, 0, Double.MAX_VALUE );
1628        }
1629    
1630        /**
1631         * create a new style
1632         * 
1633         * @param name -
1634         *            the name of the style
1635         * @param symbolizer -
1636         *            the symbolizer to use
1637         * @param minScaleDenominator -
1638         *            the minimim scale to draw the feature at
1639         * @param maxScaleDenominator -
1640         *            the maximum scale to draw the feature at
1641         * 
1642         * @return the new style
1643         */
1644        public static AbstractStyle createStyle( String name, Symbolizer symbolizer, double minScaleDenominator,
1645                                                 double maxScaleDenominator ) {
1646            // create the feature type style
1647            FeatureTypeStyle fts = createFeatureTypeStyle( name, symbolizer, minScaleDenominator, maxScaleDenominator );
1648    
1649            return createStyle( name, null, null, fts );
1650        }
1651    
1652        /**
1653         * create a style
1654         * 
1655         * @param name -
1656         *            the name of the style
1657         * @param featureTypeName -
1658         *            name of the feature type the Feature type style shall be assigned to
1659         * @param title -
1660         *            title of the FeatureTypeStyle
1661         * @param abstract_ -
1662         *            text describing the FeatureTypeStyle
1663         * @param rules -
1664         *            rules contained in the featureTypeStyle
1665         * 
1666         * @return the new style
1667         */
1668        public static AbstractStyle createStyle( String name, String title, String abstract_, String featureTypeName,
1669                                                 Rule[] rules ) {
1670    
1671            FeatureTypeStyle fts = createFeatureTypeStyle( name, title, abstract_, featureTypeName, rules );
1672            return createStyle( name, null, null, fts );
1673        }
1674    
1675        /**
1676         * create a new style
1677         * 
1678         * @param name -
1679         *            the name of the style
1680         * @param title -
1681         *            title of the style
1682         * @param abstract_ -
1683         *            text describing the style
1684         * @param featureTypeStyle -
1685         *            featureTypeStyle
1686         * 
1687         * @return the new style
1688         */
1689        public static AbstractStyle createStyle( String name, String title, String abstract_,
1690                                                 FeatureTypeStyle featureTypeStyle ) {
1691            return createStyle( name, title, abstract_, new FeatureTypeStyle[] { featureTypeStyle } );
1692        }
1693    
1694        /**
1695         * create a new style
1696         * 
1697         * @param name -
1698         *            the name of the style
1699         * @param title -
1700         *            title of the style
1701         * @param abstract_ -
1702         *            text describing the style
1703         * @param featureTypeStyles -
1704         *            featureTypeStyle
1705         * 
1706         * @return the new style
1707         */
1708        public static AbstractStyle createStyle( String name, String title, String abstract_,
1709                                                 FeatureTypeStyle[] featureTypeStyles ) {
1710            return new UserStyle( name, title, abstract_, false, featureTypeStyles );
1711        }
1712    
1713        /**
1714         * creates a style with name 'defaultPoint' for rendering point geometries
1715         * 
1716         * @param wellKnownName
1717         *            the well known name of the mark
1718         * @param fillColor
1719         *            the color of the mark
1720         * @param borderColor
1721         *            the outline color of the mark
1722         * @param borderWidth
1723         *            the width of the outline
1724         * @param opacity -
1725         *            the opacity of the graphic
1726         * @param size -
1727         *            the size of the graphic
1728         * @param rotation -
1729         *            the rotation from the top of the page of the graphic
1730         * @param min -
1731         *            the minimim scale to draw the feature at
1732         * @param max -
1733         *            the maximum scale to draw the feature at
1734         * 
1735         * @return the style created
1736         */
1737        public static AbstractStyle createPointStyle( String wellKnownName, Color fillColor, Color borderColor,
1738                                                      double borderWidth, double opacity, double size, double rotation,
1739                                                      double min, double max ) {
1740            Mark mark = createMark( wellKnownName, fillColor, borderColor, borderWidth );
1741            Graphic graphic = createGraphic( null, mark, opacity, size, rotation );
1742            Symbolizer symbolizer = createPointSymbolizer( graphic, null, min, max );
1743            return createStyle( "defaultPoint", symbolizer );
1744        }
1745    
1746        /**
1747         * creates a style with name 'defaultLine' for rendering line geometries
1748         * 
1749         * @param color
1750         *            the line color
1751         * @param width
1752         *            the width of the line
1753         * @param opacity -
1754         *            the opacity of the line
1755         * @param min -
1756         *            the minimim scale to draw the feature at
1757         * @param max -
1758         *            the maximum scale to draw the feature at
1759         * 
1760         * @return the style created
1761         */
1762        public static AbstractStyle createLineStyle( Color color, double width, double opacity, double min, double max ) {
1763            Stroke stroke = createStroke( color, width, opacity );
1764            Symbolizer symbolizer = createLineSymbolizer( stroke, null, min, max );
1765            return createStyle( "defaultLine", symbolizer );
1766        }
1767    
1768        /**
1769         * creates a style with name 'defaultPolygon' for rendering polygon geometries
1770         * 
1771         * @param fillColor -
1772         *            the fill color of the polygon
1773         * @param fillOpacity -
1774         *            the fill opacity of the polygon
1775         * @param strokeColor -
1776         *            the line color
1777         * @param strokeWidth -
1778         *            the width of the line
1779         * @param strokeOpacity -
1780         *            the opacity of the line
1781         * @param min -
1782         *            the minimim scale to draw the feature at
1783         * @param max -
1784         *            the maximum scale to draw the feature at
1785         * 
1786         * @return the style created
1787         */
1788        public static AbstractStyle createPolygonStyle( Color fillColor, double fillOpacity, Color strokeColor,
1789                                                        double strokeWidth, double strokeOpacity, double min, double max ) {
1790            Stroke stroke = createStroke( strokeColor, strokeWidth, strokeOpacity );
1791            Fill fill = createFill( fillColor, fillOpacity );
1792            Symbolizer symbolizer = createPolygonSymbolizer( stroke, fill, null, min, max );
1793            return createStyle( "defaultPolygon", symbolizer );
1794        }
1795    
1796        /**
1797         * creates a style with name 'defaultPoint' for rendering point geometries. The style contains
1798         * 1..n rules depending on the value range and the number of steps within it. So it is possible
1799         * to create a style that creates different rendering depending on the value of one feature
1800         * attribute.
1801         * <p>
1802         * there will be a linear interpolation between colors, size and width of the first and the last
1803         * rule considering the number of passed steps (rules)
1804         * 
1805         * @param wellKnownNames -
1806         *            list of well known names of the mark. the first field will be assigned to the
1807         *            starting rule the last to the ending rule.
1808         * @param startFillColor -
1809         *            the color of the mark of the first rule
1810         * @param endFillColor -
1811         *            the color of the mark of the last rule
1812         * @param startBorderColor -
1813         *            the outline color of the mark of the first rule
1814         * @param endBorderColor -
1815         *            the outline color of the mark of the last rule
1816         * @param startBorderWidth -
1817         *            the width of the outline of the first rule
1818         * @param endBorderWidth -
1819         *            the width of the outline of the last rule
1820         * @param opacity -
1821         *            the opacity of the graphic
1822         * @param startSize -
1823         *            the size of the graphic of the first rule
1824         * @param endSize -
1825         *            the size of the graphic of the last rule
1826         * @param rotation -
1827         *            the rotation from the top of the page of the graphic
1828         * @param min -
1829         *            the minimim scale to draw the feature at
1830         * @param max -
1831         *            the maximum scale to draw the feature at
1832         * @param featurePropertyName -
1833         *            name of the feature property that determines the selection of the rule for drawing
1834         * @param numberOfSteps -
1835         *            number of steps used for the interpolation between first and last value. It is
1836         *            identical with the number of rules that will be created.
1837         * 
1838         * @return the style created
1839         */
1840        public static AbstractStyle createPointStyle( String[] wellKnownNames, Color startFillColor, Color endFillColor,
1841                                                      Color startBorderColor, Color endBorderColor,
1842                                                      double startBorderWidth, double endBorderWidth, double opacity,
1843                                                      double startSize, double endSize, double rotation, double min,
1844                                                      double max, String featurePropertyName, int numberOfSteps ) {
1845            throw new UnsupportedOperationException( "method createPointStyle is not implemented yet" );
1846        }
1847    
1848        /**
1849         * creates a style with name 'defaultLine' for rendering line geometries. The style contains
1850         * 1..n rules depending on the value range and the number of steps within it. So it is possible
1851         * to create a style that creates different rendering depending on the value of one feature
1852         * attribute.
1853         * <p>
1854         * there will be a linear interpolation between colors, size and width of the first and the last
1855         * rule considering the number of passed steps (rules)
1856         * 
1857         * @param startColor -
1858         *            the color of the first rule
1859         * @param endColor -
1860         *            the color of the last rule
1861         * @param startWidth -
1862         *            the width of the line of the first rule
1863         * @param endWidth -
1864         *            the width of the line of the last rule
1865         * @param opacity -
1866         *            the opacity of the graphic
1867         * @param min -
1868         *            the minimim scale to draw the feature at
1869         * @param max -
1870         *            the maximum scale to draw the feature at
1871         * @param featurePropertyName -
1872         *            name of the feature property that determines the selection of the rule for drawing
1873         * @param numberOfSteps -
1874         *            number of steps used for the interpolation between first and last value. It is
1875         *            identical with the number of rules that will be created.
1876         * 
1877         * @return the style created
1878         */
1879        public static AbstractStyle createLineStyle( Color startColor, Color endColor, double startWidth, double endWidth,
1880                                                     double opacity, double min, double max, String featurePropertyName,
1881                                                     int numberOfSteps ) {
1882            throw new UnsupportedOperationException( "method createLineStyle is not implemented yet" );
1883        }
1884    
1885        /**
1886         * creates a style with name 'defaultPoint' for rendering point geometries. The style contains
1887         * 1..n rules depending on the value range and the number of steps within it. So it is possible
1888         * to create a style that creates different rendering depending on the value of one feature
1889         * attribute.
1890         * <p>
1891         * there will be a linear interpolation between colors, size and width of the first and the last
1892         * rule considering the number of passed steps (rules)
1893         * 
1894         * @param startFillColor -
1895         *            the fill color of the first rule
1896         * @param endFillColor -
1897         *            the fill color of the last rule
1898         * @param fillOpacity -
1899         *            the opacity of the fill
1900         * @param startStrokeColor -
1901         *            the line color of the first rule
1902         * @param endStrokeColor -
1903         *            the line color of the last rule
1904         * @param startStrokeWidth -
1905         *            the width of the outline of the first rule
1906         * @param endStrokeWidth -
1907         *            the width of the outline of the last rule
1908         * @param strokeOpacity -
1909         *            the opacity of the outline
1910         * @param min -
1911         *            the minimim scale to draw the feature at
1912         * @param max -
1913         *            the maximum scale to draw the feature at
1914         * @param featurePropertyName -
1915         *            name of the feature property that determines the selection of the rule for drawing
1916         * @param numberOfSteps -
1917         *            number of steps used for the interpolation between first and last value. It is
1918         *            identical with the number of rules that will be created.
1919         * 
1920         * @return the style created
1921         */
1922        public static AbstractStyle createPolygonStyle( Color startFillColor, Color endFillColor, double fillOpacity,
1923                                                        Color startStrokeColor, Color endStrokeColor,
1924                                                        double startStrokeWidth, double endStrokeWidth,
1925                                                        double strokeOpacity, double min, double max,
1926                                                        String featurePropertyName, int numberOfSteps ) {
1927            throw new UnsupportedOperationException( "method createPolygonStyle is not implemented yet" );
1928        }
1929    
1930        /**
1931         * create a new default style
1932         * 
1933         * @return the new style
1934         */
1935        public static AbstractStyle createStyle() {
1936            return null;
1937        }
1938    
1939    }