idx int64 0 41.2k | question stringlengths 83 4.15k | target stringlengths 5 715 |
|---|---|---|
5,900 | public static Point createPoint ( double x , double y , double z ) throws SQLException { return GF . createPoint ( new Coordinate ( x , y , z ) ) ; } | Constructs POINT from three doubles . |
5,901 | public final void setAttribute ( String currentElement , StringBuilder contentBuffer ) { if ( currentElement . equalsIgnoreCase ( GPXTags . TIME ) ) { setTime ( contentBuffer ) ; } else if ( currentElement . equalsIgnoreCase ( GPXTags . MAGVAR ) ) { setMagvar ( contentBuffer ) ; } else if ( currentElement . equalsIgnor... | Set an attribute for a point . The String currentElement gives the information of which attribute have to be setted . The attribute to set is given by the StringBuilder contentBuffer . |
5,902 | public final void setLink ( Attributes attributes ) { ptValues [ GpxMetadata . PTLINK ] = attributes . getValue ( GPXTags . HREF ) ; } | Set a link to additional information about the point . |
5,903 | public final void setSat ( StringBuilder contentBuffer ) { ptValues [ GpxMetadata . PTSAT ] = Integer . parseInt ( contentBuffer . toString ( ) ) ; } | Set the number of satellites used to calculate the GPX fix for a point . |
5,904 | public final void setHdop ( StringBuilder contentBuffer ) { ptValues [ GpxMetadata . PTHDOP ] = Double . parseDouble ( contentBuffer . toString ( ) ) ; } | Set the horizontal dilution of precision of a point . |
5,905 | public final void setVdop ( StringBuilder contentBuffer ) { ptValues [ GpxMetadata . PTVDOP ] = Double . parseDouble ( contentBuffer . toString ( ) ) ; } | Set the vertical dilution of precision of a point . |
5,906 | public final void setPdop ( StringBuilder contentBuffer ) { ptValues [ GpxMetadata . PTPDOP ] = Double . parseDouble ( contentBuffer . toString ( ) ) ; } | Set the position dilution of precision of a point . |
5,907 | public final void setAgeofdgpsdata ( StringBuilder contentBuffer ) { ptValues [ GpxMetadata . PTAGEOFDGPSDATA ] = Double . parseDouble ( contentBuffer . toString ( ) ) ; } | Set number of seconds since last DGPS update for a point . |
5,908 | public final void setDgpsid ( StringBuilder contentBuffer ) { ptValues [ GpxMetadata . PTDGPSID ] = Integer . parseInt ( contentBuffer . toString ( ) ) ; } | Set ID of DGPS station used in differential correction for a point . |
5,909 | protected static Orientation parseGlobalOrientation ( String v ) { if ( v == null ) { return null ; } if ( isDirectedString ( v ) ) { return Orientation . DIRECTED ; } else if ( isReversedString ( v ) ) { return Orientation . REVERSED ; } else if ( isUndirectedString ( v ) ) { return Orientation . UNDIRECTED ; } else {... | Recovers the global orientation from a string . |
5,910 | protected String parseEdgeOrientation ( String v ) { if ( v == null ) { return null ; } if ( ! v . contains ( SEPARATOR ) ) { throw new IllegalArgumentException ( ORIENTATION_ERROR ) ; } String [ ] s = v . split ( SEPARATOR ) ; if ( s . length == 2 ) { return s [ 1 ] . trim ( ) ; } else { throw new IllegalArgumentExcep... | Recovers the edge orientation from a string . |
5,911 | public static int [ ] parseDestinationsString ( String s ) { if ( ! s . contains ( "," ) ) { return new int [ ] { Integer . valueOf ( s . trim ( ) ) } ; } String [ ] array = s . split ( "," ) ; int [ ] destinations = new int [ array . length ] ; for ( int i = 0 ; i < destinations . length ; i ++ ) { final String string... | Returns an array of destination ids from a comma - separated list of destinations . |
5,912 | public void initialise ( XMLReader reader , AbstractGpxParserDefault parent ) { setReader ( reader ) ; setParent ( parent ) ; setContentBuffer ( parent . getContentBuffer ( ) ) ; setTrkPreparedStmt ( parent . getTrkPreparedStmt ( ) ) ; setTrkSegmentsPreparedStmt ( parent . getTrkSegmentsPreparedStmt ( ) ) ; setTrkPoint... | Create a new specific parser . It has in memory the default parser the contentBuffer the elementNames the currentLine and the trkID . |
5,913 | public static Geometry geomFromGeoJSON ( String geojson ) throws IOException , SQLException { if ( geojson == null ) { return null ; } if ( jsFactory == null ) { jsFactory = new JsonFactory ( ) ; jsFactory . configure ( JsonParser . Feature . ALLOW_COMMENTS , true ) ; jsFactory . configure ( JsonParser . Feature . ALLO... | Convert a geojson geometry to geometry . |
5,914 | public static Double perimeter ( Geometry geometry ) { if ( geometry == null ) { return null ; } if ( geometry . getDimension ( ) < 2 ) { return 0d ; } return computePerimeter ( geometry ) ; } | Compute the perimeter of a polygon or a multipolygon . |
5,915 | private static double computePerimeter ( Geometry geometry ) { double sum = 0 ; for ( int i = 0 ; i < geometry . getNumGeometries ( ) ; i ++ ) { Geometry subGeom = geometry . getGeometryN ( i ) ; if ( subGeom instanceof Polygon ) { sum += ( ( Polygon ) subGeom ) . getExteriorRing ( ) . getLength ( ) ; } } return sum ; ... | Compute the perimeter |
5,916 | public static Double getMinY ( Geometry geom ) { if ( geom != null ) { return geom . getEnvelopeInternal ( ) . getMinY ( ) ; } else { return null ; } } | Returns the minimal y - value of the given geometry . |
5,917 | public static Geometry simplyPreserve ( Geometry geometry , double distance ) { if ( geometry == null ) { return null ; } return TopologyPreservingSimplifier . simplify ( geometry , distance ) ; } | Simplifies a geometry and ensures that the result is a valid geometry having the same dimension and number of components as the input and with the components having the same topological relationship . |
5,918 | protected static KeyedGraph prepareGraph ( Connection connection , String inputTable , String orientation , String weight , Class vertexClass , Class edgeClass ) throws SQLException { GraphFunctionParser parser = new GraphFunctionParser ( ) ; parser . parseWeightAndOrientation ( orientation , weight ) ; return new Grap... | Return a JGraphT graph from the input edges table . |
5,919 | private Polygon getCellPolygon ( ) { final Coordinate [ ] summits = new Coordinate [ 5 ] ; double x1 = minX + cellI * deltaX ; double y1 = minY + cellJ * deltaY ; double x2 = minX + ( cellI + 1 ) * deltaX ; double y2 = minY + ( cellJ + 1 ) * deltaY ; summits [ 0 ] = new Coordinate ( x1 , y1 ) ; summits [ 1 ] = new Coor... | Compute the polygon corresponding to the cell |
5,920 | private Point getCellPoint ( ) { double x1 = ( minX + cellI * deltaX ) + ( deltaX / 2d ) ; double y1 = ( minY + cellJ * deltaY ) + ( deltaY / 2d ) ; cellI ++ ; return GF . createPoint ( new Coordinate ( x1 , y1 ) ) ; } | Compute the point of the cell |
5,921 | private static String getFirstGeometryField ( String tableName , Connection connection ) throws SQLException { List < String > geomFields = SFSUtilities . getGeometryFields ( connection , TableLocation . parse ( tableName , JDBCUtilities . isH2DataBase ( connection . getMetaData ( ) ) ) ) ; if ( ! geomFields . isEmpty ... | Return the first spatial geometry field name |
5,922 | private void initParameters ( ) { this . minX = envelope . getMinX ( ) ; this . minY = envelope . getMinY ( ) ; double cellWidth = envelope . getWidth ( ) ; double cellHeight = envelope . getHeight ( ) ; this . maxI = ( int ) Math . ceil ( cellWidth / deltaX ) ; this . maxJ = ( int ) Math . ceil ( cellHeight / deltaY )... | Compute the parameters need to create each cells |
5,923 | public ResultSet getResultSet ( ) throws SQLException { SimpleResultSet srs = new SimpleResultSet ( this ) ; srs . addColumn ( "THE_GEOM" , Types . JAVA_OBJECT , "GEOMETRY" , 0 , 0 ) ; srs . addColumn ( "ID" , Types . INTEGER , 10 , 0 ) ; srs . addColumn ( "ID_COL" , Types . INTEGER , 10 , 0 ) ; srs . addColumn ( "ID_R... | Give the regular grid |
5,924 | public static Double azimuth ( Geometry pointA , Geometry pointB ) { if ( pointA == null || pointB == null ) { return null ; } if ( ( pointA instanceof Point ) && ( pointB instanceof Point ) ) { Double angle ; double x0 = ( ( Point ) pointA ) . getX ( ) ; double y0 = ( ( Point ) pointA ) . getY ( ) ; double x1 = ( ( Po... | This code compute the angle in radian as postgis does . |
5,925 | public static Double getMaxY ( Geometry geom ) { if ( geom != null ) { return geom . getEnvelopeInternal ( ) . getMaxY ( ) ; } else { return null ; } } | Returns the maximal y - value of the given geometry . |
5,926 | private Point parsePoint ( JsonParser jp ) throws IOException , SQLException { jp . nextToken ( ) ; String coordinatesField = jp . getText ( ) ; if ( coordinatesField . equalsIgnoreCase ( GeoJsonField . COORDINATES ) ) { jp . nextToken ( ) ; Point point = GF . createPoint ( parseCoordinate ( jp ) ) ; jp . nextToken ( )... | Parses one position |
5,927 | private MultiPoint parseMultiPoint ( JsonParser jp ) throws IOException , SQLException { jp . nextToken ( ) ; String coordinatesField = jp . getText ( ) ; if ( coordinatesField . equalsIgnoreCase ( GeoJsonField . COORDINATES ) ) { jp . nextToken ( ) ; MultiPoint mPoint = GF . createMultiPoint ( parseCoordinates ( jp ) ... | Parses an array of positions |
5,928 | private Coordinate parseCoordinate ( JsonParser jp ) throws IOException { jp . nextToken ( ) ; double x = jp . getDoubleValue ( ) ; jp . nextToken ( ) ; double y = jp . getDoubleValue ( ) ; Coordinate coord ; jp . nextToken ( ) ; if ( jp . getCurrentToken ( ) == JsonToken . END_ARRAY ) { coord = new Coordinate ( x , y ... | Parses a GeoJSON coordinate array and returns a JTS coordinate . The first token corresponds to the first X value . The last token correponds to the end of the coordinate array ] . |
5,929 | public static MultiLineString createMultiLineString ( Geometry geom ) throws SQLException { if ( geom != null ) { if ( geom . getDimension ( ) > 0 ) { final List < LineString > lineStrings = new LinkedList < LineString > ( ) ; toMultiLineString ( geom , lineStrings ) ; return GEOMETRY_FACTORY . createMultiLineString ( ... | Constructs a MultiLineString from the given geometry s coordinates . |
5,930 | public static void readTSV ( Connection connection , String fileName , String tableReference ) throws SQLException , FileNotFoundException , IOException { File file = URIUtilities . fileFromString ( fileName ) ; if ( FileUtil . isFileImportable ( file , "tsv" ) ) { TSVDriverFunction tsvDriver = new TSVDriverFunction ( ... | Copy data from TSV File into a new table in specified connection . |
5,931 | public static Geometry translate ( Geometry geom , double x , double y ) { if ( geom == null ) { return null ; } final CoordinateSequenceDimensionFilter filter = new CoordinateSequenceDimensionFilter ( ) ; geom . apply ( filter ) ; checkMixed ( filter ) ; return AffineTransformation . translationInstance ( x , y ) . tr... | Translates a geometry using X and Y offsets . |
5,932 | public static Geometry translate ( Geometry geom , double x , double y , double z ) { if ( geom == null ) { return null ; } final CoordinateSequenceDimensionFilter filter = new CoordinateSequenceDimensionFilter ( ) ; geom . apply ( filter ) ; checkMixed ( filter ) ; if ( filter . is2D ( ) ) { return AffineTransformatio... | Translates a geometry using X Y and Z offsets . |
5,933 | public static Geometry toGeometry ( byte [ ] bytes , int srid ) throws SQLException { if ( bytes == null ) { return null ; } WKBReader wkbReader = new WKBReader ( ) ; try { Geometry geometry = wkbReader . read ( bytes ) ; geometry . setSRID ( srid ) ; return geometry ; } catch ( ParseException ex ) { throw new SQLExcep... | Convert a WKB representation to a geometry |
5,934 | public static Double maxDistance ( Geometry geomA , Geometry geomB ) { return new MaxDistanceOp ( geomA , geomB ) . getDistance ( ) ; } | Return the maximum distance |
5,935 | public void characters ( char [ ] ch , int start , int length ) throws SAXException { contentBuffer . append ( String . copyValueOf ( ch , start , length ) ) ; } | Fires one or more times for each text node encountered . It saves text informations in contentBuffer . |
5,936 | public static String quoteIdentifier ( String identifier , boolean isH2DataBase ) { if ( ( isH2DataBase && ( Constants . H2_RESERVED_WORDS . contains ( identifier . toUpperCase ( ) ) || ! H2_SPECIAL_NAME_PATTERN . matcher ( identifier ) . find ( ) ) ) || ( ! isH2DataBase && ( Constants . POSTGIS_RESERVED_WORDS . contai... | Quote identifier only if necessary . Require database knowledge . |
5,937 | public static TableLocation parse ( String concatenatedTableLocation , Boolean isH2Database ) { List < String > parts = new LinkedList < String > ( ) ; String catalog , schema , table ; catalog = table = schema = "" ; StringTokenizer st = new StringTokenizer ( concatenatedTableLocation , ".`\"" , true ) ; boolean openQ... | Convert catalog . schema . table schema . table or table into a TableLocation instance . Non - specified schema or catalogs are converted to the empty string . |
5,938 | public static String capsIdentifier ( String identifier , Boolean isH2Database ) { if ( isH2Database != null ) { if ( isH2Database ) { return identifier . toUpperCase ( ) ; } else { return identifier . toLowerCase ( ) ; } } else { return identifier ; } } | Change case of parameters to make it more user - friendly . |
5,939 | private static void decompose ( Geometry geometry , Collection < Geometry > list ) { for ( int i = 0 ; i < geometry . getNumGeometries ( ) ; i ++ ) { Geometry component = geometry . getGeometryN ( i ) ; if ( component instanceof GeometryCollection ) { decompose ( component , list ) ; } else { list . add ( component ) ;... | Decompose a geometry recursively into simple components . |
5,940 | private void removeLowerDimension ( Geometry geometry , List < Geometry > result , int dimension ) { for ( int i = 0 ; i < geometry . getNumGeometries ( ) ; i ++ ) { Geometry g = geometry . getGeometryN ( i ) ; if ( g instanceof GeometryCollection ) { removeLowerDimension ( g , result , dimension ) ; } else if ( g . ge... | Reursively remove geometries with a dimension less than dimension parameter |
5,941 | private Collection < Geometry > unionAdjacentPolygons ( Collection < Geometry > list ) { UnaryUnionOp op = new UnaryUnionOp ( list ) ; Geometry result = op . union ( ) ; if ( result . getNumGeometries ( ) < list . size ( ) ) { list . clear ( ) ; for ( int i = 0 ; i < result . getNumGeometries ( ) ; i ++ ) { list . add ... | Union adjacent polygons to make an invalid MultiPolygon valid |
5,942 | private Point makePointValid ( Point point ) { CoordinateSequence sequence = point . getCoordinateSequence ( ) ; GeometryFactory factory = point . getFactory ( ) ; CoordinateSequenceFactory csFactory = factory . getCoordinateSequenceFactory ( ) ; if ( sequence . size ( ) == 0 ) { return point ; } else if ( Double . isN... | If X or Y is null return an empty Point |
5,943 | private static CoordinateSequence makeSequenceValid ( CoordinateSequence sequence , boolean preserveDuplicateCoord , boolean close ) { int dim = sequence . getDimension ( ) ; double [ ] array = new double [ ( sequence . size ( ) + 1 ) * sequence . getDimension ( ) ] ; boolean modified = false ; int count = 0 ; for ( in... | Returns a coordinateSequence free of Coordinates with X or Y NaN value and if desired free of duplicated coordinates . makeSequenceValid keeps the original dimension of input sequence . |
5,944 | private Set < LineString > getSegments ( Collection < LineString > lines ) { Set < LineString > set = new HashSet < > ( ) ; for ( LineString line : lines ) { Coordinate [ ] cc = line . getCoordinates ( ) ; for ( int i = 1 ; i < cc . length ; i ++ ) { if ( ! cc [ i - 1 ] . equals ( cc [ i ] ) ) { LineString segment = li... | Return a set of segments from a linestring |
5,945 | private Collection < Geometry > restoreDim4 ( Collection < Geometry > geoms , Map < Coordinate , Double > map ) { GeometryFactory factory = new GeometryFactory ( new PackedCoordinateSequenceFactory ( PackedCoordinateSequenceFactory . DOUBLE , 4 ) ) ; Collection < Geometry > result = new ArrayList < > ( ) ; for ( Geomet... | Use ring to restore M values on geoms |
5,946 | private CoordinateSequence restoreDim4 ( CoordinateSequence cs , Map < Coordinate , Double > map ) { CoordinateSequence seq = new PackedCoordinateSequenceFactory ( DOUBLE , 4 ) . create ( cs . size ( ) , 4 ) ; for ( int i = 0 ; i < cs . size ( ) ; i ++ ) { seq . setOrdinate ( i , 0 , cs . getOrdinate ( i , 0 ) ) ; seq ... | Use map to restore M values on the coordinate array |
5,947 | public static PreparedStatement createTrackTable ( Connection connection , String trackTableName , boolean isH2 ) throws SQLException { try ( Statement stmt = connection . createStatement ( ) ) { StringBuilder sb = new StringBuilder ( "CREATE TABLE " ) ; sb . append ( trackTableName ) . append ( " (" ) ; if ( isH2 ) { ... | Creat the track table |
5,948 | public static PreparedStatement createTrackSegmentsTable ( Connection connection , String trackSegementsTableName , boolean isH2 ) throws SQLException { try ( Statement stmt = connection . createStatement ( ) ) { StringBuilder sb = new StringBuilder ( "CREATE TABLE " ) ; sb . append ( trackSegementsTableName ) . append... | Create the track segments table to store the segments of a track |
5,949 | public static void dropOSMTables ( Connection connection , boolean isH2 , String tablePrefix ) throws SQLException { TableLocation requestedTable = TableLocation . parse ( tablePrefix , isH2 ) ; String gpxTableName = requestedTable . getTable ( ) ; String [ ] gpxTables = new String [ ] { WAYPOINT , ROUTE , ROUTEPOINT ,... | Drop the existing GPX tables used to store the imported OSM GPX |
5,950 | public static void append ( int altitudeMode , StringBuilder sb ) { switch ( altitudeMode ) { case KML_CLAMPTOGROUND : sb . append ( "<kml:altitudeMode>clampToGround</kml:altitudeMode>" ) ; return ; case KML_RELATIVETOGROUND : sb . append ( "<kml:altitudeMode>relativeToGround</kml:altitudeMode>" ) ; return ; case KML_A... | Generate a string value corresponding to the altitude mode . |
5,951 | public static GeometryCollection extrudePolygonAsGeometry ( Polygon polygon , double height ) { GeometryFactory factory = polygon . getFactory ( ) ; Geometry [ ] geometries = new Geometry [ 3 ] ; final LineString shell = getClockWise ( polygon . getExteriorRing ( ) ) ; ArrayList < Polygon > walls = new ArrayList < Poly... | Extrude the polygon as a collection of geometries The output geometryCollection contains the floor the walls and the roof . |
5,952 | public static GeometryCollection extrudeLineStringAsGeometry ( LineString lineString , double height ) { Geometry [ ] geometries = new Geometry [ 3 ] ; GeometryFactory factory = lineString . getFactory ( ) ; Coordinate [ ] coords = lineString . getCoordinates ( ) ; Polygon [ ] walls = new Polygon [ coords . length - 1 ... | Extrude the linestring as a collection of geometries The output geometryCollection contains the floor the walls and the roof . |
5,953 | public static Geometry extractRoof ( LineString lineString , double height ) { LineString result = ( LineString ) lineString . copy ( ) ; result . apply ( new TranslateCoordinateSequenceFilter ( height ) ) ; return result ; } | Extract the linestring roof . |
5,954 | public static MultiPolygon extractWalls ( Polygon polygon , double height ) { GeometryFactory factory = polygon . getFactory ( ) ; final LineString shell = getClockWise ( polygon . getExteriorRing ( ) ) ; ArrayList < Polygon > walls = new ArrayList < Polygon > ( ) ; for ( int i = 1 ; i < shell . getNumPoints ( ) ; i ++... | Extract the walls from a polygon |
5,955 | public static Polygon extractRoof ( Polygon polygon , double height ) { GeometryFactory factory = polygon . getFactory ( ) ; Polygon roofP = ( Polygon ) polygon . copy ( ) ; roofP . apply ( new TranslateCoordinateSequenceFilter ( height ) ) ; final LinearRing shell = factory . createLinearRing ( getCounterClockWise ( r... | Extract the roof of a polygon |
5,956 | public static MultiPolygon extractWalls ( LineString lineString , double height ) { GeometryFactory factory = lineString . getFactory ( ) ; Coordinate [ ] coords = lineString . getCoordinates ( ) ; Polygon [ ] walls = new Polygon [ coords . length - 1 ] ; for ( int i = 0 ; i < coords . length - 1 ; i ++ ) { walls [ i ]... | Extrude the LineString as a set of walls . |
5,957 | private static LineString getClockWise ( final LineString lineString ) { final Coordinate c0 = lineString . getCoordinateN ( 0 ) ; final Coordinate c1 = lineString . getCoordinateN ( 1 ) ; final Coordinate c2 = lineString . getCoordinateN ( 2 ) ; lineString . apply ( new UpdateZCoordinateSequenceFilter ( 0 , 3 ) ) ; if... | Reverse the LineString to be oriented clockwise . All NaN z values are replaced by a zero value . |
5,958 | private static LineString getCounterClockWise ( final LineString lineString ) { final Coordinate c0 = lineString . getCoordinateN ( 0 ) ; final Coordinate c1 = lineString . getCoordinateN ( 1 ) ; final Coordinate c2 = lineString . getCoordinateN ( 2 ) ; lineString . apply ( new UpdateZCoordinateSequenceFilter ( 0 , 3 )... | Reverse the LineString to be oriented counter - clockwise . |
5,959 | private static Polygon extractFloor ( final Polygon polygon ) { GeometryFactory factory = polygon . getFactory ( ) ; final LinearRing shell = factory . createLinearRing ( getClockWise ( polygon . getExteriorRing ( ) ) . getCoordinates ( ) ) ; final int nbOfHoles = polygon . getNumInteriorRing ( ) ; final LinearRing [ ]... | Reverse the polygon to be oriented clockwise |
5,960 | private static Polygon extrudeEdge ( final Coordinate beginPoint , Coordinate endPoint , final double height , GeometryFactory factory ) { beginPoint . z = Double . isNaN ( beginPoint . z ) ? 0 : beginPoint . z ; endPoint . z = Double . isNaN ( endPoint . z ) ? 0 : endPoint . z ; return factory . createPolygon ( new Co... | Create a polygon corresponding to the wall . |
5,961 | public static String fetchConstraint ( Connection connection , String catalogName , String schemaName , String tableName ) throws SQLException { PreparedStatement pst = SFSUtilities . prepareInformationSchemaStatement ( connection , catalogName , schemaName , tableName , "INFORMATION_SCHEMA.CONSTRAINTS" , "" , "TABLE_C... | Read table constraints from database metadata . |
5,962 | public static Properties parse ( String jdbcUrl ) throws IllegalArgumentException { if ( ! jdbcUrl . startsWith ( URL_STARTS ) ) { throw new IllegalArgumentException ( "JDBC Url must start with " + URL_STARTS ) ; } String driverAndURI = jdbcUrl . substring ( URL_STARTS . length ( ) ) ; Properties properties = new Prope... | Convert JDBC URL into JDBC Connection properties |
5,963 | public static Geometry updateZExtremities ( Geometry geometry , double startZ , double endZ , boolean interpolate ) { if ( geometry == null ) { return null ; } if ( geometry instanceof LineString ) { return force3DStartEnd ( ( LineString ) geometry , startZ , endZ , interpolate ) ; } else if ( geometry instanceof Multi... | Update the start and end Z values . If the interpolate is true the vertices are interpolated according the start and end z values . |
5,964 | private static Geometry force3DStartEnd ( LineString lineString , final double startZ , final double endZ , final boolean interpolate ) { final double bigD = lineString . getLength ( ) ; final double z = endZ - startZ ; final Coordinate coordEnd = lineString . getCoordinates ( ) [ lineString . getCoordinates ( ) . leng... | Updates all z values by a new value using the specified first and the last coordinates . |
5,965 | public boolean push ( String newText ) { if ( stackTop < stack . length - 1 ) { stack [ stackTop ++ ] = newText ; return true ; } else { return false ; } } | Puts string in the stack . |
5,966 | private int getWindowOffset ( long bytePos , int length ) throws IOException { long desiredMax = bytePos + length - 1 ; if ( ( bytePos >= windowStart ) && ( desiredMax < windowStart + buffer . capacity ( ) ) ) { long res = bytePos - windowStart ; if ( res < Integer . MAX_VALUE ) { return ( int ) res ; } else { throw ne... | Moves the window if necessary to contain the desired byte and returns the position of the byte in the window |
5,967 | private static long getJulianCycle ( double J , double lw ) { return Math . round ( J - J2000 - J0 - lw / ( 2 * Math . PI ) ) ; } | general sun calculations |
5,968 | private static double getApproxTransit ( double Ht , double lw , double n ) { return J2000 + J0 + ( Ht + lw ) / ( 2 * Math . PI ) + n ; } | calculations for sun times |
5,969 | private static double getRightAscension ( double Ls ) { return Math . atan2 ( Math . sin ( Ls ) * Math . cos ( e ) , Math . cos ( Ls ) ) ; } | calculations for sun position |
5,970 | public static Coordinate getPosition ( Date date , double lat , double lng ) { if ( isGeographic ( lat , lng ) ) { double lw = rad * - lng ; double phi = rad * lat ; double J = dateToJulianDate ( date ) ; double M = getSolarMeanAnomaly ( J ) ; double C = getEquationOfCenter ( M ) ; double Ls = getEclipticLongitude ( M ... | Returns the sun position as a coordinate with the following properties |
5,971 | public int getContentLength ( int index ) throws IOException { int ret = - 1 ; if ( this . lastIndex != index ) { this . readRecord ( index ) ; } ret = this . recLen ; return ret ; } | Get the content length of the given record in bytes not 16 bit words . |
5,972 | public static Geometry reverse ( Geometry geometry ) { if ( geometry == null ) { return null ; } if ( geometry instanceof MultiPoint ) { return reverseMultiPoint ( ( MultiPoint ) geometry ) ; } return geometry . reverse ( ) ; } | Returns the geometry with vertex order reversed . |
5,973 | public static Geometry reverseMultiPoint ( MultiPoint mp ) { int nPoints = mp . getNumGeometries ( ) ; Point [ ] revPoints = new Point [ nPoints ] ; for ( int i = 0 ; i < nPoints ; i ++ ) { revPoints [ nPoints - 1 - i ] = ( Point ) mp . getGeometryN ( i ) . reverse ( ) ; } return mp . getFactory ( ) . createMultiPoint ... | Returns the MultiPoint with vertex order reversed . We do our own implementation here because JTS does not handle it . |
5,974 | public static Polygon makeEnvelope ( double xmin , double ymin , double xmax , double ymax ) { Coordinate [ ] coordinates = new Coordinate [ ] { new Coordinate ( xmin , ymin ) , new Coordinate ( xmax , ymin ) , new Coordinate ( xmax , ymax ) , new Coordinate ( xmin , ymax ) , new Coordinate ( xmin , ymin ) } ; return G... | Creates a rectangular Polygon formed from the minima and maxima by the given shell . |
5,975 | public static Polygon makeEnvelope ( double xmin , double ymin , double xmax , double ymax , int srid ) { Polygon geom = makeEnvelope ( xmin , ymin , xmax , ymax ) ; geom . setSRID ( srid ) ; return geom ; } | Creates a rectangular Polygon formed from the minima and maxima by the given shell . The user can set a srid . |
5,976 | public static Geometry simplify ( Geometry geometry , double distance ) { if ( geometry == null ) { return null ; } return DouglasPeuckerSimplifier . simplify ( geometry , distance ) ; } | Simplify the geometry using the douglad peucker algorithm . |
5,977 | public static Geometry expand ( Geometry geometry , double deltaX , double deltaY ) { if ( geometry == null ) { return null ; } Envelope env = geometry . getEnvelopeInternal ( ) ; double minX = env . getMinX ( ) - deltaX ; double maxX = env . getMaxX ( ) + deltaX ; double minY = env . getMinY ( ) - deltaY ; double maxY... | Expands a geometry s envelope by the given delta X and delta Y . Both positive and negative distances are supported . |
5,978 | public static LineString computeDirection ( Geometry geometry ) throws IllegalArgumentException { if ( geometry == null ) { return null ; } Triangle triangle = TINFeatureFactory . createTriangle ( geometry ) ; Vector3D normal = TriMarkers . getNormalVector ( triangle ) ; Vector3D vector = new Vector3D ( normal . getX (... | Compute the main slope direction |
5,979 | public static Geometry drapePoints ( Geometry pts , Geometry triangles , STRtree sTRtree ) { Geometry geomDrapped = pts . copy ( ) ; CoordinateSequenceFilter drapeFilter = new DrapeFilter ( sTRtree ) ; geomDrapped . apply ( drapeFilter ) ; return geomDrapped ; } | Drape a point or a multipoint geometry to a set of triangles |
5,980 | public static Geometry drapeLineString ( LineString line , Geometry triangles , STRtree sTRtree ) { GeometryFactory factory = line . getFactory ( ) ; Geometry triangleLines = LinearComponentExtracter . getGeometry ( triangles , true ) ; Geometry diffExt = lineMerge ( line . difference ( triangleLines ) , factory ) ; Co... | Drape a linestring to a set of triangles |
5,981 | public static Geometry drapePolygon ( Polygon p , Geometry triangles , STRtree sTRtree ) { GeometryFactory factory = p . getFactory ( ) ; Geometry triangleLines = LinearComponentExtracter . getGeometry ( triangles , true ) ; Polygon splittedP = processPolygon ( p , triangleLines , factory ) ; CoordinateSequenceFilter d... | Drape a polygon on a set of triangles |
5,982 | private static Polygon processPolygon ( Polygon p , Geometry triangleLines , GeometryFactory factory ) { Geometry diffExt = p . getExteriorRing ( ) . difference ( triangleLines ) ; final int nbOfHoles = p . getNumInteriorRing ( ) ; final LinearRing [ ] holes = new LinearRing [ nbOfHoles ] ; for ( int i = 0 ; i < nbOfHo... | Cut the lines of the polygon with the triangles |
5,983 | public static Geometry lineMerge ( Geometry geom , GeometryFactory factory ) { LineMerger merger = new LineMerger ( ) ; merger . add ( geom ) ; Collection lines = merger . getMergedLineStrings ( ) ; return factory . buildGeometry ( lines ) ; } | A method to merge a geometry to a set of linestring |
5,984 | public static Geometry precisionReducer ( Geometry geometry , int nbDec ) throws SQLException { if ( geometry == null ) { return null ; } if ( nbDec < 0 ) { throw new SQLException ( "Decimal_places has to be >= 0." ) ; } PrecisionModel pm = new PrecisionModel ( scaleFactorForDecimalPlaces ( nbDec ) ) ; GeometryPrecisio... | Reduce the geometry precision . Decimal_Place is the number of decimals to keep . |
5,985 | public static Geometry ringSideBuffer ( Geometry geom , double bufferSize , int numBuffer ) throws SQLException { return ringSideBuffer ( geom , bufferSize , numBuffer , "endcap=flat" ) ; } | Compute a ring buffer on one side of the geometry |
5,986 | public static Double computeAspect ( Geometry geometry ) throws IllegalArgumentException { if ( geometry == null ) { return null ; } Vector3D vector = TriMarkers . getSteepestVector ( TriMarkers . getNormalVector ( TINFeatureFactory . createTriangle ( geometry ) ) , TINFeatureFactory . EPSILON ) ; if ( vector . length ... | Compute the aspect in degree . The geometry must be a triangle . |
5,987 | public static Double getMinZ ( Geometry geom ) { if ( geom != null ) { return CoordinateUtils . zMinMax ( geom . getCoordinates ( ) ) [ 0 ] ; } else { return null ; } } | Returns the minimal z - value of the given geometry . |
5,988 | private static LineString reverse3D ( LineString lineString , String order ) { CoordinateSequence seq = lineString . getCoordinateSequence ( ) ; double startZ = seq . getCoordinate ( 0 ) . z ; double endZ = seq . getCoordinate ( seq . size ( ) - 1 ) . z ; if ( order . equalsIgnoreCase ( "desc" ) ) { if ( ! Double . isN... | Reverses a LineString according to the z value . The z of the first point must be lower than the z of the end point . |
5,989 | public static String generateGMLink ( Geometry geom , String layerType , int zoom ) { if ( geom == null ) { return null ; } try { LayerType layer = LayerType . valueOf ( layerType . toLowerCase ( ) ) ; Coordinate centre = geom . getEnvelopeInternal ( ) . centre ( ) ; StringBuilder sb = new StringBuilder ( "https://maps... | Generate a Google Map link URL based on the center of the bounding box of the input geometry . Set the layer type and the zoom level . |
5,990 | protected Coordinate [ ] toCoordinateArray ( Stack stack ) { Coordinate [ ] coordinates = new Coordinate [ stack . size ( ) ] ; for ( int i = 0 ; i < stack . size ( ) ; i ++ ) { Coordinate coordinate = ( Coordinate ) stack . get ( i ) ; coordinates [ i ] = coordinate ; } return coordinates ; } | An alternative to Stack . toArray which is not present in earlier versions of Java . |
5,991 | private Stack grahamScan ( Coordinate [ ] c ) { Coordinate p ; Stack ps = new Stack ( ) ; p = ( Coordinate ) ps . push ( c [ 0 ] ) ; p = ( Coordinate ) ps . push ( c [ 1 ] ) ; p = ( Coordinate ) ps . push ( c [ 2 ] ) ; for ( int i = 3 ; i < c . length ; i ++ ) { p = ( Coordinate ) ps . pop ( ) ; while ( ! ps . empty ( ... | Uses the Graham Scan algorithm to compute the convex hull vertices . |
5,992 | public static Geometry force3D ( Geometry geom ) { if ( geom == null ) { return null ; } return GeometryCoordinateDimension . force ( geom , 3 ) ; } | Converts a XY geometry to XYZ . If a geometry has no Z component then a 0 Z coordinate is tacked on . |
5,993 | public static Boolean isWithinDistance ( Geometry geomA , Geometry geomB , Double distance ) { if ( geomA == null || geomB == null ) { return null ; } return geomA . isWithinDistance ( geomB , distance ) ; } | Returns true if the geometries are within the specified distance of one another . |
5,994 | public static String toGeojson ( Geometry geom ) { StringBuilder sb = new StringBuilder ( ) ; toGeojsonGeometry ( geom , sb ) ; return sb . toString ( ) ; } | Convert the geometry to a GeoJSON representation . |
5,995 | public static void toGeojsonGeometry ( Geometry geom , StringBuilder sb ) { if ( geom instanceof Point ) { toGeojsonPoint ( ( Point ) geom , sb ) ; } else if ( geom instanceof LineString ) { toGeojsonLineString ( ( LineString ) geom , sb ) ; } else if ( geom instanceof Polygon ) { toGeojsonPolygon ( ( Polygon ) geom , ... | Transform a JTS geometry to a GeoJSON representation . |
5,996 | public static void toGeojsonPoint ( Point point , StringBuilder sb ) { Coordinate coord = point . getCoordinate ( ) ; sb . append ( "{\"type\":\"Point\",\"coordinates\":[" ) ; sb . append ( coord . x ) . append ( "," ) . append ( coord . y ) ; if ( ! Double . isNaN ( coord . z ) ) { sb . append ( "," ) . append ( coord... | For type Point the coordinates member must be a single position . |
5,997 | public static void toGeojsonMultiPoint ( MultiPoint multiPoint , StringBuilder sb ) { sb . append ( "{\"type\":\"MultiPoint\",\"coordinates\":" ) ; toGeojsonCoordinates ( multiPoint . getCoordinates ( ) , sb ) ; sb . append ( "}" ) ; } | Coordinates of a MultiPoint are an array of positions . |
5,998 | public static void toGeojsonLineString ( LineString lineString , StringBuilder sb ) { sb . append ( "{\"type\":\"LineString\",\"coordinates\":" ) ; toGeojsonCoordinates ( lineString . getCoordinates ( ) , sb ) ; sb . append ( "}" ) ; } | Coordinates of LineString are an array of positions . |
5,999 | public static void toGeojsonMultiLineString ( MultiLineString multiLineString , StringBuilder sb ) { sb . append ( "{\"type\":\"MultiLineString\",\"coordinates\":[" ) ; for ( int i = 0 ; i < multiLineString . getNumGeometries ( ) ; i ++ ) { toGeojsonCoordinates ( multiLineString . getGeometryN ( i ) . getCoordinates ( ... | Coordinates of a MultiLineString are an array of LineString coordinate arrays . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.