thanks Michael,
 
 now i'm having this null pointer exception, i don't know where it comes from!! 
it can be a simple thing that i have omitted,or that i can't see right now, but 
as i see the code, it is supposed to work !! :(
 
 
map = new DefaultMapContext();
Style rasterStyle = createmapRGBStyle();
map.addLayer(reader, rasterStyle);
mapPane = new JMapPane();
mapPane.setRenderer(new StreamingRenderer());
mapPane.setMapContext(map);
        
Rectangle paneArea = mapPane.getVisibleRect();
DirectPosition2D mapPos = new DirectPosition2D(35.703517777777778,-0.6396);
here is the exception: ---> double scale = 
mapPane.getWorldToScreenTransform().getScaleX();
double newScale = scale * 2;
DirectPosition2D corner = new DirectPosition2D(
mapPos.getX() - 0.5d * paneArea.getWidth() / newScale,
mapPos.getY() + 0.5d * paneArea.getHeight() / newScale);
Envelope2D newMapArea = new Envelope2D();
newMapArea.setFrameFromCenter(mapPos, corner);
mapPane.setDisplayArea(newMapArea);
maframe = new JMapFrame();
maframe.setContentPane(mapPane);
maframe.setSize(800, 700);
maframe.enableToolBar(true);
maframe.enableLayerTable(true);
maframe.enableStatusBar(true);
maframe.setVisible(true);
        


Date: Sun, 22 May 2011 20:03:11 -0700
From: [email protected]
To: [email protected]
Subject: Re: need to perform zoomin actions

Hello Robert, 

> exactly, i was interaction directly with the mapcontext, saw some results, 
> but couldn't do no pan. 

You didn't mention panning in your original question :) 

If you are trying to alter the display programmatically you will 
almost always interact with JMapPane, not the MapContext instance. 

> idea is that from the entire mapcontext, i do some zoom-in on a small 
> specific area just like the zoom-in button from the toolbar does. i just 
> have to specify the coordinates of the position i want to make the zoom. 

Yes. So if you have a look at the code for the zoom tool you will see 
that it is just using the JMapPane.setDisplayArea method: 

http://svn.osgeo.org/geotools/tags/2.7.1/modules/unsupported/swing/src/main/java/org/geotools/swing/tool/ZoomInTool.java

In particular, if you study the onMouseReleased and onMouseClicked 
methods it should be obvious how to do the same thing in your own 
program. But if you get stuck, please feel free to ask here again. 

Michael 

------------------------------------------------------------------------------ 
What Every C/C++ and Fortran developer Should Know! 
Read this article and learn how Intel has extended the reach of its 
next-generation tools to help Windows* and Linux* C/C++ and Fortran 
developers boost performance applications - including clusters. 
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________ 
Geotools-gt2-users mailing list 
[hidden email] 
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users






If you reply to this email, your message will be added to the discussion 
below:http://osgeo-org.1803224.n2.nabble.com/Double-buffering-bufferstrategy-etc-tp6391216p6392928.html
 
To start a new topic under geotools-gt2-users, email 
[email protected] 
To unsubscribe from geotools-gt2-users, click here.                             
          
------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its 
next-generation tools to help Windows* and Linux* C/C++ and Fortran 
developers boost performance applications - including clusters. 
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to