1078-设置圆形区域

This commit is contained in:
648540858
2024-05-04 00:09:12 +08:00
parent 5dd49b3d44
commit faa0a01b9f
6 changed files with 83 additions and 6 deletions

View File

@@ -48,22 +48,17 @@ public class JTCircleArea {
public ByteBuf encode(){
ByteBuf byteBuf = Unpooled.buffer();
byteBuf.writeInt((int) (id & 0xffffffffL));
System.out.println("attribute: " + attribute.encode().readableBytes());
byteBuf.writeBytes(attribute.encode());
byteBuf.writeInt((int) (Math.round((latitude * 1000000)) & 0xffffffffL));
byteBuf.writeInt((int) (Math.round((longitude * 1000000)) & 0xffffffffL));
byteBuf.writeInt((int) (radius & 0xffffffffL));
ByteBuf transform = BCDUtil.transform(DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(startTime));
ByteBuf transform1 = BCDUtil.transform(DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(endTime));
System.out.println("startTime: " + transform.readableBytes());
System.out.println("endTime: " + transform1.readableBytes());
byteBuf.writeBytes(BCDUtil.transform(DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(startTime)));
byteBuf.writeBytes(BCDUtil.transform(DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(endTime)));
byteBuf.writeShort((short)(maxSpeed & 0xffff));
byteBuf.writeByte(overSpeedDuration);
byteBuf.writeShort((short)(nighttimeMaxSpeed & 0xffff));
byteBuf.writeShort((short)(name.getBytes(Charset.forName("GBK")).length & 0xffff));
byteBuf.writeCharSequence(name, Charset.forName("GBK"));
System.out.println(byteBuf.readableBytes());
return byteBuf;
}