当前位置: 首页>>代码示例>>Java>>正文


Java LineString类代码示例

本文整理汇总了Java中org.geolatte.geom.LineString的典型用法代码示例。如果您正苦于以下问题:Java LineString类的具体用法?Java LineString怎么用?Java LineString使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


LineString类属于org.geolatte.geom包,在下文中一共展示了LineString类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: doTests

import org.geolatte.geom.LineString; //导入依赖的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.LineString; //导入依赖的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.LineString; //导入依赖的package包/类
public LineString getGeom()
{
  return _geom;
}
 
开发者ID:realityforge,项目名称:geolatte-geom-jpa,代码行数:5,代码来源:PgLineStringEntity.java

示例4: setGeom

import org.geolatte.geom.LineString; //导入依赖的package包/类
public void setGeom( final LineString geom )
{
  _geom = geom;
}
 
开发者ID:realityforge,项目名称:geolatte-geom-jpa,代码行数:5,代码来源:PgLineStringEntity.java

示例5: initialize

import org.geolatte.geom.LineString; //导入依赖的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.LineString; //导入依赖的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

示例7: writeLineStringBody

import org.geolatte.geom.LineString; //导入依赖的package包/类
private void writeLineStringBody( final JsonGenerator g, final LineString lineString )
{
  writePointCollection( g, lineString.getPoints() );
}
 
开发者ID:realityforge,项目名称:jeo,代码行数:5,代码来源:GeoJsonWriter.java


注:本文中的org.geolatte.geom.LineString类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。