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/18 18:19:25 UTC

Identifying each circle

Hi Thomas,

With the zooming problem if I set 'r' from '0.001' to '1' then the
'circle-rings' appear on the canvas!

Anyway, I would like to be able to identify each 'circle' when I click it,
i.e, attach a number (1,2,3...), so the user can have a visual reference
for each circle. How can I attach a number, I tried:


String num = Integer.parseInt(num) // Keeps record of num of Clickd Circles
elt.setAttributeNS(null,"text",num);

Thx




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


RE: Identifying each circle

Posted by ra...@blueyonder.co.uk.
Hi Javid,

I'v sorted the error I it should had been 'text' not 'textID' - anyways
thankU so much for your help!

yasmin



> Hi Yasmin,
> Sorry I wasn't very clear, I was using that piece of code for my 'g'
> elements, so I suggest you create a text element when a user clicks on
> your
> circle and translate it to the circle's position. If you look at Thomas's
> code (look couple of emails before) that uses SVGLocatable to get the
> position of circle and use that position to set the co-ordinate positions
> of
> your new text element.
>
> Thanks,
> Javid
>
> -----Original Message-----
> From: rafiqy@blueyonder.co.uk [mailto:rafiqy@blueyonder.co.uk]
> Sent: Saturday, March 18, 2006 1:28 PM
> To: batik-users@xmlgraphics.apache.org
> Subject: RE: Identifying each circle
>
>
> Hi Javid,
>
> How did you declare the variable 'rg' and also the 'CircleElement' does
> not have 'appendChild() method???
>
> Thx
>
> yasmin
>
>
>
>> Hi Yasmin,
>> I guess when you need to add text, you have to create a text element and
>> append it to the circle element. That's how I display the text.
>> Something
>> like this.
>>
>> Element textID = svgDocument.createElementNS(SVG_NS, "text");
>> Element textSpan = svgDocument.createElementNS(SVG_NS, "tspan");
>> textSpan.setAttributeNS(null, "x", "15");
>> textSpan.setAttributeNS(null, "y", "25");
>> textSpan.setAttributeNS(null, "fill", "#17238C");
>> textSpan.setAttributeNS(null, "font-family", "'Arial-BoldMT'");
>> textSpan.setAttributeNS(null, "text-anchor", "middle");
>> textSpan.setAttributeNS(null, "font-size", "18");
>>
>> rg.w3c.dom.Text tempText = (org.w3c.dom.Text)
>> svgDocument.createTextNode("Your text goes here");
>> textSpan.appendChild(tempText);
>> textID.appendChild(textSpan);
>> circleElement.appendChild(textID);
>>
>> Hope it helps.
>>
>> Javid
>>
>> -----Original Message-----
>> From: rafiqy@blueyonder.co.uk [mailto:rafiqy@blueyonder.co.uk]
>> Sent: Saturday, March 18, 2006 11:19 AM
>> To: batik-users@xmlgraphics.apache.org
>> Subject: Identifying each circle
>>
>>
>> Hi Thomas,
>>
>> With the zooming problem if I set 'r' from '0.001' to '1' then the
>> 'circle-rings' appear on the canvas!
>>
>> Anyway, I would like to be able to identify each 'circle' when I click
>> it,
>> i.e, attach a number (1,2,3...), so the user can have a visual reference
>> for each circle. How can I attach a number, I tried:
>>
>>
>> String num = Integer.parseInt(num) // Keeps record of num of Clickd
>> Circles
>> elt.setAttributeNS(null,"text",num);
>>
>> Thx
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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


RE: Identifying each circle

Posted by ra...@blueyonder.co.uk.
Hi Javid,

Yes, after studying ur code I understand what its meant to do - but for
some strange reason I'm getting the followin error:

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: textID).

...any thoughts?

thx

yasmin




