Loading ...
Sorry, an error occurred while loading the content.
 

Extracting common shapes from SVG documents

Expand Messages
  • cybernaut cybernaut
    Hi , I am working on an application , which uses SVG extensively as icons as well as background images . We are planning to provide an option for mass editing
    Message 1 of 4 , Jan 3, 2007
      Hi ,

      I am working on an application , which uses SVG extensively as icons as well as background images . We are planning to provide an option for mass editing of the icons.

      Is there any way i can extract common elements ( circles,rects.. etc ) from svg document?

      any help will be appreciated .

      thanks
      Sujesh

      __________________________________________________
      Do You Yahoo!?
      Tired of spam? Yahoo! Mail has the best spam protection around
      http://mail.yahoo.com

      [Non-text portions of this message have been removed]
    • Jonathan Chetwynd
      In general it is a bad idea to copy different groups. your question is best directed to svg-developers@yahoogroups.com Could you describe your intention more
      Message 2 of 4 , Jan 4, 2007
        In general it is a bad idea to copy different groups.
        your question is best directed to svg-developers@yahoogroups.com

        Could you describe your intention more specifically?

        it's not immediately evident what your requirement is.

        cheers

        Jonathan Chetwynd



        On 4 Jan 2007, at 04:36, cybernaut cybernaut wrote:

        Hi ,


        I am working on an application , which uses SVG extensively as icons
        as well as background images . We are planning to provide an option
        for mass editing of the icons.


        Is there any way i can extract common elements ( circles,rects..
        etc ) from svg document?


        any help will be appreciated .


        thanks

        Sujesh


        __________________________________________________
        Do You Yahoo!?
        Tired of spam? Yahoo! Mail has the best spam protection around
        http://mail.yahoo.com
      • cybernaut cybernaut
        Rick , thanks for the response , Jonathan , sorry for the trouble. I will explain the requirement more clearly ...I am working on application to create mobile
        Message 3 of 4 , Jan 4, 2007
          Rick , thanks for the response , Jonathan , sorry for the trouble.

          I will explain the requirement more clearly ...I am working on application to create mobile themes for various mobile devices . We are using Java/Eclipse/Batik to build the same .

          In the tool , user has the option to edit the svg files using an external editor like inkscape/illustrator. Currently for editing the svg icons , user need to edit each of the icons individually. So we thought of providing a mass editing functionality .

          User can select multiple svg icons and system will display a set of common shapes present in the icons . So we thinking of various ways of extracting the common shapes from svg documents like ,creating a set of rules, which states, the different attributes should match, for the basic shapes to be considered identical or similar.

          This is the scenario , i am trying to find a solution. I am looking for a better way so that i can extract common shapes from SVG documents

          Thanks again




          ----- Original Message ----
          From: Jonathan Chetwynd <j.chetwynd@...>
          To: cybernaut cybernaut <mostwantedsince198x@...>
          Cc: svg-developers@yahoogroups.com
          Sent: Thursday, January 4, 2007 2:41:01 PM
          Subject: Re: Extracting common shapes from SVG documents


          In general it is a bad idea to copy different groups.
          your question is best directed to svg-developers@yahoogroups.com

          Could you describe your intention more specifically?

          it's not immediately evident what your requirement is.

          cheers

          Jonathan Chetwynd



          On 4 Jan 2007, at 04:36, cybernaut cybernaut wrote:

          Hi ,


          I am working on an application , which uses SVG extensively as icons
          as well as background images . We are planning to provide an option
          for mass editing of the icons.


          Is there any way i can extract common elements ( circles,rects..
          etc ) from svg document?


          any help will be appreciated .


          thanks

          Sujesh


          __________________________________________________
          Do You Yahoo!?
          Tired of spam? Yahoo! Mail has the best spam protection around
          http://mail.yahoo.com

          __________________________________________________
          Do You Yahoo!?
          Tired of spam? Yahoo! Mail has the best spam protection around
          http://mail.yahoo.com

          [Non-text portions of this message have been removed]
        • ddailey
          Sujesh wrote ... I am working on an application , which uses SVG extensively as icons as well as background images . We are planning to provide an option for
          Message 4 of 4 , Jan 4, 2007
            Sujesh wrote
            -------------
            I am working on an application , which uses SVG extensively as icons as well as background images . We are planning to provide an option for mass editing of the icons.

            Is there any way i can extract common elements ( circles,rects.. etc ) from svg document?
            -----------------

            I don't know where this application is likely to run, but within the svg document itself you can use javascript to do much of the work sort of as follows:

            function multitag(O){
            var Shapes=new Array("rect","circle","path","ellipse")
            Shapelist=new Object
            for (i in Shapes){
            Shapelist[Shapes[i]]=O.getElementsByTagNameNS(xmlns,Shapes[i])
            for (j=0;j<Shapelist[Shapes[i]].length;j++){
            alert(Shapes[i]+" "+j+":"+Shapelist[Shapes[i]].item(j).nodeName)
            }
            }
            return Shapelist
            }

            The inner loop with the alerts is in there just to show step-by-step results.
            Basically this function can be invoked with a call like Stuff=multitag(SVGRoot)
            and then stuff will be an Object (sort of like an associative array), consisting of
            a collection of nodeLists organized by and indexed by node type ("rect","circle","path","ellipse").
            It can be accessed just as it is in the inner loop.

            Basically, the getElementsByTagNameNS method does all the work.

            Such code works for me in IE/ASV, Opera 9 and FF1.5.

            hope this makes sense,
            David


            [Non-text portions of this message have been removed]
          Your message has been successfully submitted and would be delivered to recipients shortly.