public static FieldBridge buildSpatialBridge(Spatial spatial, String latitudeField, String longitudeField) {
FieldBridge bridge = null;
if ( spatial != null ) {
if ( spatial.spatialMode() == SpatialMode.HASH ) {
if ( latitudeField != null && longitudeField != null ) {
bridge = new SpatialFieldBridgeByHash( spatial.topSpatialHashLevel(), spatial.bottomSpatialHashLevel(), latitudeField, longitudeField );
}
else {
bridge = new SpatialFieldBridgeByHash( spatial.topSpatialHashLevel(), spatial.bottomSpatialHashLevel() );
}
}
else {
if ( latitudeField != null && longitudeField != null ) {
bridge = new SpatialFieldBridgeByRange( latitudeField, longitudeField );