RendererUtilities needs calculateEnvelopeFromOGCScale
-----------------------------------------------------

                 Key: GEOT-1918
                 URL: http://jira.codehaus.org/browse/GEOT-1918
             Project: GeoTools
          Issue Type: New Feature
          Components: core render
            Reporter: mahmut keygubatli
            Assignee: Jesse Eichar


I want to write a combobox with defined scales. If the user choose one in the 
combobox the map will rendered in this scale.

So I have changed the formula in RendererUtilities.calculateOGCScale that he 
give me the Envelope for the given scale.
Can You put this method to the RendererUtilities or give me svn acces?

    public static ReferencedEnvelope 
calculateEnvelopeFromOGCScale(ReferencedEnvelope envelope, double scale, int 
imageWidth, Map hints) {
        // if it's geodetic, we're dealing with lat/lon unit measures
        if(envelope.getCoordinateReferenceSystem() instanceof GeographicCRS) {
            //calculate the width
            double worldWidth= (scale * (imageWidth / getDpi(hints) * 
0.0254))/OGC_DEGREE_TO_METERS;

            // and put it to the center
            Coordinate pcenter = envelope.centre();
            ReferencedEnvelope retEnv = new ReferencedEnvelope(
                                            pcenter.x-worldWidth, 
pcenter.x+worldWidth,
                                            pcenter.y, pcenter.y,
                                            
envelope.getCoordinateReferenceSystem());
            return retEnv;

        } else {
            double worldWidth= ((imageWidth / getDpi(hints) * 0.0254)*scale)/2;

            Coordinate pcenter = envelope.centre();
            ReferencedEnvelope retEnv = new ReferencedEnvelope(
                                            pcenter.x-worldWidth, 
pcenter.x+worldWidth,
                                            pcenter.y, pcenter.y,
                                            
envelope.getCoordinateReferenceSystem());
            return retEnv;
        }
    }


thanx


-- 
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

        

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to