From 24e50ce2428fc47e9e636481d59a70d7411d68b1 Mon Sep 17 00:00:00 2001 From: Grigory Pomadchin Date: Sat, 23 Sep 2023 20:59:36 -0400 Subject: [PATCH] Cleanup JNI; add more tests --- .../resources/quick-info-with-metadata.json | 157 ++++++++++++++++++ .../src/test/scala/io/pdal/PipelineSpec.scala | 9 +- .../scala/io/pdal/TestEnvironmentSpec.scala | 1 + native/src/JavaPipeline.cpp | 71 ++++---- native/src/include/JavaPipeline.hpp | 1 + native/src/io_pdal_PointLayout.cpp | 8 +- native/src/io_pdal_PointView.cpp | 25 +-- 7 files changed, 225 insertions(+), 47 deletions(-) create mode 100644 core/src/test/resources/quick-info-with-metadata.json diff --git a/core/src/test/resources/quick-info-with-metadata.json b/core/src/test/resources/quick-info-with-metadata.json new file mode 100644 index 0000000..7ce7f0a --- /dev/null +++ b/core/src/test/resources/quick-info-with-metadata.json @@ -0,0 +1,157 @@ +{ + "readers.las": + { + "bounds": + { + "maxx": 638982.55, + "maxy": 853535.43, + "maxz": 586.38, + "minx": 635619.85, + "miny": 848899.7, + "minz": 406.59 + }, + "dimensions": "X, Y, Z, Intensity, ReturnNumber, NumberOfReturns, ScanDirectionFlag, EdgeOfFlightLine, Classification, ScanAngleRank, UserData, PointSourceId, GpsTime, Red, Green, Blue", + "num_points": 1065, + "srs": + { + "compoundwkt": "PROJCS[\"NAD83(HARN) / Oregon LCC (m)\",GEOGCS[\"NAD83(HARN)\",DATUM[\"NAD83_High_Accuracy_Reference_Network\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],AUTHORITY[\"EPSG\",\"6152\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4152\"]],PROJECTION[\"Lambert_Conformal_Conic_2SP\"],PARAMETER[\"latitude_of_origin\",41.75],PARAMETER[\"central_meridian\",-120.5],PARAMETER[\"standard_parallel_1\",43],PARAMETER[\"standard_parallel_2\",45.5],PARAMETER[\"false_easting\",400000],PARAMETER[\"false_northing\",0],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"Easting\",EAST],AXIS[\"Northing\",NORTH],AUTHORITY[\"EPSG\",\"2993\"]]", + "horizontal": "PROJCS[\"NAD83(HARN) / Oregon LCC (m)\",GEOGCS[\"NAD83(HARN)\",DATUM[\"NAD83_High_Accuracy_Reference_Network\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],AUTHORITY[\"EPSG\",\"6152\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4152\"]],PROJECTION[\"Lambert_Conformal_Conic_2SP\"],PARAMETER[\"latitude_of_origin\",41.75],PARAMETER[\"central_meridian\",-120.5],PARAMETER[\"standard_parallel_1\",43],PARAMETER[\"standard_parallel_2\",45.5],PARAMETER[\"false_easting\",400000],PARAMETER[\"false_northing\",0],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"Easting\",EAST],AXIS[\"Northing\",NORTH],AUTHORITY[\"EPSG\",\"2993\"]]", + "isgeocentric": false, + "isgeographic": false, + "json": { + "type": "ProjectedCRS", + "name": "NAD83(HARN) / Oregon LCC (m)", + "base_crs": { + "name": "NAD83(HARN)", + "datum": { + "type": "GeodeticReferenceFrame", + "name": "NAD83 (High Accuracy Reference Network)", + "ellipsoid": { + "name": "GRS 1980", + "semi_major_axis": 6378137, + "inverse_flattening": 298.257222101 + } + }, + "coordinate_system": { + "subtype": "ellipsoidal", + "axis": [ + { + "name": "Geodetic latitude", + "abbreviation": "Lat", + "direction": "north", + "unit": "degree" + }, + { + "name": "Geodetic longitude", + "abbreviation": "Lon", + "direction": "east", + "unit": "degree" + } + ] + }, + "id": { + "authority": "EPSG", + "code": 4152 + } + }, + "conversion": { + "name": "unnamed", + "method": { + "name": "Lambert Conic Conformal (2SP)", + "id": { + "authority": "EPSG", + "code": 9802 + } + }, + "parameters": [ + { + "name": "Latitude of false origin", + "value": 41.75, + "unit": "degree", + "id": { + "authority": "EPSG", + "code": 8821 + } + }, + { + "name": "Longitude of false origin", + "value": -120.5, + "unit": "degree", + "id": { + "authority": "EPSG", + "code": 8822 + } + }, + { + "name": "Latitude of 1st standard parallel", + "value": 43, + "unit": "degree", + "id": { + "authority": "EPSG", + "code": 8823 + } + }, + { + "name": "Latitude of 2nd standard parallel", + "value": 45.5, + "unit": "degree", + "id": { + "authority": "EPSG", + "code": 8824 + } + }, + { + "name": "Easting at false origin", + "value": 400000, + "unit": "metre", + "id": { + "authority": "EPSG", + "code": 8826 + } + }, + { + "name": "Northing at false origin", + "value": 0, + "unit": "metre", + "id": { + "authority": "EPSG", + "code": 8827 + } + } + ] + }, + "coordinate_system": { + "subtype": "Cartesian", + "axis": [ + { + "name": "Easting", + "abbreviation": "", + "direction": "east", + "unit": "metre" + }, + { + "name": "Northing", + "abbreviation": "", + "direction": "north", + "unit": "metre" + } + ] + }, + "id": { + "authority": "EPSG", + "code": 2993 + } + }, + "prettycompoundwkt": "PROJCS[\"NAD83(HARN) / Oregon LCC (m)\",\n GEOGCS[\"NAD83(HARN)\",\n DATUM[\"NAD83_High_Accuracy_Reference_Network\",\n SPHEROID[\"GRS 1980\",6378137,298.257222101,\n AUTHORITY[\"EPSG\",\"7019\"]],\n AUTHORITY[\"EPSG\",\"6152\"]],\n PRIMEM[\"Greenwich\",0,\n AUTHORITY[\"EPSG\",\"8901\"]],\n UNIT[\"degree\",0.0174532925199433,\n AUTHORITY[\"EPSG\",\"9122\"]],\n AUTHORITY[\"EPSG\",\"4152\"]],\n PROJECTION[\"Lambert_Conformal_Conic_2SP\"],\n PARAMETER[\"latitude_of_origin\",41.75],\n PARAMETER[\"central_meridian\",-120.5],\n PARAMETER[\"standard_parallel_1\",43],\n PARAMETER[\"standard_parallel_2\",45.5],\n PARAMETER[\"false_easting\",400000],\n PARAMETER[\"false_northing\",0],\n UNIT[\"metre\",1,\n AUTHORITY[\"EPSG\",\"9001\"]],\n AXIS[\"Easting\",EAST],\n AXIS[\"Northing\",NORTH],\n AUTHORITY[\"EPSG\",\"2993\"]]", + "prettywkt": "PROJCS[\"NAD83(HARN) / Oregon LCC (m)\",\n GEOGCS[\"NAD83(HARN)\",\n DATUM[\"NAD83_High_Accuracy_Reference_Network\",\n SPHEROID[\"GRS 1980\",6378137,298.257222101,\n AUTHORITY[\"EPSG\",\"7019\"]],\n AUTHORITY[\"EPSG\",\"6152\"]],\n PRIMEM[\"Greenwich\",0,\n AUTHORITY[\"EPSG\",\"8901\"]],\n UNIT[\"degree\",0.0174532925199433,\n AUTHORITY[\"EPSG\",\"9122\"]],\n AUTHORITY[\"EPSG\",\"4152\"]],\n PROJECTION[\"Lambert_Conformal_Conic_2SP\"],\n PARAMETER[\"latitude_of_origin\",41.75],\n PARAMETER[\"central_meridian\",-120.5],\n PARAMETER[\"standard_parallel_1\",43],\n PARAMETER[\"standard_parallel_2\",45.5],\n PARAMETER[\"false_easting\",400000],\n PARAMETER[\"false_northing\",0],\n UNIT[\"metre\",1,\n AUTHORITY[\"EPSG\",\"9001\"]],\n AXIS[\"Easting\",EAST],\n AXIS[\"Northing\",NORTH],\n AUTHORITY[\"EPSG\",\"2993\"]]", + "proj4": "+proj=lcc +lat_0=41.75 +lon_0=-120.5 +lat_1=43 +lat_2=45.5 +x_0=400000 +y_0=0 +ellps=GRS80 +units=m +no_defs", + "units": + { + "horizontal": "metre", + "vertical": "" + }, + "vertical": "", + "wkt": "PROJCS[\"NAD83(HARN) / Oregon LCC (m)\",GEOGCS[\"NAD83(HARN)\",DATUM[\"NAD83_High_Accuracy_Reference_Network\",SPHEROID[\"GRS 1980\",6378137,298.257222101,AUTHORITY[\"EPSG\",\"7019\"]],AUTHORITY[\"EPSG\",\"6152\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4152\"]],PROJECTION[\"Lambert_Conformal_Conic_2SP\"],PARAMETER[\"latitude_of_origin\",41.75],PARAMETER[\"central_meridian\",-120.5],PARAMETER[\"standard_parallel_1\",43],PARAMETER[\"standard_parallel_2\",45.5],PARAMETER[\"false_easting\",400000],PARAMETER[\"false_northing\",0],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"Easting\",EAST],AXIS[\"Northing\",NORTH],AUTHORITY[\"EPSG\",\"2993\"]]" + } + } +} diff --git a/core/src/test/scala/io/pdal/PipelineSpec.scala b/core/src/test/scala/io/pdal/PipelineSpec.scala index 8d17e26..2919443 100644 --- a/core/src/test/scala/io/pdal/PipelineSpec.scala +++ b/core/src/test/scala/io/pdal/PipelineSpec.scala @@ -187,7 +187,14 @@ class PipelineSpec extends TestEnvironmentSpec { } it("should get quickInfo") { - parser.parse(pipeline.getQuickInfo()) shouldBe quickInfoJson + val p = Pipeline(json) + parser.parse(p.getQuickInfo()) shouldBe quickInfoJson + } + + it("should get quickInfo with metadata") { + val p = Pipeline(json) + p.execute() + parser.parse(p.getQuickInfo()) shouldBe quickInfoWithMetadataJson } it("should extract mesh in iterative fashion") { diff --git a/core/src/test/scala/io/pdal/TestEnvironmentSpec.scala b/core/src/test/scala/io/pdal/TestEnvironmentSpec.scala index 61bd072..002038a 100644 --- a/core/src/test/scala/io/pdal/TestEnvironmentSpec.scala +++ b/core/src/test/scala/io/pdal/TestEnvironmentSpec.scala @@ -57,6 +57,7 @@ trait TestEnvironmentSpec extends AnyFunSpec with Matchers with BeforeAndAfterAl val schemaJson: Either[ParsingFailure, Json] = parser.parse(getJson("/schema.json")) val metadataJson: Either[ParsingFailure, Json] = parser.parse(getJson("/metadata.json")) val quickInfoJson: Either[ParsingFailure, Json] = parser.parse(getJson("/quick-info.json")) + val quickInfoWithMetadataJson: Either[ParsingFailure, Json] = parser.parse(getJson("/quick-info-with-metadata.json")) val proj4String = "+proj=lcc +lat_0=41.75 +lon_0=-120.5 +lat_1=43 +lat_2=45.5 +x_0=400000 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs" diff --git a/native/src/JavaPipeline.cpp b/native/src/JavaPipeline.cpp index b038778..ae3ed74 100644 --- a/native/src/JavaPipeline.cpp +++ b/native/src/JavaPipeline.cpp @@ -36,31 +36,38 @@ #include #endif -#include - +using pdal::LogPtr; +using pdal::MetadataNode; +using pdal::PointId; using pdal::PointViewSet; +using pdal::PointTableRef; +using pdal::Stage; using pdal::point_count_t; +using std::string; +using std::stringstream; +using std::vector; + namespace libpdaljava { void CountPointTable::reset() { - for (pdal::PointId idx = 0; idx < numPoints(); idx++) + for (PointId idx = 0; idx < numPoints(); idx++) if (!skip(idx)) m_count++; FixedPointTable::reset(); } -PipelineExecutor::PipelineExecutor(std::string const& json, int level) +PipelineExecutor::PipelineExecutor(string const& json, int level) { setLogLevel(level); - pdal::LogPtr log(pdal::Log::makeLog("javapipeline", &m_logStream)); + LogPtr log(pdal::Log::makeLog("javapipeline", &m_logStream)); log->setLevel(m_logLevel); m_manager.setLog(log); - std::stringstream strm; + stringstream strm; strm << json; m_manager.readPipeline(strm); @@ -73,10 +80,10 @@ bool PipelineExecutor::validate() return true; } -pdal::point_count_t PipelineExecutor::execute() +point_count_t PipelineExecutor::execute() { - pdal::point_count_t count = m_manager.execute(); + point_count_t count = m_manager.execute(); m_executed = true; return count; } @@ -97,10 +104,10 @@ const PointViewSet& PipelineExecutor::views() const return m_manager.views(); } -std::string PipelineExecutor::getSrsWKT2() const +string PipelineExecutor::getSrsWKT2() const { - std::string output(""); - pdal::PointTableRef pointTable = m_manager.pointTable(); + string output(""); + PointTableRef pointTable = m_manager.pointTable(); pdal::SpatialReference srs = pointTable.spatialReference(); output = srs.getWKT(); @@ -108,38 +115,38 @@ std::string PipelineExecutor::getSrsWKT2() const return output; } -std::string PipelineExecutor::getPipeline() const +string PipelineExecutor::getPipeline() const { - std::stringstream strm; + stringstream strm; pdal::PipelineWriter::writePipeline(m_manager.getStage(), strm); return strm.str(); } -std::string PipelineExecutor::getMetadata() const +string PipelineExecutor::getMetadata() const { if (!m_executed) throw java_error("Pipeline has not been executed!"); - std::stringstream strm; - pdal::MetadataNode root = m_manager.getMetadata().clone("metadata"); + stringstream strm; + MetadataNode root = m_manager.getMetadata().clone("metadata"); pdal::Utils::toJSON(root, strm); return strm.str(); } -std::string PipelineExecutor::getSchema() const +string PipelineExecutor::getSchema() const { if (!m_executed) throw java_error("Pipeline has not been executed!"); - std::stringstream strm; - pdal::MetadataNode root = pointTable().layout()->toMetadata().clone("schema"); + stringstream strm; + MetadataNode root = pointTable().layout()->toMetadata().clone("schema"); pdal::Utils::toJSON(root, strm); return strm.str(); } -pdal::MetadataNode computePreview(pdal::Stage* stage) +MetadataNode computePreview(pdal::Stage* stage) { if (!stage) throw java_error("no valid stage in QuickInfo"); @@ -150,21 +157,21 @@ pdal::MetadataNode computePreview(pdal::Stage* stage) if (!qi.valid()) throw java_error("No summary data available for stage '" + stage->getName()+"'" ); - std::stringstream strm; - pdal::MetadataNode summary(stage->getName()); + stringstream strm; + MetadataNode summary(stage->getName()); summary.add("num_points", qi.m_pointCount); if (qi.m_srs.valid()) { - pdal::MetadataNode srs = qi.m_srs.toMetadata(); + MetadataNode srs = qi.m_srs.toMetadata(); summary.add(srs); } if (qi.m_bounds.valid()) { - pdal::MetadataNode bounds = pdal::Utils::toMetadata(qi.m_bounds); + MetadataNode bounds = pdal::Utils::toMetadata(qi.m_bounds); summary.add(bounds.clone("bounds")); } - std::string dims; + string dims; auto di = qi.m_dimNames.begin(); while (di != qi.m_dimNames.end()) @@ -181,12 +188,12 @@ pdal::MetadataNode computePreview(pdal::Stage* stage) } -std::string PipelineExecutor::getQuickInfo() const +string PipelineExecutor::getQuickInfo() const { pdal::Stage* stage(nullptr); - std::vector stages = m_manager.stages(); - std::vector previewStages; + vector stages = m_manager.stages(); + vector previewStages; for (auto const& s: stages) { @@ -197,14 +204,14 @@ std::string PipelineExecutor::getQuickInfo() const previewStages.push_back(s); } - pdal::MetadataNode summary; + MetadataNode summary; for (auto const& stage: previewStages) { - pdal::MetadataNode n = computePreview(stage); + MetadataNode n = computePreview(stage); summary.add(n); } - std::stringstream strm; + stringstream strm; pdal::Utils::toJSON(summary, strm); return strm.str(); } @@ -212,7 +219,7 @@ std::string PipelineExecutor::getQuickInfo() const void PipelineExecutor::setLogStream(std::ostream& strm) { - pdal::LogPtr log(pdal::Log::makeLog("javapipeline", &strm)); + LogPtr log(pdal::Log::makeLog("javapipeline", &strm)); log->setLevel(m_logLevel); m_manager.setLog(log); } diff --git a/native/src/include/JavaPipeline.hpp b/native/src/include/JavaPipeline.hpp index bc491cd..822ec61 100644 --- a/native/src/include/JavaPipeline.hpp +++ b/native/src/include/JavaPipeline.hpp @@ -36,6 +36,7 @@ #include #include #include +#include #include #include diff --git a/native/src/io_pdal_PointLayout.cpp b/native/src/io_pdal_PointLayout.cpp index 41d0f79..d45a834 100644 --- a/native/src/io_pdal_PointLayout.cpp +++ b/native/src/io_pdal_PointLayout.cpp @@ -41,6 +41,8 @@ using pdal::PointLayout; using pdal::DimTypeList; using pdal::DimType; +using std::string; + JNIEXPORT jobjectArray JNICALL Java_io_pdal_PointLayout_dimTypes (JNIEnv *env, jobject obj) { @@ -72,7 +74,7 @@ JNIEXPORT jobjectArray JNICALL Java_io_pdal_PointLayout_dimTypes JNIEXPORT jobject JNICALL Java_io_pdal_PointLayout_findDimType (JNIEnv *env, jobject obj, jstring jstr) { - std::string fid = std::string(env->GetStringUTFChars(jstr, 0)); + string fid = string(env->GetStringUTFChars(jstr, 0)); PointLayout *pl = getHandle(env, obj); DimType dt = pl->findDimType(fid); jstring id = env->NewStringUTF(pl->dimName(dt.m_id).c_str()); @@ -88,7 +90,7 @@ JNIEXPORT jobject JNICALL Java_io_pdal_PointLayout_findDimType JNIEXPORT jlong JNICALL Java_io_pdal_PointLayout_dimSize__Ljava_lang_String_2 (JNIEnv *env, jobject obj, jstring jstr) { - std::string fid = std::string(env->GetStringUTFChars(jstr, 0)); + string fid = string(env->GetStringUTFChars(jstr, 0)); PointLayout *pl = getHandle(env, obj); return pl->dimSize(pl->findDim(fid)); @@ -97,7 +99,7 @@ JNIEXPORT jlong JNICALL Java_io_pdal_PointLayout_dimSize__Ljava_lang_String_2 JNIEXPORT jlong JNICALL Java_io_pdal_PointLayout_dimPackedOffset__Ljava_lang_String_2 (JNIEnv *env, jobject obj, jstring jstr) { - std::string fid = std::string(env->GetStringUTFChars(jstr, 0)); + string fid = string(env->GetStringUTFChars(jstr, 0)); PointLayout *pl = getHandle(env, obj); DimType dimType = pl->findDimType(fid); DimTypeList dims = pl->dimTypes(); diff --git a/native/src/io_pdal_PointView.cpp b/native/src/io_pdal_PointView.cpp index 9f49ea0..55f6f48 100644 --- a/native/src/io_pdal_PointView.cpp +++ b/native/src/io_pdal_PointView.cpp @@ -58,13 +58,16 @@ using pdal::Triangle; using pdal::DimType; using pdal::pdal_error; +using std::size_t; +using std::string; + /// Converts JavaArray of DimTypes (In Java interpretation DimType is a pair of strings) /// into DimTypeList (vector of DimTypes), puts dim size into bufSize /// \param[in] env JNI environment /// \param[in] dims JavaArray of DimTypes /// \param[in] bufSize Dims sum size /// \param[in] dimTypes Vector of DimTypes -void convertDimTypeJavaArrayToVector(JNIEnv *env, jobjectArray dims, std::size_t *pointSize, DimTypeList *dimTypes, PointLayoutPtr pl) +void convertDimTypeJavaArrayToVector(JNIEnv *env, jobjectArray dims, size_t *pointSize, DimTypeList *dimTypes, PointLayoutPtr pl) { for (jint i = 0; i < env->GetArrayLength(dims); i++) { @@ -74,7 +77,7 @@ void convertDimTypeJavaArrayToVector(JNIEnv *env, jobjectArray dims, std::size_t jfieldID ftype = env->GetFieldID(cDimType, "type", "Ljava/lang/String;"); jstring jid = reinterpret_cast(env->GetObjectField(jDimType, fid)); - DimType dimType = pl->findDimType(std::string(env->GetStringUTFChars(jid, 0))); + DimType dimType = pl->findDimType(string(env->GetStringUTFChars(jid, 0))); *pointSize += pl->dimSize(dimType.m_id); dimTypes->insert(dimTypes->begin() + i, dimType); @@ -87,9 +90,9 @@ void convertDimTypeJavaArrayToVector(JNIEnv *env, jobjectArray dims, std::size_t /// \param[in] dims List of dimensions/types to retrieve. /// \param[in] idx Index of point to get. /// \param[in] buf Pointer to buffer to fill. -void appendPackedPoint(PointViewPtr pv, const DimTypeList& dims, PointId idx, std::size_t pointSize, char *buf) +void appendPackedPoint(PointViewPtr pv, const DimTypeList& dims, PointId idx, size_t pointSize, char *buf) { - std::size_t from = idx * pointSize; + size_t from = idx * pointSize; if(from >= pv->size() * pointSize) return; buf += from; pv->getPackedPoint(dims, idx, buf); @@ -141,7 +144,7 @@ JNIEXPORT jstring JNICALL Java_io_pdal_PointView_getCrsWKT__Z PointViewRawPtr *pvrp = getHandle(env, obj); PointViewPtr pv = pvrp->shared_pointer; - std::string wkt = pv->spatialReference().getWKT(); + string wkt = pv->spatialReference().getWKT(); if(pretty) wkt = SpatialReference::prettyWkt(wkt); @@ -157,7 +160,7 @@ JNIEXPORT jbyteArray JNICALL Java_io_pdal_PointView_getPackedPoint__J_3Lio_pdal_ PointLayoutPtr pl = pv->layout(); // we need to calculate buffer size - std::size_t pointSize = 0; + size_t pointSize = 0; DimTypeList dimTypes; // calculate result buffer length (for one point) and get dimTypes @@ -184,14 +187,14 @@ JNIEXPORT jbyteArray JNICALL Java_io_pdal_PointView_getPackedPoints___3Lio_pdal_ PointLayoutPtr pl = pv->layout(); // we need to calculate buffer size - std::size_t pointSize = 0; + size_t pointSize = 0; DimTypeList dimTypes; // calculate result buffer length (for one point) and get dimTypes convertDimTypeJavaArrayToVector(env, dims, &pointSize, &dimTypes, pl); // reading all points - std::size_t bufSize = pointSize * pv->size(); + size_t bufSize = pointSize * pv->size(); char *buf = new char[bufSize]; for (PointId idx = 0; idx < pv->size(); idx++) @@ -212,7 +215,7 @@ JNIEXPORT jobject JNICALL Java_io_pdal_PointView_getTriangularMesh__Ljava_lang_S { PointViewRawPtr *pvrp = getHandle(env, obj); PointViewPtr pv = pvrp->shared_pointer; - std::string cname = std::string(env->GetStringUTFChars(name, 0)); + string cname = string(env->GetStringUTFChars(name, 0)); TriangularMesh *m = pv->mesh(cname); @@ -236,7 +239,7 @@ JNIEXPORT jobject JNICALL Java_io_pdal_PointView_getTriangularMesh__Ljava_lang_S JNIEXPORT jdoubleArray JNICALL Java_io_pdal_PointView_rasterizeTriangularMesh___3DIILio_pdal_DimType_2Ljava_lang_String_2 (JNIEnv *env, jobject obj, jdoubleArray extent, jint cols, jint rows, jobject jDimType, jstring name) { - std::string cname = std::string(env->GetStringUTFChars(name, 0)); + string cname = string(env->GetStringUTFChars(name, 0)); PointViewRawPtr *pvrp = getHandle(env, obj); PointViewPtr pv = pvrp->shared_pointer; @@ -253,7 +256,7 @@ JNIEXPORT jdoubleArray JNICALL Java_io_pdal_PointView_rasterizeTriangularMesh___ jstring jid = reinterpret_cast(env->GetObjectField(jDimType, fid)); PointLayoutPtr pl = pv->layout(); - DimType dimType = pl->findDimType(std::string(env->GetStringUTFChars(jid, 0))); + DimType dimType = pl->findDimType(string(env->GetStringUTFChars(jid, 0))); Id dimId = dimType.m_id; int size = mesh->size();