| | |
| | | import com.xiaopeng.map.dto.MapAreaDataDto; |
| | | import com.xiaopeng.map.dto.OddAreaDto; |
| | | import com.xiaopeng.map.dto.OddPointDto; |
| | | import com.xiaopeng.map.dto.RTree; |
| | | |
| | | import java.io.FileOutputStream; |
| | | import java.io.IOException; |
| | |
| | | } |
| | | return buildRTreeBytes(leafNodes); |
| | | } |
| | | /** |
| | | * 构建一个空的 RTree FBS(nodes 为空数组,无任何节点)。 |
| | | * 用于围栏失效时推送给车端,表示该围栏已无有效区域。 |
| | | */ |
| | | public static byte[] buildEmptyRTreeBytes() { |
| | | FlatBufferBuilder builder = new FlatBufferBuilder(64); |
| | | int nodesVector = RTree.createNodesVector(builder, new int[0]); |
| | | int rtreeOffset = RTree.createRTree(builder, nodesVector); |
| | | builder.finish(rtreeOffset); |
| | | ByteBuffer buffer = builder.dataBuffer(); |
| | | byte[] bytes = new byte[buffer.remaining()]; |
| | | buffer.get(bytes); |
| | | return bytes; |
| | | } |
| | | |
| | | /** |
| | | * 从多个区域的坐标点列表生成 RTree fbs 文件(多区域版本,与 C++ 完全对齐)。 |
| | |
| | | gcl = args[0]; |
| | | } else { |
| | | // 默认示例,来源于用户提供的坐标 |
| | | gcl = "104.06249657558965_30.583221674855963," + |
| | | "104.06244328689024_30.58049965528362," + |
| | | "104.06640444191817_30.580606702069797," + |
| | | "104.06496563619123_30.58420035984882," + |
| | | "104.06249657558965_30.583221674855963"; |
| | | // gcl = "104.06249657558965_30.583221674855963," + |
| | | // "104.06244328689024_30.58049965528362," + |
| | | // "104.06640444191817_30.580606702069797," + |
| | | // "104.06496563619123_30.58420035984882," + |
| | | // "104.06249657558965_30.583221674855963"; |
| | | gcl = "113.372963_23.158792,113.406573_23.159749,113.396033_23.130092,113.357131_23.13471,113.298631_23.158478,113.372963_23.158792"; |
| | | } |
| | | |
| | | gcl = gcl.replace("_", ","); |
| | | List<LonLat> pts = parseGcl(gcl); |
| | | |
| | | int id = 1; |