Camera Information System
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.3 KiB

namespace Cis.Application.Core.Component.MarkSeacher;
public class HiKMarkSearcher : MarkSearcherBase
{
public HiKMarkSearcher(CameraCalcParams cameraCalcParams) : base(cameraCalcParams)
{
}
#region Implement
protected override double ConvertPanPosToAngle(double panPos)
{
double ret = 0.1 * HexToDecMa(panPos) / 180 * Math.PI;
ret = (ret >= 0) ? ret : (2 * Math.PI + ret);
return ret;
}
protected override double ConvertTiltPosToAngle(double tiltPos, double tiltMinPos = 0)
{
double ndiff;
if (tiltPos > tiltMinPos)
ndiff = HexToDecMa(tiltPos) - HexToDecMa(tiltMinPos);
else
ndiff = HexToDecMa(tiltPos) + HexToDecMa(13824) - HexToDecMa(tiltMinPos);
double ret = 0.1 * ndiff / 180 * Math.PI;
return ret;
}
protected override double GetZoomTag(double zoomPos)
{
double ret = (double)CameraCalcParams.ZoomVaryExpr.Eval(new()
{
["x"] = HexToDecMa(zoomPos),
});
return ret;
}
#endregion Implement
#region Util
protected static int HexToDecMa(double wHex)
{
int wHexInt = wHex.ToInt();
int ret = (wHexInt / 4096) * 1000 + ((wHexInt % 4096) / 256) * 100 + ((wHexInt % 256) / 16) * 10 + (wHexInt % 16);
return ret;
}
#endregion Util
}