Re: SVG2PDF programatically
Mork, I believe you could use Bruno Lowagie's iText to achieve something to that effect, though I couldn't provide details. Regards -Urs Mork0075 wrote: Thanks for your quick answer. I think of the following: i want to print 100 label, 4 per each A4 page. As i understand you, i should create 25 pdfs file (each with 4 label) and then merge it to one large pdf. This create 25 useless pdfs, i have to handle their references and delete them later and so on. I really nice solution would something like that: document.addNewPage(svg ...); document.addNewPage(svg...); ... and then transcode one large document into a pdf file. Ruud Steltenpool schrieb: if you mean artifacts as in 'visual disturbances i invite you to give examples. If you mean hassle, i think it's quite easy, though it needs a download indeed. this means that i have to create perhaps 10 single pdf files and then merge them together. Isnt there a nicer solution without so much artefacts? Ruud Steltenpool schrieb: use pdftk - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] T - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: how to draw markers
Hello hardc0d3r, you asked for help with drawing markers. When recently I introduced markers into my app, I found http://www.w3.org/TR/SVG/painting.html#Markers quite helpful. If you need anything beyond that, please ask for details. Regards -Urs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Interactors and DOM Events
Hi Thomas, thanks for your swift reply. Is there a best practice for cases like this, or could/should I just replace the interactors by another set of DOM listeners? The best practice is to stick to DOM Event listeners when you can. In this case the only slightly tricky bit is that you need to make sure that the canvas is fully covered by something (often a visiblity=hidden rect with pointer-events=fill that you ensure covers anything the canvas might show). Then you can register your listener on the root SVG and receive all mouse move events in the canvas. Following the list, I had already learned about that technique and attempted to implement it. However, once the rectangle was in place, it seemed that none of the underlying elements received any events any longer. I didn't know about the pointer-events-property, so maybe that's the problems cause. If it is not, I believe I could fix this by inserting the rectangle as the first child of the root SVG element. Correct? What's more, I've experimented with the pointer-events property for a bit in the hopes that it could solve another, simpler problem with interaction. I have a set of two polygons that are defined as a symbol and referenced troughout the document. Each reference is defined as an g-group to which first the use-reference and then a text is added. Most of these references have the fill property set to a color, but some remain at fill=none. This second class of unfilled polygons is causing me trouble, since I seem unable to get events from them, even though I have (now) set pointer-events=visible on the use element. Listeners are registered on the group, but as far as I know, events on contained elements are bubbled up to the container, so an event triggered on the polygon should reach the group. Actual behaviour, however, differs, with events only being registered from the stroked perimeter or the inner text. From the specification I take it that events should be triggered even though the polygons are fill=noned. Does my description bring to your mind any obvious mistakes I could have made? Have a nice sunday -Urs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Interactors and DOM Events
Hello Thomas Following the list, I had already learned about that technique and attempted to implement it. However, once the rectangle was in place, it seemed that none of the underlying elements received any events any longer. [...] I believe I could fix this by inserting the rectangle as the first child of the root SVG element. Correct? Correct, right now the rect is 'on top' of everything so all events are delivered to it. If you make it the first child of the SVG element, then it will be 'below' everything and it will only receive events if they 'fall through' all the other elements in the document. I did that, but things still aren't right. Some events get through: I can register mouseup/mousedown and click events, as well as mousemove. Mouseout and mouseover events, which are unfortunately crucial to the (current) workings of the document, are not triggered. (If everything else fails, I could rewrite both mouseup- and mousedown- as mousemove-listeners.) This is the outline of my document: svg defs symbol/ ##defines the polygons from which I want to receive pointer events /defs g ##group that contains the rest of the document bundled in groups. ... ##visible content /g /svg I have tried inserting the rectangle both behind and after the defs element, even as the first element inside the main group, but the problem persists. All listeners I spoke about are added to the g-elements containing the use-references to the polygon symbols via the Java API. Is there another trap I could have stumbled into? Thanks for your help, and thanks for clearing up the fill-issue. It works like a charm now. -Urs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Memory optimization question
Joel Uckelman wrote: Thus spake Urs Reupke: Archie Cobbs wrote: Simple question for the Batik DOM implementors... Does Batik intern() all DOM Strings? If not, I have a hunch that this could save a lot of memory. Aren't the Strings defined as constants (static final) in Batik? As far as I know, interning constants does not bring any advantage. Is he talking about the strings that DOM has a data? Those aren't going to be static final. Yes, of course. If so, sorry - I was thinking of the names of elements and attributes. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: swing and batik-css
Hi Donald, You wrote: How can I use batik-css to style my swing appliaction? please give me a example code or point me to a site that may have some. To which Thomas replied: I think you will find it an awful lot of work to style a Swing application with CSS. You would have to design some kind of DOM model of your Swing application, and then define a number of CSS properties, and then write code to apply those CSS properties to Swing. I don't know for sure, but isn't that what the XUI framework is about? If I remember correctly, they approach GUI design from the XML side and use batik to style their widgets. Maybe their website can help you: http://www.xoetrope.com/zone/index.php?zone=XUI -Urs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: SVGOMGElement and coordinates?
Hello Nazar, maybe this class will help you[1]. The question is how can I get SVGOMGElement coordinates when walking DOM tree of the SVG document? It takes a SVGLocatable (superinterface to SVGOMGElement) and calculates the bounding box. Regards -Urs [1]http://fisheye3.cenqua.com/browse/anathema/trunk/Charm_Tree/src/net/sf/anathema/charmtree/batik/BoundsCalculator.java?r=51 -- Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Animation engine only loaded when animation is present
Hi Cameron, is there any chance to add switch that forces the engine to load no matter what? Yes, that is the desired behaviour. For now you could do something like have a useless set element in the document: svg xmlns=http://www.w3.org/2000/svg; set attributeName=display to=inline/ /svg Excellent, thanks for the tip. What happens when I change the document in the canvas and the new document has no animation elements? Will the engine be unloaded, or will it remain active for all eternity? In other words, could I just load the example document you outlined above before loading anything else, thus trigger the animation engine, and then have my graphics loaded with animation still active? The reason I am reluctant to kick off the animation engine for all documents is that it isn't clever yet about when to check for updates. So, how greedy is it when idling? Should we expect major slowdowns even without an animation running? Regards -Urs, really looking forward to this - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: SMIL animation: invalid CSS value again
Hi Cameron, Andreas A lot of tests / examples can be found at http://olaf.kilu.de/svgtest/ I don't know if you are aware of this resource. It's quite comprehensive. A (well hidden) english version is available at http://olaf.kilu.de/svgtest/index.php?s=enin=start Regards -Urs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Flowtext
Hello Cameron. That's too bad. I'm looking at this from a strictly rect perspective, and it would be sweet to have. Do you know whether the feature will return at some point, when SVG 1.2 gets finished? After checking, it seems that the ‘textArea’ element of SVG Mobile 1.2 supports a ‘display-align’ property that does the same thing. This element is implemented yet, though. Sorry, english isn't my native language and this shows here: The yet and though conflict to my ears - is the element implemented already? Or isn't it implemented yet? (How can I check such things myself? Finding element node classes isn't too hard, but I don't know where to start looking for attributes in the source code.) If it *is* implemented, could I just rephrase my document according to the SVG Tiny specification and achieve pretty much the same effect? Thanks -Urs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Flowtext
Hi Cameron, thanks for clarifying the need for the version attribute. You wrote: Perhaps you're not using a recent enough version of Batik? Which version would qualify as recent enough? Currently, I am using the 1.6 release available from the website as is. There are several SVG12* classes present in the archives, most of them defining constants. Do I need to specify anthing more for Batik to operate with SVG 1.2? Regards -Urs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Flowtext
Cameron, Lewis, thanks for your assistance. Batik 1.6 would have been sufficient (but the update is nice, apparently it adressed an issue I had with the distributed 1.6). I wrote a test to find the problem, found it to be in my code not within Batik: I was using the SVGDomImplementation instead of SVG12DomImplementation when converting the tree from Dom4j to W3C dom, hence the SVG 1.2 features were not available. Thanks for pointing out that the regions are rendered, Cameron, you saved me from wondering why I got a black blob instead of flowtext. I hope I can include everything into my working code as easily as I could create the test. Bye -Urs Lewis Keen wrote: Urs, The version of Batik I am using was a nightly build taken on the 29th of April 2006. I found this one slightly more stable in certain things I was using (don't ask me how, I'm not quite sure :)). It may be worth just getting the latest nightly build and seeing how it goes. Regards, Lewis On 5/19/06, Urs Reupke [EMAIL PROTECTED] wrote: Hi Cameron, thanks for clarifying the need for the version attribute. You wrote: Perhaps you're not using a recent enough version of Batik? Which version would qualify as recent enough? Currently, I am using the 1.6 release available from the website as is. There are several SVG12* classes present in the archives, most of them defining constants. Do I need to specify anthing more for Batik to operate with SVG 1.2? Regards -Urs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Flowtext
Hi again, things are progressing steadily. However, some further questions have arisen: 1. In the previous draft (20041027) of SVG 1.2, there is a progression-align attribute to control the vertical alignment of the flowing text. This attribute appears not to be supported by Batik. Is there a replacement, or is there currently no way of controling vertical alignment? 2. After replacing my old, cumbersome code to determine line breaks and the corresponding text elements with flow text, I noticed that the opacity attribute, when set on a parent g element, is not honored by the flowing text - everything goes transparent, but the text remains opaque. Is this behaviour intentional? If so, can I set opacity directly on the text or is the attribute ignored altogether? Regards -Urs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Flowtext
Hello, I was wondering about how to use flowtext, and whether to use the SVG 1.2 version or Batik's own. What are the differences between the two, and what pitfalls are there with each of them? Most importantly, however: Is there any documentation how to use Batik flowtext apart from the examples available in SVN? From what I've seen there, the basic declaration is a flowtext, with a single flowregion as well as a flowdiv containing a flowpara? Thank you -Urs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Flowtext
Thanks a lot, Lewis, that looks pretty much like I thought it would. However, what's the xml:space attribute for? Also, which namespace do I have to operate in? Using http://www.w3.org/2000/svg; produces odd errors, but maybe I'm (once again) missing something during the conversion from dom4j to W3C DOM. -Urs Lewis Keen wrote: Urs, I used the following snippet in my recent project: flowRoot id=helpFlow pointer-events=none xml:space=preserve flowRegion rect x=10 y=50 width=780 height=400 fill=none/ /flowRegion flowDiv id=helpBody flowPara font-size=12 fill=whiteThis is an example of using flowRoot in order to word wrap paragraphs/flowPara /flowDiv /flowRoot The flowRegion specifies the region that the text is to be displayed in. The flowDiv then specifies the text to be displayed, with flowParas specifying each paragraph. This is a very basic example and was derived from the SVG spec. I use this with Batik and seems to work ok. As an extra thing I modified the number of flowParas attached to the flowDiv in my java code. I used this for displaying my help pages, and an example of this can be found at http://www.yeggstry.com/poker/poker_help.jpg Hope this helps, Lewis Keen On 5/18/06, Urs Reupke [EMAIL PROTECTED] wrote: Hello, I was wondering about how to use flowtext, and whether to use the SVG 1.2 version or Batik's own. What are the differences between the two, and what pitfalls are there with each of them? Most importantly, however: Is there any documentation how to use Batik flowtext apart from the examples available in SVN? From what I've seen there, the basic declaration is a flowtext, with a single flowregion as well as a flowdiv containing a flowpara? Thank you -Urs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Flowtext
Sorry, I prematurely sent the last message. Examples at the W3C site show their SVGs using the same namespace, but with an additional attribute 'version=1.2'. Specifying that attribute didn't change anything however, I keep getting exceptions: org.w3c.dom.DOMException: The current document is unable to create an element of the requested type (namespace: http://www.w3.org/2000/svg, name: flowRoot). at org.apache.batik.dom.AbstractNode.createDOMException at org.apache.batik.dom.svg.SVGDOMImplementation.createElementNS at org.apache.batik.dom.svg.SVGOMDocument.createElementNS at org.dom4j.io.DOMWriter.appendDOMTree(DOMWriter.java:184) [...] Any glaring errors on my part you can spot without me posting my entire SVG? Regards -Urs Urs Reupke wrote: Thanks a lot, Lewis, that looks pretty much like I thought it would. However, what's the xml:space attribute for? Also, which namespace do I have to operate in? Using http://www.w3.org/2000/svg; produces odd errors, but maybe I'm (once again) missing something during the conversion from dom4j to W3C DOM. -Urs Lewis Keen wrote: Urs, I used the following snippet in my recent project: flowRoot id=helpFlow pointer-events=none xml:space=preserve flowRegion rect x=10 y=50 width=780 height=400 fill=none/ /flowRegion flowDiv id=helpBody flowPara font-size=12 fill=whiteThis is an example of using flowRoot in order to word wrap paragraphs/flowPara /flowDiv /flowRoot The flowRegion specifies the region that the text is to be displayed in. The flowDiv then specifies the text to be displayed, with flowParas specifying each paragraph. This is a very basic example and was derived from the SVG spec. I use this with Batik and seems to work ok. As an extra thing I modified the number of flowParas attached to the flowDiv in my java code. I used this for displaying my help pages, and an example of this can be found at http://www.yeggstry.com/poker/poker_help.jpg Hope this helps, Lewis Keen On 5/18/06, Urs Reupke [EMAIL PROTECTED] wrote: Hello, I was wondering about how to use flowtext, and whether to use the SVG 1.2 version or Batik's own. What are the differences between the two, and what pitfalls are there with each of them? Most importantly, however: Is there any documentation how to use Batik flowtext apart from the examples available in SVN? From what I've seen there, the basic declaration is a flowtext, with a single flowregion as well as a flowdiv containing a flowpara? Thank you -Urs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problems distributing Batik (Removed spam note)
Hi John, Have you checked your jar's manifest declaration? Maybe one of the batik files has changed it's name since the last version you distributed? Regards -Urs John Knoop wrote: Hi I already do. There are 20 jar files in that folder, and I include all of them in my project. But somehow I don't think they are packaged along with my application when I build it into a jar file. Anyone? /john -Original Message- From: Tonny Kohar [mailto:[EMAIL PROTECTED] Sent: den 12 maj 2006 04:08 To: batik-users@xmlgraphics.apache.org Subject: [SPAM DNS] - Re: Problems distributing Batik - Sending mail server found on sbl-xbl.spamhaus.org Hi, On Thu, 2006-05-11 at 14:22 +0200, John Knoop wrote: I want to use Batik to convert SVG files into PNG and PDF's. This works great when I run the project in Netbeans, but how do I build and distribute it? I've tried to add all the 20 jar files to the project jar file, but it doesn't help. I get errors like Exception in thread 'main' java.lang.NoClassDefFoundError: org/apache/fop/svg/PDFTranscoder. You need to include pdf-transcoder jar as well, it found on trunk/lib directory Regards Tonny Kohar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Custom cursors: SVG or Swing (inspired by: Custom Cursor Problems)
Hi, reading the recent messages about custom cursors made me thinking. I didn't know customizing the cursors for SVG elements was so simple, up to now I did everything concerning cursors using Swing. In case you're wondering, I had to extend and override the cursor-methods in the SVGCanvas. My system is running fine, but I was wondering if the SVG way might be more performant or maybe even simpler to implement. Right now, I am listening for mouse move events on the cursor, check whether the cursor is inside an element's bounding box, and if it is, replace the standard arrow cursor by one of two custom cursors, depending on state of the model represented by the element in the SVG. If done by SVG, I would save the time to calculate the bounding box, however, I'd have to manipulate the document whenever the underlying model changes. Considering the possible trouble involved, is it worth changing? Regards -Urs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: absolute svg elements sizes
[EMAIL PROTECTED] wrote: Also I think some people have had success 'stacking' Canvas's on top of each other (you need to tell swing that the canvas is transparent otherwise it will skip painting the one underneath). This can also have advantages if the lower canvas can be 'static'. Absolutely, this can be done via Swings GlassPane. However, the images have to be even more separated - hardly a problem when generating them online, but maybe more difficult when dealing with pre-generated SVGs. That, and Swing seems to slow down quite a bit when large-scale transparency is involved. -Urs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: adding Elements to SVG Doc
Hi Yasmin, your code sample was: Element element = doc.getElementById(circleGroup); EventTarget eventTarget = (EventTarget) element; eventTarget.addEventListener(click,new CircleAction(),false); class CircleAction implements EventListener { publicvoid handleEvent(Event evt) { Element elt = (Element) evt.getCurrentTarget(); if (evt.getType() == click) { elt.setAttributeNS(circle,fill,yellow); } } In here, you add a listener to a group(?) and afterwards, when the group is clicked, try to set the attribute fill on the element elt in the namespace circle to yellow. Instead, what (I believe) you want to do is to set the attribute on the element circle. I have not tested it (and am not familiar with the W3C DOM API either, using dom4j mainly), but maybe you could change the listeners code to: Element elt = (Element) evt.getCurrentTarget(); Element circleElement = elt.getElementByTagName(circle) if (evt.getType() == click) { circleElement.setAttributeNS(null,fill,yellow); } Oh, and maybe check for the eventtype before doing anything else, possible saving some time at runtime. I've not followed your discussion in detail, but maybe you can have a look at this class from my project: http://cvs.sourceforge.net/viewcvs.py/anathema/CharmTree/src/net/sf/anathema/charmtree/listening/CharmTreeListening.java?view=markup Within, you'll find two EventListeners,cursorTooltipInitListener and selectionInvokingListener. The former acts on mouseover, but the latter reacts on mouseclick events for the element it's over. Within, the first part retrieves the target element. (Ignore the special case of an TSpan-Element being clicked) Then, an element ID is read from the synonymous attribute, finally, an event is fired. Basically, you could use this (or very simliar code) for parsing the document whenever a click event occurs and locating the target element by hand, thus making sure you got the circle and only the circle to operate upon. I guess they're way to complicated for what you intend to do, but maybe they can help you figure out how to do it by stripping things away. Good luck with your task -Urs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: adding Elements to SVG Doc
Hi, sorry, I forgot about the NodeList. Unfortunately, it doesn't use the Java Collections API, but it's similiar in function. The elements within are instance of Node, which is a subtype of Element. You should be able to retrieve your SVG Circle Element by calling the item function as you would use List.get(int index) with a regular list. What do you mean by supposed to appear clickable? If you want a special cursor to appear (like, for example, when hovering the mouse over an active hyperlink in a webpage) you have to tell Batik (which is what the first listener in the file I linked to does. Batik has simpler ways of doing it though, if you're content with standard cursors.) HTH -Urs [EMAIL PROTECTED] wrote: Hi there, elt.getElementsByTagName returns NodeList, I tried this but nothing happens, btw are the red circles suppose to appear clickable? NodeList circleElement = elt.getElementsByTagName(circle); Thx yasmin Hi Yasmin, your code sample was: Element element = doc.getElementById(circleGroup); EventTarget eventTarget = (EventTarget) element; eventTarget.addEventListener(click,new CircleAction(),false); class CircleAction implements EventListener { publicvoid handleEvent(Event evt) { Element elt = (Element) evt.getCurrentTarget(); if (evt.getType() == click) { elt.setAttributeNS(circle,fill,yellow); } } In here, you add a listener to a group(?) and afterwards, when the group is clicked, try to set the attribute fill on the element elt in the namespace circle to yellow. Instead, what (I believe) you want to do is to set the attribute on the element circle. I have not tested it (and am not familiar with the W3C DOM API either, using dom4j mainly), but maybe you could change the listeners code to: Element elt = (Element) evt.getCurrentTarget(); Element circleElement = elt.getElementByTagName(circle) if (evt.getType() == click) { circleElement.setAttributeNS(null,fill,yellow); } Oh, and maybe check for the eventtype before doing anything else, possible saving some time at runtime. I've not followed your discussion in detail, but maybe you can have a look at this class from my project: http://cvs.sourceforge.net/viewcvs.py/anathema/CharmTree/src/net/sf/anathema/charmtree/listening/CharmTreeListening.java?view=markup Within, you'll find two EventListeners,cursorTooltipInitListener and selectionInvokingListener. The former acts on mouseover, but the latter reacts on mouseclick events for the element it's over. Within, the first part retrieves the target element. (Ignore the special case of an TSpan-Element being clicked) Then, an element ID is read from the synonymous attribute, finally, an event is fired. Basically, you could use this (or very simliar code) for parsing the document whenever a click event occurs and locating the target element by hand, thus making sure you got the circle and only the circle to operate upon. I guess they're way to complicated for what you intend to do, but maybe they can help you figure out how to do it by stripping things away. Good luck with your task -Urs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: absolute svg elements sizes
Hi Dominik, I’m wondering if there is a way in Batik or SVG to have absolute element sizes, i.e. when I have a circle element of radius 1 in my svg file and I zoom in that it retains its size of 1 and actually doesn’t get zoomed in (only e.g. an underlying map) . Is this possible and how? I don't know whether there's an elegant internal way to do it, but if you're using Batik you could listen for zoom events and counter them by changing the size of the elements you want to be absolutely sized. Regards -Urs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSVGCanvas ZoomIn
Hi Volker I've recently implemented a stepped zoom function to work with a mousewheel. I took the code used in Batik as an inspiration, and it works pretty well. If I am not mistaken, all that's necessary is a GVT Component of which JSVGComponent is a subclass, so that should work as well. Regards -Urs André Ávila wrote: Hi Volker, AFAIK, the default interactors (zoom, pan, rotate) are all implemented in JSVGCanvas. I've never worked with JSVGComponent directly, so I'm not the best person to answer your question, but I suspect you would have to write your own zoom for it. - Original Message - From: Schneider, Volker [EMAIL PROTECTED] To: batik-users@xmlgraphics.apache.org Sent: Tuesday, February 14, 2006 10:58 AM Subject: AW: JSVGCanvas ZoomIn Hi André, excuse me when I'm disturbing, but does the zoom work for JSVGComponent as well? Best regards - Volker - -Ursprüngliche Nachricht- Von: André Ávila [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 14. Februar 2006 15:56 An: batik-users@xmlgraphics.apache.org Betreff: Re: JSVGCanvas ZoomIn Hello, If you're trying to assign the ZoomIn / ZoomOut actions to buttons, try the following code: Action zoomInAction = svgCanvas.getActionMap().get(JSVGCanvas.ZOOM_IN_ACTION); Action zoomOutAction = svgCanvas.getActionMap().get(JSVGCanvas.ZOOM_OUT_ACTION); JButton zoomInButton = new JButton(zoomInAction); JButton zoomOutButton = new JButton(zoomOutAction); Interactors are a little different, and cannot be directly assigned to buttons, but you can create custom interactors and use buttons to control the interaction, if that's what you want. André - Original Message - From: [EMAIL PROTECTED] To: batik-users@xmlgraphics.apache.org Sent: Tuesday, February 14, 2006 9:39 AM Subject: JSVGCanvas ZoomIn Hi there! I am a final year student on BSc Computer Science degree ...for my final year project I am using batik, I have used JSVGCanvas to display my svg files, but I am struggling to assign a Zoom In/out actions to JButtons - I've been looking at AbstractZoomInteractor class but really dnt have a clue... any ideas? Thank you, in advance yasmin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.375 / Virus Database: 267.15.7/259 - Release Date: 13/2/2006 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.375 / Virus Database: 267.15.7/259 - Release Date: 13/2/2006 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Drag selection box...how to?
Hi Micheal, Bishop, Michael W. CONTR J9C880 wrote: OK, I'm looking at the Javadoc and I'm not clear on how to use this. There isn't any explanation in the documentation for the method. What object is the SVGSVGElement? The SVGSVGElement is the interface class representing the element svg in your documents. It is implemented in Batik as SVGOMSVGElement. In the most simple case of a single document, it is the element you retrieve by calling getRootElement on the document object. The SVGRect is self-explanatory I think; it's a representation of the selection box. What is the reference element of type SVGElement? Is this a typo? SVGElement is not the same as SVGSVGElement - the former is the common superinterface to all the elements in the SVG specification, while the latter is the representation of a single element type. I see another potential problem; if you transform an element (scale, rotate, etc.) the bounding box for that element is not transformed, so the intersection may not be accurate. You can transform the bounding box via the transformations offered by the current transformation matrix (CTM) - for instances of SVGLocatable (IIRC), you get it by calling the method getScreenCTM (matrix for all nested transformations) or getCTM (matrix for this objects transformations only). Using them, you could transform the bounding boxes to the coordinate system you want to operate in, or maybe transform your selection rectangles box into it's representation within the common system of the documents elements. It's pretty well documented in the SVG specification. Regards -Urs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Resizing graphics automatically when Jframe resizes
Hi David Eastman, David wrote: I want my SVG graphic to have the following behavior: -Graphic fills the JPanel containing the JSVGCanvas -Graphic is centered in the JPanel -Graphic automatically resizes to fill the JPanel when the user resizes the JFrame The basics for the first and third of these properties are rooted in the layout manager you use within the JPanel. Tell it to automatically resize the JSVGCanvas to the panel's size, and your halfway done. Afterwards, you'll need to tell the document (not Batik) to fill the canvas. To do so, you have to add some attributes to the main svg element. I believe the attributes you're looking for are viewBox and preserveAspectRatio. You might want to consult the SVG Specification[1] and read through items 7.7 and 7.8. I believe the second property can be handled by using the same attributes, but I have never attempted to do so. Have fun -Urs [1]SVG Specification on coordinate systems http://www.w3.org/TR/SVG11/coords.html#ViewportSpace - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Resizing graphics automatically when Jframe resizes
Hello Eastman, David wrote: svgCanvas.getSVGDocument().getRootElement().setAttributeNS(null,viewb ox,svgCanvas.getX()+ +svgCanvas.getY()+ +svgCanvas.getWidth()+ +svgCanvas.getHeight()); svgCanvas.getSVGDocument().getRootElement().setAttributeNS(null,prese rveAspectRatio,xMidYMid meet); Hmm. It's looking good to me, pretty much what I thought of. I don't have spare time right now, so I can't check, but maybe you could try setting the viewBox to 0 0 [documentWidth] [documentHeight], the latter two indicating the actual width and height of your SVG document, and add two additional attributes height and width, both set to a value of 100% But that's just a hunch, I believe I did something similiar to solve that problem, but I cannot remember. Regards -Urs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
ECMA Script vs Java
Hello, my ongoing project needs some refinement in it's SVG parts. Currently, we're using Swing components rendered over a SVG image for user input, but since the SVG images will be zoomable soon, this is no longer an option. Thus, I am about to create an SVG replacement for the Swing interface, and was wondering whether I should script the visual behaviour of the interface using ECMA script or Java. Here's what I need to do: The interface consists of a row of buttons. The user can either click on of the buttons to select all of them up to the clicked one. As an alternative, one can clickhold somewhere within the bounds of the component to have a selection rectangle appear. This rectangle stretches from the left side of the component up to the x-coordinate clicked. The x-coordinate can be adjusted by drag and drop. After releasing the mousebutton, all of the buttons currently under the rectangle are selected. It's pretty simple, for most parts, but the adjustable rectangle made me wondering: Is one of the two, ECMA or Java clearly superior in terms of speed, capabilities or ease of development (in an Batik/SVG context, of course)? Thanks -Urs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ECMA Script vs Java
Hi Andreas, We are using Batik within the confines of a single Java application, with no foreseeable need to port the SVG part to any other platform. The interactive component would not have to run anywhere except in Batik's JSVGCanvas. I assume that, given that knowledge, you would implement in Java? Regards -Urs Andreas Neumann wrote: Hi Urs, well both have advantages/disadvantages. The advantage of Java might be that you can integrate with other Java components and use Batik within a standalone java program. Also Java is the more powerful language. The advantage of ECMAScript is, that it is better portable to other SVG viewers and web browsers. F.e. examples scripted in ECMAScript also work in the Adobe SVG viewer, Mozilla SVG and in the upcoming versions of Opera 9 and Safari with native SVG support. Btw: at http://www.carto.net/papers/svg/gui/ you can find a couple of ECMAScripts for GUI elements. Not very sophisticated, but they might be a starting point for further work. Andreas Urs Reupke wrote: Hello, my ongoing project needs some refinement in it's SVG parts. Currently, we're using Swing components rendered over a SVG image for user input, but since the SVG images will be zoomable soon, this is no longer an option. Thus, I am about to create an SVG replacement for the Swing interface, and was wondering whether I should script the visual behaviour of the interface using ECMA script or Java. Here's what I need to do: The interface consists of a row of buttons. The user can either click on of the buttons to select all of them up to the clicked one. As an alternative, one can clickhold somewhere within the bounds of the component to have a selection rectangle appear. This rectangle stretches from the left side of the component up to the x-coordinate clicked. The x-coordinate can be adjusted by drag and drop. After releasing the mousebutton, all of the buttons currently under the rectangle are selected. It's pretty simple, for most parts, but the adjustable rectangle made me wondering: Is one of the two, ECMA or Java clearly superior in terms of speed, capabilities or ease of development (in an Batik/SVG context, of course)? Thanks -Urs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ECMA Script vs Java
Hi Thomas, thanks for your thorough analysis. Your assumption about no one here having working knowledge about ECMA script is correct. For now, I have implemented the UI in Java, but I hope to find the time tomorrow to convert it to ECMA script and maybe learn a bit or two in the process. Also having the UI in one language and the bulk of the app in another has a secondary effect of ensuring a clean separation of the UI from the application engine. Luckily, that's not too much of an issue in this case. The existing UI is already separated from both presentation logic and the underlying model, and anything but re-implementing the existing UI-interfaces for the new component would cause more trouble than it's worth. Working on this has brought up an idea: From discussions on this list, I have a rough understanding that Batik is able to convert SVG images to a number of different bitmap formats, such as PNG. Right now, our distributions come with a set of icons, that differ only in the colors used for a single image layer. Currently, there are 30 icons (10 variants in 3 sizes each). I guess it would be no big deal to re-build these icons using SVG and exchange the color-layer for each of them on-the-fly. This would allow for much simpler extension and modification in the future. What I'd like to know is, whether the transcoder system is fast enough generate the images at runtime without too much of a slowdown. Regards -Urs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
SVG 1.2 beta release (was: Re: Nightly release much improved over 1.6)
[EMAIL PROTECTED] wrote: My current leaning would be a release of 1.6.1 off the svg11 branch, but I am open to debate on a 1.7 from the trunk (svg 1.2 code). It is also possible that we could have both 1.6.1 stable, and 1.7beta or some such. What's the situation with SVG 1.2? Is there finalization of the drafts to be expected anytime soon? If not, are they still being revised or just bidding their time until they become recommendations? In other words - how interesting to the general public (up to and including me) would an 1.7beta release be, assuming that one wouldn't want to revise his code every three month? I remember reading that Batik's SVG 1.2 had some differences from W3C's - is that correct, or were these just working differences until the draft was / is finalized? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Exception Explanation (IllegalStateException: RunnableQueue not started)
Hi Thomas, thanks for the explanation. I suspect that this is totally harmless This is the line I had hoped for. :) Thanks. I will consider the implications of just catching the IllegalStateException in these cases (this will work well for this case but some of the other places are a bit more complex and it would not be quite as simple). That'd be nice, thank you. Thanks for reporting this, just out of curiosity have other people seen this problem? It's the first time I heard of it - I can't remember seeing it during development. At least not since we last changed the way we handle the SVG display/generation, might have happened in the more unstable state that we had before. -Urs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: nightly builds
Hello, make sure that the java compiler (java) is available in the path This should probably be javac. Regards -Urs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Base-URI problem
Hello Thomas, unfortunately, your suggestion did not work as intended. If I add result.setNodeValue(importedNode.getNodeValue()); return result; to the ATTRIBUTE_NODE case of the importNode method of batik.dom.AbstractDocument the problem persists. I suspect this is due to a lack of events fired - in the setNodeValue method, an Event is only fired, when OwnerElement is not 'null'. This, however, is the case in both the dom4j.DOMWriter class used to create the original batik.SVGDOMDocument as well as by the DOMUtils when creating the clone. I further believe that this is due to the order of calls in AbstractElement$ExtendedNamedNodeHashmap: Within the method setUnspecifiedAttribute, at first, the Attribute Value is set via a call to AbstractAttr.setValue, and _afterwards_ the OwnerElement is set indirectly by calling setItemNS (which calls setOwnerElement, among other things). Do you know whether the order of things can be reversed without negative side effects (or if it's at least worth trying)? If so, I think, the problem should be solved. In high hopes -Urs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Base-URI problem
Hi Thomas, I think I have finally found the problem. The class SVGOMDocument implements the method isId(Attr node) in such a way that the id nodes generated by the dom4j writer are not recognized as such: It checks for 'null'-Namespaces, but fails to check for the empty string ''. I have modified the line in question, the method (around line 305) now being: public boolean isId(Attr node) { if (!(node.getNamespaceURI() ==null||node.getNamespaceURI().equals())){ return false; } return SVG_ID_ATTRIBUTE.equals(node.getNodeName()); } After this modification, the table of IDs is correctly created and filled. Trouble's not gone yet, though: In the former problem's wake follows an error about 'circle' elements requiring the 'r' attribute. Again, Batik requires the Namespace URI to be 'null' (by calling e.getAttributeNS(null, SVG_R_ATTRIBUTE)) while it is in fact the empty string. I will look for a way to change this. Thanks for your support so far -Urs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Base-URI problem
Hi Thomas, thank you for your reply. My computer was busy doing some major compilations, so I couldn't reply sooner. Unfortunately this is not the 'original' error however I believe that this error indicates that 'doc.getElementById(Solar)' is failing. I was not aware that this was not the original error message. I you give me some instructions, I can try to retrieve it. In the mean time, to answer your question: Can you check if getElementById(Solar) works? So after you construct the Batik DOM from Dom4J just println the results of calling getElementById(Solar). I did as instructed, and the result is indeed 'null'. If this is a dom4j-Problem I could turn to their support to find out what is wrong, but as always with such interoperability-problems, I appreciate any help you can give. I will try to find out what is happening with the attributes in the dom4j-class. Regards -Urs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Base-URI problem
Hello Thomas, I'm guessing this is the problem. I think that we aren't tracking the addition/removal of child nodes directly from the Attribute Node. I'm looking into this now, the tricky bit is that it isn't clear to me what events should be sent in this case (DOM Node Inserted, DOM Attr Modified? both?). This is a Batik internal problem, not dependent on the creator of the SVG Document (dom4j in my case) or the SVG Specification, isn't it? Also, am I correct in assuming that firing both wouldn't hurt anything but speed? In the interest of continuing our project, if you could give me some further pointers, I could try to find out what to do. I cannot promise anything, however, since my knowledge of the Batik code base is close to 0. Yes, the Document maintains a hash table of all the Id's on any element it created. This is what getElementById uses so that this is a quick operation. Alright, thank you. I've had another look - guess the table is clearly labled. I noticed that all three of the xBYy hash tables - ElementsByID, ElementsByTagnames, ElementsByTagnamesNS - are 'null', so the problem might extend further than just IDs. Regards -Urs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Base-URI problem
Hello Thomas, here's the stack trace as given by the dialog: org.apache.batik.bridge.BridgeException: null: -1 Cannot find the referenced element: #Solar specified on the element use - may be a problem of id at org.apache.batik.bridge.BridgeContext.getReferencedElement(Unknown Source) at org.apache.batik.bridge.SVGUseElementBridge.buildCompositeGraphicsNode(Unknown Source) at org.apache.batik.bridge.SVGUseElementBridge.createGraphicsNode(Unknown Source) at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(Unknown Source) at org.apache.batik.bridge.GVTBuilder.buildComposite(Unknown Source) at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(Unknown Source) at org.apache.batik.bridge.GVTBuilder.buildComposite(Unknown Source) at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(Unknown Source) at org.apache.batik.bridge.GVTBuilder.buildComposite(Unknown Source) at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(Unknown Source) at org.apache.batik.bridge.GVTBuilder.buildComposite(Unknown Source) at org.apache.batik.bridge.GVTBuilder.build(Unknown Source) at org.apache.batik.swing.svg.GVTTreeBuilder.run(Unknown Source) I am using the Batik 1.6 on a Java 5 Update 4 virtual machine running on Windows XP service pack 2. The batik .jars are taken directly from the distribution. If it will further your assessment of the situation, I could recompile batik with debug information and resend the stack trace. Just give me the word. Good bye -Urs Thomas DeWeese wrote: Hi Urs, This is a bug, can you provide a full stack trace? So I can tell who is getting it wrong? Urs Reupke wrote: Greetings, Tonny Kohar wrote: On Tue, 2005-07-19 at 16:48 +0200, Urs Reupke wrote: Now, I believe this is a problem with the base URI of the document - when converting from another XML-implementation, the (which did not exist in the first place, since the document is created in memory) URI is lost, thus Batik has no point of reference. Is this assumption correct? I am not sure if the error is because the base URI, since the Solar is embeded within the same doc. It become problem when the referenced resources is not within/embeded on the same doc That's what I thought - but for some reason, there's a problem nonetheless. Maybe there's something wrong with my conversion. Does anyone here have experience with converting dom4j to w3c.dom? However, to set the base URI there is two ways (you can choose either one) Thanks, for pointing this out. Referring to the my original message, however, since the documents are created in-memory, there is no valid URI I want them to have - all references will be to elements within the document itself. Regards -Urs - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]