當前位置: 首頁>>代碼示例>>Java>>正文


Java MultiPolygon類代碼示例

本文整理匯總了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)))" );
}
 
開發者ID:realityforge,項目名稱:geolatte-geom-jpa,代碼行數:37,代碼來源:AbstractConverterTest.java

示例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)))" );
}
 
開發者ID:realityforge,項目名稱:geolatte-geom-eclipselink,代碼行數:37,代碼來源:AbstractGeolatteExtensionTest.java

示例3: getGeom

import org.geolatte.geom.MultiPolygon; //導入依賴的package包/類
public MultiPolygon getGeom()
{
  return _geom;
}
 
開發者ID:realityforge,項目名稱:geolatte-geom-jpa,代碼行數:5,代碼來源:PgMultiPolygonEntity.java

示例4: setGeom

import org.geolatte.geom.MultiPolygon; //導入依賴的package包/類
public void setGeom( final MultiPolygon geom )
{
  _geom = geom;
}
 
開發者ID:realityforge,項目名稱:geolatte-geom-jpa,代碼行數:5,代碼來源:PgMultiPolygonEntity.java

示例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" );
    }
  }
}
 
開發者ID:realityforge,項目名稱:geolatte-geom-eclipselink,代碼行數:58,代碼來源:PostgisConverter.java

示例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 );
          }
        }
      }
    }
  }
}
 
開發者ID:realityforge,項目名稱:geolatte-geom-eclipselink,代碼行數:71,代碼來源:GeolatteExtension.java


注:本文中的org.geolatte.geom.MultiPolygon類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。