public static FieldBridge buildSpatialBridge(Spatial spatial, String latitudeField, String longitudeField) {
FieldBridge bridge = null;
if ( spatial != null ) {
if ( spatial.spatialMode() == SpatialMode.GRID ) {
if ( latitudeField != null && longitudeField != null ) {
bridge = new SpatialFieldBridgeByQuadTree( spatial.topQuadTreeLevel(), spatial.bottomQuadTreeLevel(), latitudeField, longitudeField );
}
else {
bridge = new SpatialFieldBridgeByQuadTree( spatial.topQuadTreeLevel(), spatial.bottomQuadTreeLevel() );
}
}
else {
if ( latitudeField != null && longitudeField != null ) {
bridge = new SpatialFieldBridgeByRange( latitudeField, longitudeField );