setMapArea, um, sets the map area :-) Specifically, it's just a setter method for the mapArea field (= class variable) in JMapPane. Next time the display is due to be repainted, mapArea is passed as an argument to the object that does the drawing...
http://javadoc.geotools.fr/2.5/org/geotools/renderer/GTRenderer.html#paint(java.awt.Graphics2D,%20java.awt.Rectangle,%20com.vividsolutions.jts.geom.Envelope) As for zooming in with a mouse click... You've got the right idea. The click triggers a listener method; a rectangle is calculated that's centred on the click location and half the size of the current map area; and the world coords of this rectangle become the new map area. Hope that helps Michael 2009/2/18 nvidia <luong8...@hotmail.com>: > > Hi, > > thanks for the explanation, although i am curious to know, the function > setMapArea(), how does it actually zoom in? because i understand that it > defines the area to zoom into, but HOW does it do that? > > My guess would be that it listens for the mouse click, which would invoke a > mouseclick listener or something like that and increase the size of the area > that was click giving the zoomin impression. > > > cheers > > Michael Bedward wrote: >> >> Just to clarify the setReset method... >> >> Martin is quite right that it tells the map pane to update all layers. >> Included in this is a recalculation of the display scale. If you >> replace a layer (e.g. display a shapefile, then delete that layer and >> swap to another shapefile) without calling setReset you can get a >> distorted display of the features because the scale variables have not >> been correctly recalculated. >> >> If you are just chaning features within a vector layer (points, >> lines, polygons) then you shouldn't need to call setReset to see the >> changes. >> >> But "setReset"... it's a terrible name for a method :-) >> >> Michael >> >> 2009/2/16 Martin Schmitz <gt-m...@mojays.de>: >>> Hello, >>> >>> setContext(.) defines the "context" which holds the displayed layers >>> >>> setMapArea(.) defines the area to zoom to >>> >>> isReset(.) checks whether setReset(true) was previously called, so every >>> layer is updated on next repaint(); without setReset(true) changes on >>> layers (e.g. new features) do not become visible (as my experience is!) >>> >>> Kind regards >>> >>> Martin Schmitz >>> >>> nvidia schrieb: >>>> Hi, >>>> >>>> would somebody kindly explain what the following functions do: >>>> >>>> public void setContext(MapContext context) >>>> >>>> public void setMapArea(Envelope mapArea) >>>> >>>> public boolean isReset(); >>>> >>>> because i can't find any description of this in the user guide with >>>> referrence to using a JMapPane or even in API >>>> http://javadoc.geotools.fr/2.3/org/geotools/gui/swing/JMapPane.html >>>> which i >>>> found was not greate >>>> :(. >>>> >>>> >>>> Cheers >>> >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, >>> CA >>> -OSBC tackles the biggest issue in open source: Open Sourcing the >>> Enterprise >>> -Strategies to boost innovation and cut costs with open source >>> participation >>> -Receive a $600 discount off the registration fee with the source code: >>> SFAD >>> http://p.sf.net/sfu/XcvMzF8H >>> _______________________________________________ >>> Geotools-gt2-users mailing list >>> Geotools-gt2-users@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users >>> >> >> ------------------------------------------------------------------------------ >> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, >> CA >> -OSBC tackles the biggest issue in open source: Open Sourcing the >> Enterprise >> -Strategies to boost innovation and cut costs with open source >> participation >> -Receive a $600 discount off the registration fee with the source code: >> SFAD >> http://p.sf.net/sfu/XcvMzF8H >> _______________________________________________ >> Geotools-gt2-users mailing list >> Geotools-gt2-users@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users >> >> > > -- > View this message in context: > http://n2.nabble.com/function-definitions-tp2331677p2345732.html > Sent from the geotools-gt2-users mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA > -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise > -Strategies to boost innovation and cut costs with open source participation > -Receive a $600 discount off the registration fee with the source code: SFAD > http://p.sf.net/sfu/XcvMzF8H > _______________________________________________ > Geotools-gt2-users mailing list > Geotools-gt2-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users > ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ Geotools-gt2-users mailing list Geotools-gt2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users