Bug Hunting Session
Bug 95717 - DRAW: Manage layers in SVG export with id-attribute for the <g>-element
Summary: DRAW: Manage layers in SVG export with id-attribute for the <g>-element
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
Version:
(earliest affected)
5.0.3.2 release
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Layers
  Show dependency treegraph
 
Reported: 2015-11-10 07:51 UTC by Stephane Santon
Modified: 2016-05-04 09:22 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Draw file with 4 objects, and 1 custom layer (9.54 KB, application/vnd.oasis.opendocument.graphics)
2015-11-12 09:09 UTC, Stephane Santon
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stephane Santon 2015-11-10 07:51:10 UTC
More and more users create SVG pictures to be used in HTML5 animations, or to replace classic linear presentation applications (like PREZI, but on SOZI with HTML5 compliance).
We have to create multilayer SVG pictures to manage animation.

But even if we create different layers in Draw, there are no more layers when it is exported to SVG format.
(We still have to use Inkscape which provides real multilayers SVG pictures)
Comment 1 Regina Henschel 2015-11-10 22:33:37 UTC
Which w3.org standard svg elements provides "layers"?

In ODF, "The animation elements are based upon §3.5 and §12.5 of [SMIL20], and section §19.2 of [SVG]."
with [SMIL20]=http://www.w3.org/TR/2005/REC-SMIL2-20050107/
[SVG]=http://www.w3.org/TR/2003/REC-SVG11-20030114/
For details see section "15 SMIL Animations" in http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html

Can you please provide a standard conform svg document using "layers"? Inkscape "svg" <> standard svg.

Draw does not have animation and Impress has no layers. It is not clear, what do you mean.
Comment 2 Stephane Santon 2015-11-11 21:25:43 UTC
Standard SVG does not implement specific "layers" but groups with <g>, and layers can be seen as groups.

I don't want to integrate animation in the SVG file, but to distinguish layers (groups) in order to animate then with a HTML5 page. 

Inkscape can find his layers while opening his SVG files by :
 <g
     id="layer2"
     inkscape:groupmode="layer"
     inkscape:label="..."

DRAW could do the same :
 <g
     id="layer2"
     draw:groupmode="layer"

or
 <g
     class="layer"
     id="layer2"

Then, an application could detect these layers an create some animations by hiding, showing, moving groups, like SOZI does :
http://sozi.baierouge.fr/images/tutorial-layers/sozi-layers-tutorial-full.svg
Comment 3 Regina Henschel 2015-11-11 23:02:01 UTC
To me it looks like your request is not about "layers" but about groups.

I think, introducing an own namespace should not be done; svg is rich enough to do all needed things in standard svg. Namespace "draw" would be a bad choice anyway, because it can be confused with ODF.

Currently neither a page nor a group gets an identifier but only the individual shapes. I would support a request, that svg export should make the name of a group to an id-attribute of the <g>-element in svg. Such could be used in Impress too, where no user layers exists.

It would be possible to put the layer into a class attribute, but it does not work well, because a group in Draw can contain shapes from different layers. Therefore the layer-information would only be meaningful for a single shape, but not for a group.

Do you agree to take this bug report as request for an id-attribute for the <g>-element, which is generated for a group in Draw? If yes, the subject line should be changed accordingly.
Comment 4 Stephane Santon 2015-11-12 09:09:41 UTC
Created attachment 120492 [details]
Draw file with 4 objects, and 1 custom layer
Comment 5 Stephane Santon 2015-11-12 09:15:51 UTC
(In reply to Regina Henschel from comment #3)
> To me it looks like your request is not about "layers" but about groups.

Yes. The Draw layers have to be exported as groups.

> an own namespace should not be done

OK

> Currently neither a page nor a group gets an identifier but only the
> individual shapes. I would support a request, that svg export should make
> the name of a group to an id-attribute of the <g>-element in svg. Such could
> be used in Impress too, where no user layers exists.

Good !

> It would be possible to put the layer into a class attribute, but it does
> not work well, because a group in Draw can contain shapes from different
> layers. 

Oh ! I didn't know. OK.

> Do you agree to take this bug report as request for an id-attribute for the
> <g>-element, which is generated for a group in Draw? If yes, the subject
> line should be changed accordingly.

In a first step, yes. 

Is it enough to define "layers" ? Layers could be defined by :
- a SVG goup (OK)
- with an id (OK with the new request)
- and that is *a direct child of the root SVG element*.

----

In the current SVG export, you can find the first SVG Child group as :
<g>
  <g id="id2" class="Master_Slide">
   <g id="bg-id2" class="Background"/>
   <g id="bo-id2" class="BackgroundObjects"/>
  </g>
 </g>

What is it for ?

----

And then the next (and last) SVG child group with the SlideGroup class as :

 <g class="SlideGroup">
  <g>
   <g id="id1" class="Slide" clip-path="url(#presentation_clip_path)">
    <g class="Page">
     <g class="com.sun.star.drawing.CustomShape">
      <g id="id3">
        [...]
      </g>
     </g>
     <g class="com.sun.star.drawing.TextShape">
      <g id="id4">
        [...]
      </g>
     </g>
     <g class="Group">
      <g class="com.sun.star.drawing.CustomShape">
       <g id="id5">
        [...]
       </g>
      </g>
      <g class="com.sun.star.drawing.CustomShape">
       <g id="id6">
        [...]
       </g>
      </g>
     </g>
    </g>
   </g>
  </g>
 </g>

Is there always only ONE SlideGroup ?

Could the layers objects be separated in different SlideGroups with their own ID ?

Thanks
Comment 6 Stephane Santon 2015-11-12 18:15:40 UTC
You can have a look to an article about how Adobe Illustrator exports its layers :

http://www.adobe.com/inspire/2013/09/exporting-svg-illustrator.html

(At the bottom of the page)
Comment 7 Regina Henschel 2015-11-12 21:09:49 UTC
The description of the request is detailed enough now, therefore I set it to new. At least using the id attribute of the <g>-element in svg would be a useful enhancement.

I have no answer to your other questions.
Comment 8 Stephane Santon 2015-11-12 21:14:20 UTC
(In reply to Regina Henschel from comment #7)
> The description of the request is detailed enough now, therefore I set it to
> new. At least using the id attribute of the <g>-element in svg would be a
> useful enhancement.

Thanks :-)

> I have no answer to your other questions.

I hope ID-ed groups (= layers) will be direct children of SVG element.