Example #1
0
WaySubline::WaySubline(const WaySubline& from, const ConstOsmMapPtr& newMap)
{
  if (from.isValid())
  {
    ConstWayPtr oldWay = from.getStart().getWay();
    ConstWayPtr newWay = newMap->getWay(oldWay->getId());
    _start = WayLocation(newMap, newWay,
      from.getStart().getSegmentIndex(), from.getStart().getSegmentFraction());
    _end = WayLocation(newMap, newWay,
      from.getEnd().getSegmentIndex(), from.getEnd().getSegmentFraction());
  }
}
Example #2
0
WayPtr WaySplitter::createSubline(const WaySubline& subline, vector<WayPtr>& scraps)
{
  vector<WayLocation> wls;
  wls.push_back(subline.getStart());
  wls.push_back(subline.getEnd());

  assert(subline.isValid() && subline.getStart() != subline.getEnd());

  vector<WayPtr> splits = createSplits(wls);

  assert(splits[1].get() != 0);

  if (splits[0].get())
  {
    scraps.push_back(splits[0]);
  }
  if (splits[2].get())
  {
    scraps.push_back(splits[2]);
  }

  return splits[1];
}