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 ra...@blueyonder.co.uk on 2006/03/02 11:12:13 UTC

ZoomIn Problem

Hi there,

I've solved the issue about the circles by drawing them on the Overlay but
now I have the problem when I zoomIn the circles also get bigger, is there
away I could keep the circles the same size -  I was thinking of when I
zoomIn to remove the circles from the overlay and then redraw them, But
how do I remove them...?

Many Thx

yasmin





> Hi Yasmin,
>
> rafiqy@blueyonder.co.uk wrote on 02/28/2006 05:00:41 PM:
>
>> Sorry, should had given the complete code, so you can see:
>>
>> canvas.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC);
>>
>> canvas.getUpdateManager().getUpdateRunnableQueue().invokeLater(new
>> Runnable() {
>
>    The UpdateManager and RunnableQueue only become available after the
> first
> rendering completes.  Alternately you could put your code to create the
> Circles in the SVG onload event callback.  There are good examples in the
> JavaScripting and JSVGCanvas sections of the Batik web site that covers
> how
> to do this (I would tend towards registering an 'onload' event handler).
>
> http://xmlgraphics.apache.org/batik/javaScripting.html
> http://xmlgraphics.apache.org/batik/svgcanvas.html
>
>>
>>                       public void run()
>>                       {
>>                         SVGDocument doc = canvas.getSVGDocument();
>>                         String SVGNS = "http://www.w3.org/2000/svg";
>>                         Iterator i = spots.iterator();
>>                         Element g; // =
> doc.getElementById("circleGroup");
>>                         g = doc.createElementNS(SVGNS,"g");
>>                 g.setAttributeNS(null, "id", "circleGroup");
>>                 doc.getRootElement().appendChild(g);
>>
>>                         while (i.hasNext())
>>                         {
>>                           Point2D pt2d = (Point2D) i.next();
>>                           Element e =
> doc.createElementNS(SVGNS,"circle");
>>                           e.setAttributeNS(null,"cx",""+pt2d.getX());
>>                           e.setAttributeNS(null,"cy",""+pt2d.getY());
>>                           e.setAttributeNS(null,"r","8");
>>                           e.setAttributeNS(null,"fill","Red");
>>                           g.appendChild(e);
>>                         }
>>                       }
>>                       });
>>
>> Many thx
>>
>> yasmin
>>
>>
>> > Hi Yasmin,
>> >
>> > rafiqy@blueyonder.co.uk wrote on 02/28/2006 03:37:12 PM:
>> >
>> >> ...yes you are right I haven't created a group with attribute 'id'
> set
>> > to
>> >> 'circlegroup', not sure how to :( I'm a complete novice to SVG and
> have
>> >> embarked on this ambitiouse project I'm finding it very difficult and
>> > time
>> >> is running out, pls ELP!
>> >
>> >   I would add something like:
>> >
>> >         if (g == null) {
>> >                 g = doc.createElementNS(SVGNS,"g");
>> >                 g.setAttributeNS(null, "id", "circleGroup");
>> >                 doc.getRootElement().appendChild(g);
>> >         }
>> >
>> >   Right after you call getElementById.
>> >   In your case you could probably also just skip the
>> > 'getElementById' and 'if' and just create the element in all cases
>> > (but you should avoid creating it twice - it's bad to have two
>> > elements with the same 'id' in one document).
>> >
>> >   BTW If at some point you want to remove the group (and
>> > consiquently all it's children) you can use:
>> >         g.getParentNode().removeChild(g);
>> >
>> >   Good luck!
>> >
>> > ---------------------------------------------------------------------
>> > 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