本文整理汇总了Java中com.sun.jna.ptr.DoubleByReference类的典型用法代码示例。如果您正苦于以下问题:Java DoubleByReference类的具体用法?Java DoubleByReference怎么用?Java DoubleByReference使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DoubleByReference类属于com.sun.jna.ptr包,在下文中一共展示了DoubleByReference类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getInstanceDerivedBoundingBox
import com.sun.jna.ptr.DoubleByReference; //导入依赖的package包/类
/**
* Returns advanced bounding box measures, can be used in combination with
* getInstanceDerivedTransformationMatrix().
*
* @param model
* Unique number identifying the model in the opened file.
* @param instance
* A numeric instanceID that uniquely identifies an instance.
* @return InstanceDerivedBoundingBox object
* @throws Exception
*/
public InstanceDerivedBoundingBox getInstanceDerivedBoundingBox(Pointer model, Pointer instance) {
DoubleByReference pOx = new DoubleByReference();
DoubleByReference pOy = new DoubleByReference();
DoubleByReference pOz = new DoubleByReference();
DoubleByReference pVx = new DoubleByReference();
DoubleByReference pVy = new DoubleByReference();
DoubleByReference pVz = new DoubleByReference();
engine._getInstanceDerivedBoundingBox(model, instance, pOx, pOy, pOz, pVx, pVy, pVz);
double ox = pOx.getValue();
double oy = pOy.getValue();
double oz = pOz.getValue();
double vx = pVx.getValue();
double vy = pVy.getValue();
double vz = pVz.getValue();
return new InstanceDerivedBoundingBox(model, instance, ox, oy, oz, vx, vy, vz);
}
示例2: sdaiAppend
import com.sun.jna.ptr.DoubleByReference; //导入依赖的package包/类
/**
* Adds an attribute value at the end of an attribute list.
*
* @param list
* @param valueType
* @param value
*/
public void sdaiAppend(int list, SdaiTypes valueType, Object value) {
switch (valueType) {
case INTEGER:
case BOOLEAN:
case LOGICAL:
IntByReference iVal = new IntByReference((Integer) value);
engine.sdaiAppend(list, valueType.ordinal(), iVal);
break;
case REAL:
DoubleByReference dVal = new DoubleByReference((Double) value);
engine.sdaiAppend(list, valueType.ordinal(), dVal);
break;
case STRING:
engine.sdaiAppend(list, valueType.ordinal(), (String) value);
break;
default:
engine.sdaiAppend(list, valueType.ordinal(), (Pointer) value);
break;
}
}
示例3: sdaiCreateADB
import com.sun.jna.ptr.DoubleByReference; //导入依赖的package包/类
/**
* Creates an Attribute Data Block (ADB).
*
* @param valueType
* identifies the type of parameter value.
* @param value
* identifies the data to be stored in the new ADB.
* @return the handle of the newly created ADB.
*/
public Pointer sdaiCreateADB(SdaiTypes valueType, Object value) {
Pointer returnValue = null;
switch (valueType) {
case INTEGER:
case BOOLEAN:
case LOGICAL:
IntByReference iVal = new IntByReference((Integer) value);
returnValue = engine.sdaiCreateADB(valueType.ordinal(), iVal);
break;
case REAL:
DoubleByReference dVal = new DoubleByReference((Double) value);
returnValue = engine.sdaiCreateADB(valueType.ordinal(), dVal);
break;
case STRING:
returnValue = engine.sdaiCreateADB(valueType.ordinal(), (String) value);
break;
default:
returnValue = engine.sdaiCreateADB(valueType.ordinal(), (Pointer) value);
break;
}
return returnValue;
}
示例4: setBoundaryNoise
import com.sun.jna.ptr.DoubleByReference; //导入依赖的package包/类
public static int setBoundaryNoise(int boundaryNoiseId, double value, int operation) {
int retVal;
double startTime = 0.0;
double endTime = 0.0;
int nvals = 1;
double[] valuearray = new double[]{value};
if (platform == D3dFlowModelConfig.DllType.win32_ifort) {
retVal = winIfortDll.SE_SET_NOISE_FOR_TIME_SPAN(new IntByReference(boundaryNoiseId),
new DoubleByReference(startTime), new DoubleByReference(endTime),
new IntByReference(operation),
new IntByReference(nvals), valuearray);
} else if (platform == D3dFlowModelConfig.DllType.linux64_gnu) {
retVal = linuxGnuDll.se_set_noise_for_time_span_(new IntByReference(boundaryNoiseId),
new DoubleByReference(startTime), new DoubleByReference(endTime),
new IntByReference(operation),
new IntByReference(nvals), valuearray);
} else {
throw new RuntimeException("setBoundaryNoise: DLL/so type not known for model");
}
if (retVal < 0) {
throw new RuntimeException("Error in D3dFlowDll.setBoundaryNoise, retVal " + retVal);
}
return retVal;
}
示例5: getTimeHorizon
import com.sun.jna.ptr.DoubleByReference; //导入依赖的package包/类
public static ITime getTimeHorizon() {
int retVal;
DoubleByReference startTime = new DoubleByReference(Double.NaN);
DoubleByReference endTime = new DoubleByReference(Double.NaN);
if (platform == D3dFlowModelConfig.DllType.win32_ifort) {
retVal = winIfortDll.SE_GETTIMEHORIZON(componentID, modelIdentifier,
startTime, endTime, componentID.length(), modelIdentifier.length());
} else if (platform == D3dFlowModelConfig.DllType.linux64_gnu) {
retVal = linuxGnuDll.se_gettimehorizon_(componentID, modelIdentifier,
startTime, endTime, componentID.length(), modelIdentifier.length());
} else {
throw new RuntimeException("getTimeHorizon: DLL/so type not known for model");
}
if (retVal != 0) {
throw new RuntimeException("Error in D3dFlowDll.getTimeHorizon(), retVal " + retVal);
}
return new Time(startTime.getValue(), endTime.getValue());
}
示例6: getValues
import com.sun.jna.ptr.DoubleByReference; //导入依赖的package包/类
/**
* Returns selected values for a scalar time series parameter.
*
* @param parameterNumber
* @param locationNumber
* @param layerNumber
* @param startTime
* @param endTime
* @return values
*/
public double[] getValues(int parameterNumber, int locationNumber, int layerNumber, ITime startTime, ITime endTime) {
int valuesCount = getValuesCount(parameterNumber, locationNumber, startTime, endTime);
double[] values = new double[valuesCount];
int retVal = nativeDLL.m_openda_wrapper_get_values_for_time_span_(
new IntByReference(myModelInstanceId),
new IntByReference(parameterNumber), new IntByReference(locationNumber), new IntByReference(layerNumber),
new DoubleByReference(startTime.getMJD() - referenceDateInMjd ),
new DoubleByReference(endTime.getMJD() - referenceDateInMjd),
new IntByReference(valuesCount), values);
if (retVal != 0) {
nativeDLL.m_openda_wrapper_finish_(new IntByReference(currentModelInstance));
throw new RuntimeException("Invalid result from dll.GET_VALUES_FOR_TIME_SPAN call, retVal= " + retVal);
}
return values;
}
示例7: setValues
import com.sun.jna.ptr.DoubleByReference; //导入依赖的package包/类
/**
* Sets selected values for a scalar time series parameter.
*
* @param parameterNumber
* @param values
* @param locationNumber
* @param layerNumber
* @param startTime
* @param endTime
*/
public void setValues(int parameterNumber, double[] values, int locationNumber, int layerNumber, ITime startTime, ITime endTime) {
int valuesCount = getValuesCount(parameterNumber, locationNumber, startTime, endTime);
if (valuesCount != values.length) {
nativeDLL.m_openda_wrapper_finish_(new IntByReference(currentModelInstance));
throw new RuntimeException("Invalid number of values in setValues(exchangeItemId=" +
parameterNumber + "). #Values=" + values.length + ", #expected=" + valuesCount);
}
int retVal = nativeDLL.m_openda_wrapper_set_values_for_time_span_(
new IntByReference(myModelInstanceId),
new IntByReference(parameterNumber), new IntByReference(locationNumber), new IntByReference(layerNumber),
new DoubleByReference(startTime.getMJD() - referenceDateInMjd),
new DoubleByReference(endTime.getMJD() - referenceDateInMjd),
new IntByReference(valuesCount), values);
if (retVal != 0) {
nativeDLL.m_openda_wrapper_finish_(new IntByReference(currentModelInstance));
throw new RuntimeException("Invalid result from dll.SET_VALUES_FOR_TIME_SPAN call, retVal= " + retVal);
}
}
示例8: getValues
import com.sun.jna.ptr.DoubleByReference; //导入依赖的package包/类
public double[] getValues(int exchangeItemId, int locationIndex, ITime startTime, ITime endTime) {
int valuesCount = getValuesCount(exchangeItemId, locationIndex, startTime, endTime);
double[] values = new double[valuesCount];
startModelInstanceAccess();
int retVal = nativeDLL.m_simple_model_mp_get_values_for_time_span_(
new IntByReference(myModelInstanceId),
new IntByReference(exchangeItemId), new IntByReference(locationIndex),
new DoubleByReference(startTime.getMJD()), new DoubleByReference(endTime.getMJD()),
new IntByReference(valuesCount), values);
endModelInstanceAccess();
if (retVal != 0) {
nativeDLL.m_simple_model_mp_finish_(new IntByReference(currentModelInstance));
throw new RuntimeException("Invalid result from dll.GET_VALUES call, retVal= " + retVal);
}
return values;
}
示例9: setValues
import com.sun.jna.ptr.DoubleByReference; //导入依赖的package包/类
public void setValues(int exchangeItemId, double[] values, int locationIndex, ITime startTime, ITime endTime) {
int valuesCount = getValuesCount(exchangeItemId, locationIndex, startTime, endTime);
if (valuesCount != values.length) {
nativeDLL.m_simple_model_mp_finish_(new IntByReference(currentModelInstance));
throw new RuntimeException("Invalid #values in setValues(exchangeItemId=" +
exchangeItemId + "). #Values=" + values.length + ", #expected=" + valuesCount);
}
startModelInstanceAccess();
int retVal = nativeDLL.m_simple_model_mp_set_values_for_time_span_(
new IntByReference(myModelInstanceId),
new IntByReference(exchangeItemId), new IntByReference(locationIndex),
new DoubleByReference(startTime.getMJD()), new DoubleByReference(endTime.getMJD()),
new IntByReference(valuesCount), values);
endModelInstanceAccess();
if (retVal != 0) {
nativeDLL.m_simple_model_mp_finish_(new IntByReference(currentModelInstance));
throw new RuntimeException("Invalid result from dll.SET_VALUES call, retVal= " + retVal);
}
}
示例10: start
import com.sun.jna.ptr.DoubleByReference; //导入依赖的package包/类
public static synchronized void start(HackRFSweepDataCallback dataCallback, int freq_min_MHz, int freq_max_MHz, int fft_bin_width, int num_samples,
int lna_gain, int vga_gain, boolean antennaPowerEnable)
{
hackrf_sweep_lib_start__fft_power_callback_callback callback = new hackrf_sweep_lib_start__fft_power_callback_callback()
{
@Override public void apply(byte sweep_started, int bins, DoubleByReference freqStart, float fftBinWidth, FloatByReference powerdBm)
{
double[] freqStartArr = bins == 0 ? null : freqStart.getPointer().getDoubleArray(0, bins);
float[] powerArr = bins == 0 ? null : powerdBm.getPointer().getFloatArray(0, bins);
dataCallback.newSpectrumData(sweep_started==0 ? false : true, freqStartArr, fftBinWidth, powerArr);
}
};
Native.setCallbackThreadInitializer(callback, new CallbackThreadInitializer(true));
HackrfSweepLibrary.hackrf_sweep_lib_start(callback, freq_min_MHz, freq_max_MHz, fft_bin_width, num_samples, lna_gain, vga_gain, antennaPowerEnable ? 1 : 0);
}
示例11: addSubFeatures
import com.sun.jna.ptr.DoubleByReference; //导入依赖的package包/类
private void addSubFeatures(CSensors cSensors, CChip chip, List<CSubFeature> subFeatures) {
for (final CSubFeature subFeature : subFeatures) {
addDebugData(String.format("SubFeature type: %d", subFeature.type));
addDebugData(String.format("SubFeature name: %s", subFeature.name));
double value = 0.0;
DoubleByReference pValue = new DoubleByReference(value);
if (cSensors.sensors_get_value(chip, subFeature.number, pValue) == 0) {
addDebugData(String.format("SubFeature value: %s", pValue.getValue()));
if (subFeature.name.endsWith("_input")) {
addData(String.format("%s", pValue.getValue()));
break;
}
} else {
addData("Could not retrieve value");
}
}
}
示例12: getPosition
import com.sun.jna.ptr.DoubleByReference; //导入依赖的package包/类
/**
* Read the position of the device. Units are meters [m].
* @param aPosition - Return value.
* @return - Return 0 if no error occurred.
*/
@Override
public int getPosition(JVector3d aPosition)
{
// check if drivers are installed
if (!mDriverInstalled) return (-1);
DoubleByReference x = new DoubleByReference(),
y = new DoubleByReference(),
z = new DoubleByReference();
int error = 0;
try{
error = hdFalcon.hdFalconGetPosition(mDeviceID, x, y, z);
}catch(Exception e)
{e.printStackTrace();}
// add a small offset for zero centering
x.setValue(x.getValue() + 0.01);
aPosition.set(x.getValue(), y.getValue(), z.getValue());
estimateLinearVelocity(aPosition);
return (error);
}
示例13: setForce
import com.sun.jna.ptr.DoubleByReference; //导入依赖的package包/类
/**
* Send a force [N] to the Falcon haptic device.
* @param aForce - Force command to be applied to device.
* @return - Return 0 if no error occurred.
*/
@Override
public int setForce(JVector3d aForce)
{
// check if drivers are installed
if (!mDriverInstalled) return (-1);
DoubleByReference x = new DoubleByReference(aForce.getX()),
y = new DoubleByReference(aForce.getY()),
z = new DoubleByReference(aForce.getZ());
int error = 0;
try{
error = hdFalcon.hdFalconSetForce(mDeviceID, x, y, z);
}catch(Exception e)
{e.printStackTrace();}
aForce.setX(x.getValue());
aForce.setY(y.getValue());
aForce.setZ(z.getValue());
setPrevForce(aForce);
return (error);
}
示例14: getLinearVelocity
import com.sun.jna.ptr.DoubleByReference; //导入依赖的package包/类
/**
* Read the linear velocity of the device. Units are in [m/s].
* @return - Return 0 if no error occurred.
*/
@Override
public int getLinearVelocity(JVector3d aLinearVelocity) {
// check if the system is available
if (!mSystemAvailable) {
return (-1);
}
int error = -1;
DoubleByReference vx = new DoubleByReference(),
vy = new DoubleByReference(),
vz = new DoubleByReference();
try {
error = dhd.dhdGetLinearVelocity(vx, vy, vz, (char) mDeviceID);
} catch (Exception e) {
e.printStackTrace();
}
mLinearVelocity.set(vx.getValue(), vy.getValue(), vz.getValue());
aLinearVelocity.copyFrom(mLinearVelocity);
return (error);
}
示例15: getPosition
import com.sun.jna.ptr.DoubleByReference; //导入依赖的package包/类
/**
* Read the position of the device. Units are meters [m].
* @param aPosition - Return value.
* @return - Return 0 if no error occurred.
*/
@Override
public int getPosition(JVector3d aPosition)
{
// check if drivers are installed
if (!mDriverInstalled) return (-1);
DoubleByReference x=new DoubleByReference(),
y=new DoubleByReference(),
z=new DoubleByReference();
int error = -1;
try{
error = hdPhantom.hdPhantomGetPosition(mDeviceID, x, y, z);
}catch(Exception e)
{e.printStackTrace();}
aPosition.set(x.getValue(), y.getValue(), z.getValue());
estimateLinearVelocity(aPosition);
return (error);
}