本文整理匯總了Java中org.geolatte.geom.MultiPolygon類的典型用法代碼示例。如果您正苦於以下問題:Java MultiPolygon類的具體用法?Java MultiPolygon怎麽用?Java MultiPolygon使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
MultiPolygon類屬於org.geolatte.geom包,在下文中一共展示了MultiPolygon類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: doTests
import org.geolatte.geom.MultiPolygon; //導入依賴的package包/類
private void doTests( final boolean postgres )
throws Exception
{
testType( postgres,
postgres ? PgGeometryEntity.class : MsGeometryEntity.class,
Geometry.class,
"POINT ( 1 1 )" );
testType( postgres,
postgres ? PgGeometryCollectionEntity.class : MsGeometryCollectionEntity.class,
GeometryCollection.class,
"GEOMETRYCOLLECTION ( POINT ( 1 1 ) , POINT ( 1 1 ))" );
testType( postgres,
postgres ? PgPointEntity.class : MsPointEntity.class,
Point.class,
"POINT ( 1 1 )" );
testType( postgres,
postgres ? PgMultiPointEntity.class : MsMultiPointEntity.class,
MultiPoint.class,
"MULTIPOINT ( (100.0 0.0) , (101.0 1.0) )" );
testType( postgres,
postgres ? PgLineStringEntity.class : MsLineStringEntity.class,
LineString.class,
"LINESTRING ( 1 1, 2 1 )" );
testType( postgres,
postgres ? PgMultiLineStringEntity.class : MsMultiLineStringEntity.class,
MultiLineString.class,
"MULTILINESTRING ( ( 100.0 0.0, 101.0 1.0 ), ( 102.0 2.0, 103.0 3.0 ) )" );
testType( postgres,
postgres ? PgPolygonEntity.class : MsPolygonEntity.class,
Polygon.class,
"POLYGON((100.0 0.0, 101.0 0.0, 101.0 1.0, 100.0 0.0))" );
testType( postgres,
postgres ? PgMultiPolygonEntity.class : MsMultiPolygonEntity.class,
MultiPolygon.class,
"MULTIPOLYGON(((100.0 0.0, 101.0 0.0, 101.0 1.0, 100.0 0.0)))" );
}
示例2: doTests
import org.geolatte.geom.MultiPolygon; //導入依賴的package包/類
private void doTests( final boolean postgres )
throws Exception
{
testType( postgres,
TestGeometryEntity.class,
Geometry.class,
"POINT ( 1 1 )" );
testType( postgres,
TestGeometryCollectionEntity.class,
GeometryCollection.class,
"GEOMETRYCOLLECTION ( POINT ( 1 1 ) , POINT ( 1 1 ))" );
testType( postgres,
TestPointEntity.class,
Point.class,
"POINT ( 1 1 )" );
testType( postgres,
TestMultiPointEntity.class,
MultiPoint.class,
"MULTIPOINT ( (100.0 0.0) , (101.0 1.0) )" );
testType( postgres,
TestLineStringEntity.class,
LineString.class,
"LINESTRING ( 1 1, 2 1 )" );
testType( postgres,
TestMultiLineStringEntity.class,
MultiLineString.class,
"MULTILINESTRING ( ( 100.0 0.0, 101.0 1.0 ), ( 102.0 2.0, 103.0 3.0 ) )" );
testType( postgres,
TestPolygonEntity.class,
Polygon.class,
"POLYGON((100.0 0.0, 101.0 0.0, 101.0 1.0, 100.0 0.0))" );
testType( postgres,
TestMultiPolygonEntity.class,
MultiPolygon.class,
"MULTIPOLYGON(((100.0 0.0, 101.0 0.0, 101.0 1.0, 100.0 0.0)))" );
}
示例3: getGeom
import org.geolatte.geom.MultiPolygon; //導入依賴的package包/類
public MultiPolygon getGeom()
{
return _geom;
}
示例4: setGeom
import org.geolatte.geom.MultiPolygon; //導入依賴的package包/類
public void setGeom( final MultiPolygon geom )
{
_geom = geom;
}
示例5: initialize
import org.geolatte.geom.MultiPolygon; //導入依賴的package包/類
@Override
public void initialize( final DatabaseMapping mapping, final Session session )
{
final DatabaseField field;
if ( mapping instanceof DirectCollectionMapping )
{
field = ( (DirectCollectionMapping) mapping ).getDirectField();
}
else
{
field = mapping.getField();
}
field.setSqlType( java.sql.Types.OTHER );
if ( null == field.getTypeName() )
{
field.setTypeName( "geometry" );
}
if ( null == field.getColumnDefinition() )
{
final Field javaField = getJavaField( mapping, field );
final Class<?> javaFieldType = javaField.getType();
//TODO: Dervive the SRS from an annotation
//TODO: Dervive the M from an annotation
if ( Point.class == javaFieldType )
{
field.setColumnDefinition( "geometry(POINT,-1)" );
}
else if ( Polygon.class == javaFieldType )
{
field.setColumnDefinition( "geometry(POLYGON,-1)" );
}
else if ( LineString.class == javaFieldType )
{
field.setColumnDefinition( "geometry(LINESTRING,-1)" );
}
else if ( MultiPoint.class == javaFieldType )
{
field.setColumnDefinition( "geometry(MULTIPOINT,-1)" );
}
else if ( MultiPolygon.class == javaFieldType )
{
field.setColumnDefinition( "geometry(MULTIPOLYGON,-1)" );
}
else if ( MultiLineString.class == javaFieldType )
{
field.setColumnDefinition( "geometry(MULTILINESTRING,-1)" );
}
else if ( LinearRing.class == javaFieldType )
{
field.setColumnDefinition( "geometry(LINEARRING,-1)" );
}
else
{
field.setColumnDefinition( "geometry" );
}
}
}
示例6: preLogin
import org.geolatte.geom.MultiPolygon; //導入依賴的package包/類
@Override
public void preLogin( final SessionEvent event )
{
final Session session = event.getSession();
boolean isSqlServer = false;
boolean isPostgreSQL = false;
final String geomDriver = (String) session.getProperty( "geolatte.geom.driver" );
if ( null != geomDriver )
{
isSqlServer = geomDriver.equals( "sqlserver" );
isPostgreSQL = geomDriver.equals( "postgres" );
}
else
{
final String driver = (String) session.getProperty( "javax.persistence.jdbc.driver" );
if ( null != driver )
{
isSqlServer = driver.contains( ".jtds." );
isPostgreSQL = driver.contains( "org.postgresql." );
}
}
if ( !isSqlServer && !isPostgreSQL )
{
final String message =
"Unable to determine database type. Explicitly set jpa " +
"property 'geolatte.geom.driver' to 'sqlserver' or 'postgres'" ;
throw new IllegalStateException( message );
}
final Map<Class, ClassDescriptor> descriptorMap = session.getDescriptors();
// Walk through all descriptors...
for ( final Map.Entry<Class, ClassDescriptor> entry : descriptorMap.entrySet() )
{
final ClassDescriptor desc = entry.getValue();
final Vector<DatabaseMapping> mappings = desc.getMappings();
// walk through all mappings for some class...
for ( final DatabaseMapping mapping : mappings )
{
if ( mapping instanceof DirectToFieldMapping )
{
final DirectToFieldMapping dfm = (DirectToFieldMapping) mapping;
if ( isCandidateConverter( dfm ) )
{
final Class type = entry.getKey();
final String attributeName = dfm.getAttributeName();
final Field field = getField( type, attributeName );
final Class<?> fieldType = field.getType();
if ( Point.class == fieldType ||
Polygon.class == fieldType ||
LinearRing.class == fieldType ||
LineString.class == fieldType ||
MultiPoint.class == fieldType ||
MultiPolygon.class == fieldType ||
MultiLineString.class == fieldType ||
Geometry.class == fieldType ||
GeometryCollection.class == fieldType )
{
final Converter converter = isSqlServer ? new SqlServerConverter() : new PostgisConverter();
converter.initialize( mapping, session );
dfm.setConverter( converter );
}
}
}
}
}
}