xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thomas.dewe...@kodak.com
Subject Re: AW: Clipping SVG documents
Date Fri, 09 Jun 2006 09:54:05 GMT
Hi Tilo,

"Tilo Behrmann" <T.behrmann@gmx.net> wrote on 06/09/2006 04:26:55 AM:

> i mean "mirrored" my district is mirrored at the x axis

   Does your map use a 'strange' coordinate system?
It is common for maps to do things like mirror the Y axis
(in a misguided attempt to make increasing Y 'up', it's
much better handled as part of the transcoding processes).

> i have found my failure. My next Question is it is possible to generate 
a
> SVG Document that only contains the svg code from the clipping path.

   This is possible. If you set the clip region on an SVGGraphics2D and
use it to 'paint' the GVT tree for the whole document it will skip
elements that are completely outside of the clip region.  This is not
trivial to setup (can have problems with some SVG content, although not
likely with a map).

   You are probably better off trying to setup a geographic information 
server.
Apparently MySQL and Postgris have geographic extensions.  You might
want to spend some time reading stuff on carto.net (
http://www.carto.net/).

> main Problem is i have tree JSVGCanvas in the first i show the hole map 
in
> the second a part of this map (like a district) and in the last i show 
only
> a special point of the map. The problem is when i have a svg File that 
is
> 1Mb big the batik needs 600 Mb Memory and the system works very slow. 
Have
> anybody a idea to solve this problem.

   This is a common problem in GIS.

> -----Ursprüngliche Nachricht-----
> Von: Steiner, Dominik [mailto:Dominik.Steiner@gigatronik.com]
> Gesendet: Donnerstag, 8. Juni 2006 15:15
> An: batik-users@xmlgraphics.apache.org; T.behrmann@gmx.net
> Betreff: AW: Clipping SVG documents
> 
> 
> Hi Tilo,
> 
> perhaps this one can help:
> 
> // shape is your clipping shape, so for example a polygon and
> // svgDocument the document you want to clip
> public void clipMap(SVGDocument svgDocument, java.awt.Shape shape)
> {
>    // first clone the document
>    SVGDocument doc = (SVGDocument) svgDocument.cloneNode(true);
> 
>    // create an svg element from the clipping shape with the cloned
> document
>    SVGGraphics2D svgGenerator = new SVGGraphics2D(doc);
>    Element svgShape = svgGenerator.getShapeConverter().toSVG(shape);
> 
>    // add the clipping element to the <defs> tag of the document
>    NodeList n1 = doc.getRootElement().getElementsByTagName(
> SVGConstants.SVG_DEFS_TAG);
>    Element defs = (Element) n1.item(0);
> 
>    // create the <clip-path> tag
>    Element clip = doc.createElementNS(svgNS, 
SVGConstants.SVG_CLIP_PATH_TAG);
>    clip.setAttributeNS(null, SVGConstants.SVG_ID_ATTRIBUTE, "clipmap");
> 
>       // append the clip shape to the clip path and the <defs> tag
>    clip.appendChild(svgShape);
>    defs.appendChild(clip);
> 
>    // reference the clipping from the element you want to clip
>    Element el = doc.getElementById("myelement");
>    el.setAttributeNS(null, SVGConstants.SVG_CLIP_PATH_ATTRIBUTE,
>             "url(#clipmap)");
> }
> 
> 
> Dominik Steiner
> Dipl-Ing. Informationstechnik (BA)
> GIGATRONIK
> Gesellschaft für Automobil-
> elektronikentwicklung mbH
> Taunusstr. 21
> 80807 München
> Telefon +49 (0) 89 / 353 96 80-70
> Telefax +49 (0) 89 / 353 96 80-99
> mailto:dominik.steiner@gigatronik.com
> www.gigatronik.com
> 
> -----Ursprüngliche Nachricht-----
> Von: Tilo Behrmann [mailto:T.behrmann@gmx.net]
> Gesendet: Donnerstag, 8. Juni 2006 14:54
> An: Batik User
> Betreff: Clipping SVG documents
> 
> Hi all,
> 
> I have an SVG document and I want to generate an SVG document that 
contains
> only a smaller part of this document - just cut a rectangle from the
> original image. Does anyone have an idea about how to do this using the
> Batik toolkit ?
> 
> MfG
> 
> Tilo
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 


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


Mime
View raw message