Accessing SVG World Map. Trying to modify but keeps coming up as black
in
Programming Questions
•
2 years ago
Hi. I'm new to Processing and I'm working on a small project.
I've got a map of Africa which I'm working with. I can load it fine. But as soon as I try and select a country to modify I get no errors but the modifications don't show.
For example...
I'm using the following SVG map from wikipedia :
http://upload.wikimedia.org/wikipedia/commons/f/f9/BlankMap-Africa.svg
- PShape africa;
- PShape country;
- void setup() {
- size( 1000, 1000 );
- africa = loadShape( "BlankMap-Africa.svg" );
- smooth();
- noLoop();
- }
- void draw() {
- background( 255 );
- shape( africa, 0, 0 );
- setCountryColour();
- saveFrame( "/Users/KJ/Documents/Processing/frames/africa_population.png" );
- }
- void setCountryColour() {
- country = africa.getChild( "dz" );
- if (country == null ) {
- println( "no country found" );
- }
- else {
- println( "country found" );
- }
- country.disableStyle();
- fill( 0, 0, 255 );
- noStroke();
- shape( country, 0, 0 );
- }
Hoping someone can help me with this.
KJ
1