/** * Converts a byte array to a hexadecimal string. * * @param bytes * @return a string of hexadecimal digits * * @deprecated */ public static String bytesToHex(byte[] bytes) { return toHex(bytes); }
/** * Converts a byte array to a hexadecimal string. * * @param bytes * @return a string of hexadecimal digits * * @deprecated */ public static String bytesToHex(byte[] bytes) { return toHex(bytes); }
@Override public MultiPolygon backwardConvert(final byte[] wkb) { com.vividsolutions.jts.geom.MultiPolygon geometry = null; try { geometry = (com.vividsolutions.jts.geom.MultiPolygon) WKB_READER.read(wkb); } catch (final ParseException | ClassCastException e) { throw new CoreException("Cannot parse wkb : {}", WKBWriter.toHex(wkb)); } return new JtsMultiPolygonToMultiPolygonConverter().convert(geometry); }
@Override public Polygon backwardConvert(final byte[] wkb) { com.vividsolutions.jts.geom.Polygon geometry = null; final WKBReader myReader = new WKBReader(); try { geometry = (com.vividsolutions.jts.geom.Polygon) myReader.read(wkb); } catch (final ParseException | ClassCastException e) { throw new CoreException("Cannot parse wkb : {}", WKBWriter.toHex(wkb)); } return new JtsPolygonConverter().backwardConvert(geometry); }
@Override public Location backwardConvert(final byte[] wkb) { Point geometry = null; final WKBReader myReader = new WKBReader(); try { geometry = (Point) myReader.read(wkb); } catch (final ParseException | ClassCastException e) { throw new CoreException("Cannot parse wkb : {}", WKBWriter.toHex(wkb)); } return new JtsPointConverter().backwardConvert(geometry); }
@Override public PolyLine backwardConvert(final byte[] wkb) { PolyLine polyLine = null; Geometry geometry = null; final WKBReader myReader = new WKBReader(); try { geometry = myReader.read(wkb); } catch (final ParseException e) { throw new CoreException("Cannot parse wkb : {}", WKBWriter.toHex(wkb)); } final Coordinate[] coordinates = geometry.getCoordinates(); final List<Location> locations = new ArrayList<>(); for (int i = 0; i < coordinates.length; i++) { // y = latitude, x = longitude from JTS Coordinate format locations.add(new Location(Latitude.degrees(coordinates[i].y), Longitude.degrees(coordinates[i].x))); } polyLine = new PolyLine(locations); return polyLine; }
final String convertedWkbString = WKBWriter.toHex(convertedWkb); Assert.assertEquals(convertedWkbString, strings.get(stringIndex)); logger.trace(convertedWkbString);
ret.namespaceId = srs.getString(6); if (geometry != null) { ret.geometryWKB = WKBWriter.toHex(wkbWriter.write(geometry));
/** * Tests every polygon input form supported by the filter */ @Test public void testForms() { final Atlas testFormsAtlas = this.setup.getTestForm(); final String wktConfigurationStringFormat = "{\"filter.polygons\":{\"include.wkt\":[\"%s\"]}}"; final String wkbConfigurationStringFormat = "{\"filter.polygons\":{\"include.wkb\":[\"%s\"]}}"; final String atlasConfigurationStringFormat = "{\"filter.polygons\":{\"include.atlas\":[\"%s\"]}}"; final String geojsonConfigurationStringFormat = "{\"filter.polygons\":{\"include.geojson\":[\"%s\"]}}"; final Polygon includeBoundary = this.getPolygonWithName(testFormsAtlas, "include"); this.assertCounts(this.setup.getTestForm(), this.constructConfiguredFilter( wktConfigurationStringFormat, includeBoundary.toWkt()), 2, 2, 2, 0); this.assertCounts(this.setup.getTestForm(), this.constructConfiguredFilter(wkbConfigurationStringFormat, WKBWriter.toHex(new WkbPolygonConverter().convert(includeBoundary))), 2, 2, 2, 0); this.assertCounts(this.setup.getTestForm(), this.constructConfiguredFilter(atlasConfigurationStringFormat, new PolygonStringConverter().backwardConvert(includeBoundary)), 2, 2, 2, 0); this.assertCounts(this.setup.getTestForm(), this.constructConfiguredFilter(geojsonConfigurationStringFormat, includeBoundary.asGeoJson().toString().replaceAll("\"", "\\\\\"")), 2, 2, 2, 0); }
WKBWriter.toHex(new WkbMultiPolygonConverter().convert(multiPolygon1))), 3, 1, -1, -1); this.assertCounts(testMultiPolygonFormsAtlas,