org.locationtech.jts.geom.Geometry Java Examples
The following examples show how to use
org.locationtech.jts.geom.Geometry.
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: OmsLW08_NetworkBufferWidthCalculator.java From hortonmachine with GNU General Public License v3.0 | 6 votes |
private ArrayList<Geometry> getPolygonBetweenLines( ArrayList<SimpleFeature> newLinesFeatures ) { ArrayList<Geometry> polygons = new ArrayList<Geometry>(); for( int i = 0; i < newLinesFeatures.size() - 1; i++ ) { SimpleFeature f1 = newLinesFeatures.get(i); SimpleFeature f2 = newLinesFeatures.get(i + 1); LineString l1 = (LineString) f1.getDefaultGeometry(); LineString l2 = (LineString) f2.getDefaultGeometry(); MultiLineString multiLine = gf.createMultiLineString(new LineString[]{l1, l2}); Geometry convexHull = multiLine.convexHull(); Geometry buffer = convexHull.buffer(0.1); polygons.add(buffer); } return polygons; }
Example #2
Source File: FieldConfigInlineFeatureTest.java From sldeditor with GNU General Public License v3.0 | 6 votes |
/** * Test method for {@link * com.sldeditor.ui.detail.config.inlinefeature.FieldConfigInlineFeature#setVisible(boolean)}. */ @Test public void testSetVisible() { FieldConfigInlineFeature field = new FieldConfigInlineFeature( new FieldConfigCommonData( Geometry.class, FieldIdEnum.NAME, null, true, false)); boolean expectedValue = true; field.setVisible(expectedValue); field.createUI(); field.setVisible(expectedValue); expectedValue = false; field.setVisible(expectedValue); }
Example #3
Source File: ProductAdvancedDialog.java From snap-desktop with GNU General Public License v3.0 | 6 votes |
private AbstractSubsetRegion setGeometry(){ if(this.readerInspectorExposeParameters != null && this.readerInspectorExposeParameters.isHasGeoCoding()) { final GeoPos geoPos1 = new GeoPos((Double) geoCoordNorthLatSpinner.getValue(), (Double) geoCoordWestLongSpinner.getValue()); final GeoPos geoPos2 = new GeoPos((Double) geoCoordSouthLatSpinner.getValue(), (Double) geoCoordEastLongSpinner.getValue()); GeoCoding geoCoding = this.readerInspectorExposeParameters.getGeoCoding(); final PixelPos pixelPos1 = geoCoding.getPixelPos(geoPos1, null); final PixelPos pixelPos2 = geoCoding.getPixelPos(geoPos2, null); final Rectangle.Float region = new Rectangle.Float(); region.setFrameFromDiagonal(pixelPos1.x, pixelPos1.y, pixelPos2.x, pixelPos2.y); final Rectangle.Float productBounds = new Rectangle.Float(0, 0, productWidth, productHeight); Rectangle2D finalRegion = productBounds.createIntersection(region); Rectangle bounds = new Rectangle((int)finalRegion.getMinX(), (int)finalRegion.getMinY(), (int)(finalRegion.getMaxX() - finalRegion.getMinX()) + 1, (int)(finalRegion.getMaxY() - finalRegion.getMinY()) + 1); Geometry geometry = GeoUtils.computeGeometryUsingPixelRegion(geoCoding, bounds); return new GeometrySubsetRegion(geometry, 0); } return null; }
Example #4
Source File: GeoFunctions.java From presto with Apache License 2.0 | 6 votes |
@Description("Returns the 2D Euclidean area of a geometry") @ScalarFunction("ST_Area") @SqlType(DOUBLE) public static double stArea(@SqlType(GEOMETRY_TYPE_NAME) Slice input) { OGCGeometry geometry = deserialize(input); // The Esri geometry library does not support area for geometry collections. We compute the area // of collections by summing the area of the individual components. GeometryType type = GeometryType.getForEsriGeometryType(geometry.geometryType()); if (type == GeometryType.GEOMETRY_COLLECTION) { double area = 0.0; GeometryCursor cursor = geometry.getEsriGeometryCursor(); while (true) { com.esri.core.geometry.Geometry esriGeometry = cursor.next(); if (esriGeometry == null) { return area; } area += esriGeometry.calculateArea2D(); } } return geometry.getEsriGeometry().calculateArea2D(); }
Example #5
Source File: NwwUtilities.java From hortonmachine with GNU General Public License v3.0 | 6 votes |
/** * Get the lat/long world geometry from two screen corner coordinates. * * @param wwd * the {@link WorldWindow} instance. * @param x1 * the first point screen x. * @param y1 * the first point screen y. * @param x2 * the second point screen x. * @param y2 * the second point screen y. * @return the world geomnetry. */ public static Geometry getScreenPointsPolygon( WorldWindow wwd, int x1, int y1, int x2, int y2 ) { View view = wwd.getView(); Position p1 = view.computePositionFromScreenPoint(x1, y1); Position p2 = view.computePositionFromScreenPoint(x1, y2); Position p3 = view.computePositionFromScreenPoint(x2, y2); Position p4 = view.computePositionFromScreenPoint(x2, y1); Coordinate[] coords = { // new Coordinate(p1.longitude.degrees, p1.latitude.degrees), // new Coordinate(p2.longitude.degrees, p2.latitude.degrees), // new Coordinate(p3.longitude.degrees, p3.latitude.degrees), // new Coordinate(p4.longitude.degrees, p4.latitude.degrees)// }; Geometry convexHull = GeometryUtilities.gf().createMultiPoint(coords).convexHull(); return convexHull; }
Example #6
Source File: VectorTileEncoderTest.java From java-vector-tile with Apache License 2.0 | 6 votes |
public void testProvidedAndAutoincrementIds() throws IOException { VectorTileEncoder vtm = new VectorTileEncoder(256, 8, true, true); Geometry geometry = gf.createPoint(new Coordinate(3, 6)); Map<String, String> attributes = Collections.singletonMap("key1", "value1"); vtm.addFeature("DEPCNT", attributes, geometry, 50); geometry = gf.createPoint(new Coordinate(3, 6)); attributes = Collections.singletonMap("key1", "value1"); vtm.addFeature("DEPCNT", attributes, geometry); geometry = gf.createPoint(new Coordinate(3, 6)); attributes = Collections.singletonMap("key1", "value1"); vtm.addFeature("DEPCNT", attributes, geometry, 27); geometry = gf.createPoint(new Coordinate(3, 6)); attributes = Collections.singletonMap("key1", "value1"); vtm.addFeature("DEPCNT", attributes, geometry); List<Feature> features = encodeDecodeFeatures(vtm); assertEquals(4, features.size()); assertEquals(50, features.get(0).getId()); assertEquals(51, features.get(1).getId()); assertEquals(27, features.get(2).getId()); assertEquals(52, features.get(3).getId()); }
Example #7
Source File: FeatureUtilities.java From hortonmachine with GNU General Public License v3.0 | 6 votes |
/** * Extracts features from a {@link FeatureCollection} into an {@link STRtree}. * * @param collection the feature collection. * @return the tree containing the features. */ public static STRtree featureCollectionToSTRtree( SimpleFeatureCollection collection ) { STRtree tree = new STRtree(); SimpleFeatureIterator featureIterator = collection.features(); while( featureIterator.hasNext() ) { SimpleFeature feature = featureIterator.next(); Geometry geometry = (Geometry) feature.getDefaultGeometry(); tree.insert(geometry.getEnvelopeInternal(), feature); } featureIterator.close(); return tree; }
Example #8
Source File: GeoWaveGeometryPrecisionIT.java From geowave with Apache License 2.0 | 6 votes |
@Test public void testNegativePrecision() { final GeometryFactory factory = GeometryUtils.GEOMETRY_FACTORY; final Geometry[] geometries = new Geometry[] { factory.createPoint(new Coordinate(12.123456789, -10.987654321)), factory.createLineString( new Coordinate[] { new Coordinate(123456789.987654321, -123456789.987654321), new Coordinate(987654321.123456789, -987654321.123456789)}), factory.createPoint(new Coordinate(0, 0))}; final Geometry[] expected = new Geometry[] { factory.createPoint(new Coordinate(0, 0)), factory.createLineString( new Coordinate[] { new Coordinate(123457000, -123457000), new Coordinate(987654000, -987654000)}), factory.createPoint(new Coordinate(0, 0))}; testPrecision(geometries, expected, -3); }
Example #9
Source File: ShapeWriter.java From geopaparazzi with GNU General Public License v3.0 | 5 votes |
private DrawableShape toShape(GeometryCollection gc) { GeometryCollectionShape shape = new GeometryCollectionShape(); // add components to GC shape for (int i = 0; i < gc.getNumGeometries(); i++) { Geometry g = (Geometry) gc.getGeometryN(i); shape.add(toShape(g)); } return shape; }
Example #10
Source File: FieldConfigFeatureTypeConstraintTest.java From sldeditor with GNU General Public License v3.0 | 5 votes |
/** * Test method for {@link * com.sldeditor.ui.detail.config.featuretypeconstraint.FieldConfigFeatureTypeConstraint#generateExpression()}. * Test method for {@link * com.sldeditor.ui.detail.config.featuretypeconstraint.FieldConfigFeatureTypeConstraint#populateExpression(java.lang.Object)}. * Test method for {@link * com.sldeditor.ui.detail.config.featuretypeconstraint.FieldConfigFeatureTypeConstraint#setTestValue(com.sldeditor.ui.detail.config.FieldId, * java.util.List)}. Test method for {@link * com.sldeditor.ui.detail.config.featuretypeconstraint.FieldConfigFeatureTypeConstraint#populateField(java.util.List)}. * Test method for {@link * com.sldeditor.ui.detail.config.featuretypeconstraint.FieldConfigFeatureTypeConstraint#getFeatureTypeConstraint()}. */ @Test public void testGenerateExpression() { FieldConfigFeatureTypeConstraint field = new FieldConfigFeatureTypeConstraint( new FieldConfigCommonData( Geometry.class, FieldIdEnum.NAME, "label", true, false)); List<FeatureTypeConstraint> testValue = null; field.populate(null); field.setTestValue(FieldIdEnum.UNKNOWN, testValue); field.populateField(testValue); field.createUI(); assertNull(field.getStringValue()); StyleFactoryImpl styleFactory = (StyleFactoryImpl) CommonFactoryFinder.getStyleFactory(); FeatureTypeConstraint expectedValue1 = styleFactory.createFeatureTypeConstraint("Feature", Filter.INCLUDE, new Extent[0]); testValue = new ArrayList<FeatureTypeConstraint>(); testValue.add(expectedValue1); field.populateField(testValue); assertEquals(expectedValue1, field.getFeatureTypeConstraint().get(0)); field.setTestValue(FieldIdEnum.UNKNOWN, testValue); assertEquals(expectedValue1, field.getFeatureTypeConstraint().get(0)); field.populateExpression((String) null); }
Example #11
Source File: GeoJSONUtils.java From crate with Apache License 2.0 | 5 votes |
public Map<String, Object> convert(Geometry geometry) { HashMap<String, Object> builder = new HashMap<>(); if (geometry instanceof Point) { builder.put(TYPE_FIELD, POINT); builder.put(COORDINATES_FIELD, extract((Point) geometry)); } else if (geometry instanceof MultiPoint) { builder.put(TYPE_FIELD, MULTI_POINT); builder.put(COORDINATES_FIELD, extract((MultiPoint) geometry)); } else if (geometry instanceof LineString) { builder.put(TYPE_FIELD, LINE_STRING); builder.put(COORDINATES_FIELD, extract((LineString) geometry)); } else if (geometry instanceof MultiLineString) { builder.put(TYPE_FIELD, MULTI_LINE_STRING); builder.put(COORDINATES_FIELD, extract((MultiLineString) geometry)); } else if (geometry instanceof Polygon) { builder.put(TYPE_FIELD, POLYGON); builder.put(COORDINATES_FIELD, extract((Polygon) geometry)); } else if (geometry instanceof MultiPolygon) { builder.put(TYPE_FIELD, MULTI_POLYGON); builder.put(COORDINATES_FIELD, extract((MultiPolygon) geometry)); } else if (geometry instanceof GeometryCollection) { GeometryCollection geometryCollection = (GeometryCollection) geometry; int size = geometryCollection.getNumGeometries(); List<Map<String, Object>> geometries = new ArrayList<>(size); for (int i = 0; i < size; i++) { geometries.add(convert(geometryCollection.getGeometryN(i))); } builder.put(TYPE_FIELD, GEOMETRY_COLLECTION); builder.put(GEOMETRIES_FIELD, geometries); } else { throw new IllegalArgumentException(String.format(Locale.ENGLISH, "Cannot extract coordinates from geometry %s", geometry.getGeometryType())); } return Collections.unmodifiableMap(builder); }
Example #12
Source File: SimpleFeatureGeometryExtractor.java From geowave with Apache License 2.0 | 5 votes |
@Override public Geometry getGeometry(final SimpleFeature anObject) { final FeatureGeometryHandler handler = new FeatureGeometryHandler(anObject.getDefaultGeometryProperty().getDescriptor()); final Geometry geometry = handler.toIndexValue(anObject).getGeometry(); final int srid = getSRID(anObject); geometry.setSRID(srid); return geometry; }
Example #13
Source File: GeometryUtils.java From geowave with Apache License 2.0 | 5 votes |
/** * Converts a byte array as well-known binary to a JTS geometry * * @param binary The well known binary * @return The JTS geometry */ public static Geometry geometryFromBinary( final byte[] binary, final @Nullable Integer precision) { try { if (precision == null) { return new WKBReader().read(binary); } return new TWKBReader().read(binary); } catch (final ParseException e) { throw new GeoWaveSerializationException("Unable to deserialize geometry data", e); } }
Example #14
Source File: AbstractSamplingFeature.java From arctic-sea with Apache License 2.0 | 5 votes |
@Override public void setGeometry(final Geometry geometry) throws InvalidSridException { if (geometry != null && geometry.getSRID() == 0) { throw new InvalidSridException(0); } this.geometry = geometry; }
Example #15
Source File: MvtReaderTest.java From mapbox-vector-tile-java with Apache License 2.0 | 5 votes |
@Test public void simpleTest() { try { // Load multipolygon z0 tile final JtsMvt mvt = loadMvt("src/test/resources/vec_tile_test/0/0/0.mvt"); List<Geometry> geoms = getAllGeometries(mvt); // Debug stats of multipolygon final JtsGeomStats stats = JtsGeomStats.getStats(geoms); LoggerFactory.getLogger(MvtReaderTest.class).info("Stats: {}", stats); } catch (IOException e) { fail(e.getMessage()); } }
Example #16
Source File: AnalyzeRunner.java From geowave with Apache License 2.0 | 5 votes |
private void nextScene(final SimpleFeature currentBand) { printSceneInfo(); sceneCount++; entityBandIdToSimpleFeatureMap.clear(); final int path = (int) currentBand.getAttribute(SceneFeatureIterator.PATH_ATTRIBUTE_NAME); final int row = (int) currentBand.getAttribute(SceneFeatureIterator.ROW_ATTRIBUTE_NAME); final float cloudCover = (float) currentBand.getAttribute(SceneFeatureIterator.CLOUD_COVER_ATTRIBUTE_NAME); final String processingLevel = (String) currentBand.getAttribute(SceneFeatureIterator.PROCESSING_LEVEL_ATTRIBUTE_NAME); final Date date = (Date) currentBand.getAttribute(SceneFeatureIterator.ACQUISITION_DATE_ATTRIBUTE_NAME); minRow = Math.min(minRow, row); maxRow = Math.max(maxRow, row); minPath = Math.min(minPath, path); maxPath = Math.max(maxPath, path); final Envelope env = ((Geometry) currentBand.getDefaultGeometry()).getEnvelopeInternal(); minLat = Math.min(minLat, env.getMinY()); maxLat = Math.max(maxLat, env.getMaxY()); minLon = Math.min(minLon, env.getMinX()); maxLon = Math.max(maxLon, env.getMaxX()); minCloudCover = Math.min(minCloudCover, cloudCover); maxCloudCover = Math.max(maxCloudCover, cloudCover); totalCloudCover += cloudCover; Integer count = processingLevelCounts.get(processingLevel); if (count == null) { count = 0; } processingLevelCounts.put(processingLevel, ++count); startDate = Math.min(startDate, date.getTime()); endDate = Math.max(endDate, date.getTime()); wrs2Keys.add(new WRS2Key(path, row)); }
Example #17
Source File: QueryIndexHelper.java From geowave with Apache License 2.0 | 5 votes |
/** * If composed constraints matched statistics constraints, are empty or null, then return empty * constraint set */ public static GeoConstraintsWrapper composeGeometricConstraints( final SimpleFeatureType featureType, final Geometry jtsBounds) { if (jtsBounds == null) { return new GeoConstraintsWrapper(new ConstraintsByClass(), true, null); } final GeoConstraintsWrapper geoConstraints = GeometryUtils.basicGeoConstraintsWrapperFromGeometry(jtsBounds); return geoConstraints; }
Example #18
Source File: GeoJSONDecoder.java From arctic-sea with Apache License 2.0 | 5 votes |
protected Geometry decodeGeometry(Object o, GeometryFactory parentFactory) throws GeoJSONDecodingException { if (!(o instanceof JsonNode)) { throw new GeoJSONDecodingException("Cannot decode " + o); } final JsonNode node = (JsonNode) o; final String type = getType(node); final GeometryFactory factory = getGeometryFactory(node, parentFactory); switch (type) { case JSONConstants.POINT: return decodePoint(node, factory); case JSONConstants.MULTI_POINT: return decodeMultiPoint(node, factory); case JSONConstants.LINE_STRING: return decodeLineString(node, factory); case JSONConstants.MULTI_LINE_STRING: return decodeMultiLineString(node, factory); case JSONConstants.POLYGON: return decodePolygon(node, factory); case JSONConstants.MULTI_POLYGON: return decodeMultiPolygon(node, factory); case JSONConstants.GEOMETRY_COLLECTION: return decodeGeometryCollection(node, factory); default: throw new GeoJSONDecodingException("Unkown geometry type: " + type); } }
Example #19
Source File: VectorLayer.java From MeteoInfo with GNU Lesser General Public License v3.0 | 5 votes |
/** * Select a shape by point * * @param p The point * @return Selected shape */ public Shape selectShape(PointD p) { Coordinate c = new Coordinate(p.X, p.Y); Geometry point = new GeometryFactory().createPoint(c); for (Shape shape : _shapeList) { if (point.within(shape.toGeometry())) { return shape; } } return null; }
Example #20
Source File: FastLiteShape.java From hortonmachine with GNU General Public License v3.0 | 5 votes |
public FastLiteShape( Geometry geom ) { super(geom, new AffineTransform(), false); this.prepared = PreparedGeometryFactory.prepare(geom); GeometryFactory gf = new GeometryFactory(); pointCS = new LiteCoordinateSequence(1, 2); point = gf.createPoint(pointCS); rectCS = new LiteCoordinateSequence(5, 2); rect = gf.createPolygon(gf.createLinearRing(rectCS), null); // System.out.println("Crop area: " + geom); }
Example #21
Source File: OmsLineSmootherMcMaster.java From hortonmachine with GNU General Public License v3.0 | 5 votes |
/** * Checks if the given geometry is connected to any other line. * * @param geometryN the geometry to test. * @return true if the geometry is alone in the space, i.e. not connected at * one of the ends to any other geometry. */ private boolean isAlone( Geometry geometryN ) { Coordinate[] coordinates = geometryN.getCoordinates(); if (coordinates.length > 1) { Coordinate first = coordinates[0]; Coordinate last = coordinates[coordinates.length - 1]; for( SimpleFeature line : linesList ) { Geometry lineGeom = (Geometry) line.getDefaultGeometry(); int numGeometries = lineGeom.getNumGeometries(); for( int i = 0; i < numGeometries; i++ ) { Geometry subGeom = lineGeom.getGeometryN(i); Coordinate[] lineCoordinates = subGeom.getCoordinates(); if (lineCoordinates.length < 2) { continue; } else { Coordinate tmpFirst = lineCoordinates[0]; Coordinate tmpLast = lineCoordinates[lineCoordinates.length - 1]; if (tmpFirst.distance(first) < SAMEPOINTTHRESHOLD || tmpFirst.distance(last) < SAMEPOINTTHRESHOLD || tmpLast.distance(first) < SAMEPOINTTHRESHOLD || tmpLast.distance(last) < SAMEPOINTTHRESHOLD) { return false; } } } } } // 1 point line or no connection, mark it as alone for removal return true; }
Example #22
Source File: JTSHelperTest.java From arctic-sea with Apache License 2.0 | 5 votes |
@Test public void shouldPointSwitchCoordinatesWithPackedPositionSequence() throws ParseException { G2D c2D = new G2D(52.0, 7.0); Point<G2D> geometry1 = new Point<G2D>(c2D, CoordinateReferenceSystems.WGS84); Geometry geometry = JTS.to(geometry1); assertNotEquals(geometry, switchCoordinateAxisOrder(geometry)); }
Example #23
Source File: SamplingEncoderv20.java From arctic-sea with Apache License 2.0 | 5 votes |
private String getFeatureType(Geometry geometry) { if (geometry instanceof Point || geometry instanceof MultiPoint) { return SfConstants.SAMPLING_FEAT_TYPE_SF_SAMPLING_POINT; } else if (geometry instanceof LineString || geometry instanceof MultiLineString) { return SfConstants.SAMPLING_FEAT_TYPE_SF_SAMPLING_CURVE; } else if (geometry instanceof Polygon || geometry instanceof MultiPolygon) { return SfConstants.SAMPLING_FEAT_TYPE_SF_SAMPLING_SURFACE; } else { return SfConstants.SAMPLING_FEAT_TYPE_SF_SAMPLING_FEATURE; } }
Example #24
Source File: ElasticParserUtilTest.java From elasticgeo with GNU General Public License v3.0 | 5 votes |
@Test public void testGeoPointAsUnrecognizedProperties() { final double lat = rand.nextDouble() * 90 - 90; final double lon = rand.nextDouble() * 180 - 180; properties.put("latD", lat); properties.put("lonD", lon); final Geometry geometry = parserUtil.createGeometry(properties); assertNull(geometry); }
Example #25
Source File: CustomProcessFunction.java From sldeditor with GNU General Public License v3.0 | 5 votes |
/** Populate data map. */ private void populateDataMap() { dataTypeMap.put("xs:int", Integer.class); dataTypeMap.put("xs:double", Double.class); dataTypeMap.put("xs:boolean", Boolean.class); dataTypeMap.put("xs:float", Float.class); dataTypeMap.put("xs:long", Long.class); dataTypeMap.put(GEOMETRY_NAME, Geometry.class); dataTypeMap.put(BBOX_NAME, ReferencedEnvelope.class); dataTypeMap.put(ENUMERATION_NAME, StringBuilder.class); }
Example #26
Source File: FunctionCentroidY.java From GeoTriples with Apache License 2.0 | 5 votes |
@Override public Object execute(Object argument, QLTerm qlterm) throws SAXException, IOException, ParserConfigurationException, FactoryException, MalformedGeometryException, ParseException { Geometry geometry = computeGeometry(argument, qlterm); return GTransormationFunctions.centroidy( (Geometry) geometry); }
Example #27
Source File: GeometryHullToolTest.java From geowave with Apache License 2.0 | 5 votes |
@Test public void testRLPolygons() { final Geometry leftShape = factory.createPolygon(poly2); final Geometry rightShape = factory.createPolygon(poly1); assertFalse(GeometryHullTool.clockwise(leftShape.getCoordinates())); assertTrue(GeometryHullTool.clockwise(rightShape.getCoordinates())); final GeometryHullTool cg = new GeometryHullTool(); cg.setDistanceFnForCoordinate(new CoordinateCircleDistanceFn()); final Geometry geo = cg.connect(leftShape, rightShape); assertEquals( "POLYGON ((39.2 41.2, 39 40.7, 38.7 40.1, 38.4 39.5, 39.3 39.2, 40.6 39.6, 40.8 40.6, 41.2 40.8, 40.5 41, 39.2 41.2))", geo.toString()); }
Example #28
Source File: InlineCellEditor.java From sldeditor with GNU General Public License v3.0 | 5 votes |
@Override public Component getTableCellEditorComponent( JTable table, Object value, boolean isSelected, int row, int column) { if ((model != null) && column == model.getGeometryFieldIndex()) { WKTDialog wktDialog = new WKTDialog(); String geometryString = null; Object obj = model.getValueAt(row, column); if (obj != null) { geometryString = obj.toString(); } if (wktDialog.showDialog(geometryString)) { String crsCode = model.getSelectedCRSCode(); Geometry geometry = WKTConversion.convertToGeometry(wktDialog.getWKTString(), crsCode); model.updateGeometry(row, geometry); } } else { this.textField.setFont(table.getFont()); this.textField.setText(value.toString()); return this.textField; } return null; }
Example #29
Source File: TinHandler.java From hortonmachine with GNU General Public License v3.0 | 5 votes |
public void finalCleanup( final double pFinalCleanupDist ) { if (isFirstStatsCalculation) { throw new IllegalArgumentException("The first round needs to be filtered on all data."); } pm.beginTask("Creating points indexes...", leftOverCoordinateList.size()); final STRtree leftOverCoordinatesTree = new STRtree(leftOverCoordinateList.size()); for( Coordinate c : leftOverCoordinateList ) { leftOverCoordinatesTree.insert(new Envelope(c), c); } pm.done(); final AtomicInteger removedCount = new AtomicInteger(); Geometry[] triangles = getTriangles(); final List<Coordinate> newLeftOverCoordinateList = new ArrayList<Coordinate>(); pm.beginTask("Final cleanup through triangle to point distance filter...", triangles.length); ThreadedRunnable tRun = new ThreadedRunnable(threadsNum, null); for( int i = 0; i < triangles.length; i++ ) { final Geometry triangle = triangles[i]; tRun.executeRunnable(new Runnable(){ public void run() { runFinalFilter(leftOverCoordinatesTree, newLeftOverCoordinateList, triangle, pFinalCleanupDist, removedCount); } }); } tRun.waitAndClose(); pm.done(); pm.message("Final points removed from non ground: " + removedCount.get()); pm.message("Final points left as non ground: " + newLeftOverCoordinateList.size()); leftOverCoordinateList.clear(); leftOverCoordinateList.addAll(newLeftOverCoordinateList); }
Example #30
Source File: GeoWaveFeatureReader.java From geowave with Apache License 2.0 | 5 votes |
protected long getCountInternal( final Geometry jtsBounds, final TemporalConstraintsSet timeBounds, final Filter filter, final Integer limit) { final CountQueryIssuer countIssuer = new CountQueryIssuer(filter, limit); issueQuery(jtsBounds, timeBounds, countIssuer); return countIssuer.count; }