We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › SVG child not appearing
Page Index Toggle Pages: 1
SVG child not appearing (Read 316 times)
SVG child not appearing
May 8th, 2009, 10:33pm
 
I want to write a simple program that colours different countries in Africa different colours. I found a .svg file on wikipedia. I can make it appear and I can disable its style. I can use getChild to make a new PShape from the parent, but no matter what I do the child will not appear.

Am I crazy? Did I make a stupid mistake somewhere? Any help would be greatly appreciated.

You can download the svg file here: commons.wikimedia.org/wiki/File:Gdp_nominal_2007_africa_map.svg

Here is the code:
Code:

PShape africa;
PShape kenya;

void setup () {
background(255);
int width = 800;
int height = 800;
size(width, height);
africa = loadShape("Gdp_nominal_2007_africa_map.svg");
kenya = africa.getChild("ke");
smooth();
noLoop();
}

void draw(){
 //africa.disableStyle();
 //shape(africa, 0, 0, width, height);
 kenya.disableStyle();
 fill(100, 10, 10);
 shape(kenya, 0, 0, width, height);
}
Page Index Toggle Pages: 1