WellKnowMark Shape Fix
----------------------

                 Key: GEOT-1847
                 URL: http://jira.codehaus.org/browse/GEOT-1847
             Project: GeoTools
          Issue Type: Improvement
          Components: core render
    Affects Versions: 2.5-M3
            Reporter: Johann Sorel
            Assignee: Jesse Eichar
            Priority: Trivial


Small fix in the WellKnownMarkFactory.java class
package : org.geotools.renderer.style

Triangle and Star are upsidedown
(OGC SE define star upward, triangle I believe is the same thing)

Both Triangle and star are not centered also.

Exemples and code fix :

BEFORE :
http://img244.imageshack.us/img244/7439/beforewkmyr1.png

        AffineTransform at = new AffineTransform();
        at.rotate(Math.PI / 4.0);
        X = cross.createTransformedShape(at);
        star = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
        star.moveTo(0.191f, 0.0f);
        star.lineTo(0.25f, 0.344f);
        star.lineTo(0.0f, 0.588f);
        star.lineTo(0.346f, 0.638f);
        star.lineTo(0.5f, 0.951f);
        star.lineTo(0.654f, 0.638f);
        star.lineTo(1.0f, 0.588f); // max = 7.887
        star.lineTo(0.75f, 0.344f);
        star.lineTo(0.89f, 0f);
        star.lineTo(0.5f, 0.162f);
        star.lineTo(0.191f, 0.0f);
        at = new AffineTransform();
        at.translate(-.5, -.5);
        star.transform(at);
        triangle = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
        triangle.moveTo(0f, 1f);
        triangle.lineTo(0.866f, -.5f);
        triangle.lineTo(-0.866f, -.5f);
        triangle.lineTo(0f, 1f);
        at = new AffineTransform();

        at.translate(0, -.25);
        at.scale(.5, .5);

        triangle.transform(at);





AFTER :
http://img244.imageshack.us/img244/9658/afterwkmbb4.png

        GeneralPath path = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
        float angle = (float) (-Math.PI / 2.0);
        float sin = (float) Math.sin(angle);
        float cos = (float) Math.cos(angle);
        float dist = 0.5f;
        path.moveTo( dist*cos , dist*sin);
        for(int i=0; i<10; i++){
            angle += Math.PI / 5.0;
            dist = (i%2 !=0) ? 0.5f : 0.25f ;
            sin = (float) Math.sin(angle);
            cos = (float) Math.cos(angle);
            path.lineTo(dist*cos , dist*sin);
        }
        at = new AffineTransform();
        System.out.println(1-path.getBounds2D().getHeight());
        at.translate(0, -path.getBounds2D().getCenterY());
        star = path.createTransformedShape(at);
        
        
        path = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
        angle = (float) (-Math.PI / 2.0);
        sin = (float) Math.sin(angle);
        cos = (float) Math.cos(angle);
        dist = 0.5f;
        path.moveTo(dist*cos , dist*sin);
        for(int i=0; i<3; i++){
            angle += 2f/3f * Math.PI ;
            sin = (float) Math.sin(angle);
            cos = (float) Math.cos(angle);
            path.lineTo(dist*cos , dist*sin);
        }
        at = new AffineTransform();
        System.out.println(1-path.getBounds2D().getHeight());
        at.translate(0, -path.getBounds2D().getCenterY());
        triangle = path.createTransformedShape(at);

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to