GeoCoord GeoCoord::Add(double bearing, double distance)
{
    if (distance == 0.0) return GeoCoord(GetLat(), GetLon());
    double lat = GetLat();
    double lon = GetLon();
    GetEllipsoidalDistance(GetLat(), GetLon(), bearing, distance, lat, lon);
    return GeoCoord(lat, lon);
}
  bool TileProjection::GetDimensions(GeoBox& boundingBox) const
  {
    assert(valid);

    boundingBox.Set(GeoCoord(latMin,lonMin),
                    GeoCoord(latMax,lonMax));

    return true;
  }
 /**
  * Ceate a new tile by passing magnification and tile coordinates
  */
 TileId::TileId(const Magnification& magnification,
                size_t x,
                size_t y)
 : magnification(magnification),
   x(x),
   y(y),
   boundingBox(GeoCoord(y*cellDimension[magnification.GetLevel()].height-90.0,
                        x*cellDimension[magnification.GetLevel()].width-180.0),
               GeoCoord((y+1)*cellDimension[magnification.GetLevel()].height-90.0,
                        (x+1)*cellDimension[magnification.GetLevel()].width-180.0))
 {
   // no code
 }
Exemple #4
0
  void Area::Ring::GetBoundingBox(GeoBox& boundingBox) const
  {
    assert(!nodes.empty());

    double minLon=nodes[0].GetLon();
    double maxLon=minLon;
    double minLat=nodes[0].GetLat();
    double maxLat=minLat;

    for (size_t i=1; i<nodes.size(); i++) {
      minLon=std::min(minLon,nodes[i].GetLon());
      maxLon=std::max(maxLon,nodes[i].GetLon());
      minLat=std::min(minLat,nodes[i].GetLat());
      maxLat=std::max(maxLat,nodes[i].GetLat());
    }

    boundingBox.Set(GeoCoord(minLat,minLon),
                    GeoCoord(maxLat,maxLon));
  }
Exemple #5
0
  void Preprocess::Callback::ProcessNode(const OSMId& id,
                                         const double& lon,
                                         const double& lat,
                                         const TagMap& tagMap)
  {
    RawNode      node;
    ObjectOSMRef object(id,
                        osmRefNode);

    if (id<lastNodeId) {
      nodeSortingError=true;
    }

    minCoord.Set(std::min(minCoord.GetLat(),lat),
                 std::min(minCoord.GetLon(),lon));

    maxCoord.Set(std::max(maxCoord.GetLat(),lat),
                 std::max(maxCoord.GetLon(),lon));

    coordCount++;

    StoreCoord(id,
               GeoCoord(lat,
                        lon));

    TypeInfoRef type=typeConfig->GetNodeType(tagMap);

    nodeStat[type->GetIndex()]++;

    if (!type->GetIgnore()) {
      node.SetId(id);
      node.SetType(type);
      node.SetCoords(lon,lat);

      node.Parse(progress,
                 *typeConfig,
                 tagMap);

      node.Write(*typeConfig,
                 nodeWriter);

      nodeCount++;
    }

    lastNodeId=id;
  }