• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Is anyone familiar with the unfoldingmaps API?

 
Ranch Hand
Posts: 186
1
Netbeans IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some people has classified this as intermediate to advanced java because you are dealing with lists and parsing data from webpages. In any case, I wanted to know if anyone is familiar with the unfoldingmaps API? I am doing an assignment for University of California, San Diego through Coursera for a specialization that I registered for. Technically speaking, I have written some code in an applet that displays a map of recent earthquakes. The data for the recent earthquakes is parsed from a US gov website and displayed on the map via the Marker class and its various subclasses taken from the Unfoldingmaps library. One of the assignment questions has had me in a stupor for the last 13 hours ROFLLL.

This question specifically states that I should write some code in an overriden mouseClick() method that states "When an earthquake’s marker is selected, all cities within the threat circle of this earthquake are displayed on the map and all other cities and earthquakes are hidden. You are given an implementation of the threatCircle() method in the EarthquakeMarker class.
When a city’s marker is selected, all earthquakes which contain that city in their threat circle are displayed on the map and all other cities and earthquakes are hidden. You are given an implementation of the threatCircle() method in the EarthquakeMarker class."

CityMarker and EarthquakeMarker are subclasses of a CommonMarker class, which it in itself is a subclass of the superclass Marker, just to give you all an idea of the class hierarchy. With that said. I am unable to get my program to When an earthquake’s marker is selected, all cities within the threat circle of this earthquake are displayed on the map and all other cities and earthquakes are hidden. You are given an implementation of the threatCircle() method in the EarthquakeMarker class." Instead, when I click on an earthquake in question, the earthquake itself disappears but not the markers around it. There is a setHidden(boolean arg) method that allows one to set a marker object to not display on the map. With that said, I have my source code here:


In the code above, a wrote a helper method selectMarkerIfClicked to handle the mouseClick functionality as shown below:



My goal with this code was to use the threatCircle() method from the Earthquakemarker class as a means of finding the threat radius of the earthquake and making anything that is not within that radius disappear with the setHidden(boolean arg) method. Instead, as aforementioned, the only thing disappearing is the marker on the map that I click on. Any advice would be greatly appreciated. Thanks!

In case if you would like to see the threatCircle method, it's here



It returns a double as one can see. Please let me know if you need further clarification in order to help me. Thanks!
 
Naziru Gelajo
Ranch Hand
Posts: 186
1
Netbeans IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone know what I'm doing wrong? Thanks!
 
Sheriff
Posts: 24654
58
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator




I think your comment disagrees with the code, no? You're acting on markers which are inside the circle, it seems to me.
 
Naziru Gelajo
Ranch Hand
Posts: 186
1
Netbeans IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Paul Clapham wrote:



I think your comment disagrees with the code, no? You're acting on markers which are inside the circle, it seems to me.



Yah you are right, I did the opposite. I must be brain dead. UCSD assignments do that to you sir ROFL. Thank you very much. I'll work on the second part. Thanks once again Paul.
 
Are you okay? You look a little big. Maybe this tiny ad will help:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!