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

feature_merger.cpp « generator - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b4ecbf82fcb86dbf16c29b86439a246b378dfeaa (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
#include "feature_merger.hpp"

#include "../base/logging.hpp"

#define MAX_MERGED_POINTS_COUNT 10000

FeatureBuilder1Merger::FeatureBuilder1Merger(FeatureBuilder1 const & fb)
  : FeatureBuilder1(fb)
{
}

bool FeatureBuilder1Merger::ReachedMaxPointsCount() const
{
  return (m_Geometry.size() > MAX_MERGED_POINTS_COUNT);
}

void FeatureBuilder1Merger::AppendFeature(FeatureBuilder1Merger const & fb)
{
  // check that both features are of linear type
  CHECK(fb.m_bLinear && m_bLinear, ("Not linear feature"));

  // check that classificator types are the same
  CHECK_EQUAL(fb.m_Types, m_Types, ("Not equal types"));

  // check last-first points equality
  CHECK_EQUAL(m_Geometry.back(), fb.m_Geometry.front(), ("End and Start point are no equal"));
  // merge fb at the end
  size_t const size = fb.m_Geometry.size();
  for (size_t i = 1; i < size; ++i)
    AddPoint(fb.m_Geometry[i]);
}