idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
129,800 | public static PreparedStatement createWayMemberTable ( Connection connection , String wayMemberTable ) throws SQLException { try ( Statement stmt = connection . createStatement ( ) ) { StringBuilder sb = new StringBuilder ( "CREATE TABLE " ) ; sb . append ( wayMemberTable ) ; sb . append ( "(ID_RELATION BIGINT, ID_WAY ... | Create a table to store all way members . |
129,801 | public static PreparedStatement createRelationMemberTable ( Connection connection , String relationMemberTable ) throws SQLException { try ( Statement stmt = connection . createStatement ( ) ) { StringBuilder sb = new StringBuilder ( "CREATE TABLE " ) ; sb . append ( relationMemberTable ) ; sb . append ( "(ID_RELATION ... | Store all relation members |
129,802 | public static void dropOSMTables ( Connection connection , boolean isH2 , String tablePrefix ) throws SQLException { TableLocation requestedTable = TableLocation . parse ( tablePrefix , isH2 ) ; String osmTableName = requestedTable . getTable ( ) ; String [ ] omsTables = new String [ ] { TAG , NODE , NODE_TAG , WAY , W... | Drop the existing OSM tables used to store the imported OSM data |
129,803 | public static Triangle createTriangle ( Geometry geom ) throws IllegalArgumentException { Coordinate [ ] coordinates = geom . getCoordinates ( ) ; if ( coordinates . length != 4 ) { throw new IllegalArgumentException ( "The geometry must be a triangle" ) ; } return new Triangle ( coordinates [ 0 ] , coordinates [ 1 ] ,... | A factory to create a DTriangle from a Geometry |
129,804 | public static void toKMLLineString ( LineString lineString , ExtrudeMode extrude , int altitudeModeEnum , StringBuilder sb ) { sb . append ( "<LineString>" ) ; appendExtrude ( extrude , sb ) ; appendAltitudeMode ( altitudeModeEnum , sb ) ; appendKMLCoordinates ( lineString . getCoordinates ( ) , sb ) ; sb . append ( "<... | Defines a connected set of line segments . |
129,805 | public static void toKMLPolygon ( Polygon polygon , ExtrudeMode extrude , int altitudeModeEnum , StringBuilder sb ) { sb . append ( "<Polygon>" ) ; appendExtrude ( extrude , sb ) ; appendAltitudeMode ( altitudeModeEnum , sb ) ; sb . append ( "<outerBoundaryIs>" ) ; toKMLLinearRing ( polygon . getExteriorRing ( ) , extr... | A Polygon is defined by an outer boundary and 0 or more inner boundaries . The boundaries in turn are defined by LinearRings . |
129,806 | public static void appendKMLCoordinates ( Coordinate [ ] coords , StringBuilder sb ) { sb . append ( "<coordinates>" ) ; for ( int i = 0 ; i < coords . length ; i ++ ) { Coordinate coord = coords [ i ] ; sb . append ( coord . x ) . append ( "," ) . append ( coord . y ) ; if ( ! Double . isNaN ( coord . z ) ) { sb . app... | Build a string represention to kml coordinates |
129,807 | private static void appendExtrude ( ExtrudeMode extrude , StringBuilder sb ) { if ( extrude . equals ( ExtrudeMode . TRUE ) ) { sb . append ( "<extrude>" ) . append ( 1 ) . append ( "</extrude>" ) ; } else if ( extrude . equals ( ExtrudeMode . FALSE ) ) { sb . append ( "<extrude>" ) . append ( 0 ) . append ( "</extrude... | Append the extrude value |
129,808 | public static String getGeometryTypeNameFromConstraint ( String constraint , int numericPrecision ) { int geometryTypeCode = GeometryTypeFromConstraint . geometryTypeFromConstraint ( constraint , numericPrecision ) ; return SFSUtilities . getGeometryTypeNameFromCode ( geometryTypeCode ) ; } | Parse the constraint and return the Geometry type name . |
129,809 | public static Integer getCoordinateDimension ( byte [ ] geom ) throws IOException { if ( geom == null ) { return null ; } return GeometryMetaData . getMetaDataFromWKB ( geom ) . dimension ; } | Returns the dimension of the coordinates of the given geometry . |
129,810 | public static Point getCircumCenter ( Geometry geometry ) { if ( geometry == null || geometry . getNumPoints ( ) == 0 ) { return null ; } return geometry . getFactory ( ) . createPoint ( new MinimumBoundingCircle ( geometry ) . getCentre ( ) ) ; } | Compute the minimum bounding circle center of a geometry |
129,811 | public void initDriverFromFile ( File dbfFile , String forceEncoding ) throws IOException { this . dbfFile = dbfFile ; FileInputStream fis = new FileInputStream ( dbfFile ) ; dbaseFileReader = new DbaseFileReader ( fis . getChannel ( ) , forceEncoding ) ; } | Init file header for DBF File |
129,812 | public void insertRow ( Object [ ] values ) throws IOException { checkWriter ( ) ; if ( values . length != getDbaseFileHeader ( ) . getNumFields ( ) ) { throw new IllegalArgumentException ( "Incorrect field count " + values . length + " expected " + getFieldCount ( ) ) ; } try { dbaseFileWriter . write ( values ) ; } c... | Write a row |
129,813 | public static Geometry computePositiveRingBuffer ( Geometry geom , double bufferDistance , int numBuffer , BufferParameters bufferParameters , boolean doDifference ) throws SQLException { Polygon [ ] buffers = new Polygon [ numBuffer ] ; if ( geom instanceof Polygon ) { geom = geom . getFactory ( ) . createPolygon ( ( ... | Compute a ring buffer with a positive offset |
129,814 | public static Geometry computeNegativeRingBuffer ( Geometry geom , double bufferDistance , int numBuffer , BufferParameters bufferParameters , boolean doDifference ) throws SQLException { Polygon [ ] buffers = new Polygon [ numBuffer ] ; Geometry previous = geom ; double distance = 0 ; if ( geom instanceof Polygon ) { ... | Compute a ring buffer with a negative offset |
129,815 | public static Geometry runBuffer ( final Geometry geom , final double bufferSize , final BufferParameters bufferParameters ) throws SQLException { return BufferOp . bufferOp ( geom , bufferSize , bufferParameters ) ; } | Calculate the ring buffer |
129,816 | public static Boolean covers ( Geometry geomA , Geometry geomB ) { if ( geomA == null || geomB == null ) { return null ; } return geomA . covers ( geomB ) ; } | Returns true if no point in geometry B is outside geometry A . |
129,817 | public static Vector3D getNormalVector ( Triangle t ) throws IllegalArgumentException { if ( Double . isNaN ( t . p0 . z ) || Double . isNaN ( t . p1 . z ) || Double . isNaN ( t . p2 . z ) ) { throw new IllegalArgumentException ( "Z is required, cannot compute triangle normal of " + t ) ; } double dx1 = t . p0 . x - t ... | Get the normal vector to this triangle of length 1 . |
129,818 | public static Vector3D getSteepestVector ( final Vector3D normal , final double epsilon ) { if ( Math . abs ( normal . getX ( ) ) < epsilon && Math . abs ( normal . getY ( ) ) < epsilon ) { return new Vector3D ( 0 , 0 , 0 ) ; } Vector3D slope ; if ( Math . abs ( normal . getX ( ) ) < epsilon ) { slope = new Vector3D ( ... | Get the vector with the highest down slope in the plan . |
129,819 | public static Geometry scale ( Geometry geom , double xFactor , double yFactor ) { return scale ( geom , xFactor , yFactor , 1.0 ) ; } | Scales the given geometry by multiplying the coordinates by the indicated x and y scale factors leaving the z - coordinate untouched . |
129,820 | public static Geometry scale ( Geometry geom , double xFactor , double yFactor , double zFactor ) { if ( geom != null ) { Geometry scaledGeom = geom . copy ( ) ; for ( Coordinate c : scaledGeom . getCoordinates ( ) ) { c . setOrdinate ( Coordinate . X , c . getOrdinate ( Coordinate . X ) * xFactor ) ; c . setOrdinate (... | Scales the given geometry by multiplying the coordinates by the indicated x y and z scale factors . |
129,821 | public static Geometry lineIntersector ( Geometry inputLines , Geometry clipper ) throws IllegalArgumentException { if ( inputLines == null || clipper == null ) { return null ; } if ( inputLines . getDimension ( ) == 1 ) { MCIndexNoder mCIndexNoder = new MCIndexNoder ( ) ; mCIndexNoder . setSegmentIntersector ( new Int... | Split a lineal geometry by a another geometry |
129,822 | public static void addGeometryToSegments ( Geometry geometry , int flag , ArrayList < SegmentString > segments ) { for ( int i = 0 ; i < geometry . getNumGeometries ( ) ; i ++ ) { Geometry component = geometry . getGeometryN ( i ) ; if ( component instanceof Polygon ) { add ( ( Polygon ) component , flag , segments ) ;... | Convert the a geometry as a list of segments and mark it with a flag |
129,823 | private static void add ( Polygon poly , int flag , ArrayList < SegmentString > segments ) { add ( poly . getExteriorRing ( ) , flag , segments ) ; for ( int j = 0 ; j < poly . getNumInteriorRing ( ) ; j ++ ) { add ( poly . getInteriorRingN ( j ) , flag , segments ) ; } } | Convert a polygon as a list of segments and mark it with a flag |
129,824 | private static void add ( LineString line , int flag , ArrayList < SegmentString > segments ) { SegmentString ss = new NodedSegmentString ( line . getCoordinates ( ) , flag ) ; segments . add ( ss ) ; } | Convert a linestring as a list of segments and mark it with a flag |
129,825 | public static MultiPoint locateAlong ( Geometry geom , double segmentLengthFraction , double offsetDistance ) { if ( geom == null ) { return null ; } if ( geom . getDimension ( ) == 0 ) { return null ; } Set < Coordinate > result = new HashSet < Coordinate > ( ) ; for ( int i = 0 ; i < geom . getNumGeometries ( ) ; i +... | Returns a MULTIPOINT containing points along the line segments of the given geometry matching the specified segment length fraction and offset distance . |
129,826 | public static void load ( Connection connection ) throws SQLException { Statement st = connection . createStatement ( ) ; for ( Function function : getBuiltInsFunctions ( ) ) { try { H2GISFunctions . registerFunction ( st , function , "" ) ; } catch ( SQLException ex ) { LOGGER . error ( ex . getLocalizedMessage ( ) , ... | Init H2 DataBase with the network functions |
129,827 | public void close ( ) throws IOException { if ( channel != null && channel . isOpen ( ) ) { channel . close ( ) ; } channel = null ; header = null ; } | Clean up any resources . Closes the channel . |
129,828 | public Geometry geomAt ( int offset ) throws IOException { buffer . position ( offset ) ; buffer . skip ( 8 ) ; buffer . order ( ByteOrder . LITTLE_ENDIAN ) ; ShapeType recordType = ShapeType . forID ( buffer . getInt ( ) ) ; if ( recordType != ShapeType . NULL && recordType != fileShapeType ) { throw new IllegalStateE... | Fetch the next record information . |
129,829 | public static Double st3Dperimeter ( Geometry geometry ) { if ( geometry == null ) { return null ; } if ( geometry . getDimension ( ) < 2 ) { return 0d ; } return compute3DPerimeter ( geometry ) ; } | Compute the 3D perimeter of a polygon or a multipolygon . |
129,830 | private static double compute3DPerimeter ( Geometry geometry ) { double sum = 0 ; for ( int i = 0 ; i < geometry . getNumGeometries ( ) ; i ++ ) { Geometry subGeom = geometry . getGeometryN ( i ) ; if ( subGeom instanceof Polygon ) { sum += ST_3DLength . length3D ( ( ( Polygon ) subGeom ) . getExteriorRing ( ) ) ; } } ... | Compute the 3D perimeter |
129,831 | public static int dimensionFromConstraint ( String constraint , String columnName ) { Matcher matcher = Z_CONSTRAINT_PATTERN . matcher ( constraint ) ; if ( matcher . find ( ) ) { String extractedColumnName = matcher . group ( 1 ) . replace ( "\"" , "" ) . replace ( "`" , "" ) ; if ( extractedColumnName . equalsIgnoreC... | Public for Unit test |
129,832 | public static double length3D ( Geometry geom ) { double sum = 0 ; for ( int i = 0 ; i < geom . getNumGeometries ( ) ; i ++ ) { sum += length3D ( ( LineString ) geom . getGeometryN ( i ) ) ; } return sum ; } | Returns the 3D length of the given geometry . |
129,833 | public static double length3D ( Polygon polygon ) { double length = 0.0 ; length += length3D ( polygon . getExteriorRing ( ) . getCoordinateSequence ( ) ) ; for ( int i = 0 ; i < polygon . getNumInteriorRing ( ) ; i ++ ) { length += length3D ( polygon . getInteriorRingN ( i ) ) ; } return length ; } | Returns the 3D perimeter of the given polygon . |
129,834 | public static double length3D ( CoordinateSequence points ) { int numberOfCoords = points . size ( ) ; if ( numberOfCoords < 2 ) { return 0.0 ; } Coordinate currentCoord = new Coordinate ( ) ; points . getCoordinate ( 0 , currentCoord ) ; double x0 = currentCoord . x ; double y0 = currentCoord . y ; double z0 = current... | Computes the length of a LineString specified by a sequence of coordinates . |
129,835 | public static Geometry sunPosition ( Geometry point , Date date ) throws IllegalArgumentException { if ( point == null ) { return null ; } if ( point instanceof Point ) { Coordinate coord = point . getCoordinate ( ) ; return point . getFactory ( ) . createPoint ( SunCalc . getPosition ( date , coord . y , coord . x ) )... | Return the sun position for a given date |
129,836 | public static Geometry offsetCurve ( Geometry geometry , double offset , String parameters ) { if ( geometry == null ) { return null ; } String [ ] buffParemeters = parameters . split ( "\\s+" ) ; BufferParameters bufferParameters = new BufferParameters ( ) ; for ( String params : buffParemeters ) { String [ ] keyValue... | Return an offset line at a given distance and side from an input geometry |
129,837 | public static Geometry computeOffsetCurve ( Geometry geometry , double offset , BufferParameters bufferParameters ) { ArrayList < LineString > lineStrings = new ArrayList < LineString > ( ) ; for ( int i = 0 ; i < geometry . getNumGeometries ( ) ; i ++ ) { Geometry subGeom = geometry . getGeometryN ( i ) ; if ( subGeom... | Method to compute the offset line |
129,838 | public static void lineStringOffSetCurve ( ArrayList < LineString > list , LineString lineString , double offset , BufferParameters bufferParameters ) { list . add ( lineString . getFactory ( ) . createLineString ( new OffsetCurveBuilder ( lineString . getPrecisionModel ( ) , bufferParameters ) . getOffsetCurve ( lineS... | Compute the offset curve for a linestring |
129,839 | public static void geometryOffSetCurve ( ArrayList < LineString > list , Geometry geometry , double offset , BufferParameters bufferParameters ) { final List curves = new OffsetCurveSetBuilder ( geometry , offset , new OffsetCurveBuilder ( geometry . getFactory ( ) . getPrecisionModel ( ) , bufferParameters ) ) . getCu... | Compute the offset curve for a polygon a point or a collection of geometries |
129,840 | public static Geometry longestLine ( Geometry geomA , Geometry geomB ) { Coordinate [ ] coords = new MaxDistanceOp ( geomA , geomB ) . getCoordinatesDistance ( ) ; if ( coords != null ) { return geomA . getFactory ( ) . createLineString ( coords ) ; } return null ; } | Return the longest line between the points of two geometries . |
129,841 | public static Geometry force2D ( Geometry geom ) { if ( geom == null ) { return null ; } return GeometryCoordinateDimension . force ( geom , 2 ) ; } | Converts a XYZ geometry to XY . |
129,842 | public static GeometryMetaData getMetaDataFromWKB ( byte [ ] bytes ) throws IOException { ByteOrderDataInStream dis = new ByteOrderDataInStream ( ) ; dis . setInStream ( new ByteArrayInStream ( bytes ) ) ; byte byteOrderWKB = dis . readByte ( ) ; int byteOrder = byteOrderWKB == WKBConstants . wkbNDR ? ByteOrderValues .... | Read the first bytes of Geometry WKB . |
129,843 | public void writeHeaders ( ShapeType type ) throws IOException { try { handler = type . getShapeHandler ( ) ; } catch ( ShapefileException se ) { throw new IOException ( "Error with type " + type , se ) ; } if ( indexBuffer != null ) { indexBuffer . flush ( ) ; } if ( shapeBuffer != null ) { shapeBuffer . flush ( ) ; }... | Write the headers for this shapefile . Use this function before inserting the first geometry then when all geometries are inserted . |
129,844 | public void writeGeometry ( Geometry g ) throws IOException { if ( type == null ) { throw new IllegalStateException ( "Header must be written before writeGeometry" ) ; } if ( bounds != null ) { if ( g != null ) { bounds . expandToInclude ( g . getEnvelopeInternal ( ) ) ; } } else { bounds = g . getEnvelopeInternal ( ) ... | Write a single Geometry to this shapefile . The Geometry must be compatable with the ShapeType assigned during the writing of the headers . |
129,845 | public void close ( ) throws IOException { indexBuffer . flush ( ) ; shapeBuffer . flush ( ) ; if ( shpChannel != null && shpChannel . isOpen ( ) ) { shpChannel . close ( ) ; } if ( shxChannel != null && shxChannel . isOpen ( ) ) { shxChannel . close ( ) ; } shpChannel = null ; shxChannel = null ; handler = null ; inde... | Close the underlying Channels . |
129,846 | protected KeyedGraph < V , E > prepareGraph ( ) throws SQLException { LOGGER . info ( "Loading graph into memory..." ) ; final long start = System . currentTimeMillis ( ) ; KeyedGraph < V , E > graph ; if ( ! globalOrientation . equals ( GraphFunctionParser . Orientation . UNDIRECTED ) ) { if ( weightColumn != null ) {... | Prepares a graph . |
129,847 | private void initIndices ( ResultSet edges ) { try { ResultSetMetaData metaData = edges . getMetaData ( ) ; for ( int i = 1 ; i <= metaData . getColumnCount ( ) ; i ++ ) { final String columnName = metaData . getColumnName ( i ) ; if ( columnName . equalsIgnoreCase ( START_NODE ) ) startNodeIndex = i ; if ( columnName ... | Recovers the indices from the metadata . |
129,848 | private E loadEdge ( KeyedGraph < V , E > graph , ResultSet edges ) throws SQLException { final int startNode = edges . getInt ( startNodeIndex ) ; final int endNode = edges . getInt ( endNodeIndex ) ; final int edgeID = edges . getInt ( edgeIDIndex ) ; double weight = WeightedGraph . DEFAULT_EDGE_WEIGHT ; if ( weightC... | Loads an edge into the graph from the current row . |
129,849 | private E loadDoubleEdge ( KeyedGraph < V , E > graph , final int startNode , final int endNode , final int edgeID , final double weight ) throws SQLException { final E edgeTo = graph . addEdge ( startNode , endNode , edgeID ) ; setEdgeWeight ( edgeTo , weight ) ; final E edgeFrom = graph . addEdge ( endNode , startNod... | In directed graphs undirected edges are represented by directed edges in both directions . The edges are assigned ids with opposite signs . |
129,850 | private void setEdgeWeight ( E edge , final double weight ) throws SQLException { if ( edge != null && weightColumnIndex != - 1 ) { edge . setWeight ( weight ) ; } } | Set this edge s weight to the weight contained in the current row . |
129,851 | public static Geometry getGeometryN ( Geometry geometry , Integer n ) throws SQLException { if ( geometry == null ) { return null ; } if ( n >= 1 && n <= geometry . getNumGeometries ( ) ) { return geometry . getGeometryN ( n - 1 ) ; } else { throw new SQLException ( OUT_OF_BOUNDS_ERR_MESSAGE ) ; } } | Return Geometry number n from the given GeometryCollection . |
129,852 | public static GeometryCollection getHoles ( Geometry geom ) throws SQLException { if ( geom != null ) { if ( geom . getDimension ( ) >= 2 ) { ArrayList < Geometry > holes = new ArrayList < Geometry > ( ) ; for ( int i = 0 ; i < geom . getNumGeometries ( ) ; i ++ ) { Geometry subgeom = geom . getGeometryN ( i ) ; if ( s... | Returns the given geometry s holes as a GeometryCollection . |
129,853 | public int getLength ( Object geometry ) { MultiPoint mp = ( MultiPoint ) geometry ; int length ; if ( shapeType == ShapeType . MULTIPOINT ) { length = ( mp . getNumGeometries ( ) * 16 ) + 40 ; } else if ( shapeType == ShapeType . MULTIPOINTM ) { length = ( mp . getNumGeometries ( ) * 16 ) + 40 + 16 + ( 8 * mp . getNum... | Calcuates the record length of this object . |
129,854 | private static String formatKey ( String prjKey ) { String formatKey = prjKey ; if ( prjKey . startsWith ( "+" ) ) { formatKey = prjKey . substring ( 1 ) ; } return formatKey ; } | Remove + char if exists |
129,855 | public static int getSRID ( File prjFile ) throws IOException { int srid = 0 ; if ( prjFile == null ) { log . debug ( "This prj file is null. \n A default srid equals to 0 will be added." ) ; } else { PrjParser parser = new PrjParser ( ) ; String prjString = readPRJFile ( prjFile ) ; if ( ! prjString . isEmpty ( ) ) { ... | Return the SRID value stored in a prj file |
129,856 | private static String readPRJFile ( File prjFile ) throws FileNotFoundException , IOException { try ( FileInputStream fis = new FileInputStream ( prjFile ) ) { BufferedReader r = new BufferedReader ( new InputStreamReader ( fis , Charset . defaultCharset ( ) ) ) ; StringBuilder b = new StringBuilder ( ) ; while ( r . r... | Return the content of the PRJ file as a single string |
129,857 | public static void writePRJ ( Connection connection , TableLocation location , String geomField , File fileName ) throws SQLException , FileNotFoundException { int srid = SFSUtilities . getSRID ( connection , location , geomField ) ; writePRJ ( connection , srid , fileName ) ; } | Write a prj file according the SRID code of an input table |
129,858 | public static void writePRJ ( Connection connection , int srid , File fileName ) throws SQLException , FileNotFoundException { if ( srid != 0 ) { StringBuilder sb = new StringBuilder ( "SELECT SRTEXT FROM " ) ; sb . append ( "PUBLIC.SPATIAL_REF_SYS " ) . append ( " WHERE SRID = ?" ) ; PreparedStatement ps = connection ... | Write a prj file according a given SRID code . |
129,859 | public static boolean isSRIDValid ( int srid , Connection connection ) throws SQLException { PreparedStatement ps = null ; ResultSet rs = null ; String queryCheck = "SELECT count(SRID) from PUBLIC.SPATIAL_REF_SYS WHERE SRID = ?" ; try { ps = connection . prepareStatement ( queryCheck ) ; ps . setInt ( 1 , srid ) ; rs =... | This method checks if a SRID value is valid according a list of SRID s avalaible on spatial_ref table of the datababase . |
129,860 | public static boolean isFileImportable ( File file , String prefix ) throws SQLException , FileNotFoundException { if ( isExtensionWellFormated ( file , prefix ) ) { if ( file . exists ( ) ) { return true ; } else { throw new FileNotFoundException ( "The following file does not exists:\n" + file . getPath ( ) ) ; } } e... | Check if the file is well formatted regarding an extension prefix . Check also if the file doesn t exist . |
129,861 | public static boolean isExtensionWellFormated ( File file , String prefix ) { String path = file . getAbsolutePath ( ) ; String extension = "" ; int i = path . lastIndexOf ( '.' ) ; if ( i >= 0 ) { extension = path . substring ( i + 1 ) ; } return extension . equalsIgnoreCase ( prefix ) ; } | Check if the file has the good extension |
129,862 | public static String getUniqueColumnName ( String base , List < Column > columns ) { String cursor = base ; int cpt = 2 ; boolean findDuplicate = true ; while ( findDuplicate ) { findDuplicate = false ; for ( Column column : columns ) { if ( column . getName ( ) . equalsIgnoreCase ( cursor ) ) { findDuplicate = true ; ... | Compute unique column name among the other columns |
129,863 | public static Geometry snap ( Geometry geometryA , Geometry geometryB , double distance ) { if ( geometryA == null || geometryB == null ) { return null ; } Geometry [ ] snapped = GeometrySnapper . snap ( geometryA , geometryB , distance ) ; return snapped [ 0 ] ; } | Snaps two geometries together with a given tolerance |
129,864 | public static Geometry updateZ ( Geometry geometry , double z , int updateCondition ) throws SQLException { if ( geometry == null ) { return null ; } if ( updateCondition == 1 || updateCondition == 2 || updateCondition == 3 ) { Geometry outPut = geometry . copy ( ) ; outPut . apply ( new UpdateZCoordinateSequenceFilter... | Replace the z value depending on the condition . |
129,865 | public boolean read ( File inputFile ) throws SAXException , IOException { boolean success = false ; try ( FileInputStream fs = new FileInputStream ( inputFile ) ) { XMLReader parser = XMLReaderFactory . createXMLReader ( ) ; parser . setErrorHandler ( this ) ; parser . setContentHandler ( this ) ; parser . parse ( new... | Reads the document and pre - parses it . The other method is called automatically when a start markup is found . |
129,866 | public void startElement ( String uri , String localName , String qName , Attributes attributes ) throws SAXException { if ( localName . compareToIgnoreCase ( GPXTags . GPX ) == 0 ) { version = attributes . getValue ( GPXTags . VERSION ) ; } else if ( localName . compareToIgnoreCase ( GPXTags . RTE ) == 0 ) { totalRte ... | Fires whenever an XML start markup is encountered . It indicates which version of gpx file is to be parsed . It counts the waypoints routes routepoints tracks track segments and trackpoints . |
129,867 | public static boolean contains3D ( Coordinate [ ] coords , Coordinate coord ) { for ( Coordinate coordinate : coords ) { if ( coordinate . equals3D ( coord ) ) { return true ; } } return false ; } | Check if a coordinate array contains a specific coordinate . |
129,868 | public static Coordinate [ ] getFurthestCoordinate ( Coordinate base , Coordinate [ ] coords ) { double distanceMax = Double . MIN_VALUE ; Coordinate farCoordinate = null ; for ( Coordinate coord : coords ) { double distance = coord . distance ( base ) ; if ( distance > distanceMax ) { distanceMax = distance ; farCoord... | Find the furthest coordinate in a geometry from a base coordinate |
129,869 | public static double length3D ( CoordinateSequence pts ) { int n = pts . size ( ) ; if ( n <= 1 ) { return 0.0 ; } double len = 0.0 ; Coordinate p = new Coordinate ( ) ; pts . getCoordinate ( 0 , p ) ; double x0 = p . x ; double y0 = p . y ; double z0 = p . z ; if ( Double . isNaN ( z0 ) ) { return 0.0 ; } for ( int i ... | Computes the length of a linestring specified by a sequence of points . if a coordinate has a NaN z return 0 . |
129,870 | public static double length3D ( Geometry geom ) { double sum = 0 ; for ( int i = 0 ; i < geom . getNumGeometries ( ) ; i ++ ) { Geometry subGeom = geom . getGeometryN ( i ) ; if ( subGeom instanceof Polygon ) { sum += length3D ( ( Polygon ) subGeom ) ; } else if ( subGeom instanceof LineString ) { sum += length3D ( ( L... | Returns the 3D length of the geometry |
129,871 | public static double length3D ( Polygon polygon ) { double len = 0.0 ; len += length3D ( polygon . getExteriorRing ( ) . getCoordinateSequence ( ) ) ; for ( int i = 0 ; i < polygon . getNumInteriorRing ( ) ; i ++ ) { len += length3D ( polygon . getInteriorRingN ( i ) ) ; } return len ; } | Returns the 3D perimeter of a polygon |
129,872 | public static ValueArray createArray ( int begin , int end , int step ) { if ( end < begin ) { throw new IllegalArgumentException ( "End must be greater or equal to begin" ) ; } int nbClasses = ( int ) ( ( end - begin ) / step ) ; ValueInt [ ] getArray = new ValueInt [ nbClasses ] ; for ( int i = 0 ; i < nbClasses ; i ... | Return an array of integers |
129,873 | public static String mangleURL ( String url ) throws SQLException { if ( url . startsWith ( POSTGIS_H2PROTOCOL ) ) { return POSTGIS_PROTOCOL + url . substring ( POSTGIS_H2PROTOCOL . length ( ) ) ; } else { throw new SQLException ( "Unknown protocol or subprotocol in url " + url ) ; } } | Mangles the PostGIS URL to return the original PostGreSQL URL . |
129,874 | public boolean acceptsURL ( String url ) { try { url = mangleURL ( url ) ; } catch ( SQLException e ) { return false ; } return super . acceptsURL ( url ) ; } | Check whether the driver thinks he can handle the given URL . |
129,875 | public static boolean hasField ( Connection connection , String tableName , String fieldName ) throws SQLException { final Statement statement = connection . createStatement ( ) ; try { final ResultSet resultSet = statement . executeQuery ( "SELECT * FROM " + TableLocation . parse ( tableName ) + " LIMIT 0;" ) ; try { ... | Return true if table tableName contains field fieldName . |
129,876 | public static int getFieldIndex ( ResultSetMetaData resultSetMetaData , String fieldName ) throws SQLException { for ( int columnId = 1 ; columnId <= resultSetMetaData . getColumnCount ( ) ; columnId ++ ) { if ( fieldName . equalsIgnoreCase ( resultSetMetaData . getColumnName ( columnId ) ) ) { return columnId ; } } re... | Fetch the metadata and check field name |
129,877 | public static List < String > getFieldNames ( DatabaseMetaData meta , String table ) throws SQLException { List < String > fieldNameList = new ArrayList < String > ( ) ; TableLocation location = TableLocation . parse ( table ) ; ResultSet rs = meta . getColumns ( location . getCatalog ( null ) , location . getSchema ( ... | Returns the list of all the field name of a table . |
129,878 | public static int getRowCount ( Connection connection , String tableReference ) throws SQLException { Statement st = connection . createStatement ( ) ; int rowCount = 0 ; try { ResultSet rs = st . executeQuery ( String . format ( "select count(*) rowcount from %s" , TableLocation . parse ( tableReference ) ) ) ; try { ... | Fetch the row count of a table . |
129,879 | public static boolean isTemporaryTable ( Connection connection , String tableReference ) throws SQLException { TableLocation location = TableLocation . parse ( tableReference ) ; ResultSet rs = getTablesView ( connection , location . getCatalog ( ) , location . getSchema ( ) , location . getTable ( ) ) ; boolean isTemp... | Read INFORMATION_SCHEMA . TABLES in order to see if the provided table reference is a temporary table . |
129,880 | public static boolean isLinkedTable ( Connection connection , String tableReference ) throws SQLException { TableLocation location = TableLocation . parse ( tableReference ) ; ResultSet rs = getTablesView ( connection , location . getCatalog ( ) , location . getSchema ( ) , location . getTable ( ) ) ; boolean isLinked ... | Read INFORMATION_SCHEMA . TABLES in order to see if the provided table reference is a linked table . |
129,881 | public static boolean tableExists ( Connection connection , String tableName ) throws SQLException { try ( Statement statement = connection . createStatement ( ) ) { statement . execute ( "SELECT * FROM " + TableLocation . parse ( tableName ) + " LIMIT 0;" ) ; return true ; } catch ( SQLException ex ) { return false ; ... | Return true if the table exists . |
129,882 | public static List < String > getTableNames ( DatabaseMetaData metaData , String catalog , String schemaPattern , String tableNamePattern , String [ ] types ) throws SQLException { List < String > tableList = new ArrayList < String > ( ) ; ResultSet rs = metaData . getTables ( catalog , schemaPattern , tableNamePattern... | Returns the list of table names . |
129,883 | public static List < String > getUniqueFieldValues ( Connection connection , String tableName , String fieldName ) throws SQLException { final Statement statement = connection . createStatement ( ) ; List < String > fieldValues = new ArrayList < String > ( ) ; try { ResultSet result = statement . executeQuery ( "SELECT... | Returns the list of distinct values contained by a field from a table from the database |
129,884 | public static List < String > getFieldNames ( ResultSetMetaData resultSetMetaData ) throws SQLException { List < String > columnNames = new ArrayList < > ( ) ; int cols = resultSetMetaData . getColumnCount ( ) ; for ( int i = 1 ; i <= cols ; i ++ ) { columnNames . add ( resultSetMetaData . getColumnName ( i ) ) ; } ret... | Fetch the name of columns |
129,885 | public static void feedTableDataFromHeader ( DbaseFileHeader header , CreateTableData data ) throws IOException { for ( int i = 0 ; i < header . getNumFields ( ) ; i ++ ) { String fieldsName = header . getFieldName ( i ) ; final int type = dbfTypeToH2Type ( header , i ) ; Column column = new Column ( fieldsName . toUpp... | Parse the DBF file then init the provided data structure |
129,886 | private void prepareToAddBytes ( int numBytes ) throws IOException { if ( buffer . remaining ( ) < numBytes ) { buffer . flip ( ) ; channel . write ( buffer ) ; int bufferCapacity = Math . max ( BUFFER_SIZE , numBytes ) ; if ( bufferCapacity != buffer . capacity ( ) ) { ByteOrder order = buffer . order ( ) ; buffer = B... | Moves the window |
129,887 | public static MultiPoint createMultiPoint ( Geometry geom ) { if ( geom != null ) { return GEOMETRY_FACTORY . createMultiPoint ( geom . getCoordinates ( ) ) ; } else { return null ; } } | Constructs a MultiPoint from the given geometry s coordinates . |
129,888 | public static void writeTSV ( Connection connection , String fileName , String tableReference , String encoding ) throws SQLException , IOException { TSVDriverFunction tSVDriverFunction = new TSVDriverFunction ( ) ; tSVDriverFunction . exportTable ( connection , tableReference , URIUtilities . fileFromString ( fileName... | Export a table into a Tab - separated values file |
129,889 | public static Polygon makeEllipse ( Point p , double width , double height ) throws SQLException { if ( p == null ) { return null ; } if ( height < 0 || width < 0 ) { throw new SQLException ( "Both width and height must be positive." ) ; } else { GSF . setCentre ( new Coordinate ( p . getX ( ) , p . getY ( ) ) ) ; GSF ... | Make an ellipse centered at the given point with the given width and height . |
129,890 | 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 . |
129,891 | 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 |
129,892 | 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 . |
129,893 | 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 . |
129,894 | 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 |
129,895 | 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 . |
129,896 | 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 |
129,897 | 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 |
129,898 | 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 |
129,899 | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.