| 380 | } |
| 381 | |
| 382 | void FeatureBuilder::SerializeForIntermediate(Buffer & data) const |
| 383 | { |
| 384 | CHECK(IsValid(), (*this)); |
| 385 | |
| 386 | data.clear(); |
| 387 | |
| 388 | serial::GeometryCodingParams cp; |
| 389 | |
| 390 | PushBackByteSink<Buffer> sink(data); |
| 391 | m_params.Write(sink); |
| 392 | |
| 393 | if (m_params.GetGeomType() == GeomType::Point) |
| 394 | { |
| 395 | serial::SavePoint(sink, m_center, cp); |
| 396 | } |
| 397 | else |
| 398 | { |
| 399 | WriteVarUint(sink, static_cast<uint32_t>(m_polygons.size())); |
| 400 | |
| 401 | for (PointSeq const & points : m_polygons) |
| 402 | serial::SaveOuterPath(points, cp, sink); |
| 403 | |
| 404 | WriteVarInt(sink, m_coastCell); |
| 405 | } |
| 406 | |
| 407 | // Save OSM IDs to link meta information with sorted features later. |
| 408 | rw::WriteVectorOfPOD(sink, m_osmIds); |
| 409 | |
| 410 | // Check for correct serialization. |
| 411 | #ifdef DEBUG |
| 412 | Buffer tmp(data); |
| 413 | FeatureBuilder fb; |
| 414 | fb.DeserializeFromIntermediate(tmp); |
| 415 | ASSERT(fb == *this, ("Source feature: ", *this, "Deserialized feature: ", fb)); |
| 416 | #endif |
| 417 | } |
| 418 | |
| 419 | void FeatureBuilder::DeserializeFromIntermediate(Buffer & data) |
| 420 | { |