> Hi Yasmin,
> Sorry I wasn't very clear, I was using that piece of code for my 'g'
> elements, so I suggest you create a text element when a user clicks on
> your
> circle and translate it to the circle's position. If you look at Thomas's
> code (look couple of emails before) that uses SVGLocatable to get the
> position of circle and use that position to set the co-ordinate positions
> of
> your new text element.
>
> Thanks,
> Javid
>
> -----Original Message-----
> From: rafiqy@blueyonder.co.uk [mailto:rafiqy@blueyonder.co.uk]
> Sent: Saturday, March 18, 2006 1:28 PM
> To: batik-users@xmlgraphics.apache.org
> Subject: RE: Identifying each circle
>
>
> Hi Javid,
>
> How did you declare the variable 'rg' and also the 'CircleElement' does
> not have 'appendChild() method???
>
> Thx
>
> yasmin
>
>
>
>> Hi Yasmin,
>> I guess when you need to add text, you have to create a text element and
>> append it to the circle element. That's how I display the text.
>> Something
>> like this.
>>
>> Element textID = svgDocument.createElementNS(SVG_NS, "text");
>> Element textSpan = svgDocument.createElementNS(SVG_NS, "tspan");
>> textSpan.setAttributeNS(null, "x", "15");
>> textSpan.setAttributeNS(null, "y", "25");
>> textSpan.setAttributeNS(null, "fill", "#17238C");
>> textSpan.setAttributeNS(null, "font-family", "'Arial-BoldMT'");
>> textSpan.setAttributeNS(null, "text-anchor", "middle");
>> textSpan.setAttributeNS(null, "font-size", "18");
>>
>> rg.w3c.dom.Text tempText = (org.w3c.dom.Text)
>> svgDocument.createTextNode("Your text goes here");
>> textSpan.appendChild(tempText);
>> textID.appendChild(textSpan);
>> circleElement.appendChild(textID);
>>
>> Hope it helps.
>>
>> Javid
>>
>> -----Original Message-----
>> From: rafiqy@blueyonder.co.uk [mailto:rafiqy@blueyonder.co.uk]
>> Sent: Saturday, March 18, 2006 11:19 AM
>> To: batik-users@xmlgraphics.apache.org
>> Subject: Identifying each circle
>>
>>
>> Hi Thomas,
>>
>> With the zooming problem if I set 'r' from '0.001' to '1' then the
>> 'circle-rings' appear on the canvas!
>>
>> Anyway, I would like to be able to identify each 'circle' when I click
>> it,
>> i.e, attach a number (1,2,3...), so the user can have a visual reference
>> for each circle. How can I attach a number, I tried:
>>
>>
>> String num = Integer.parseInt(num) // Keeps record of num of Clickd
>> Circles
>> elt.setAttributeNS(null,"text",num);
>>
>> Thx
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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


RE: Identifying each circle

Posted by Javid Alimohideen <ja...@gmail.com>.
Hi Yasmin,
Sorry I wasn't very clear, I was using that piece of code for my 'g'
elements, so I suggest you create a text element when a user clicks on your
circle and translate it to the circle's position. If you look at Thomas's
code (look couple of emails before) that uses SVGLocatable to get the
position of circle and use that position to set the co-ordinate positions of
your new text element.

Thanks,
Javid

-----Original Message-----
From: rafiqy@blueyonder.co.uk [mailto:rafiqy@blueyonder.co.uk]
Sent: Saturday, March 18, 2006 1:28 PM
To: batik-users@xmlgraphics.apache.org
Subject: RE: Identifying each circle


Hi Javid,

How did you declare the variable 'rg' and also the 'CircleElement' does
not have 'appendChild() method???

Thx

yasmin



> Hi Yasmin,
> I guess when you need to add text, you have to create a text element and
> append it to the circle element. That's how I display the text. Something
> like this.
>
> Element textID = svgDocument.createElementNS(SVG_NS, "text");
> Element textSpan = svgDocument.createElementNS(SVG_NS, "tspan");
> textSpan.setAttributeNS(null, "x", "15");
> textSpan.setAttributeNS(null, "y", "25");
> textSpan.setAttributeNS(null, "fill", "#17238C");
> textSpan.setAttributeNS(null, "font-family", "'Arial-BoldMT'");
> textSpan.setAttributeNS(null, "text-anchor", "middle");
> textSpan.setAttributeNS(null, "font-size", "18");
>
> rg.w3c.dom.Text tempText = (org.w3c.dom.Text)
> svgDocument.createTextNode("Your text goes here");
> textSpan.appendChild(tempText);
> textID.appendChild(textSpan);
> circleElement.appendChild(textID);
>
> Hope it helps.
>
> Javid
>
> -----Original Message-----
> From: rafiqy@blueyonder.co.uk [mailto:rafiqy@blueyonder.co.uk]
> Sent: Saturday, March 18, 2006 11:19 AM
> To: batik-users@xmlgraphics.apache.org
> Subject: Identifying each circle
>
>
> Hi Thomas,
>
> With the zooming problem if I set 'r' from '0.001' to '1' then the
> 'circle-rings' appear on the canvas!
>
> Anyway, I would like to be able to identify each 'circle' when I click it,
> i.e, attach a number (1,2,3...), so the user can have a visual reference
> for each circle. How can I attach a number, I tried:
>
>
> String num = Integer.parseInt(num) // Keeps record of num of Clickd
> Circles
> elt.setAttributeNS(null,"text",num);
>
> Thx
>
>
>
>
> ---------------------------------------------------------------------
> 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


