* Look in the database and create the QuadTree holding all the
* Locations.
*/
protected QuadTree createData() {
QuadTree qt = new QuadTree(90.0f, -180.0f, -90.0f, 180.0f, 100, 50f);
ByteRasterLocation loc;
byte bytearr[];
if (locationQueryString == null) {
return qt;
}
// Code for reading from DB and pushing it into QuadTree.
try {
if (jdbcDriver != null) {
Class.forName(getJdbcDriver());
}
Connection connection = DriverManager.getConnection(getJdbcString(),
getUserName(),
getUserPassword());
RawDataRecordSet gifdataRS = new RawDataRecordSet(connection, getPropertyPrefix(), props);
RecordSet locationdataRS = new RecordSet(connection, locationQueryString);
while (locationdataRS.next()) {
LocationData ld = new LocationData(locationdataRS);
if (Debug.debugging("location")) {
Debug.output("DBLocationHandler: location information:\n"
+ ld);
}
bytearr = gifdataRS.getRawData(ld.getGraphicName());
float lat = ld.getLatitude();
float lon = ld.getLongitude();
loc = new ByteRasterLocation(lat, lon, ld.getCityName(), bytearr);
loc.setLocationHandler(this);
// let the layer handler default set these
// initially...
loc.setShowName(isShowNames());
loc.setShowLocation(isShowLocations());
loc.setLocationPaint(getLocationColor());
loc.getLabel().setLinePaint(getNameColor());
loc.setDetails(ld.getCityName() + " is at lat: " + lat
+ ", lon: " + lon);
qt.put(lat, lon, loc);
}
locationdataRS.close();
connection.close();