Processing - Delicious Data Visualization
For a school project i'm trying to use Delicious API in Processing platform.
I have a question,
So far i can visualize the 'Titles' and 'Tags' of individual posts into the processing canvas.
What i want to do is, i want to get a specific get like "design" and scatter the posts' titles around that tag and draw a line from center to each of them... like network graphs, sort of.
But in the documentation, i cannot find a way to get a single specific Tag in the getTag() method.
The link to the documentation is here, (getTag) http://delicious-java.sourceforge.net/del/icio/us/beans/Post.html#getTag()
get the tag 'design' and type the posts' titles that contains 'design' tag around it randomly.
What is the logic behind it, can you explain it to me?
My code looks like this
- Delicious delicious;
- PFont font;
- String title;
- void setup() {
- font = loadFont("HelveticaNeue-9.vlw");
- textFont(font);
- size(800, 1000);
- // Initiate Delicious object. Replace username and password with your own info.
- delicious=new Delicious("Textfield", "met7052");
- // Retrieve recent posts. The result is a List object containing the
- // Posts as del.icio.us.beans.Post objects. We'll use List.toArray() to
- // give us an array of the Objects in the List.
- Object [] o=delicious.getRecentPosts("", 150).toArray();
- // Uncomment the following line to get all posts.
- // Object [] o=delicious.getAllPosts().toArray();
- // Convert the Objects to Posts
- Post [] posts=new Post[o.length];
- for (int i=0; i<posts.length; i++) {
- posts[i]=(Post)o[i];
- }
- // Print the posts
- println("Del.icio.us posts retrieved: "+posts.length);
- for (int i=0; i<posts.length; i++) {
- // println(i+": "+posts[i]);
- pushMatrix();
- translate(50, 50);
- float descriptionWidth = textWidth(posts[i].getDescription());
- float tagWidth = textWidth(posts[i].getTag());
- int margin = 30;
- fill(50);
- text(posts[i].getDescription(), 0, 20*i);
- //text(posts[i].getTime(), descriptionWidth + margin, 20*i);
- fill(135);
- text(posts[i].getTag(), descriptionWidth + margin, 20*i);
- popMatrix();
- }
- }
Thanks a bunch. Met.