You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by joto <tr...@yahoo.de> on 2007/10/22 16:59:17 UTC

zoomIn svg

Hi!
I'm working on a project using apache batik and i'm not very familiar with
it. I've got an svg map and i want to zoom in/ and out. I've found some code
to zoom in:

Action zoomInAction =
svgCanvas.getActionMap().get(JSVGCanvas.ZOOM_IN_ACTION);
Action zoomOutAction =
svgCanvas.getActionMap().get(JSVGCanvas.ZOOM_OUT_ACTION);

It works, but i don't know how to get the zoomFactor. Moreover, i don't know
how to implement a scrolling function, because it always zooms into the
middle of the svg. Is it also possible to scroll using the mouse-wheel?

Additionally, i want to set points into the map, which are linked to a
picture folder on the hdd. Furthermore, i need to convert gps-koordinates
into koordinates of the svg. 

Hopefully someone can help me, because I'm getting desperate....
thx joto
-- 
View this message in context: http://www.nabble.com/zoomIn-svg-tf4670567.html#a13342360
Sent from the Batik - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: zoomIn svg

Posted by Andreas Neumann <a....@carto.net>.
for dealing with gps coordinates I can recommend gpsbabel, an open source
tool to download, convert and process gps from file or device source.

For projecting cartographic data proj4 is an open source library and
commandline tool which is very popular.

Both of them have nothing todo with svg but text format outputs, as can be
provided by both tools, can be easily converted to SVG.

Andreas


>> Furthermore, i need to convert gps-koordinates into koordinates of the
> svg.
>
>    Often people use the gps-coordinates as the svg-coordinates.
> If you can get away with that (relatively small viewing scale, so
> distortions aren't too bad) it's the simplest thing.  However if you
> need to do a cartographic projection then you need to do the cartographic
> projection.  Can't be much help there, sorry.
>


-- 
Andreas Neumann
Böschacherstrasse 6, CH-8624 Grüt/Gossau, Switzerland
Email: a.neumann@carto.net, Web:
* http://www.carto.net/ (Carto and SVG resources)
* http://www.carto.net/neumann/ (personal page)
* http://www.svgopen.org/ (SVG Open Conference)
* http://www.geofoto.ch/ (Georeferenced Photos of Switzerland)


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Re: zoomIn svg

Posted by th...@kodak.com.
Hi Joto,

joto <tr...@yahoo.de> wrote on 10/22/2007 10:59:17 AM:

> I've found some code to zoom in:
> 
> Action zoomInAction =
> svgCanvas.getActionMap().get(JSVGCanvas.ZOOM_IN_ACTION);
> Action zoomOutAction =
> svgCanvas.getActionMap().get(JSVGCanvas.ZOOM_OUT_ACTION);
> 
> It works, but i don't know how to get the zoomFactor.

   If you only do simple zoom and pan then you can get 
the zoom factor from the AffineTransform returned with: 
.

        AffineTransform at = canvas.getRenderingTransform();
        float zoom = Math.sqrt(at.getDeterminate());

> Moreover, i don't know how to implement a scrolling function, 
> because it always zooms into the middle of the svg. 

   Well the canvas comes with built in pan functionality with
'<shift> mouse_drag'.  There are also the following actions:

        actionMap.put(SCROLL_RIGHT_ACTION, new ScrollRightAction(10));
        actionMap.put(SCROLL_LEFT_ACTION, new ScrollLeftAction(10));
        actionMap.put(SCROLL_UP_ACTION, new ScrollUpAction(10));
        actionMap.put(SCROLL_DOWN_ACTION, new ScrollDownAction(10));

        actionMap.put(FAST_SCROLL_RIGHT_ACTION, new 
ScrollRightAction(30));
        actionMap.put(FAST_SCROLL_LEFT_ACTION, new ScrollLeftAction(30));
        actionMap.put(FAST_SCROLL_UP_ACTION, new ScrollUpAction(30));
        actionMap.put(FAST_SCROLL_DOWN_ACTION, new ScrollDownAction(30));

> Is it also possible to scroll using the mouse-wheel?

   You can always register a mouse-wheel event listener and trigger
scroll up/down actions based on it.  I think the canvas might default
to zoom in/out on mouse wheel currently.

> Additionally, i want to set points into the map, which are linked to a
> picture folder on the hdd.

   Well, it's easy to either use SVG anchors or register event listeners
on particular elements to know when the user clicks on items.  It will be
up to you to do something to show pictures however (you could change the
xlink:href attribute on a image element to reference on of them, but that
needs to be done in script or in a Java DOM Event handler).

> Furthermore, i need to convert gps-koordinates into koordinates of the 
svg. 

   Often people use the gps-coordinates as the svg-coordinates.
If you can get away with that (relatively small viewing scale, so
distortions aren't too bad) it's the simplest thing.  However if you
need to do a cartographic projection then you need to do the cartographic
projection.  Can't be much help there, sorry.