RE: Identifying each circle

Posted by ra...@blueyonder.co.uk.
Hi Javid,

How did you declare the variable 'rg' and also the 'CircleElement' does
not have 'appendChild() method???

Thx

yasmin



> Hi Yasmin,
> I guess when you need to add text, you have to create a text element and
> append it to the circle element. That's how I display the text. Something
> like this.
>
> Element textID = svgDocument.createElementNS(SVG_NS, "text");
> Element textSpan = svgDocument.createElementNS(SVG_NS, "tspan");
> textSpan.setAttributeNS(null, "x", "15");
> textSpan.setAttributeNS(null, "y", "25");
> textSpan.setAttributeNS(null, "fill", "#17238C");
> textSpan.setAttributeNS(null, "font-family", "'Arial-BoldMT'");
> textSpan.setAttributeNS(null, "text-anchor", "middle");
> textSpan.setAttributeNS(null, "font-size", "18");
>
> rg.w3c.dom.Text tempText = (org.w3c.dom.Text)
> svgDocument.createTextNode("Your text goes here");
> textSpan.appendChild(tempText);
> textID.appendChild(textSpan);
> circleElement.appendChild(textID);
>
> Hope it helps.
>
> Javid
>
> -----Original Message-----
> From: rafiqy@blueyonder.co.uk [mailto:rafiqy@blueyonder.co.uk]
> Sent: Saturday, March 18, 2006 11:19 AM
> To: batik-users@xmlgraphics.apache.org
> Subject: Identifying each circle
>
>
> Hi Thomas,
>
> With the zooming problem if I set 'r' from '0.001' to '1' then the
> 'circle-rings' appear on the canvas!
>
> Anyway, I would like to be able to identify each 'circle' when I click it,
> i.e, attach a number (1,2,3...), so the user can have a visual reference
> for each circle. How can I attach a number, I tried:
>
>
> String num = Integer.parseInt(num) // Keeps record of num of Clickd
> Circles
> elt.setAttributeNS(null,"text",num);
>
> Thx
>
>
>
>
> ---------------------------------------------------------------------
> 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


RE: Identifying each circle

Posted by Javid Alimohideen <ja...@gmail.com>.
Hi Yasmin,
I guess when you need to add text, you have to create a text element and
append it to the circle element. That's how I display the text. Something
like this.

Element textID = svgDocument.createElementNS(SVG_NS, "text");
Element textSpan = svgDocument.createElementNS(SVG_NS, "tspan");
textSpan.setAttributeNS(null, "x", "15");
textSpan.setAttributeNS(null, "y", "25");
textSpan.setAttributeNS(null, "fill", "#17238C");
textSpan.setAttributeNS(null, "font-family", "'Arial-BoldMT'");
textSpan.setAttributeNS(null, "text-anchor", "middle");
textSpan.setAttributeNS(null, "font-size", "18");

rg.w3c.dom.Text tempText = (org.w3c.dom.Text)
svgDocument.createTextNode("Your text goes here");
textSpan.appendChild(tempText);
textID.appendChild(textSpan);
circleElement.appendChild(textID);

Hope it helps.

Javid

-----Original Message-----
From: rafiqy@blueyonder.co.uk [mailto:rafiqy@blueyonder.co.uk]
Sent: Saturday, March 18, 2006 11:19 AM
To: batik-users@xmlgraphics.apache.org
Subject: Identifying each circle


Hi Thomas,

With the zooming problem if I set 'r' from '0.001' to '1' then the
'circle-rings' appear on the canvas!

Anyway, I would like to be able to identify each 'circle' when I click it,
i.e, attach a number (1,2,3...), so the user can have a visual reference
for each circle. How can I attach a number, I tried:


String num = Integer.parseInt(num) // Keeps record of num of Clickd Circles
elt.setAttributeNS(null,"text",num);

Thx




---------------------------------------------------------------------
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