Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3748226

Browse files
authored
Extract spatial API to a dedicated module and migrate corresponding classes (#455)
1 parent6fd2010 commit3748226

File tree

109 files changed

+878
-1228
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+878
-1228
lines changed

‎api/pom.xml‎

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Copyright (c) "Neo4j"
4+
~ Neo4j Sweden AB [http://neo4j.com]
5+
~
6+
~ This file is part of Neo4j Spatial.
7+
~
8+
~ Neo4j is free software: you can redistribute it and/or modify
9+
~ it under the terms of the GNU General Public License as published by
10+
~ the Free Software Foundation, either version 3 of the License, or
11+
~ (at your option) any later version.
12+
~
13+
~ This program is distributed in the hope that it will be useful,
14+
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
~ GNU General Public License for more details.
17+
~
18+
~ You should have received a copy of the GNU General Public License
19+
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
20+
-->
21+
22+
<projectxmlns="http://maven.apache.org/POM/4.0.0"
23+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
24+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
25+
<modelVersion>4.0.0</modelVersion>
26+
<parent>
27+
<groupId>org.neo4j</groupId>
28+
<artifactId>neo4j-spatial</artifactId>
29+
<version>2025.10.1-SNAPSHOT</version>
30+
</parent>
31+
32+
<artifactId>neo4j-spatial-api</artifactId>
33+
34+
<dependencies>
35+
<dependency>
36+
<groupId>org.neo4j</groupId>
37+
<artifactId>neo4j</artifactId>
38+
<version>${neo4j.version}</version>
39+
<scope>provided</scope>
40+
</dependency>
41+
<dependency>
42+
<groupId>org.geotools</groupId>
43+
<artifactId>gt-main</artifactId>
44+
<version>${geotools.version}</version>
45+
</dependency>
46+
</dependencies>
47+
</project>

server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/Envelope.java renamed to api/src/main/java/org/neo4j/spatial/api/Envelope.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* You should have received a copy of the GNU General Public License
1818
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1919
*/
20-
packageorg.neo4j.gis.spatial.rtree;
20+
packageorg.neo4j.spatial.api;
2121

2222
publicclassEnvelopeextendsorg.neo4j.gis.spatial.index.Envelope {
2323

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
* Copyright (c) "Neo4j"
3+
* Neo4j Sweden AB [http://neo4j.com]
4+
*
5+
* This file is part of Neo4j Spatial.
6+
*
7+
* Neo4j is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation, either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19+
*/
20+
packageorg.neo4j.spatial.api;
21+
22+
importorg.neo4j.graphdb.Entity;
23+
24+
25+
/**
26+
* Interface for decoding spatial envelope information from Neo4j entities.
27+
* <p>
28+
* An envelope decoder is responsible for extracting spatial bounding box information
29+
* from Neo4j database entities (nodes or relationships) and converting it into
30+
* an {@link Envelope} object that can be used for spatial indexing and querying.
31+
* </p>
32+
* <p>
33+
* This interface is typically implemented by classes that understand how spatial
34+
* data is stored within specific Neo4j entities and can extract the minimum and
35+
* maximum coordinate values to form a bounding envelope.
36+
* </p>
37+
*
38+
* @see Envelope
39+
* @see Entity
40+
*/
41+
publicinterfaceEnvelopeDecoder {
42+
43+
/**
44+
* Decodes and extracts the spatial envelope (bounding box) from the given Neo4j entity.
45+
* <p>
46+
* This method analyzes the provided entity and extracts spatial coordinate information
47+
* to construct an envelope that represents the spatial bounds of the data contained
48+
* within the entity.
49+
* </p>
50+
*
51+
* @param container the Neo4j entity (node or relationship) containing spatial data
52+
* from which to extract envelope information
53+
* @return the decoded {@link Envelope} representing the spatial bounds of the entity's data,
54+
* or null if no spatial envelope can be determined from the entity
55+
* @throws IllegalArgumentException if the container entity is null or does not contain
56+
* the expected spatial data format
57+
*/
58+
EnvelopedecodeEnvelope(Entitycontainer);
59+
60+
}

server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/filter/SearchFilter.java renamed to api/src/main/java/org/neo4j/spatial/api/SearchFilter.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@
1717
* You should have received a copy of the GNU General Public License
1818
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1919
*/
20-
packageorg.neo4j.gis.spatial.rtree.filter;
20+
packageorg.neo4j.spatial.api;
2121

22-
importorg.neo4j.gis.spatial.rtree.Envelope;
2322
importorg.neo4j.graphdb.Node;
2423
importorg.neo4j.graphdb.Transaction;
2524

server-plugin/src/main/java/org/neo4j/gis/spatial/rtree/filter/SearchResults.java renamed to api/src/main/java/org/neo4j/spatial/api/SearchResults.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* You should have received a copy of the GNU General Public License
1818
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1919
*/
20-
packageorg.neo4j.gis.spatial.rtree.filter;
20+
packageorg.neo4j.spatial.api;
2121

2222
importjava.util.Iterator;
2323
importjavax.annotation.Nonnull;

server-plugin/src/main/java/org/neo4j/gis/spatial/SpatialDataset.java renamed to api/src/main/java/org/neo4j/spatial/api/SpatialDataset.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@
1717
* You should have received a copy of the GNU General Public License
1818
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1919
*/
20-
packageorg.neo4j.gis.spatial;
20+
packageorg.neo4j.spatial.api;
2121

2222
importorg.locationtech.jts.geom.Geometry;
2323
importorg.neo4j.graphdb.Node;
2424
importorg.neo4j.graphdb.Transaction;
25+
importorg.neo4j.spatial.api.encoder.GeometryEncoder;
26+
importorg.neo4j.spatial.api.layer.Layer;
2527

2628
/**
2729
* <p>

server-plugin/src/main/java/org/neo4j/gis/spatial/SpatialRecord.java renamed to api/src/main/java/org/neo4j/spatial/api/SpatialRecord.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* You should have received a copy of the GNU General Public License
1818
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1919
*/
20-
packageorg.neo4j.gis.spatial;
20+
packageorg.neo4j.spatial.api;
2121

2222
importjava.util.Map;
2323
importjava.util.Set;
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/*
2+
* Copyright (c) "Neo4j"
3+
* Neo4j Sweden AB [http://neo4j.com]
4+
*
5+
* This file is part of Neo4j Spatial.
6+
*
7+
* Neo4j is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation, either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19+
*/
20+
packageorg.neo4j.spatial.api;
21+
22+
importjava.util.Iterator;
23+
importjava.util.function.BiFunction;
24+
importjavax.annotation.Nonnull;
25+
importorg.neo4j.graphdb.Node;
26+
importorg.neo4j.spatial.api.layer.Layer;
27+
28+
publicclassSpatialRecordsimplementsIterable<SpatialRecord> {
29+
30+
privatefinalSearchResultsresults;
31+
privatefinalBiFunction<Layer,Node,SpatialRecord>searchRecordsProducer;
32+
privatefinalLayerlayer;
33+
34+
publicSpatialRecords(Layerlayer,SearchResultsresults,
35+
BiFunction<Layer,Node,SpatialRecord>searchRecordsProducer) {
36+
this.layer =layer;
37+
this.results =results;
38+
this.searchRecordsProducer =searchRecordsProducer;
39+
}
40+
41+
@Override
42+
@Nonnull
43+
publicIterator<SpatialRecord>iterator() {
44+
returnnewSpatialRecordIterator();
45+
}
46+
47+
privateclassSpatialRecordIteratorimplementsIterator<SpatialRecord> {
48+
49+
privatefinalIterator<Node>nodeIterator;
50+
51+
publicSpatialRecordIterator() {
52+
this.nodeIterator =results.iterator();
53+
}
54+
55+
@Override
56+
publicbooleanhasNext() {
57+
returnnodeIterator.hasNext();
58+
}
59+
60+
@Override
61+
publicSpatialRecordnext() {
62+
returnsearchRecordsProducer.apply(layer,nodeIterator.next());
63+
}
64+
65+
@Override
66+
publicvoidremove() {
67+
thrownewUnsupportedOperationException("Cannot remove from results");
68+
}
69+
}
70+
}

server-plugin/src/main/java/org/neo4j/gis/spatial/GeometryEncoder.java renamed to api/src/main/java/org/neo4j/spatial/api/encoder/GeometryEncoder.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,16 @@
1717
* You should have received a copy of the GNU General Public License
1818
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1919
*/
20-
packageorg.neo4j.gis.spatial;
20+
packageorg.neo4j.spatial.api.encoder;
2121

2222
importjava.util.Map;
2323
importjava.util.Set;
2424
importorg.locationtech.jts.geom.Geometry;
25-
importorg.neo4j.gis.spatial.rtree.EnvelopeDecoder;
2625
importorg.neo4j.graphdb.Entity;
2726
importorg.neo4j.graphdb.Node;
2827
importorg.neo4j.graphdb.Transaction;
28+
importorg.neo4j.spatial.api.EnvelopeDecoder;
29+
importorg.neo4j.spatial.api.layer.Layer;
2930

3031

3132
/**
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Copyright (c) "Neo4j"
3+
* Neo4j Sweden AB [http://neo4j.com]
4+
*
5+
* This file is part of Neo4j Spatial.
6+
*
7+
* Neo4j is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as published by
9+
* the Free Software Foundation, either version 3 of the License, or
10+
* (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public License
18+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19+
*/
20+
21+
packageorg.neo4j.spatial.api.index;
22+
23+
importorg.neo4j.graphdb.Label;
24+
importorg.neo4j.graphdb.Transaction;
25+
importorg.neo4j.graphdb.schema.IndexDefinition;
26+
27+
publicinterfaceIndexManager {
28+
29+
/**
30+
* Blocking call that spawns a thread to create an index and then waits for that thread to finish.
31+
* This is highly likely to cause deadlocks on index checks, so be careful where it is used.
32+
* Best used if you can commit any other outer transaction first, then run this, and after that
33+
* start a new transaction. For example, see the OSMImport approaching to batching transactions.
34+
* It is possible to use this in procedures with outer transactions if you can ensure the outer
35+
* transactions are read-only.
36+
*/
37+
IndexDefinitionindexFor(Transactiontx,StringindexName,Labellabel,StringpropertyKey);
38+
39+
/**
40+
* Non-blocking call that spawns a thread to create an index and then waits for that thread to finish.
41+
* Use this especially on indexes that are not immediately needed. Also use it if you have an outer
42+
* transaction that cannot be committed before making this call.
43+
*/
44+
voidmakeIndexFor(Transactiontx,StringindexName,Labellabel,StringpropertyKey);
45+
46+
voiddeleteIndex(IndexDefinitionindex);
47+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp