shape() parameters when using getChild()
In Inkscape, I have 3 separate rectangles in a page 388w x 297h px.
Each rectangle has id: house, door, window.
Inkscape / svg question
The svg file shows:
- <svg
- width="388.57144"
- height="297.73553"
That agrees with Page size.
But it also includes:
- <g
- inkscape:label="Layer 1"
- inkscape:groupmode="layer"
- id="layer1"
- transform="translate(-8.5714245,593.94476)">
- <rect
- style="fill:#00ff00;fill-opacity:1;stroke:none"
- id="house"
- width="300"
- height="200"
- x="8.5714245"
- y="-584.7807"
- ry="8.1554852"
- inkscape:label="#rect2985" />
- <rect
- style="fill:#ff0000;fill-opacity:1;stroke:none"
- id="door"
- width="60"
- height="100"
- x="337.14285"
- y="-593.94476"
- ry="5.6589088"
- inkscape:label="#rect2987" />
- <rect
- style="fill:#00ffff;fill-opacity:1;stroke:none"
- id="window"
- width="100"
- height="70"
- x="294.28571"
- y="-366.20923"
- ry="7.7640224"
- inkscape:label="#rect2992" />
- </g>
Where does the transform="translate(-8.5714245,593.94476)"> get these values?
I couldn’t find them in Inkscape.
Processing question
In the sketch I have:
- main = loadShape("drawing08_3RectsId.svg");
- house = main.getChild("house");
- door = main.getChild("door");
- window = main.getChild("window");
- shape(main);
displays the whole file, all three rectangles as they appear in Inkscape.
But to see the children, I need to use
- translate(-9, 593);
- shape(house,0, 0);
- shape(door,0, 0);
- shape(window,0, 0);
In Reference, shape() it indicates that parameters x, y, width, and height refer to location and size of drawn shape.
http://processing.org/reference/shape_.html
The only way I’ve seen this works is if:
- There’s one shape per file, and
- Page size is made equal to the selected object
It's confusing that main appears with no translation but the children don't.
Are there additional steps needed with children so that shape() parameters work?
If not, shouldn't Reference shape() provide some further explanation?