SVG overlap Coordinates
in
Programming Questions
•
1 year ago
I'm working on a visualization of a map project. I've posted about it in the past here:
https://forum.processing.org/topic/linking-ui-method-to-selected-child.
What I want to do now is parse the svg/xml to look for overlapping points. That is, I want a function that knows the overlapping points and tallies them. A little guiding light would be helpful. I'm kind of wondering if I should parse the data directly as XML? and more to the point, how I would identify child elements that overlap, and where that happens.
I just completed this tutorial by jer thorp:
http://blog.blprnt.com/blog/blprnt/your-random-numbers-getting-started-with-processing-and-data-visualization
In his code he references a spread sheet and uses this function to parse numbers and create a bar graph:
- void barGraph(int[] nums, float y) {
- //Make a list of number counts
- int[] counts = new int[100];
- //Fill it with zeros
- for (int i = 1; i < 100; i++) {
- counts[i] = 0;
- };
- //Tally the counts
- for (int i = 0; i < nums.length; i++) {
- counts[nums[i]] ++;
- };
- //Draw the bar graph
- for (int i = 0; i < counts.length; i++) {
- colorMode(HSB);
- fill(counts[i] * 30, 255, 255);
- rect(i * 8, y, 8, -counts[i] * 10);
- };
- };
I'm wondering how I might do something similar with the svg/xml I have.
Any help is greatly appreciated. Thanks!!
1