Skip to content

Commit 6ef8392

Browse files
author
Isaac Brodsky
committed
Add functions and tests for v3.7.0
1 parent a500880 commit 6ef8392

File tree

9 files changed

+489
-192
lines changed

9 files changed

+489
-192
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,5 @@ pom.xml.releaseBackup
2424
pom.xml.versionsBackup
2525
pom.xml.next
2626
release.properties
27+
28+
.vscode/

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,19 @@ file [H3Core.java](./src/main/java/com/uber/h3core/H3Core.java), and support
77
for the Linux x64 and Darwin x64 platforms.
88

99
## [Unreleased]
10+
## Added
11+
- Area and haversine distance functions
12+
- `cellAreaRads2`
13+
- `cellAreaKm2`
14+
- `cellAreaM2`
15+
- `pointDistRads`
16+
- `pointDistKm`
17+
- `pointDistM`
18+
- `exactEdgeLengthRads`
19+
- `exactEdgeLengthKm`
20+
- `exactEdgeLengthM`
21+
## Changed
22+
- Updated the core library to v3.7.0.
1023

1124
## [3.6.4] - 2020-06-29
1225
### Changed

h3version.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
h3.git.reference=v3.6.4
1+
h3.git.reference=v3.7.0

src/main/c/h3-java/src/jniapi.c

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,106 @@ JNIEXPORT jint JNICALL Java_com_uber_h3core_NativeMethods_uncompact(
763763
return ret;
764764
}
765765

766+
/*
767+
* Class: com_uber_h3core_NativeMethods
768+
* Method: cellAreaRads2
769+
* Signature: (J)D
770+
*/
771+
JNIEXPORT jdouble JNICALL Java_com_uber_h3core_NativeMethods_cellAreaRads2(
772+
JNIEnv *env, jobject thiz, jlong h3) {
773+
return cellAreaRads2(h3);
774+
}
775+
776+
/*
777+
* Class: com_uber_h3core_NativeMethods
778+
* Method: cellAreaKm2
779+
* Signature: (J)D
780+
*/
781+
JNIEXPORT jdouble JNICALL Java_com_uber_h3core_NativeMethods_cellAreaKm2(
782+
JNIEnv *env, jobject thiz, jlong h3) {
783+
return cellAreaKm2(h3);
784+
}
785+
786+
/*
787+
* Class: com_uber_h3core_NativeMethods
788+
* Method: cellAreaM2
789+
* Signature: (J)D
790+
*/
791+
JNIEXPORT jdouble JNICALL Java_com_uber_h3core_NativeMethods_cellAreaM2(
792+
JNIEnv *env, jobject thiz, jlong h3) {
793+
return cellAreaM2(h3);
794+
}
795+
796+
/*
797+
* Class: com_uber_h3core_NativeMethods
798+
* Method: pointDistRads
799+
* Signature: (DDDD)D
800+
*/
801+
JNIEXPORT jdouble JNICALL Java_com_uber_h3core_NativeMethods_pointDistRads(
802+
JNIEnv *env, jobject thiz, jdouble lat1, jdouble lon1, jdouble lat2,
803+
jdouble lon2) {
804+
GeoCoord c1 = {.lat = lat1, .lon = lon1};
805+
GeoCoord c2 = {.lat = lat2, .lon = lon2};
806+
return pointDistRads(&c1, &c2);
807+
}
808+
809+
/*
810+
* Class: com_uber_h3core_NativeMethods
811+
* Method: pointDistKm
812+
* Signature: (DDDD)D
813+
*/
814+
JNIEXPORT jdouble JNICALL Java_com_uber_h3core_NativeMethods_pointDistKm(
815+
JNIEnv *env, jobject thiz, jdouble lat1, jdouble lon1, jdouble lat2,
816+
jdouble lon2) {
817+
GeoCoord c1 = {.lat = lat1, .lon = lon1};
818+
GeoCoord c2 = {.lat = lat2, .lon = lon2};
819+
return pointDistKm(&c1, &c2);
820+
}
821+
822+
/*
823+
* Class: com_uber_h3core_NativeMethods
824+
* Method: pointDistM
825+
* Signature: (DDDD)D
826+
*/
827+
JNIEXPORT jdouble JNICALL Java_com_uber_h3core_NativeMethods_pointDistM(
828+
JNIEnv *env, jobject thiz, jdouble lat1, jdouble lon1, jdouble lat2,
829+
jdouble lon2) {
830+
GeoCoord c1 = {.lat = lat1, .lon = lon1};
831+
GeoCoord c2 = {.lat = lat2, .lon = lon2};
832+
return pointDistM(&c1, &c2);
833+
}
834+
835+
/*
836+
* Class: com_uber_h3core_NativeMethods
837+
* Method: exactEdgeLengthRads
838+
* Signature: (J)D
839+
*/
840+
JNIEXPORT jdouble JNICALL
841+
Java_com_uber_h3core_NativeMethods_exactEdgeLengthRads(JNIEnv *env,
842+
jobject thiz, jlong h3) {
843+
return exactEdgeLengthRads(h3);
844+
}
845+
846+
/*
847+
* Class: com_uber_h3core_NativeMethods
848+
* Method: exactEdgeLengthKm
849+
* Signature: (J)D
850+
*/
851+
JNIEXPORT jdouble JNICALL Java_com_uber_h3core_NativeMethods_exactEdgeLengthKm(
852+
JNIEnv *env, jobject thiz, jlong h3) {
853+
return exactEdgeLengthKm(h3);
854+
}
855+
856+
/*
857+
* Class: com_uber_h3core_NativeMethods
858+
* Method: exactEdgeLengthM
859+
* Signature: (J)D
860+
*/
861+
JNIEXPORT jdouble JNICALL Java_com_uber_h3core_NativeMethods_exactEdgeLengthM(
862+
JNIEnv *env, jobject thiz, jlong h3) {
863+
return exactEdgeLengthM(h3);
864+
}
865+
766866
/*
767867
* Class: com_uber_h3core_NativeMethods
768868
* Method: hexAreaKm2

src/main/java/com/uber/h3core/AreaUnit.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
* Unit of measurement for areas.
2020
*/
2121
public enum AreaUnit {
22+
/**
23+
* Square radians on the WGS84 sphere
24+
*/
25+
rads2,
2226
/**
2327
* Square kilometers
2428
*/

0 commit comments

Comments
 (0)