Package viewer.base

Class DatabaseLayer

java.lang.Object
viewer.base.Layer
viewer.base.DatabaseLayer

public class DatabaseLayer
extends Layer
This class represents a layer enabling a database connection
Author:
Jan-Henrik Haunert
  • Field Summary

    Fields inherited from class viewer.base.Layer

    extent, mySymbolFactory
  • Constructor Summary

    Constructors 
    Constructor Description
    DatabaseLayer​(java.sql.Statement st, SymbolFactory factory, java.lang.String tablename, java.lang.String geocolumnname)  
  • Method Summary

    Modifier and Type Method Description
    protected java.util.List<Symbol> executeQuery​(java.lang.String query)
    The method sends the query to the database using the class attribute st and creates a List of Symbols from the ResultSet.
    java.lang.String getGeocolname()  
    int getSrid()  
    java.sql.Statement getSt()  
    java.lang.String getTablename()  
    java.util.List<Symbol> query​(Envelope searchEnv)
    Queries all symbols whose bounding boxes intersect the search envelope

    Methods inherited from class viewer.base.Layer

    getExtent, setExtent, toCachedLayer

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DatabaseLayer

      public DatabaseLayer​(java.sql.Statement st, SymbolFactory factory, java.lang.String tablename, java.lang.String geocolumnname)
      Parameters:
      st - statement for the execution of an SQL query
      factory - symbol factory object
      tablename - table name
      geocolumnname - column of the geometry
  • Method Details

    • query

      public java.util.List<Symbol> query​(Envelope searchEnv)
      Description copied from class: Layer
      Queries all symbols whose bounding boxes intersect the search envelope
      Specified by:
      query in class Layer
      Parameters:
      searchEnv - the search envelope
      Returns:
      found objects
    • executeQuery

      protected java.util.List<Symbol> executeQuery​(java.lang.String query)
      The method sends the query to the database using the class attribute st and creates a List of Symbols from the ResultSet. We assume that the geometry column that we want to visualize is queried with 'SELECT ST_asText(..) AS geom_wkt'.
      Parameters:
      query - The parameter String that is send to the database.
      Returns:
      mySymbols A List of Symbols that are returned by the database.
    • getSt

      public java.sql.Statement getSt()
    • getTablename

      public java.lang.String getTablename()
    • getGeocolname

      public java.lang.String getGeocolname()
    • getSrid

      public int getSrid()