com.vividsolutions.jts.geom.PrecisionModel Java Examples
The following examples show how to use
com.vividsolutions.jts.geom.PrecisionModel.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OffsetSegmentGenerator.java From jts with GNU Lesser General Public License v2.1 | 6 votes |
public OffsetSegmentGenerator(PrecisionModel precisionModel, BufferParameters bufParams, double distance) { this.precisionModel = precisionModel; this.bufParams = bufParams; // compute intersections in full precision, to provide accuracy // the points are rounded as they are inserted into the curve line li = new RobustLineIntersector(); filletAngleQuantum = Math.PI / 2.0 / bufParams.getQuadrantSegments(); /** * Non-round joins cause issues with short closing segments, so don't use * them. In any case, non-round joins only really make sense for relatively * small buffer distances. */ if (bufParams.getQuadrantSegments() >= 8 && bufParams.getJoinStyle() == BufferParameters.JOIN_ROUND) closingSegLengthFactor = MAX_CLOSING_SEG_LEN_FACTOR; init(distance); }
Example #2
Source File: BeanFeatureModel.java From geomajas-project-server with GNU Affero General Public License v3.0 | 6 votes |
public Geometry getGeometry(Object feature) throws LayerException { Entity entity = entityMapper.asEntity(feature); Object geometry = entity.getAttribute(getGeometryAttributeName()); if (!wkt || null == geometry) { log.debug("bean.getGeometry {}", geometry); return (Geometry) geometry; } else { try { WKTReader reader = new WKTReader(new GeometryFactory(new PrecisionModel(), srid)); Geometry geom = reader.read((String) geometry); log.debug("bean.getGeometry {}", geom); return geom; } catch (Throwable t) { throw new LayerException(t, ExceptionCode.FEATURE_MODEL_PROBLEM, geometry); } } }
Example #3
Source File: GeometryConverterTest.java From geomajas-project-server with GNU Affero General Public License v3.0 | 6 votes |
public GeometryConverterTest() { factory = new GeometryFactory(new PrecisionModel(), SRID); jtsC1 = new com.vividsolutions.jts.geom.Coordinate(10.0, 10.0); jtsC2 = new com.vividsolutions.jts.geom.Coordinate(20.0, 10.0); jtsC3 = new com.vividsolutions.jts.geom.Coordinate(20.0, 20.0); jtsC4 = new com.vividsolutions.jts.geom.Coordinate(10.0, 20.0); jtsC5 = new com.vividsolutions.jts.geom.Coordinate(12.0, 12.0); jtsC6 = new com.vividsolutions.jts.geom.Coordinate(12.0, 18.0); jtsC7 = new com.vividsolutions.jts.geom.Coordinate(18.0, 18.0); jtsC8 = new com.vividsolutions.jts.geom.Coordinate(18.0, 12.0); dtoC1 = new Coordinate(10.0, 10.0); dtoC2 = new Coordinate(20.0, 10.0); dtoC3 = new Coordinate(20.0, 20.0); dtoC4 = new Coordinate(10.0, 20.0); dtoC5 = new Coordinate(12.0, 12.0); dtoC6 = new Coordinate(12.0, 18.0); dtoC7 = new Coordinate(18.0, 18.0); dtoC8 = new Coordinate(18.0, 12.0); }
Example #4
Source File: GeoServiceTest.java From geomajas-project-server with GNU Affero General Public License v3.0 | 6 votes |
@Test public void testCreateCircle() throws Exception { Geometry geometry; GeometryFactory factory = new GeometryFactory(new PrecisionModel(), 4326); Point point = factory.createPoint(new Coordinate(0, 0)); Point inside = factory.createPoint(new Coordinate(9.5, 0)); Point insideFine = factory.createPoint(new Coordinate(6.8, 6.8)); Point outsideAll = factory.createPoint(new Coordinate(9, 5)); geometry = geoService.createCircle(point, 10, 4); Assert.assertEquals(5, geometry.getCoordinates().length); Assert.assertTrue(geometry.contains(inside)); Assert.assertFalse(geometry.contains(insideFine)); Assert.assertFalse(geometry.contains(outsideAll)); geometry = geoService.createCircle(point, 10, 16); Assert.assertEquals(17, geometry.getCoordinates().length); Assert.assertTrue(geometry.contains(inside)); Assert.assertTrue(geometry.contains(insideFine)); Assert.assertFalse(geometry.contains(outsideAll)); }
Example #5
Source File: PolygonOverlayFunctions.java From jts with GNU Lesser General Public License v2.1 | 6 votes |
public static Geometry overlaySnapRounded(Geometry g1, Geometry g2, double precisionTol) { PrecisionModel pm = new PrecisionModel(precisionTol); GeometryFactory geomFact = g1.getFactory(); List lines = LinearComponentExtracter.getLines(g1); // add second input's linework, if any if (g2 != null) LinearComponentExtracter.getLines(g2, lines); List nodedLinework = new GeometryNoder(pm).node(lines); // union the noded linework to remove duplicates Geometry nodedDedupedLinework = geomFact.buildGeometry(nodedLinework).union(); // polygonize the result Polygonizer polygonizer = new Polygonizer(); polygonizer.add(nodedDedupedLinework); Collection polys = polygonizer.getPolygons(); // convert to collection for return Polygon[] polyArray = GeometryFactory.toPolygonArray(polys); return geomFact.createGeometryCollection(polyArray); }
Example #6
Source File: SOSSelectionChangedHandler.java From SensorWebClient with GNU General Public License v2.0 | 5 votes |
private BoundingBox createBoundingBox(Record record) { Double llEasting = Double.parseDouble(getValueFor(record, "llEasting")); Double llNorthing = Double.parseDouble(getValueFor(record, "llNorthing")); Double urEasting = Double.parseDouble(getValueFor(record, "urEasting")); Double urNorthing = Double.parseDouble(getValueFor(record, "urNorthing")); GeometryFactory factory = new GeometryFactory(new PrecisionModel(), 4326); Point ll = factory.createPoint(new Coordinate(llEasting, llNorthing)); Point ur = factory.createPoint(new Coordinate(urEasting, urNorthing)); return new BoundingBox(ll, ur, "EPSG:4326"); }
Example #7
Source File: AreaAuthorizationInfo.java From geomajas-project-server with GNU Affero General Public License v3.0 | 5 votes |
private Geometry readWkt(String area) { try { WKTReader wktReader = new WKTReader(new GeometryFactory(new PrecisionModel(), 0)); return wktReader.read(area); } catch (ParseException pe) { throw new IllegalArgumentException("Could not parse geometry " + area, pe); } }
Example #8
Source File: MergePolygonCommand.java From geomajas-project-server with GNU Affero General Public License v3.0 | 5 votes |
@Override public void execute(MergePolygonRequest request, MergePolygonResponse response) throws Exception { Polygon[] polygons = new Polygon[request.getPolygons().length]; for (int i = 0; i < request.getPolygons().length; i++) { try { polygons[i] = (Polygon) converter.toInternal(request.getPolygons()[i]); } catch (Exception e) { throw new GeomajasException(e, ExceptionCode.MERGE_NO_POLYGON); } } int precision = polygons[0].getPrecisionModel().getMaximumSignificantDigits() - 1; PrecisionModel precisionModel = new PrecisionModel(Math.pow(10.0, precision)); GeometryFactory factory = new GeometryFactory(precisionModel, polygons[0].getSRID()); Geometry temp = factory.createGeometry(polygons[0]); for (int i = 1; i < polygons.length; i++) { Geometry polygon = factory.createGeometry(polygons[i]); temp = temp.union(polygon.buffer(Math.pow(10.0, -(precision - 1)))); } if (temp instanceof Polygon) { MultiPolygon mp = factory.createMultiPolygon(new Polygon[] { (Polygon) temp }); response.setGeometry(converter.toDto(mp)); } else if (temp instanceof MultiPolygon && temp.getNumGeometries() != 0 && (request.isAllowMultiPolygon() || temp.getNumGeometries() == 1)) { response.setGeometry(converter.toDto(temp)); } else { throw new GeomajasException(ExceptionCode.MERGE_NO_POLYGON); } }
Example #9
Source File: CustomBeanLayerTest.java From geomajas-project-server with GNU Affero General Public License v3.0 | 5 votes |
@Test public void readGeometry() throws LayerException { GeometryFactory factory = new GeometryFactory(new PrecisionModel(), 4326); LinearRing shell = factory.createLinearRing(new Coordinate[] { new Coordinate(0, 0), new Coordinate(1, 0), new Coordinate(1, 1), new Coordinate(0, 1), new Coordinate(0, 0), }); Polygon p = factory.createPolygon(shell, null); MultiPolygon expected = factory.createMultiPolygon(new Polygon[] { p }); Assert.assertTrue(((CustomBean) layer.read("1")).getGeometry().equalsExact(expected)); }
Example #10
Source File: CustomBeanLayerTest.java From geomajas-project-server with GNU Affero General Public License v3.0 | 5 votes |
@Before public void setupBeans() throws LayerException { GeometryFactory factory = new GeometryFactory(new PrecisionModel(PrecisionModel.FLOATING), 4329); LinearRing shell = factory.createLinearRing(new Coordinate[] { new Coordinate(0, 0), new Coordinate(1, 0), new Coordinate(1, 1), new Coordinate(0, 1), new Coordinate(0, 0), }); Polygon p = factory.createPolygon(shell, null); MultiPolygon expected = factory.createMultiPolygon(new Polygon[] { p }); CustomBean cb = new CustomBean(); cb.setId(1); cb.setGeometry(expected); cb.setName("testbean"); layer.saveOrUpdate(cb); }
Example #11
Source File: BeanLayerTest.java From geomajas-project-server with GNU Affero General Public License v3.0 | 5 votes |
@Test public void readGeometry() throws LayerException { Object bean = layer.read("1"); GeometryFactory factory = new GeometryFactory(new PrecisionModel(), 4326); LinearRing shell = factory.createLinearRing(new Coordinate[] { new Coordinate(0, 0), new Coordinate(1, 0), new Coordinate(1, 1), new Coordinate(0, 1), new Coordinate(0, 0), }); Polygon p = factory.createPolygon(shell, null); MultiPolygon expected =factory.createMultiPolygon(new Polygon[]{p}); Geometry g = layer.getFeatureModel().getGeometry(bean); Assert.assertTrue(expected.equalsExact(g, 0.00001)); }
Example #12
Source File: OddFeatureAuthorization.java From geomajas-project-server with GNU Affero General Public License v3.0 | 5 votes |
protected Geometry getAuthorizedArea(String layerId) { if (null == biggestGeometry) { // build Geometry which covers biggest possible area Envelope maxBounds = new Envelope(-Double.MAX_VALUE, Double.MAX_VALUE, -Double.MAX_VALUE, Double.MAX_VALUE); PrecisionModel precisionModel = new PrecisionModel(PrecisionModel.FLOATING); GeometryFactory geometryFactory = new GeometryFactory(precisionModel, 0); biggestGeometry = geometryFactory.toGeometry(maxBounds); } return biggestGeometry; }
Example #13
Source File: SecurityContextAreaAuthorizationTest.java From geomajas-project-server with GNU Affero General Public License v3.0 | 5 votes |
@Test public void testDefaultVisibleAreaOne() throws Exception { DefaultSecurityContext securityContext = (DefaultSecurityContext)this.securityContext; List<Authentication> authentications = new ArrayList<Authentication>(); Authentication auth1 = getAuthentication(); Authentication auth2 = getAreaAuthentication(1); authentications.add(auth1); authentications.add(auth2); securityContext.setAuthentications("token", authentications); Geometry geometry = securityContext.getVisibleArea(LAYER_ID); Assert.assertNotNull(geometry); PrecisionModel precisionModel = new PrecisionModel(PrecisionModel.FLOATING); GeometryFactory geometryFactory = new GeometryFactory(precisionModel, LAYER_SRID); Coordinate coordinate = new Coordinate(); coordinate.x = coordinate.y = 0.5; Assert.assertFalse(geometry.contains(geometryFactory.createPoint(coordinate))); coordinate.x = coordinate.y = 1.5; Assert.assertTrue(geometry.contains(geometryFactory.createPoint(coordinate))); coordinate.x = coordinate.y = 2.5; Assert.assertTrue(geometry.contains(geometryFactory.createPoint(coordinate))); coordinate.x = coordinate.y = 3.5; Assert.assertFalse(geometry.contains(geometryFactory.createPoint(coordinate))); coordinate.x = coordinate.y = 4.5; Assert.assertFalse(geometry.contains(geometryFactory.createPoint(coordinate))); Assert.assertFalse(securityContext.isPartlyVisibleSufficient(LAYER_ID)); }
Example #14
Source File: BufferTest.java From jts with GNU Lesser General Public License v2.1 | 5 votes |
public void testMultiLineString3_holeVanishes_floatingSingle() throws Exception { new BufferValidator( 0.16, "MULTILINESTRING (( 635074.5418406526 6184832.4888257105, 635074.5681951842 6184832.571842485, 635074.6472587794 6184832.575795664 ), ( 635074.6657069515 6184832.53889932, 635074.6933792098 6184832.451929366, 635074.5642420045 6184832.474330718 ))", false) .setBufferHolesExpected(false) .setEmptyBufferExpected(true) .setPrecisionModel(new PrecisionModel(PrecisionModel.FLOATING_SINGLE)) .test(); }
Example #15
Source File: SecurityContextAreaAuthorizationTest.java From geomajas-project-server with GNU Affero General Public License v3.0 | 5 votes |
@Test public void testDefaultVisibleArea() throws Exception { DefaultSecurityContext securityContext = (DefaultSecurityContext)this.securityContext; List<Authentication> authentications = new ArrayList<Authentication>(); Authentication auth1 = getBaseAuthentication(); authentications.add(auth1); securityContext.setAuthentications("token", authentications); Assert.assertTrue(securityContext.isLayerVisible(LAYER_ID)); Geometry geometry = securityContext.getVisibleArea(LAYER_ID); Assert.assertNotNull(geometry); PrecisionModel precisionModel = new PrecisionModel(PrecisionModel.FLOATING); GeometryFactory geometryFactory = new GeometryFactory(precisionModel, LAYER_SRID); Coordinate coordinate = new Coordinate(); coordinate.x = coordinate.y = -86; Assert.assertFalse(geometry.contains(geometryFactory.createPoint(coordinate))); coordinate.x = -85.05; coordinate.y = -85.05; Assert.assertTrue(geometry.contains(geometryFactory.createPoint(coordinate))); coordinate.x = -85.05; coordinate.y = 85.05; Assert.assertTrue(geometry.contains(geometryFactory.createPoint(coordinate))); coordinate.x = 85.05; coordinate.y = -85.05; Assert.assertTrue(geometry.contains(geometryFactory.createPoint(coordinate))); coordinate.x = 85.05; coordinate.y = 85.05; Assert.assertTrue(geometry.contains(geometryFactory.createPoint(coordinate))); coordinate.x = coordinate.y = 86; Assert.assertFalse(geometry.contains(geometryFactory.createPoint(coordinate))); Assert.assertFalse(securityContext.isPartlyVisibleSufficient(LAYER_ID)); }
Example #16
Source File: AllowAllAuthorization.java From geomajas-project-server with GNU Affero General Public License v3.0 | 5 votes |
protected Geometry getAuthorizedArea(String layerId) { if (null == biggestGeometry) { // build Geometry which covers biggest possible area Envelope maxBounds = new Envelope(-Float.MAX_VALUE, Float.MAX_VALUE, -Float.MAX_VALUE, Float.MAX_VALUE); PrecisionModel precisionModel = new PrecisionModel(PrecisionModel.FLOATING); GeometryFactory geometryFactory = new GeometryFactory(precisionModel, 0); biggestGeometry = geometryFactory.toGeometry(maxBounds); } return biggestGeometry; }
Example #17
Source File: SecurityContextAreaAuthorizationTest.java From geomajas-project-server with GNU Affero General Public License v3.0 | 5 votes |
@Test public void testDefaultVisibleAreaTwo() throws Exception { DefaultSecurityContext securityContext = (DefaultSecurityContext)this.securityContext; List<Authentication> authentications = new ArrayList<Authentication>(); Authentication auth1 = getAreaAuthentication(1); Authentication auth2 = getAreaAuthentication(2); authentications.add(auth1); authentications.add(auth2); securityContext.setAuthentications("token", authentications); Geometry geometry = securityContext.getVisibleArea(LAYER_ID); Assert.assertNotNull(geometry); PrecisionModel precisionModel = new PrecisionModel(PrecisionModel.FLOATING); GeometryFactory geometryFactory = new GeometryFactory(precisionModel, LAYER_SRID); Coordinate coordinate = new Coordinate(); coordinate.x = coordinate.y = 0.5; Assert.assertFalse(geometry.contains(geometryFactory.createPoint(coordinate))); coordinate.x = coordinate.y = 1.5; Assert.assertFalse(geometry.contains(geometryFactory.createPoint(coordinate))); coordinate.x = coordinate.y = 2.5; Assert.assertTrue(geometry.contains(geometryFactory.createPoint(coordinate))); coordinate.x = coordinate.y = 3.5; Assert.assertFalse(geometry.contains(geometryFactory.createPoint(coordinate))); coordinate.x = coordinate.y = 4.5; Assert.assertFalse(geometry.contains(geometryFactory.createPoint(coordinate))); Assert.assertFalse(securityContext.isPartlyVisibleSufficient(LAYER_ID)); }
Example #18
Source File: GeoServiceTransformableAreaTest.java From geomajas-project-server with GNU Affero General Public License v3.0 | 5 votes |
@Test public void transformOutsideAreaTest() throws Exception { GeometryFactory factory = new GeometryFactory(new PrecisionModel(), 4326); Geometry geometry = factory.createLineString(new Coordinate[] { new Coordinate(110, 50), new Coordinate(120, 60) }); geometry = geoService.transform(geometry, LONLAT, LAMBERT72); Assert.assertTrue(geometry.isEmpty()); }
Example #19
Source File: GeoServiceTest.java From geomajas-project-server with GNU Affero General Public License v3.0 | 5 votes |
@Test public void testCalcDefaultLabelPosition() throws Exception { Geometry geometry; GeometryFactory factory = new GeometryFactory(new PrecisionModel(), 4326); Coordinate coordinate; InternalFeature feature = new InternalFeatureImpl(); feature.setId("x"); feature.setLabel("Label x"); coordinate = geoService.calcDefaultLabelPosition(feature); Assert.assertNull(coordinate); feature.setGeometry(factory.createMultiPolygon(new Polygon[] {})); coordinate = geoService.calcDefaultLabelPosition(feature); Assert.assertNull(coordinate); feature.setGeometry(JTS.toGeometry(new Envelope(10, 20, 30, 40))); coordinate = geoService.calcDefaultLabelPosition(feature); // this tests current behaviour, without claims that this is the "best" (or even "good") position Assert.assertEquals(15.0, coordinate.x, DELTA); Assert.assertEquals(35.0, coordinate.y, DELTA); geometry = factory.createLineString(new Coordinate[] { new Coordinate(5,4), new Coordinate(30,10) }); feature.setGeometry(geometry); coordinate = geoService.calcDefaultLabelPosition(feature); // this tests current behaviour, without claims that this is the "best" (or even "good") position Assert.assertEquals(5.0, coordinate.x, DELTA); Assert.assertEquals(4.0, coordinate.y, DELTA); }
Example #20
Source File: NestedFeatureModelTest.java From geomajas-project-server with GNU Affero General Public License v3.0 | 5 votes |
@Before public void setUpTestDataWithinTransaction() throws LayerException, ParseException { wktReader = new WKTReader(new GeometryFactory(new PrecisionModel(), 4326)); featureModel = layer.getFeatureModel(); feature1 = NestedFeature.getDefaultInstance1(); feature1.setGeometry(wktReader.read("POINT(10 20)")); layer.create(feature1); }
Example #21
Source File: DefaultSecurityContext.java From geomajas-project-server with GNU Affero General Public License v3.0 | 5 votes |
private Geometry areaCombine(String layerId, AreaCombineGetter areaGetter) { if (null == authentications || authentications.size() == 0) { // no authorizations, so nothing should be allowed return null; } Layer<?> layer = configurationService.getLayer(layerId); if (null == layer) { log.error("areaCombine on unknown layer " + layerId); return null; } LayerInfo layerInfo = layer.getLayerInfo(); // base is the max bounds of the layer Envelope maxBounds = converterService.toInternal(layerInfo.getMaxExtent()); PrecisionModel precisionModel = new PrecisionModel(PrecisionModel.FLOATING); int srid = geoService.getSridFromCrs(layer.getLayerInfo().getCrs()); GeometryFactory geometryFactory = new GeometryFactory(precisionModel, srid); Geometry geometry = geometryFactory.toGeometry(maxBounds); // limit based on authorizations for (Authentication authentication : authentications) { for (BaseAuthorization authorization : authentication.getAuthorizations()) { if (authorization instanceof AreaAuthorization) { geometry = geometry.intersection(areaGetter.get((AreaAuthorization) authorization)); } } } geometry.setSRID(srid); // force srid, even when not set correctly by security service return geometry; }
Example #22
Source File: WKTReaderTest.java From jts with GNU Lesser General Public License v2.1 | 5 votes |
public void testReadLargeNumbers() throws Exception { PrecisionModel precisionModel = new PrecisionModel(1E9); GeometryFactory geometryFactory = new GeometryFactory(precisionModel, 0); WKTReader reader = new WKTReader(geometryFactory); Geometry point1 = reader.read("POINT (123456789.01234567890 10)"); Point point2 = geometryFactory.createPoint(new Coordinate(123456789.01234567890, 10)); assertEquals(point1.getCoordinate().x, point2.getCoordinate().x, 1E-7); assertEquals(point1.getCoordinate().y, point2.getCoordinate().y, 1E-7); }
Example #23
Source File: SnapRoundingTest.java From jts with GNU Lesser General Public License v2.1 | 5 votes |
void runRounding(String[] wkt) { List geoms = fromWKT(wkt); PrecisionModel pm = new PrecisionModel(SNAP_TOLERANCE); GeometryNoder noder = new GeometryNoder(pm); noder.setValidate(true); List nodedLines = noder.node(geoms); /* for (Iterator it = nodedLines.iterator(); it.hasNext(); ) { System.out.println(it.next()); } */ assertTrue(isSnapped(nodedLines, SNAP_TOLERANCE)); }
Example #24
Source File: BufferTest.java From jts with GNU Lesser General Public License v2.1 | 5 votes |
public void testPolygon_MultipleHoles() throws Exception { new BufferValidator( 10.0, "POLYGON (( 78 82, 78 282, 312 282, 312 82, 78 82 ), ( 117 242, 122 242, 122 248, 117 248, 117 242 ), ( 156 104, 288 104, 288 210, 156 210, 156 104 ))") .setBufferHolesExpected(true) .setEmptyBufferExpected(false) .setPrecisionModel(new PrecisionModel(PrecisionModel.FLOATING)) .test(); }
Example #25
Source File: BufferTest.java From jts with GNU Lesser General Public License v2.1 | 5 votes |
public void testMultiLineString4_reallyBigDistance_floatingSingle() throws Exception { new BufferValidator( 1E10, "MULTILINESTRING (( 635074.5418406526 6184832.4888257105, 635074.5681951842 6184832.571842485, 635074.6472587794 6184832.575795664 ), ( 635074.6657069515 6184832.53889932, 635074.6933792098 6184832.451929366, 635074.5642420045 6184832.474330718 ))") .setBufferHolesExpected(false) .setEmptyBufferExpected(false) .setPrecisionModel(new PrecisionModel(PrecisionModel.FLOATING_SINGLE)) .test(); }
Example #26
Source File: UserMapper.java From C4SG-Obsolete with MIT License | 5 votes |
/** * Map user data transfer object into user entity * * @param userDTO User Data Transfer object * @return User */ public User getUserEntityFromDto(UserDTO userDTO){ User user = map(userDTO, User.class); if (userDTO.getLatitude() != null && userDTO.getLongitude() != null){ GeometryFactory gf = new GeometryFactory(new PrecisionModel(PrecisionModel.FLOATING)); Coordinate coordinate = new Coordinate(Double.parseDouble(userDTO.getLongitude()), Double.parseDouble(userDTO.getLatitude())); com.vividsolutions.jts.geom.Point point = gf.createPoint(coordinate); user.setLocation(point); } user.setDisplayFlag(Boolean.valueOf(userDTO.getDisplayFlag())); return user; }
Example #27
Source File: BufferTest.java From jts with GNU Lesser General Public License v2.1 | 5 votes |
public void testMultiLineString2_buffersTouchToMakeHole_floatingSingle() throws Exception { new BufferValidator( 0.037, "MULTILINESTRING (( 635074.5418406526 6184832.4888257105, 635074.5681951842 6184832.571842485, 635074.6472587794 6184832.575795664 ), ( 635074.6657069515 6184832.53889932, 635074.6933792098 6184832.451929366, 635074.5642420045 6184832.474330718 ))", false) .setBufferHolesExpected(false) .setEmptyBufferExpected(true) .setPrecisionModel(new PrecisionModel(PrecisionModel.FLOATING_SINGLE)) .test(); }
Example #28
Source File: BufferTest.java From jts with GNU Lesser General Public License v2.1 | 5 votes |
public void testMultiLineString_separateBuffers_floatingSingle() throws Exception { BufferValidator bv = new BufferValidator( 0.01, "MULTILINESTRING (( 635074.5418406526 6184832.4888257105, 635074.5681951842 6184832.571842485, 635074.6472587794 6184832.575795664 ), ( 635074.6657069515 6184832.53889932, 635074.6933792098 6184832.451929366, 635074.5642420045 6184832.474330718 ))", false); bv.setBufferHolesExpected(false); bv.setEmptyBufferExpected(true); bv.setPrecisionModel(new PrecisionModel(PrecisionModel.FLOATING_SINGLE)); bv.test(); }
Example #29
Source File: BufferValidator.java From jts with GNU Lesser General Public License v2.1 | 5 votes |
public BufferValidator(double bufferDistance, String wkt, boolean addContainsTest) throws ParseException { // SRID = 888 is to test that SRID is preserved in computed buffers setFactory(new PrecisionModel(), 888); this.bufferDistance = bufferDistance; this.wkt = wkt; if (addContainsTest) addContainsTest(); //addBufferResultValidatorTest(); }
Example #30
Source File: WKTWriter.java From jts with GNU Lesser General Public License v2.1 | 5 votes |
/** * Converts a <code>Coordinate</code> to <Point Text> format, then * appends it to the writer. * *@param coordinate the <code>Coordinate</code> to process *@param writer the output writer to append to *@param precisionModel the <code>PrecisionModel</code> to use to convert * from a precise coordinate to an external coordinate */ private void appendPointText(Coordinate coordinate, int level, Writer writer, PrecisionModel precisionModel) throws IOException { if (coordinate == null) { writer.write("EMPTY"); } else { writer.write("("); appendCoordinate(coordinate, writer); writer.write(")"); } }