From: nvidia <luo...@ho...> - 2009-02-22 13:54:30
|
In terms of zoom in bit of the function, is a description of how it does this on any of the documentation found on the website? Not to say that i don't believe you or anything it's just that i've been testing my app with my younger brother as i go along and he is interested in how the zoom in works but when i describe it to him and show him that 1 line of code, he responds to me by saying "OK, if it zooms in, where is the bit that listens for the mouse click as i can't see any mouse listener?" at which point i say "umm.. i'll get back to you on that..". So is there a document that actually describes the how the zoom in bit works? because it would help me understand it better and if i want to do my own version, i have a clear understand of how to do it. Cheers again. mbedward wrote: > > 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 <luo...@ho...>: >> >> 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...@mo...>: >>>> 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 >>>> Geo...@li... >>>> 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 >>> Geo...@li... >>> 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 >> Geo...@li... >> 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 > Geo...@li... > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users > > -- View this message in context: http://n2.nabble.com/function-definitions-tp2331677p2367577.html Sent from the geotools-gt2-users mailing list archive at Nabble.com. |