Hi Joto,
joto <[EMAIL PROTECTED]> 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.