| 453 | } |
| 454 | |
| 455 | void FeatureBuilder::SerializeAccuratelyForIntermediate(Buffer & data) const |
| 456 | { |
| 457 | CHECK(IsValid(), (*this)); |
| 458 | |
| 459 | data.clear(); |
| 460 | PushBackByteSink<Buffer> sink(data); |
| 461 | m_params.Write(sink); |
| 462 | if (IsPoint()) |
| 463 | { |
| 464 | rw::WritePOD(sink, m_center); |
| 465 | } |
| 466 | else |
| 467 | { |
| 468 | WriteVarUint(sink, static_cast<uint32_t>(m_polygons.size())); |
| 469 | for (PointSeq const & points : m_polygons) |
| 470 | rw::WriteVectorOfPOD(sink, points); |
| 471 | |
| 472 | WriteVarInt(sink, m_coastCell); |
| 473 | } |
| 474 | |
| 475 | // Save OSM IDs to link meta information with sorted features later. |
| 476 | rw::WriteVectorOfPOD(sink, m_osmIds); |
| 477 | |
| 478 | // Check for correct serialization. |
| 479 | #ifdef DEBUG |
| 480 | Buffer tmp(data); |
| 481 | FeatureBuilder fb; |
| 482 | fb.DeserializeAccuratelyFromIntermediate(tmp); |
| 483 | ASSERT(fb == *this, ("Source feature: ", *this, "Deserialized feature: ", fb)); |
| 484 | #endif |
| 485 | } |
| 486 | |
| 487 | void FeatureBuilder::DeserializeAccuratelyFromIntermediate(Buffer & data) |
| 488 | { |