Ejemplo n.º 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());
  }
}
Ejemplo n.º 2
0
bool WaySubline::touches(const WaySubline& other) const
{
  bool touches = true;

  if (other.getWay() != getWay() ||
      getStart() > other.getEnd() ||
      other.getStart() > getEnd())
  {
    touches = false;
  }

  return touches;
}
Ejemplo n.º 3
0
bool WaySubline::overlaps(const WaySubline& other) const
{
  bool overlaps = true;

  if (other.getWay() != getWay() ||
      getStart() >= other.getEnd() ||
      other.getStart() >= getEnd())
  {
    overlaps = false;
  }

  return overlaps;
}
Ejemplo n.º 4
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];
}
Ejemplo n.º 5
0
bool WaySubline::contains(const WaySubline& other) const
{
  return getStart().getWay() == other.getStart().getWay() &&
      other.getStart() >= getStart() && other.getEnd() <= getEnd();
}
Ejemplo n.º 6
0
WaySubline::WaySubline(const WaySubline& from) :
  _start(from.getStart()),
  _end(from.getEnd())
{

}
Ejemplo n.º 7
0
bool operator==(const WaySubline& a, const WaySubline& b)
{
  return a.getStart() == b.getStart() && a.getEnd() == b.getEnd();
}
Ejemplo n.º 8
0
bool compareSublines(const WaySubline& ws1, const WaySubline& ws2)
{
  return ws1.getStart() < ws2.getStart();
}