MapMouseEvent ReferencedEnvelope based on number of pixels
----------------------------------------------------------

                 Key: GEOT-3715
                 URL: https://jira.codehaus.org/browse/GEOT-3715
             Project: GeoTools
          Issue Type: Wish
          Components: swing
            Reporter: Jody Garnett


The following is a "wish"; wish sounds so nice as far as JIRA issues go; I hope 
your wishes come true....


{code}

    public JMapPane getSource() {
        return (JMapPane) super.getSource();
    }
    /**
     * Get the position, in map (world) using a small rectangle of a set
     * number of pixels.
     * 
     * @param pixels Number of pixels to select with (example 1 or 3 pixels)
     * @return A new referenced envelope object for the world coordinstes 
(based on number of pixels)
     */
    public ReferencedEnvelope getMapPosition( int pixels ){
        Rectangle screenRect = new Rectangle(
                getX()-(pixels/2), 
                getY()-(pixels/2), 
                pixels, pixels);
        JMapPane pane = getSource();
        Rectangle2D worldRect = 
pane.getScreenToWorldTransform().createTransformedShape(screenRect).getBounds2D();
        ReferencedEnvelope mapRectangle = new ReferencedEnvelope(
                worldRect, pane.getMapContext().getCoordinateReferenceSystem());
        
        return mapRectangle;        
    
{code}


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to