mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-10-03 13:28:19 +00:00
- IfcJni: Fix access violation errors by creating a copy of the byte[]
- Add version identifier to bimserver_plugin and IfcJni
This commit is contained in:
@@ -64,6 +64,7 @@
|
|||||||
#include <gp_Trsf.hxx>
|
#include <gp_Trsf.hxx>
|
||||||
#include <gp_Trsf2d.hxx>
|
#include <gp_Trsf2d.hxx>
|
||||||
|
|
||||||
|
#include "../ifcparse/IfcParse.h"
|
||||||
#include "../ifcgeom/IfcShapeList.h"
|
#include "../ifcgeom/IfcShapeList.h"
|
||||||
|
|
||||||
namespace IfcGeomObjects {
|
namespace IfcGeomObjects {
|
||||||
|
|||||||
+37
-28
@@ -1,28 +1,28 @@
|
|||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* *
|
* *
|
||||||
* This file is part of IfcOpenShell. *
|
* This file is part of IfcOpenShell. *
|
||||||
* *
|
* *
|
||||||
* IfcOpenShell is free software: you can redistribute it and/or modify *
|
* IfcOpenShell is free software: you can redistribute it and/or modify *
|
||||||
* it under the terms of the Lesser GNU General Public License as published by *
|
* it under the terms of the Lesser GNU General Public License as published by *
|
||||||
* the Free Software Foundation, either version 3.0 of the License, or *
|
* the Free Software Foundation, either version 3.0 of the License, or *
|
||||||
* (at your option) any later version. *
|
* (at your option) any later version. *
|
||||||
* *
|
* *
|
||||||
* IfcOpenShell is distributed in the hope that it will be useful, *
|
* IfcOpenShell is distributed in the hope that it will be useful, *
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
* Lesser GNU General Public License for more details. *
|
* Lesser GNU General Public License for more details. *
|
||||||
* *
|
* *
|
||||||
* You should have received a copy of the Lesser GNU General Public License *
|
* You should have received a copy of the Lesser GNU General Public License *
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||||
* *
|
* *
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* *
|
* *
|
||||||
* This is a JNI interface to IfcOpenShell for use with the open source *
|
* This is a JNI interface to IfcOpenShell for use with the open source *
|
||||||
* http://BIMserver.org *
|
* http://BIMserver.org *
|
||||||
* *
|
* *
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
#include "org_ifcopenshell_IfcOpenShellModel.h"
|
#include "org_ifcopenshell_IfcOpenShellModel.h"
|
||||||
#include "../ifcgeom/IfcGeomObjects.h"
|
#include "../ifcgeom/IfcGeomObjects.h"
|
||||||
@@ -66,11 +66,20 @@ JNIEXPORT jobject JNICALL Java_org_ifcopenshell_IfcOpenShellModel_getGeometry (J
|
|||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jboolean JNICALL Java_org_ifcopenshell_IfcOpenShellModel_setIfcData (JNIEnv * env, jobject, jbyteArray jdata) {
|
JNIEXPORT jboolean JNICALL Java_org_ifcopenshell_IfcOpenShellModel_setIfcData (JNIEnv * env, jobject, jbyteArray jdata) {
|
||||||
void* data = env->GetByteArrayElements(jdata, NULL);
|
if ( ! jdata ) return false;
|
||||||
const int length = env->GetArrayLength(jdata);
|
const int length = env->GetArrayLength(jdata);
|
||||||
if ( ! data || ! length ) return false;
|
jboolean is_copy = false;
|
||||||
IfcGeomObjects::Settings(IfcGeomObjects::USE_WORLD_COORDS,true);
|
jbyte* jbytes = env->GetByteArrayElements(jdata, &is_copy);
|
||||||
IfcGeomObjects::Settings(IfcGeomObjects::WELD_VERTICES,false);
|
if ( ! jbytes || ! length ) return false;
|
||||||
IfcGeomObjects::Settings(IfcGeomObjects::CONVERT_BACK_UNITS,true);
|
void* data = new char[length];
|
||||||
return has_more = IfcGeomObjects::Init(data,length);
|
memcpy(data,jbytes,length);
|
||||||
|
env->ReleaseByteArrayElements(jdata, jbytes, JNI_ABORT);
|
||||||
|
IfcGeomObjects::Settings(IfcGeomObjects::USE_WORLD_COORDS, true);
|
||||||
|
IfcGeomObjects::Settings(IfcGeomObjects::WELD_VERTICES, false);
|
||||||
|
IfcGeomObjects::Settings(IfcGeomObjects::CONVERT_BACK_UNITS, true);
|
||||||
|
return has_more = IfcGeomObjects::Init(data, length);
|
||||||
|
}
|
||||||
|
|
||||||
|
JNIEXPORT jstring JNICALL Java_org_ifcopenshell_IfcOpenShellModel_getPluginVersion (JNIEnv * env, jobject) {
|
||||||
|
return env->NewStringUTF(IFCOPENSHELL_VERSION);
|
||||||
}
|
}
|
||||||
@@ -23,6 +23,14 @@ JNIEXPORT jobject JNICALL Java_org_ifcopenshell_IfcOpenShellModel_getGeometry
|
|||||||
JNIEXPORT jboolean JNICALL Java_org_ifcopenshell_IfcOpenShellModel_setIfcData
|
JNIEXPORT jboolean JNICALL Java_org_ifcopenshell_IfcOpenShellModel_setIfcData
|
||||||
(JNIEnv *, jobject, jbyteArray);
|
(JNIEnv *, jobject, jbyteArray);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Class: org_ifcopenshell_IfcOpenShellModel
|
||||||
|
* Method: getPluginVersion
|
||||||
|
* Signature: ()Ljava/lang/String;
|
||||||
|
*/
|
||||||
|
JNIEXPORT jstring JNICALL Java_org_ifcopenshell_IfcOpenShellModel_getPluginVersion
|
||||||
|
(JNIEnv *, jobject);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -27,6 +27,8 @@
|
|||||||
#ifndef IFCPARSE_H
|
#ifndef IFCPARSE_H
|
||||||
#define IFCPARSE_H
|
#define IFCPARSE_H
|
||||||
|
|
||||||
|
#define IFCOPENSHELL_VERSION "0.3.0-rc2"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|||||||
Reference in New Issue
Block a user