Welcome to mirror list, hosted at ThFree Co, Russian Federation.

locality_object.cpp « indexer - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a8263ccf0cc1646771aa493c5d6c8654cdee1d3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "indexer/locality_object.hpp"

#include "indexer/feature_decl.hpp"

#include "coding/byte_stream.hpp"
#include "coding/geometry_coding.hpp"

namespace indexer
{
void LocalityObject::Deserialize(char const * data)
{
  ArrayByteSource src(data);
  serial::GeometryCodingParams cp = {};
  ReadPrimitiveFromSource(src, m_id);
  feature::GeomType type;
  ReadPrimitiveFromSource(src, type);

  if (type == feature::GeomType::Point)
  {
    m_points.push_back(serial::LoadPoint(src, cp));
    return;
  }

  ASSERT_EQUAL(type, feature::GeomType::Area, ("Only supported types are Point and Area."));
  uint32_t trgCount;
  ReadPrimitiveFromSource(src, trgCount);
  CHECK_GREATER(trgCount, 0, ());
  trgCount += 2;
  char const * start = static_cast<char const *>(src.PtrC());
  serial::LoadInnerTriangles(start, trgCount, cp, m_triangles);
}
}  // namespace indexer