| | |
| | | import lombok.extern.slf4j.Slf4j;
|
| | | import org.springframework.beans.factory.annotation.Value;
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import java.io.*;
|
| | | import java.text.DecimalFormat;
|
| | |
| | | if (b) {
|
| | | DecimalFormat df = new DecimalFormat("0.0");//设置保留位数
|
| | | String nPTZPan = df.format((float) dh_ptz_location_info.nPTZPan / 10);
|
| | | float t = (float) dh_ptz_location_info.nPTZTilt / 10;
|
| | | float t = (float) dh_ptz_location_info.nPTZTilt / 10 * -1;
|
| | | String nPTZTilt = df.format(t < 0 ? t + 360 : t);
|
| | | String nPTZZoom = df.format((float) dh_ptz_location_info.nPTZZoom);
|
| | | ptzMap.put("p", nPTZPan);
|
| | |
| | | try {
|
| | | int p = (int) (ptz.get("p") * 10);
|
| | | int t = (int) (ptz.get("t") * 10);
|
| | | int z = ptz.get("z").intValue();
|
| | | if (z == 0) {
|
| | | z = 1;
|
| | | }
|
| | | t = t > 900 ? 3600 - t : t * -1;
|
| | |
|
| | | int z = ptz.get("z").intValue() == 0 ? 1 : ptz.get("z").intValue();
|
| | | boolean bool = netsdk.CLIENT_DHPTZControlEx(loginId, chanNo - 1, NetSDKLib.NET_EXTPTZ_ControlType.NET_EXTPTZ_EXACTGOTO, p, t, z, 0);
|
| | | if (!bool) {
|
| | | log.error("控制失败,请稍后重试" + getErrorCodePrint());
|