本文整理汇总了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 );
}
}
}
}
}
}