001    //$HeadURL: svn+ssh://rbezema@svn.wald.intevation.org/deegree/base/tags/2.1/src/org/deegree/graphics/sld/Mark.java $
002    /*----------------    FILE HEADER  ------------------------------------------
003    
004     This file is part of deegree.
005     Copyright (C) 2001-2006 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     This library is free software; you can redistribute it and/or
012     modify it under the terms of the GNU Lesser General Public
013     License as published by the Free Software Foundation; either
014     version 2.1 of the License, or (at your option) any later version.
015    
016     This library is distributed in the hope that it will be useful,
017     but WITHOUT ANY WARRANTY; without even the implied warranty of
018     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
019     Lesser General Public License for more details.
020    
021     You should have received a copy of the GNU Lesser General Public
022     License along with this library; if not, write to the Free Software
023     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
024    
025     Contact:
026    
027     Andreas Poth
028     lat/lon GmbH
029     Aennchenstr. 19
030     53115 Bonn
031     Germany
032     E-Mail: poth@lat-lon.de
033    
034     Prof. Dr. Klaus Greve
035     Department of Geography
036     University of Bonn
037     Meckenheimer Allee 166
038     53115 Bonn
039     Germany
040     E-Mail: greve@giub.uni-bonn.de
041    
042     
043     ---------------------------------------------------------------------------*/
044    package org.deegree.graphics.sld;
045    
046    import java.awt.BasicStroke;
047    import java.awt.Color;
048    import java.awt.FontMetrics;
049    import java.awt.Graphics2D;
050    import java.awt.Polygon;
051    import java.awt.image.BufferedImage;
052    
053    import org.deegree.framework.util.StringTools;
054    import org.deegree.framework.xml.Marshallable;
055    import org.deegree.model.feature.Feature;
056    import org.deegree.model.filterencoding.FilterEvaluationException;
057    
058    /**
059     * A Mark takes a "shape" and applies coloring to it. The shape can be derived either from a
060     * well-known name (such as "square"), an external URL in various formats (such as, perhaps GIF), or
061     * from a glyph of a font. Multiple external formats may be used with the semantic that they all
062     * contain the equivalent shape in different formats. If an image format is used that has inherent
063     * coloring, the coloring is discarded and only the opacity channel (or equivalent) is used. A Halo,
064     * Fill, and/or Stroke is applied as appropriate for the shape's source format.
065     * <p>
066     * 
067     * @author <a href="mailto:k.lupp@web.de">Katharina Lupp </a>
068     * @author <a href="mailto:mschneider@lat-lon.de">Markus Schneider </a>
069     * @version $Revision: 6698 $ $Date: 2007-04-26 11:40:11 +0200 (Do, 26 Apr 2007) $
070     */
071    
072    public class Mark implements Marshallable {
073    
074        private BufferedImage image = null;
075    
076        private Fill fill = null;
077    
078        private String wellKnownName = null;
079    
080        private Stroke stroke = null;
081    
082        /**
083         * Constructor for the default <tt>Mark</tt>.
084         */
085        Mark() {
086        }
087    
088        /**
089         * constructor initializing the class with the <Mark>
090         */
091        Mark( String wellKnownName, Stroke stroke, Fill fill ) {
092            setWellKnownName( wellKnownName );
093            setStroke( stroke );
094            setFill( fill );
095        }
096    
097        /**
098         * Gives the well known name of a Mark's shape. Allowed values include at least "square",
099         * "circle", "triangle", "star", "cross", and "x", though map servers may draw a different
100         * symbol instead if they don't have a shape for all of these. Renderings of these marks may be
101         * made solid or hollow depending on Fill and Stroke parameters. The default value is "square".
102         * 
103         * @return the WK-Name of the mark
104         * 
105         */
106        public String getWellKnownName() {
107            return wellKnownName;
108        }
109    
110        /**
111         * Sets the well known name of a Mark's shape. Allowed values include at least "square",
112         * "circle", "triangle", "star", "cross", and "x", though map servers may draw a different
113         * symbol instead if they don't have a shape for all of these. Renderings of these marks may be
114         * made solid or hollow depending on Fill and Stroke parameters. The default value is "square".
115         * 
116         * @param wellKnownName
117         *            the WK-Name of the mark
118         * 
119         */
120        public void setWellKnownName( String wellKnownName ) {
121            this.wellKnownName = wellKnownName;
122        }
123    
124        /**
125         * A Fill allows area geometries to be filled. There are two types of fills: solid-color and
126         * repeated GraphicFill. In general, if a Fill element is omitted in its containing element, no
127         * fill will be rendered. The default is a solid 50%-gray (color "#808080") opaque fill.
128         * 
129         * @return the fill of the mark
130         */
131        public Fill getFill() {
132            return fill;
133        }
134    
135        /**
136         * sets the <Fill>
137         * 
138         * @param fill
139         *            the fill of the mark
140         */
141        public void setFill( Fill fill ) {
142            this.fill = fill;
143        }
144    
145        /**
146         * A Stroke allows a string of line segments (or any linear geometry) to be rendered. There are
147         * three basic types of strokes: solid Color, GraphicFill (stipple), and repeated GraphicStroke.
148         * A repeated graphic is plotted linearly and has its graphic symbol bended around the curves of
149         * the line string. The default is a solid black line (Color "#000000").
150         * 
151         * @return the stroke of the mark
152         */
153        public Stroke getStroke() {
154            return stroke;
155        }
156    
157        /**
158         * sets <Stroke>
159         * 
160         * @param stroke
161         *            the stroke of the mark
162         */
163        public void setStroke( Stroke stroke ) {
164            this.stroke = stroke;
165        }
166    
167        /**
168         * DOCUMENT ME!
169         * 
170         * @param size
171         *            DOCUMENT ME!
172         * 
173         * @return DOCUMENT ME!
174         */
175        public BufferedImage getAsImage( Feature feature, int size )
176                                throws FilterEvaluationException {
177            double fillOpacity = 1.0;
178            double strokeOpacity = 1.0;
179            float[] dash = null;
180            float dashOffset = 0;
181            int cap = BasicStroke.CAP_ROUND;
182            int join = BasicStroke.JOIN_ROUND;
183            float width = 1;
184            Color fillColor = new Color( 128, 128, 128 );
185            Color strokeColor = new Color( 0, 0, 0 );
186    
187            if ( fill != null ) {
188                fillOpacity = fill.getOpacity( feature );
189                fillColor = fill.getFill( feature );
190            }
191    
192            if ( stroke != null ) {
193                strokeOpacity = stroke.getOpacity( feature );
194                strokeColor = stroke.getStroke( feature );
195                dash = stroke.getDashArray( feature );
196                cap = stroke.getLineCap( feature );
197                join = stroke.getLineJoin( feature );
198                width = (float) stroke.getWidth( feature );
199                dashOffset = stroke.getDashOffset( feature );
200            }
201    
202            if ( wellKnownName == null ) {
203                wellKnownName = "square";
204            }
205    
206            if ( wellKnownName.equalsIgnoreCase( "circle" ) ) {
207                image = drawCircle( size, fillOpacity, fillColor, strokeOpacity, strokeColor, dash, dashOffset, width, cap,
208                                    join );
209            } else if ( wellKnownName.equalsIgnoreCase( "triangle" ) ) {
210                image = drawTriangle( size, fillOpacity, fillColor, strokeOpacity, strokeColor, dash, dashOffset, width,
211                                      cap, join );
212            } else if ( wellKnownName.equalsIgnoreCase( "cross" ) ) {
213                image = drawCross1( size, strokeOpacity, strokeColor, dash, dashOffset, width, cap, join );
214            } else if ( wellKnownName.equalsIgnoreCase( "x" ) ) {
215                image = drawCross2( size, strokeOpacity, strokeColor, dash, dashOffset, width, cap, join );
216            } else if ( wellKnownName.startsWith( "CHAR" ) ) {
217                image = drawCharacter( size, fillOpacity, fillColor, strokeOpacity, strokeColor, wellKnownName );
218            } else if ( wellKnownName.equalsIgnoreCase( "star" ) ) {
219                image = drawStar( size, fillOpacity, fillColor, strokeOpacity, strokeColor, dash, dashOffset, width, cap,
220                                  join );
221            } else {
222                image = drawSquare( size, fillOpacity, fillColor, strokeOpacity, strokeColor, dash, dashOffset, width, cap,
223                                    join );
224            }
225    
226            return image;
227        }
228    
229        /**
230         * Sets the mark as an image. Rhis method is not part of the sld specifications but it is added
231         * to speed up applications.
232         * 
233         * @param bufferedImage
234         *            the bufferedImage to be set for the mark
235         */
236        public void setAsImage( BufferedImage bufferedImage ) {
237            this.image = bufferedImage;
238        }
239    
240        /**
241         * 
242         * @param dash
243         * @param dashOffset
244         * @param width
245         * @param cap
246         * @param join
247         * @return
248         * @throws FilterEvaluationException
249         */
250        private BasicStroke createBasicStroke( float[] dash, float dashOffset, float width, int cap, int join ) {
251            BasicStroke bs2 = null;
252            if ( ( dash == null ) || ( dash.length < 2 ) ) {
253                bs2 = new BasicStroke( width, cap, join );
254            } else {
255                bs2 = new BasicStroke( width, cap, join, 10.0f, dash, dashOffset );
256            }
257            return bs2;
258        }
259    
260        /**
261         * Draws a scaled instance of a triangle mark according to the given parameters.
262         * 
263         * @param size
264         *            resulting image's height and width
265         * @param fillOpacity
266         *            opacity value for the filled parts of the image
267         * @param fillColor
268         *            <tt>Color</tt> to be used for the fill
269         * @param strokeOpacity
270         *            opacity value for the stroked parts of the image
271         * @param strokeColor
272         *            <tt>Color</tt> to be used for the strokes
273         * @param dash
274         *            dash array for rendering boundary line
275         * @param width
276         *            of the boundary line
277         * @param cap
278         *            of the boundary line
279         * @param join
280         *            of the boundary line
281         * @param dashOffset
282         * 
283         * @return image displaying a triangle
284         */
285        public BufferedImage drawTriangle( int size, double fillOpacity, Color fillColor, double strokeOpacity,
286                                           Color strokeColor, float[] dash, float dashOffset, float width, int cap, int join ) {
287    
288            int offset = (int) ( width * 2 + 1 ) / 2;
289            BufferedImage image = new BufferedImage( size + offset * 2, size + offset * 2, BufferedImage.TYPE_INT_ARGB );
290    
291            int[] x_ = new int[3];
292            int[] y_ = new int[3];
293            x_[0] = offset;
294            y_[0] = offset;
295            x_[1] = size / 2 + offset;
296            y_[1] = size - 1 + offset;
297            x_[2] = size - 1 + offset;
298            y_[2] = offset;
299    
300            Graphics2D g2D = (Graphics2D) image.getGraphics();
301            BasicStroke bs = createBasicStroke( dash, dashOffset, width, cap, join );
302            g2D.setStroke( bs );
303            setColor( g2D, fillColor, fillOpacity );
304            g2D.fillPolygon( x_, y_, 3 );
305            setColor( g2D, strokeColor, strokeOpacity );
306            g2D.drawPolygon( x_, y_, 3 );
307    
308            return image;
309        }
310    
311        /**
312         * Draws a five-pointed star (pentagram) according to the given parameters.
313         * 
314         * @param size
315         *            resulting image's height and width
316         * @param fillOpacity
317         *            opacity value for the filled parts of the image
318         * @param fillColor
319         *            <tt>Color</tt> to be used for the fill
320         * @param strokeOpacity
321         *            opacity value for the stroked parts of the image
322         * @param strokeColor
323         *            <tt>Color</tt> to be used for the strokes
324         * @param dash
325         *            dash array for rendering boundary line
326         * @param width
327         *            of the boundary line
328         * @param cap
329         *            of the boundary line
330         * @param join
331         *            of the boundary line
332         * @param dashOffset
333         * 
334         * @return an image of a pentagram
335         */
336        public BufferedImage drawStar( int size, double fillOpacity, Color fillColor, double strokeOpacity,
337                                       Color strokeColor, float[] dash, float dashOffset, float width, int cap, int join ) {
338            int offset = (int) ( width * 2 + 1 ) / 2;
339            BufferedImage image = new BufferedImage( size + offset * 2, size + offset * 2, BufferedImage.TYPE_INT_ARGB );
340    
341            Graphics2D g2D = image.createGraphics();
342            BasicStroke bs = createBasicStroke( dash, dashOffset, width, cap, join );
343            g2D.setStroke( bs );
344            int s = size / 2;
345            int x0 = s;
346            int y0 = s;
347            double sin36 = Math.sin( Math.toRadians( 36 ) );
348            double cos36 = Math.cos( Math.toRadians( 36 ) );
349            double sin18 = Math.sin( Math.toRadians( 18 ) );
350            double cos18 = Math.cos( Math.toRadians( 18 ) );
351            int smallRadius = (int) ( s * sin18 / Math.sin( Math.toRadians( 54 ) ) );
352    
353            int p0X = x0;
354            int p0Y = y0 - s;
355            int p1X = x0 + (int) ( smallRadius * sin36 );
356            int p1Y = y0 - (int) ( smallRadius * cos36 );
357            int p2X = x0 + (int) ( s * cos18 );
358            int p2Y = y0 - (int) ( s * sin18 );
359            int p3X = x0 + (int) ( smallRadius * cos18 );
360            int p3Y = y0 + (int) ( smallRadius * sin18 );
361            int p4X = x0 + (int) ( s * sin36 );
362            int p4Y = y0 + (int) ( s * cos36 );
363            int p5Y = y0 + smallRadius;
364            int p6X = x0 - (int) ( s * sin36 );
365            int p7X = x0 - (int) ( smallRadius * cos18 );
366            int p8X = x0 - (int) ( s * cos18 );
367            int p9X = x0 - (int) ( smallRadius * sin36 );
368    
369            int[] x = new int[] { p0X, p1X, p2X, p3X, p4X, p0X, p6X, p7X, p8X, p9X };
370            int[] y = new int[] { p0Y, p1Y, p2Y, p3Y, p4Y, p5Y, p4Y, p3Y, p2Y, p1Y };
371            for ( int i = 0; i < y.length; i++ ) {
372                x[i] = x[i] + offset;
373                y[i] = y[i] + offset;
374            }
375            Polygon shape = new Polygon( x, y, 10 );
376    
377            setColor( g2D, fillColor, fillOpacity );
378            g2D.fill( shape );
379            setColor( g2D, strokeColor, strokeOpacity );
380            g2D.draw( shape );
381    
382            g2D.dispose();
383    
384            return image;
385        }
386    
387        /**
388         * Draws a scaled instance of a circle mark according to the given parameters.
389         * 
390         * @param size
391         *            resulting image's height and widthh
392         * @param fillOpacity
393         *            opacity value for the filled parts of the image
394         * @param fillColor
395         *            <tt>Color</tt> to be used for the fill
396         * @param strokeOpacity
397         *            opacity value for the stroked parts of the image
398         * @param strokeColor
399         *            <tt>Color</tt> to be used for the strokes
400         * @param dash
401         *            dash array for rendering boundary line
402         * @param width
403         *            of the boundary line
404         * @param cap
405         *            of the boundary line
406         * @param join
407         *            of the boundary line
408         * @param dashOffset
409         * 
410         * @return image displaying a circle
411         * @throws FilterEvaluationException
412         */
413        public BufferedImage drawCircle( int size, double fillOpacity, Color fillColor, double strokeOpacity,
414                                         Color strokeColor, float[] dash, float dashOffset, float width, int cap, int join ) {
415            int offset = (int) ( width * 2 + 1 ) / 2;
416            BufferedImage image = new BufferedImage( size + offset * 2, size + offset * 2, BufferedImage.TYPE_INT_ARGB );
417    
418            Graphics2D g2D = (Graphics2D) image.getGraphics();
419            BasicStroke bs = createBasicStroke( dash, dashOffset, width, cap, join );
420            g2D.setStroke( bs );
421            setColor( g2D, fillColor, fillOpacity );
422            g2D.fillOval( offset, offset, size, size );
423    
424            setColor( g2D, strokeColor, strokeOpacity );
425            g2D.drawOval( offset, offset, size, size );
426    
427            return image;
428        }
429    
430        /**
431         * Draws a scaled instance of a square mark according to the given parameters.
432         * 
433         * @param size
434         *            resulting image's height and widthh
435         * @param fillOpacity
436         *            opacity value for the filled parts of the image
437         * @param fillColor
438         *            <tt>Color</tt> to be used for the fill
439         * @param strokeOpacity
440         *            opacity value for the stroked parts of the image
441         * @param strokeColor
442         *            <tt>Color</tt> to be used for the strokes
443         * @param dash
444         *            dash array for rendering boundary line
445         * @param width
446         *            of the boundary line
447         * @param cap
448         *            of the boundary line
449         * @param join
450         *            of the boundary line
451         * @param dashOffset
452         * 
453         * @return image displaying a square
454         */
455        public BufferedImage drawSquare( int size, double fillOpacity, Color fillColor, double strokeOpacity,
456                                         Color strokeColor, float[] dash, float dashOffset, float width, int cap, int join ) {
457            int offset = (int) ( width * 2 + 1 ) / 2;
458            BufferedImage image = new BufferedImage( size + offset * 2, size + offset * 2, BufferedImage.TYPE_INT_ARGB );
459    
460            Graphics2D g2D = (Graphics2D) image.getGraphics();
461            BasicStroke bs = createBasicStroke( dash, dashOffset, width, cap, join );
462            g2D.setStroke( bs );
463            setColor( g2D, fillColor, fillOpacity );
464            g2D.fillRect( offset, offset, size, size );
465    
466            setColor( g2D, strokeColor, strokeOpacity );
467            g2D.drawRect( offset, offset, size - 1, size - 1 );
468    
469            return image;
470        }
471    
472        /**
473         * Draws a scaled instance of a cross mark (a "+") according to the given parameters.
474         * 
475         * @param size
476         *            resulting image's height and widthh
477         * @param strokeOpacity
478         *            opacity value for the stroked parts of the image
479         * @param strokeColor
480         *            <tt>Color</tt> to be used for the strokes
481         * @param dash
482         *            dash array for rendering boundary line
483         * @param width
484         *            of the boundary line
485         * @param cap
486         *            of the boundary line
487         * @param join
488         *            of the boundary line
489         * @param dashOffset
490         * 
491         * @return image displaying a cross (a "+")
492         */
493        public BufferedImage drawCross1( int size, double strokeOpacity, Color strokeColor, float[] dash, float dashOffset,
494                                         float width, int cap, int join ) {
495    
496            int offset = (int) ( width * 2 + 1 ) / 2;
497            BufferedImage image = new BufferedImage( size + offset * 2, size + offset * 2, BufferedImage.TYPE_INT_ARGB );
498    
499            Graphics2D g2D = (Graphics2D) image.getGraphics();
500    
501            BasicStroke bs = createBasicStroke( dash, dashOffset, width, cap, join );
502            g2D.setStroke( bs );
503    
504            setColor( g2D, strokeColor, strokeOpacity );
505            g2D.drawLine( offset, size / 2 + offset, size - 1 + offset, size / 2 + offset );
506            g2D.drawLine( size / 2 + offset, offset, size / 2 + offset, size - 1 + offset );
507    
508            return image;
509        }
510    
511        /**
512         * Draws a scaled instance of a cross mark (an "X") according to the given parameters.
513         * 
514         * @param size
515         *            resulting image's height and widthh
516         * @param strokeOpacity
517         *            opacity value for the stroked parts of the image
518         * @param strokeColor
519         *            <tt>Color</tt> to be used for the strokes
520         * @param dash
521         *            dash array for rendering boundary line
522         * @param width
523         *            of the boundary line
524         * @param cap
525         *            of the boundary line
526         * @param join
527         *            of the boundary line
528         * @param dashOffset
529         * 
530         * @return image displaying a cross (a "X")
531         */
532        public BufferedImage drawCross2( int size, double strokeOpacity, Color strokeColor, float[] dash, float dashOffset,
533                                         float width, int cap, int join ) {
534    
535            int offset = (int) ( width * 2 + 1 ) / 2;
536            BufferedImage image = new BufferedImage( size + offset * 2, size + offset * 2, BufferedImage.TYPE_INT_ARGB );
537    
538            Graphics2D g2D = (Graphics2D) image.getGraphics();
539    
540            BasicStroke bs = createBasicStroke( dash, dashOffset, width, cap, join );
541            g2D.setStroke( bs );
542    
543            setColor( g2D, strokeColor, strokeOpacity );
544            g2D.drawLine( offset, offset, size - 1 + offset, size - 1 + offset );
545            g2D.drawLine( offset, size - 1 + offset, size - 1 + offset, offset );
546    
547            return image;
548        }
549    
550        /**
551         * 
552         * @param size
553         * @param fillOpacity
554         * @param fillColor
555         * @param strokeOpacity
556         * @param strokeColor
557         * @param charDesc
558         *            e.g. CHAR:Times New Roman:45
559         */
560        private BufferedImage drawCharacter( int size, double fillOpacity, Color fillColor, double strokeOpacity,
561                                             Color strokeColor, String charDesc ) {
562    
563            String[] tmp = StringTools.toArray( charDesc, ":", false );
564    
565            BufferedImage image = new BufferedImage( size, size, BufferedImage.TYPE_INT_ARGB );
566    
567            Graphics2D g2 = (Graphics2D) image.getGraphics();
568            setColor( g2, fillColor, fillOpacity );
569            g2.fillRect( 0, 0, size, size );
570    
571            java.awt.Font font = new java.awt.Font( tmp[1], java.awt.Font.PLAIN, size );
572            g2.setFont( font );
573            FontMetrics fm = g2.getFontMetrics();
574    
575            char c = (char) Integer.parseInt( tmp[2] );
576            int w = fm.charWidth( c );
577            int h = fm.getHeight();
578    
579            String s = "" + c;
580            setColor( g2, strokeColor, strokeOpacity );
581            g2.drawString( s, size / 2 - w / 2, size / 2 + h / 2 - fm.getDescent() );
582            g2.dispose();
583            return image;
584        }
585    
586        /**
587         * @param g2D
588         * @param color
589         * @param opacity
590         */
591        private void setColor( Graphics2D g2D, Color color, double opacity ) {
592            if ( opacity < 0.999 ) {
593                final int alpha = (int) Math.round( opacity * 255 );
594                final int red = color.getRed();
595                final int green = color.getGreen();
596                final int blue = color.getBlue();
597                color = new Color( red, green, blue, alpha );
598            }
599    
600            g2D.setColor( color );
601        }
602    
603        /**
604         * exports the content of the Mark as XML formated String
605         * 
606         * @return xml representation of the Mark
607         */
608        public String exportAsXML() {
609    
610            StringBuffer sb = new StringBuffer( 1000 );
611            sb.append( "<Mark>" );
612            if ( wellKnownName != null && !wellKnownName.equals( "" ) ) {
613                sb.append( "<WellKnownName>" ).append( wellKnownName );
614                sb.append( "</WellKnownName>" );
615            }
616            if ( fill != null ) {
617                sb.append( ( (Marshallable) fill ).exportAsXML() );
618            }
619            if ( stroke != null ) {
620                sb.append( ( (Marshallable) stroke ).exportAsXML() );
621            }
622    
623            sb.append( "</Mark>" );
624    
625            return sb.toString();
626        }
627    
628        // private void drawUnicode(Graphics2D g2, int x, int y, double rotation,
629        // double size, String m, Mark mark) {
630        // int sz = (int)size;
631        // double fo = mark.getFill().getOpacity();
632        // double so = mark.getStroke().getOpacity();
633        //        
634        // java.awt.Font font = new java.awt.Font("sans serif", java.awt.Font.PLAIN,
635        // sz);
636        // g2.setFont( font );
637        // FontMetrics fm = g2.getFontMetrics();
638        //        
639        // char c = (char)m.charAt(0);
640        // int w = fm.charWidth(c);
641        // int h = fm.getHeight();
642        //        
643        // g2 = setColor( g2, mark.getFill().getFill(), fo );
644        // g2.fillRect( x-w/2, y-h/2, w, h);
645        // g2 = setColor( g2, mark.getStroke().getStroke(), so );
646        //        
647        // String s = "" + c;
648        // g2.drawString( s, x-w/2, y+h/2-fm.getDescent());
649        // }
650        // else {
651        //            
652        // Mark[] marks = sym.getGraphic().getMarks();
653        // double rotation = sym.getGraphic().getRotation();
654        // double size = sym.getGraphic().getSize();
655        // if (marks != null) {
656        //                
657        // for (int k = 0; k > marks.length; k++) {
658        //                    
659        // float w = (float)marks[k].getStroke().getWidth();
660        // g2.setStroke( new BasicStroke( w ) );
661        //                    
662        // if (marks[k].getWellKnownName().equalsIgnoreCase("triangle") ) {
663        // drawTriangle( g2, x, y, rotation, size, marks[k] );
664        // }
665        // else
666        // if (marks[k].getWellKnownName().equalsIgnoreCase("circle") ) {
667        // drawCircle( g2, x, y, rotation, size, marks[k] );
668        // }
669        // else
670        // if (marks[k].getWellKnownName().equalsIgnoreCase("square") ) {
671        // drawSquare( g2, x, y, rotation, size, marks[k] );
672        // }
673        // else
674        // if (marks[k].getWellKnownName().equalsIgnoreCase("cross") ) {
675        // drawCross1( g2, x, y, rotation, size, marks[k] );
676        // }
677        // else
678        // if (marks[k].getWellKnownName().equalsIgnoreCase("x") ) {
679        // drawCross2( g2, x, y, rotation, size, marks[k] );
680        // }
681        // else
682        // if (marks[k].getWellKnownName().length() == 0 ) {
683        // drawSquare( g2, x, y, rotation, size, marks[k] );
684        // }
685        // else {
686        // drawUnicode( g2, x, y, rotation, size,
687        // marks[k].getWellKnownName(), marks[k] );
688        // }
689        // }
690        // }
691        // }
692    }
693    /***************************************************************************************************
694     * Changes to this class. What the people have been up to: $Log$ Revision 1.14 2006/11/24 14:59:27
695     * poth ** empty log message ***
696     * 
697     * Revision 1.13 2006/11/24 14:27:16 poth ** empty log message ***
698     * 
699     * Revision 1.12 2006/11/22 21:23:37 poth bug fixes - considering all Stroke parameters drawing well
700     * known marks
701     * 
702     * Revision 1.11 2006/07/29 08:51:12 poth references to deprecated classes removed
703     * 
704     * Revision 1.10 2006/07/21 12:09:43 poth bug fix - setting fill and stroke transparency drawing a
705     * star
706     * 
707     * Revision 1.9 2006/07/20 15:16:19 taddei implementation of star
708     * 
709     * Revision 1.8 2006/07/12 14:46:14 poth comment footer added
710     * 
711     **************************************************************************************************/