idx int64 0 41.2k | question stringlengths 83 4.15k | target stringlengths 5 715 |
|---|---|---|
6,200 | public static ResultSet createGridPoints ( Connection connection , Value value , double deltaX , double deltaY ) throws SQLException { if ( value == null ) { return null ; } if ( value instanceof ValueString ) { GridRowSet gridRowSet = new GridRowSet ( connection , deltaX , deltaY , value . getString ( ) ) ; gridRowSet... | Create a regular grid of points using the first input value to compute the full extent . |
6,201 | public void exportTable ( Connection connection , String tableReference , File fileName , ProgressVisitor progress , String encoding ) throws SQLException , IOException { JsonWriteDriver jsonDriver = new JsonWriteDriver ( connection ) ; jsonDriver . write ( progress , tableReference , fileName , encoding ) ; } | Save a table or a query to JSON file |
6,202 | private int getOrAppendVertex ( Coordinate newCoord , Quadtree ptQuad ) { Envelope queryEnv = new Envelope ( newCoord ) ; queryEnv . expandBy ( epsilon ) ; QuadTreeVisitor visitor = new QuadTreeVisitor ( epsilon , newCoord ) ; try { ptQuad . query ( queryEnv , visitor ) ; } catch ( RuntimeException ex ) { } if ( visito... | Compute unique index for the coordinate Index count from 0 to n If the new vertex is closer than distMerge with an another vertex then it will return its index . |
6,203 | public Triple [ ] generateTriangleNeighbors ( Geometry geometry ) throws TopologyException { inputTriangles = geometry ; CoordinateSequenceDimensionFilter sequenceDimensionFilter = new CoordinateSequenceDimensionFilter ( ) ; geometry . apply ( sequenceDimensionFilter ) ; hasZ = sequenceDimensionFilter . getDimension ( ... | Given the input TIN construct a graph of triangle . |
6,204 | public static void registerGeometryType ( Connection connection ) throws SQLException { Statement st = connection . createStatement ( ) ; for ( DomainInfo domainInfo : getBuiltInsType ( ) ) { st . execute ( "CREATE DOMAIN IF NOT EXISTS " + domainInfo . getDomainName ( ) + " AS " + GEOMETRY_BASE_TYPE + "(" + domainInfo ... | Register geometry type in an OSGi environment |
6,205 | public static void registerSpatialTables ( Connection connection ) throws SQLException { Statement st = connection . createStatement ( ) ; st . execute ( "drop view if exists geometry_columns" ) ; st . execute ( "create view geometry_columns as select TABLE_CATALOG f_table_catalog,TABLE_SCHEMA f_table_schema,TABLE_NAME... | Register view in order to create GEOMETRY_COLUMNS standard table . |
6,206 | public static void unRegisterGeometryType ( Connection connection ) throws SQLException { Statement st = connection . createStatement ( ) ; DomainInfo [ ] domainInfos = getBuiltInsType ( ) ; for ( DomainInfo domainInfo : domainInfos ) { st . execute ( "DROP DOMAIN IF EXISTS " + domainInfo . getDomainName ( ) ) ; } } | Release geometry type |
6,207 | private static String getStringProperty ( Function function , String propertyKey ) { Object value = function . getProperty ( propertyKey ) ; return value instanceof String ? ( String ) value : "" ; } | Return a string property of the function |
6,208 | private static boolean getBooleanProperty ( Function function , String propertyKey , boolean defaultValue ) { Object value = function . getProperty ( propertyKey ) ; return value instanceof Boolean ? ( Boolean ) value : defaultValue ; } | Return a boolean property of the function |
6,209 | public static String getAlias ( Function function ) { String functionAlias = getStringProperty ( function , Function . PROP_NAME ) ; if ( ! functionAlias . isEmpty ( ) ) { return functionAlias ; } return function . getClass ( ) . getSimpleName ( ) ; } | Return the alias name of the function |
6,210 | public static void unRegisterFunction ( Statement st , Function function ) throws SQLException { String functionAlias = getStringProperty ( function , Function . PROP_NAME ) ; if ( functionAlias . isEmpty ( ) ) { functionAlias = function . getClass ( ) . getSimpleName ( ) ; } st . execute ( "DROP ALIAS IF EXISTS " + fu... | Remove the specified function from the provided DataBase connection |
6,211 | private static void registerH2GISFunctions ( Connection connection , String packagePrepend ) throws SQLException { Statement st = connection . createStatement ( ) ; for ( Function function : getBuiltInsFunctions ( ) ) { try { registerFunction ( st , function , packagePrepend ) ; } catch ( SQLException ex ) { ex . print... | Register all H2GIS functions |
6,212 | public static void unRegisterH2GISFunctions ( Connection connection ) throws SQLException { Statement st = connection . createStatement ( ) ; for ( Function function : getBuiltInsFunctions ( ) ) { unRegisterFunction ( st , function ) ; } unRegisterGeometryType ( connection ) ; } | Unregister spatial type and H2GIS functions from the current connection . |
6,213 | public static String isValidReason ( Geometry geometry , int flag ) { if ( geometry != null ) { if ( flag == 0 ) { return validReason ( geometry , false ) ; } else if ( flag == 1 ) { return validReason ( geometry , true ) ; } else { throw new IllegalArgumentException ( "Supported arguments are 0 or 1." ) ; } } return "... | Returns text stating whether a geometry is valid . If not returns a reason why . |
6,214 | public static Geometry polygonize ( Geometry geometry ) { if ( geometry == null ) { return null ; } Polygonizer polygonizer = new Polygonizer ( ) ; polygonizer . add ( geometry ) ; Collection pols = polygonizer . getPolygons ( ) ; if ( pols . isEmpty ( ) ) { return null ; } return FACTORY . createMultiPolygon ( Geometr... | Creates a GeometryCollection containing possible polygons formed from the constituent linework of a set of geometries . |
6,215 | private void computeMaxDistance ( ) { HashSet < Coordinate > coordinatesA = new HashSet < Coordinate > ( Arrays . asList ( geomA . convexHull ( ) . getCoordinates ( ) ) ) ; Geometry fullHull = geomA . getFactory ( ) . createGeometryCollection ( new Geometry [ ] { geomA , geomB } ) . convexHull ( ) ; maxDistanceFilter =... | Compute the max distance |
6,216 | public Double getDistance ( ) { if ( geomA == null || geomB == null ) { return null ; } if ( geomA . isEmpty ( ) || geomB . isEmpty ( ) ) { return 0.0 ; } if ( geomA . equals ( geomB ) ) { sameGeom = true ; } if ( maxDistanceFilter == null ) { computeMaxDistance ( ) ; } return maxDistanceFilter . getDistance ( ) ; } | Return the max distance |
6,217 | public Coordinate [ ] getCoordinatesDistance ( ) { if ( geomA == null || geomB == null ) { return null ; } if ( geomA . isEmpty ( ) || geomB . isEmpty ( ) ) { return null ; } if ( geomA . equals ( geomB ) ) { sameGeom = true ; } if ( maxDistanceFilter == null ) { computeMaxDistance ( ) ; } return maxDistanceFilter . ge... | Return the two coordinates to build the max distance line |
6,218 | public static Geometry toGeometry ( String gmlFile , int srid ) throws SAXException , IOException , ParserConfigurationException { if ( gmlFile == null ) { return null ; } if ( gf == null ) { gf = new GeometryFactory ( new PrecisionModel ( ) , srid ) ; } GMLReader gMLReader = new GMLReader ( ) ; return gMLReader . read... | Read the GML representation with a specified SRID |
6,219 | public void write ( ProgressVisitor progress , ResultSet rs , File fileName , String encoding ) throws SQLException , IOException { if ( FileUtil . isExtensionWellFormated ( fileName , "geojson" ) ) { FileOutputStream fos = null ; JsonEncoding jsonEncoding = JsonEncoding . UTF8 ; if ( encoding != null ) { try { jsonEnc... | Write a resulset to a geojson file |
6,220 | private void writeFeature ( JsonGenerator jsonGenerator , ResultSet rs , int geoFieldIndex ) throws IOException , SQLException { jsonGenerator . writeStartObject ( ) ; jsonGenerator . writeStringField ( "type" , "Feature" ) ; writeGeometry ( ( Geometry ) rs . getObject ( geoFieldIndex ) , jsonGenerator ) ; writePropert... | Write a GeoJSON feature . |
6,221 | private void cacheMetadata ( ResultSetMetaData resultSetMetaData ) throws SQLException { cachedColumnNames = new LinkedHashMap < String , Integer > ( ) ; for ( int i = 1 ; i <= resultSetMetaData . getColumnCount ( ) ; i ++ ) { final String fieldTypeName = resultSetMetaData . getColumnTypeName ( i ) ; if ( ! fieldTypeNa... | Cache the column name and its index . |
6,222 | private void writeGeometry ( Geometry geom , JsonGenerator gen ) throws IOException { if ( geom != null ) { gen . writeObjectFieldStart ( "geometry" ) ; if ( geom instanceof Point ) { write ( ( Point ) geom , gen ) ; } else if ( geom instanceof MultiPoint ) { write ( ( MultiPoint ) geom , gen ) ; } else if ( geom insta... | Write a JTS geometry to its GeoJSON geometry representation . |
6,223 | private void writeProperties ( JsonGenerator jsonGenerator , ResultSet rs ) throws IOException , SQLException { if ( columnCountProperties != - 1 ) { jsonGenerator . writeObjectFieldStart ( "properties" ) ; for ( Map . Entry < String , Integer > entry : cachedColumnNames . entrySet ( ) ) { String string = entry . getKe... | Write the GeoJSON properties . |
6,224 | public boolean isSupportedPropertyType ( int sqlTypeId , String sqlTypeName ) throws SQLException { switch ( sqlTypeId ) { case Types . BOOLEAN : case Types . DOUBLE : case Types . FLOAT : case Types . INTEGER : case Types . BIGINT : case Types . SMALLINT : case Types . DATE : case Types . VARCHAR : case Types . NCHAR ... | Return true is the SQL type is supported by the GeoJSON driver . |
6,225 | private void writeCRS ( JsonGenerator jsonGenerator , String [ ] authorityAndSRID ) throws IOException { if ( authorityAndSRID [ 1 ] != null ) { jsonGenerator . writeObjectFieldStart ( "crs" ) ; jsonGenerator . writeStringField ( "type" , "name" ) ; jsonGenerator . writeObjectFieldStart ( "properties" ) ; StringBuilder... | Write the CRS in the geojson |
6,226 | private void writeArray ( JsonGenerator jsonGenerator , Object [ ] array , boolean firstInHierarchy ) throws IOException , SQLException { if ( ! firstInHierarchy ) { jsonGenerator . writeStartArray ( ) ; } for ( int i = 0 ; i < array . length ; i ++ ) { if ( array [ i ] instanceof Integer ) { jsonGenerator . writeNumbe... | Write the array in the geojson |
6,227 | public static Geometry singleSideBuffer ( Geometry geometry , double distance ) { if ( geometry == null ) { return null ; } return computeSingleSideBuffer ( geometry , distance , new BufferParameters ( ) ) ; } | Compute a single side buffer with default parameters |
6,228 | private static Geometry computeSingleSideBuffer ( Geometry geometry , double distance , BufferParameters bufferParameters ) { bufferParameters . setSingleSided ( true ) ; return BufferOp . bufferOp ( geometry , distance , bufferParameters ) ; } | Compute the buffer |
6,229 | public static Boolean geomEquals ( Geometry a , Geometry b ) { if ( a == null || b == null ) { return null ; } return a . equals ( b ) ; } | Return true if Geometry A is equal to Geometry B |
6,230 | private void addGeometry ( Geometry geom ) { if ( geom != null ) { if ( geom instanceof GeometryCollection ) { List < Geometry > toUnitTmp = new ArrayList < Geometry > ( geom . getNumGeometries ( ) ) ; for ( int i = 0 ; i < geom . getNumGeometries ( ) ; i ++ ) { toUnitTmp . add ( geom . getGeometryN ( i ) ) ; feedDim (... | Add geometry into an array to accumulate |
6,231 | public void exportTable ( Connection connection , String tableReference , File fileName , ProgressVisitor progress , String encoding ) throws SQLException , IOException { GeoJsonWriteDriver geoJsonDriver = new GeoJsonWriteDriver ( connection ) ; geoJsonDriver . write ( progress , tableReference , fileName , encoding ) ... | Export a table or a query to a geojson file |
6,232 | public void startElement ( String uri , String localName , String qName , Attributes attributes ) throws SAXException { if ( localName . compareToIgnoreCase ( "osm" ) == 0 ) { version = attributes . getValue ( GPXTags . VERSION ) ; } else if ( localName . compareToIgnoreCase ( "node" ) == 0 ) { totalNode ++ ; } else if... | Fires whenever an XML start markup is encountered . It indicates which version of osm file is to be parsed . |
6,233 | public static Geometry addPoint ( Geometry geometry , Point point ) throws SQLException { return addPoint ( geometry , point , PRECISION ) ; } | Returns a new geometry based on an existing one with a specific point as a new vertex . A default distance 10E - 6 is used to snap the input point . |
6,234 | public static Geometry addPoint ( Geometry geometry , Point point , double tolerance ) throws SQLException { if ( geometry == null || point == null ) { return null ; } if ( geometry instanceof MultiPoint ) { return insertVertexInMultipoint ( geometry , point ) ; } else if ( geometry instanceof LineString ) { return ins... | Returns a new geometry based on an existing one with a specific point as a new vertex . |
6,235 | private static Geometry insertVertexInMultipoint ( Geometry g , Point vertexPoint ) { ArrayList < Point > geoms = new ArrayList < Point > ( ) ; for ( int i = 0 ; i < g . getNumGeometries ( ) ; i ++ ) { Point geom = ( Point ) g . getGeometryN ( i ) ; geoms . add ( geom ) ; } geoms . add ( FACTORY . createPoint ( new Coo... | Adds a Point into a MultiPoint geometry . |
6,236 | private static Polygon insertVertexInPolygon ( Polygon polygon , Point vertexPoint , double tolerance ) throws SQLException { Polygon geom = polygon ; LineString linearRing = polygon . getExteriorRing ( ) ; int index = - 1 ; for ( int i = 0 ; i < polygon . getNumInteriorRing ( ) ; i ++ ) { double distCurr = computeDist... | Adds a vertex into a Polygon with a given tolerance . |
6,237 | private static double computeDistance ( Geometry geometry , Point vertexPoint , double tolerance ) { DistanceOp distanceOp = new DistanceOp ( geometry , vertexPoint , tolerance ) ; return distanceOp . distance ( ) ; } | Return minimum distance between a geometry and a point . |
6,238 | private static LinearRing insertVertexInLinearRing ( LineString lineString , Point vertexPoint , double tolerance ) { GeometryLocation geomLocation = EditUtilities . getVertexToSnap ( lineString , vertexPoint , tolerance ) ; if ( geomLocation != null ) { Coordinate [ ] coords = lineString . getCoordinates ( ) ; int ind... | Adds a vertex into a LinearRing with a given tolerance . |
6,239 | public static void openFile ( Connection connection , String fileName , String tableName ) throws SQLException { String ext = fileName . substring ( fileName . lastIndexOf ( '.' ) + 1 , fileName . length ( ) ) ; final boolean isH2 = JDBCUtilities . isH2DataBase ( connection . getMetaData ( ) ) ; for ( DriverDef driverD... | Create a new table |
6,240 | public static void exportTable ( Connection connection , String fileName , String tableReference , String encoding ) throws IOException , SQLException { SHPDriverFunction shpDriverFunction = new SHPDriverFunction ( ) ; shpDriverFunction . exportTable ( connection , tableReference , URIUtilities . fileFromString ( fileN... | Read a table and write it into a shape file . |
6,241 | public static Geometry force ( Geometry geom , int dimension ) { if ( geom instanceof Point ) { return gf . createPoint ( convertSequence ( geom . getCoordinates ( ) , dimension ) ) ; } else if ( geom instanceof LineString ) { return gf . createLineString ( convertSequence ( geom . getCoordinates ( ) , dimension ) ) ; ... | Force the dimension of the geometry and update correctly the coordinate dimension |
6,242 | public static GeometryCollection convert ( GeometryCollection gc , int dimension ) { int nb = gc . getNumGeometries ( ) ; final Geometry [ ] geometries = new Geometry [ nb ] ; for ( int i = 0 ; i < nb ; i ++ ) { geometries [ i ] = force ( gc . getGeometryN ( i ) , dimension ) ; } return gf . createGeometryCollection ( ... | Force the dimension of the GeometryCollection and update correctly the coordinate dimension |
6,243 | public static MultiPolygon convert ( MultiPolygon multiPolygon , int dimension ) { int nb = multiPolygon . getNumGeometries ( ) ; final Polygon [ ] pl = new Polygon [ nb ] ; for ( int i = 0 ; i < nb ; i ++ ) { pl [ i ] = GeometryCoordinateDimension . convert ( ( Polygon ) multiPolygon . getGeometryN ( i ) , dimension )... | Force the dimension of the MultiPolygon and update correctly the coordinate dimension |
6,244 | public static MultiLineString convert ( MultiLineString multiLineString , int dimension ) { int nb = multiLineString . getNumGeometries ( ) ; final LineString [ ] ls = new LineString [ nb ] ; for ( int i = 0 ; i < nb ; i ++ ) { ls [ i ] = GeometryCoordinateDimension . convert ( ( LineString ) multiLineString . getGeome... | Force the dimension of the MultiLineString and update correctly the coordinate dimension |
6,245 | public static Polygon convert ( Polygon polygon , int dimension ) { LinearRing shell = GeometryCoordinateDimension . convert ( polygon . getExteriorRing ( ) , dimension ) ; int nbOfHoles = polygon . getNumInteriorRing ( ) ; final LinearRing [ ] holes = new LinearRing [ nbOfHoles ] ; for ( int i = 0 ; i < nbOfHoles ; i ... | Force the dimension of the Polygon and update correctly the coordinate dimension |
6,246 | public static LinearRing convert ( LineString lineString , int dimension ) { return gf . createLinearRing ( convertSequence ( lineString . getCoordinates ( ) , dimension ) ) ; } | Force the dimension of the LineString and update correctly the coordinate dimension |
6,247 | public static LinearRing convert ( LinearRing linearRing , int dimension ) { return gf . createLinearRing ( convertSequence ( linearRing . getCoordinates ( ) , dimension ) ) ; } | Force the dimension of the LinearRing and update correctly the coordinate dimension |
6,248 | private static CoordinateArraySequence convertSequence ( Coordinate [ ] cs , int dimension ) { for ( int i = 0 ; i < cs . length ; i ++ ) { Coordinate coord = cs [ i ] ; switch ( dimension ) { case 2 : coord . z = Double . NaN ; cs [ i ] = coord ; break ; case 3 : { double z = coord . z ; if ( Double . isNaN ( z ) ) { ... | Create a new CoordinateArraySequence and update its dimension |
6,249 | public static Double computeCompacity ( Geometry geom ) { if ( geom == null ) { return null ; } if ( geom instanceof Polygon ) { final double circleRadius = Math . sqrt ( geom . getArea ( ) / Math . PI ) ; final double circleCurcumference = 2 * Math . PI * circleRadius ; return circleCurcumference / geom . getLength ( ... | Returns the compactness ratio of the given polygon |
6,250 | public static Double st3darea ( Geometry geometry ) { if ( geometry == null ) { return null ; } double area = 0 ; for ( int idPoly = 0 ; idPoly < geometry . getNumGeometries ( ) ; idPoly ++ ) { Geometry subGeom = geometry . getGeometryN ( idPoly ) ; if ( subGeom instanceof Polygon ) { area += compute3DArea ( ( Polygon ... | Compute the 3D area of a polygon a geometrycollection that contains polygons |
6,251 | private static Double compute3DArea ( Polygon geometry ) { DelaunayData delaunayData = new DelaunayData ( ) ; delaunayData . put ( geometry , DelaunayData . MODE . TESSELLATION ) ; delaunayData . triangulate ( ) ; return delaunayData . get3DArea ( ) ; } | Compute the 3D area of a polygon |
6,252 | public static Geometry setSRID ( Geometry geometry , Integer srid ) throws IllegalArgumentException { if ( geometry == null ) { return null ; } if ( srid == null ) { throw new IllegalArgumentException ( "The SRID code cannot be null." ) ; } Geometry geom = geometry . copy ( ) ; geom . setSRID ( srid ) ; return geom ; } | Set a new SRID to the geometry |
6,253 | public static void writeGeoJson ( Connection connection , String fileName , String tableReference , String encoding ) throws IOException , SQLException { JsonDriverFunction jsonDriver = new JsonDriverFunction ( ) ; jsonDriver . exportTable ( connection , tableReference , URIUtilities . fileFromString ( fileName ) , new... | Write the JSON file . |
6,254 | public static int geometryTypeFromConstraint ( String constraint , int numericPrecision ) { if ( constraint . isEmpty ( ) && numericPrecision > GeometryTypeCodes . GEOMETRYZM ) { return GeometryTypeCodes . GEOMETRY ; } if ( numericPrecision <= GeometryTypeCodes . GEOMETRYZM ) { return numericPrecision ; } Matcher match... | Convert H2 constraint string into a OGC geometry type index . |
6,255 | public static String getQuestionMark ( int count ) { StringBuilder qMark = new StringBuilder ( ) ; for ( int i = 0 ; i < count ; i ++ ) { if ( i > 0 ) { qMark . append ( ", " ) ; } qMark . append ( "?" ) ; } return qMark . toString ( ) ; } | Generate the concatenation of ? characters . Used by PreparedStatement . |
6,256 | public static String getSQLColumnTypes ( DbaseFileHeader header , boolean isH2Database ) throws IOException { StringBuilder stringBuilder = new StringBuilder ( ) ; for ( int idColumn = 0 ; idColumn < header . getNumFields ( ) ; idColumn ++ ) { if ( idColumn > 0 ) { stringBuilder . append ( ", " ) ; } String fieldName =... | Return SQL Columns declaration |
6,257 | public static DbaseFileHeader dBaseHeaderFromMetaData ( ResultSetMetaData metaData , List < Integer > retainedColumns ) throws SQLException { DbaseFileHeader dbaseFileHeader = new DbaseFileHeader ( ) ; for ( int fieldId = 1 ; fieldId <= metaData . getColumnCount ( ) ; fieldId ++ ) { final String fieldTypeName = metaDat... | Create a DBF header from the columns specified in parameter . |
6,258 | public static Geometry removePoint ( Geometry geometry , Polygon polygon ) throws SQLException { if ( geometry == null ) { return null ; } GeometryEditor localGeometryEditor = new GeometryEditor ( ) ; PolygonDeleteVertexOperation localBoxDeleteVertexOperation = new PolygonDeleteVertexOperation ( geometry . getFactory (... | Remove all vertices that are located within a polygon |
6,259 | public static Map < String , String > getQueryKeyValuePairs ( URI uri ) throws UnsupportedEncodingException { Map < String , String > queryParameters = new HashMap < String , String > ( ) ; String query = uri . getRawQuery ( ) ; if ( query == null ) { try { uri = URI . create ( uri . getRawSchemeSpecificPart ( ) ) ; qu... | Read the Query part of an URI . |
6,260 | public static String getConcatenatedParameters ( Map < String , String > parameters , String ... keys ) { StringBuilder keyValues = new StringBuilder ( ) ; for ( String key : keys ) { String value = parameters . get ( key . toLowerCase ( ) . trim ( ) ) ; if ( value != null ) { if ( keyValues . length ( ) != 0 ) { keyVa... | Create the Query part of an URI |
6,261 | public static URI relativize ( URI base , URI target ) { if ( ! base . getScheme ( ) . equals ( target . getScheme ( ) ) ) { return target ; } StringBuilder rel = new StringBuilder ( ) ; String path = base . getPath ( ) ; String separator = "/" ; StringTokenizer tokenizer = new StringTokenizer ( target . getPath ( ) , ... | Enhanced version of URI . relativize the target can now be in parent folder of base URI . |
6,262 | public static File fileFromString ( String fileName ) { try { return new File ( new URI ( fileName ) . getPath ( ) ) ; } catch ( URISyntaxException ex ) { return new File ( fileName ) ; } } | Get a File from the specified file name . |
6,263 | private static Geometry shadowLine ( LineString lineString , double [ ] shadowOffset , GeometryFactory factory , boolean doUnion ) { Coordinate [ ] coords = lineString . getCoordinates ( ) ; Collection < Polygon > shadows = new ArrayList < Polygon > ( ) ; createShadowPolygons ( shadows , coords , shadowOffset , factory... | Compute the shadow for a linestring |
6,264 | private static Geometry shadowPolygon ( Polygon polygon , double [ ] shadowOffset , GeometryFactory factory , boolean doUnion ) { Coordinate [ ] shellCoords = polygon . getExteriorRing ( ) . getCoordinates ( ) ; Collection < Polygon > shadows = new ArrayList < Polygon > ( ) ; createShadowPolygons ( shadows , shellCoord... | Compute the shadow for a polygon |
6,265 | private static Geometry shadowPoint ( Point point , double [ ] shadowOffset , GeometryFactory factory ) { Coordinate startCoord = point . getCoordinate ( ) ; Coordinate offset = moveCoordinate ( startCoord , shadowOffset ) ; if ( offset . distance ( point . getCoordinate ( ) ) < 10E-3 ) { return point ; } else { startC... | Compute the shadow for a point |
6,266 | public static double [ ] shadowOffset ( double azimuth , double altitude , double height ) { double spread = 1 / Math . tan ( altitude ) ; return new double [ ] { - height * spread * Math . sin ( azimuth ) , - height * spread * Math . cos ( azimuth ) } ; } | Return the shadow offset in X and Y directions |
6,267 | private static Coordinate moveCoordinate ( Coordinate inputCoordinate , double [ ] shadowOffset ) { return new Coordinate ( inputCoordinate . x + shadowOffset [ 0 ] , inputCoordinate . y + shadowOffset [ 1 ] , 0 ) ; } | Move the input coordinate according X and Y offset |
6,268 | private static void createShadowPolygons ( Collection < Polygon > shadows , Coordinate [ ] coordinates , double [ ] shadow , GeometryFactory factory ) { for ( int i = 1 ; i < coordinates . length ; i ++ ) { Coordinate startCoord = coordinates [ i - 1 ] ; Coordinate endCoord = coordinates [ i ] ; Coordinate nextEnd = mo... | Create and collect shadow polygons . |
6,269 | public void exportTable ( Connection connection , String tableReference , File fileName , ProgressVisitor progress , String csvOptions ) throws SQLException , IOException { String regex = ".*(?i)\\b(select|from)\\b.*" ; Pattern pattern = Pattern . compile ( regex ) ; Matcher matcher = pattern . matcher ( tableReference... | Export a table or a query to a CSV file |
6,270 | public static GeometryCollection createDT ( Geometry geometry , int flag ) throws SQLException { if ( geometry != null ) { DelaunayTriangulationBuilder triangulationBuilder = new DelaunayTriangulationBuilder ( ) ; triangulationBuilder . setSites ( geometry ) ; if ( flag == 0 ) { return getTriangles ( geometry . getFact... | Build a delaunay triangulation based on all coordinates of the geometry |
6,271 | public static String toKml ( Geometry geometry ) throws SQLException { StringBuilder sb = new StringBuilder ( ) ; KMLGeometry . toKMLGeometry ( geometry , sb ) ; return sb . toString ( ) ; } | Generate a KML geometry |
6,272 | public static String toKml ( Geometry geometry , boolean extrude , int altitudeModeEnum ) throws SQLException { StringBuilder sb = new StringBuilder ( ) ; if ( extrude ) { KMLGeometry . toKMLGeometry ( geometry , ExtrudeMode . TRUE , altitudeModeEnum , sb ) ; } else { KMLGeometry . toKMLGeometry ( geometry , ExtrudeMod... | Generates a KML geometry . Specifies the extrude and altitudeMode . |
6,273 | public static int getGeometryTypeFromGeometry ( Geometry geometry ) { Integer sfsGeomCode = GEOM_TYPE_TO_SFS_CODE . get ( geometry . getGeometryType ( ) . toLowerCase ( ) ) ; if ( sfsGeomCode == null ) { return GeometryTypeCodes . GEOMETRY ; } else { return sfsGeomCode ; } } | Return the sfs geometry type identifier of the provided Geometry |
6,274 | public static int getGeometryType ( Connection connection , TableLocation location , String fieldName ) throws SQLException { if ( fieldName == null || fieldName . isEmpty ( ) ) { List < String > geometryFields = getGeometryFields ( connection , location ) ; if ( geometryFields . isEmpty ( ) ) { throw new SQLException ... | Return the sfs geometry type identifier of the provided field of the provided table . |
6,275 | public static Map < String , Integer > getGeometryTypes ( Connection connection , TableLocation location ) throws SQLException { Map < String , Integer > map = new HashMap < > ( ) ; ResultSet geomResultSet = getGeometryColumnsView ( connection , location . getCatalog ( ) , location . getSchema ( ) , location . getTable... | Returns a map containing the field names as key and the SFS geometry type as value from the given table . |
6,276 | public static Envelope getTableEnvelope ( Connection connection , TableLocation location , String geometryField ) throws SQLException { if ( geometryField == null || geometryField . isEmpty ( ) ) { List < String > geometryFields = getGeometryFields ( connection , location ) ; if ( geometryFields . isEmpty ( ) ) { throw... | Merge the bounding box of all geometries inside the provided table . |
6,277 | public static PreparedStatement prepareInformationSchemaStatement ( Connection connection , String catalog , String schema , String table , String informationSchemaTable , String endQuery , String catalog_field , String schema_field , String table_field ) throws SQLException { Integer catalogIndex = null ; Integer sche... | For table containing catalog schema and table name this function create a prepared statement with a filter on this combination . |
6,278 | public static PreparedStatement prepareInformationSchemaStatement ( Connection connection , String catalog , String schema , String table , String informationSchemaTable , String endQuery ) throws SQLException { return prepareInformationSchemaStatement ( connection , catalog , schema , table , informationSchemaTable , ... | For table containing catalog schema and table name this function create a prepared statement with a filter on this combination . Use f_table_catalog f_table_schema f_table_name as field names . |
6,279 | public static List < String > getGeometryFields ( ResultSet resultSet ) throws SQLException { List < String > fieldsName = new LinkedList < > ( ) ; ResultSetMetaData meta = resultSet . getMetaData ( ) ; int columnCount = meta . getColumnCount ( ) ; for ( int i = 1 ; i <= columnCount ; i ++ ) { if ( meta . getColumnType... | Find geometry fields name of a resultSet . |
6,280 | public static boolean hasGeometryField ( ResultSet resultSet ) throws SQLException { ResultSetMetaData meta = resultSet . getMetaData ( ) ; int columnCount = meta . getColumnCount ( ) ; for ( int i = 1 ; i <= columnCount ; i ++ ) { if ( meta . getColumnTypeName ( i ) . equalsIgnoreCase ( "geometry" ) ) { return true ; ... | Check if the ResultSet contains a geometry field |
6,281 | public static Envelope getResultSetEnvelope ( ResultSet resultSet ) throws SQLException { List < String > geometryFields = getGeometryFields ( resultSet ) ; if ( geometryFields . isEmpty ( ) ) { throw new SQLException ( "This ResultSet doesn't contain any geometry field." ) ; } else { return getResultSetEnvelope ( resu... | Compute the full extend of a ResultSet using the first geometry field . If the ResultSet does not contain any geometry field throw an exception |
6,282 | public static Envelope getResultSetEnvelope ( ResultSet resultSet , String fieldName ) throws SQLException { Envelope aggregatedEnvelope = null ; while ( resultSet . next ( ) ) { Geometry geom = ( Geometry ) resultSet . getObject ( fieldName ) ; if ( aggregatedEnvelope != null ) { aggregatedEnvelope . expandToInclude (... | Compute the full extend of a ResultSet using a specified geometry field . If the ResultSet does not contain this geometry field throw an exception |
6,283 | public static int getSRID ( Connection connection , TableLocation table ) throws SQLException { ResultSet geomResultSet = getGeometryColumnsView ( connection , table . getCatalog ( ) , table . getSchema ( ) , table . getTable ( ) ) ; int srid = 0 ; while ( geomResultSet . next ( ) ) { srid = geomResultSet . getInt ( "s... | Return the SRID of the first geometry column of the input table |
6,284 | public static void addTableSRIDConstraint ( Connection connection , TableLocation tableLocation , int srid ) throws SQLException { if ( srid > 0 ) { connection . createStatement ( ) . execute ( String . format ( "ALTER TABLE %s ADD CHECK ST_SRID(the_geom)=%d" , tableLocation . toString ( ) , srid ) ) ; } } | Alter a table to add a SRID constraint . The srid must be greater than zero . |
6,285 | public MockInternetGateway createInternetGateway ( ) { MockInternetGateway ret = new MockInternetGateway ( ) ; ret . setInternetGatewayId ( "InternetGateway-" + UUID . randomUUID ( ) . toString ( ) . substring ( 0 , INTERNETGATEWAY_ID_POSTFIX_LENGTH ) ) ; allMockInternetGateways . put ( ret . getInternetGatewayId ( ) ,... | Create the mock InternetGateway . |
6,286 | public MockInternetGateway attachInternetGateway ( final String internetgatewayId , final String vpcId ) { if ( internetgatewayId == null ) { return null ; } MockInternetGateway ret = allMockInternetGateways . get ( internetgatewayId ) ; if ( ret != null ) { MockInternetGatewayAttachmentType internetGatewayAttachmentTy... | Attach the mock InternetGateway . |
6,287 | public MockInternetGateway deleteInternetGateway ( final String internetgatewayId ) { if ( internetgatewayId != null && allMockInternetGateways . containsKey ( internetgatewayId ) ) { return allMockInternetGateways . remove ( internetgatewayId ) ; } return null ; } | Delete InternetGateway . |
6,288 | private static long getMsFromProperty ( final String propertyName , final String propertyNameInSeconds ) { String property = PropertiesUtils . getProperty ( propertyName ) ; if ( property != null ) { return Long . parseLong ( property ) ; } return Integer . parseInt ( PropertiesUtils . getProperty ( propertyNameInSecon... | Get millisecs from properties . |
6,289 | public final void initializeInternalTimer ( ) { if ( ! internalTimerInitialized ) { TimerTask internalTimerTask = new TimerTask ( ) { public void run ( ) { if ( terminated ) { running = false ; booting = false ; stopping = false ; pubDns = null ; this . cancel ( ) ; onTerminated ( ) ; return ; } if ( running ) { if ( b... | Start scheduling the internal timer that controls the behaviors and states of this mock ec2 instance . |
6,290 | public final boolean start ( ) { if ( running || booting || stopping || terminated ) { return false ; } else { booting = true ; running = true ; onStarted ( ) ; return true ; } } | Start a stopped mock ec2 instance . |
6,291 | public final boolean stop ( ) { if ( booting || running ) { stopping = true ; booting = false ; onStopping ( ) ; return true ; } else { return false ; } } | Stop this ec2 instance . |
6,292 | public final InstanceState getInstanceState ( ) { return isTerminated ( ) ? InstanceState . TERMINATED : ( isBooting ( ) ? InstanceState . PENDING : ( isStopping ( ) ? InstanceState . STOPPING : ( isRunning ( ) ? InstanceState . RUNNING : InstanceState . STOPPED ) ) ) ; } | Get state of this mock ec2 instance . |
6,293 | public static List < Instance > describeAllInstances ( ) { AWSCredentials credentials = new BasicAWSCredentials ( "foo" , "bar" ) ; AmazonEC2Client amazonEC2Client = new AmazonEC2Client ( credentials ) ; String ec2Endpoint = "http://localhost:8000/aws-mock/ec2-endpoint/" ; amazonEC2Client . setEndpoint ( ec2Endpoint ) ... | Describe all mock instances within aws - mock . |
6,294 | public MockSubnet createSubnet ( final String cidrBlock , final String vpcId ) { MockSubnet ret = new MockSubnet ( ) ; ret . setCidrBlock ( cidrBlock ) ; ret . setSubnetId ( "subnet-" + UUID . randomUUID ( ) . toString ( ) . substring ( 0 , SUBNET_ID_POSTFIX_LENGTH ) ) ; ret . setVpcId ( vpcId ) ; allMockSubnets . put ... | Create the mock Subnet . |
6,295 | public MockSubnet deleteSubnet ( final String subnetId ) { if ( subnetId != null && allMockSubnets . containsKey ( subnetId ) ) { return allMockSubnets . remove ( subnetId ) ; } return null ; } | Delete Subnet . |
6,296 | private Set < String > parseInstanceStates ( final Map < String , String [ ] > queryParams ) { Set < String > instanceStates = new TreeSet < String > ( ) ; for ( String queryKey : queryParams . keySet ( ) ) { if ( queryKey . startsWith ( "Filter.1.Value" ) ) { for ( String state : queryParams . get ( queryKey ) ) { ins... | Parse instance states from query parameters . |
6,297 | private DescribeAvailabilityZonesResponseType describeAvailabilityZones ( ) { DescribeAvailabilityZonesResponseType ret = new DescribeAvailabilityZonesResponseType ( ) ; ret . setRequestId ( UUID . randomUUID ( ) . toString ( ) ) ; AvailabilityZoneSetType info = new AvailabilityZoneSetType ( ) ; AvailabilityZoneItemTyp... | Handles describeAvailabilityZones request as simple as without any filters to use . |
6,298 | private Set < String > parseInstanceIDs ( final Map < String , String [ ] > queryParams ) { Set < String > ret = new TreeSet < String > ( ) ; Set < Map . Entry < String , String [ ] > > entries = queryParams . entrySet ( ) ; for ( Map . Entry < String , String [ ] > entry : entries ) { if ( null != entry && null != ent... | Parse instance IDs from query parameters . |
6,299 | protected String generateToken ( ) { StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < TOKEN_MIDDLE_LEN ; i ++ ) { sb . append ( TOKEN_DICT . charAt ( random . nextInt ( TOKEN_DICT . length ( ) ) ) ) ; } return TOKEN_PREFIX + sb . toString ( ) + TOKEN_SUFFIX ; } | Generate a new token used in describeInstanceResponse while paging enabled . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.