Esempio n. 1
0
  bool WayLocationProcessorFilter::Process(Progress& progress,
                                           const FileOffset& offset,
                                           Way& way,
                                           bool& /*save*/)
  {
    try {
      if (!way.GetType()->GetIndexAsPOI()) {
        return true;
      }

      NameFeatureValue     *nameValue=nameReader->GetValue(way.GetFeatureValueBuffer());

      if (nameValue==NULL) {
        return true;
      }

      LocationFeatureValue *locationValue=locationReader->GetValue(way.GetFeatureValueBuffer());
      std::string          name;
      std::string          location;
      std::string          address;

      name=nameValue->GetName();

      if (locationValue!=NULL) {
        location=locationValue->GetLocation();
      }

      writer.WriteFileOffset(offset);
      writer.WriteNumber(way.GetType()->GetWayId());
      writer.Write(name);
      writer.Write(location);
      writer.Write(way.nodes);

      overallDataCount++;
    }
    catch (IOException& e) {
      progress.Error(e.GetDescription());

      return false;
    }

    return true;
  }
Esempio n. 2
0
  bool AbstractRoutingProfile::CanUseBackward(const Way& way) const
  {
    size_t index=way.GetType()->GetIndex();

    if (index>=speeds.size() || speeds[index]<=0.0) {
      return false;
    }

    AccessFeatureValue *accessValue=accessReader.GetValue(way.GetFeatureValueBuffer());

    if (accessValue!=NULL) {
      switch (vehicle) {
      case vehicleFoot:
        return accessValue->CanRouteFootBackward();
        break;
      case vehicleBicycle:
        return accessValue->CanRouteBicycleBackward();
        break;
      case vehicleCar:
        return accessValue->CanRouteCarBackward();
        break;
      }
    }
    else {
      switch (vehicle) {
      case vehicleFoot:
        return way.GetType()->CanRouteFoot();
        break;
      case vehicleBicycle:
        return way.GetType()->CanRouteBicycle();
        break;
      case vehicleCar:
        return way.GetType()->CanRouteCar();
        break;
      }
    }

    return false;
  }