Hi there,
I am not new to Processing but new to SVG.
I am developping interactive map based on SVG
(not read data visualization from Mister Fry yet but I am waiting for it..).
I am using an SVG world map from wikipedia.
The SVG looks all fine under both Adobe illustrator and Inkscape.
When using it with Processing I have two problems perhaps related one to another : size is wrong and impossible to center.
Here is my code :
Code:
PShape essai;
void setup()
{
size(1000,700);
smooth();
// want to place the object in the middle of the screen
shapeMode(CENTER);
// download the file from en.wikipedia.org/wiki/File:BlankMap-World6.svg
essai=loadShape("BlankMap-World6.svg");
// what's the metadata size info ?
//width:939.74725 height:476.7276
println(essai.width+" "+essai.height);
// make the svg visible by styling it
essai.disableStyle();
stroke(0);
// here we go
shape(essai,width/2,height/2,essai.width,essai.height);
// 2 problems :
// 1- the size of the shape is huge
// putting width and height argument in shape doesn't matter
// I have to scale it down by 0.36 so that it feets in 1000x700 screen
// 2- not centered at all
// just to have a visible center
fill(0,255,0);
ellipse(width/2,height/2,5,5);
}
void draw()
{
// nothing yet unfortunately ...
}
Is that a bug ?
Is the SVG wrong in any manner ?
Or did I miss something ?
Thanks a lot for your help
Paul
ps: thanks a lot guys for your work, Processing's amazing