コード例 #1
0
ファイル: osmscout_dumpdata.cpp プロジェクト: lanixXx/scratch
static void DumpArea(const osmscout::TypeConfig* typeConfig,
                     const osmscout::AreaRef area,
                     osmscout::Id id)
{
  std::cout << "Area {" << std::endl;

  std::cout << "  id: " << id << std::endl;
  std::cout << "  fileOffset: " << area->GetFileOffset() << std::endl;

  DumpAreaSegmentAttributes(area->rings.front().GetType(),
                            area->rings.front().GetAttributes(),
                            typeConfig,
                            2);

  for (size_t r=1; r<area->rings.size(); r++) {
    std::cout << std::endl;
    std::cout << "  role[" << r << "] {" << std::endl;

    if (area->rings[r].ring==osmscout::Area::outerRingId) {
      std::cout << "    outer" << std::endl;
    }
    else {
      std::cout << "    ring: " << (size_t)area->rings[r].ring << std::endl;
    }

    DumpAreaSegmentAttributes(area->rings[r].GetType(),
                              area->rings[r].GetAttributes(),
                              typeConfig,
                              4);

    if (!area->rings[r].nodes.empty()) {
      std::cout << std::endl;

      for (size_t n=0; n<area->rings[r].nodes.size(); n++) {
        std::cout << "    node[" << n << "] {";

        if (n<area->rings[r].ids.size() &&
            area->rings[r].ids[n]!=0) {
          std::cout << " id: " << area->rings[r].ids[n];
        }

        std::cout << " lat: " << area->rings[r].nodes[n].GetLat() << " lon: "<< area->rings[r].nodes[n].GetLon() << " }" << std::endl;
      }
    }

    std::cout << "  }" << std::endl;
  }

  std::cout << "}" << std::endl;
}
コード例 #2
0
ファイル: DumpData.cpp プロジェクト: camiloMS/libosmscout
static void DumpArea(const osmscout::TypeConfigRef& typeConfig,
                     const osmscout::AreaRef area,
                     osmscout::Id id)
{
  osmscout::GeoBox   boundingBox;
  osmscout::GeoCoord center;

  area->GetBoundingBox(boundingBox);

  std::cout << "Area {" << std::endl;

  std::cout << "  id: " << id << std::endl;
  std::cout << "  fileOffset: " << area->GetFileOffset() << std::endl;
  std::cout << "  type: " << area->GetType()->GetName() << std::endl;
  std::cout << "  boundingBox: " << boundingBox.GetDisplayText() << std::endl;
  std::cout << "  center: " << boundingBox.GetCenter().GetDisplayText() << std::endl;
  std::cout << "  cell level: " << CalculateCellLevel(boundingBox) << std::endl;

  std::cout << std::endl;

  DumpFeatureValueBuffer(area->rings.front().GetFeatureValueBuffer(),
                         IDENT);

  if (!area->rings.front().nodes.empty()) {
    std::cout << std::endl;

    for (size_t n=0; n<area->rings.front().nodes.size(); n++) {
      std::cout << "  node[" << n << "] {";

      if (n<area->rings.front().ids.size() &&
          area->rings.front().ids[n]!=0) {
        std::cout << " id: " << area->rings.front().ids[n];
      }

      std::cout << " lat: " << area->rings.front().nodes[n].GetLat() << " lon: "<< area->rings.front().nodes[n].GetLon() << " }" << std::endl;
    }
  }

  for (size_t r=1; r<area->rings.size(); r++) {
    area->rings[r].GetBoundingBox(boundingBox);

    std::cout << std::endl;
    std::cout << "  role[" << r << "] {" << std::endl;

    if (area->rings[r].ring==osmscout::Area::outerRingId) {
      std::cout << "    outer" << std::endl;
    }
    else {
      std::cout << "    ring: " << (size_t)area->rings[r].ring << std::endl;
    }
    std::cout << "    type: " << area->rings[r].GetType()->GetName() << std::endl;
    std::cout << "    boundingBox: " << boundingBox.GetDisplayText() << std::endl;
    std::cout << "    center: " << boundingBox.GetCenter().GetDisplayText() << std::endl;

    DumpFeatureValueBuffer(area->rings[r].GetFeatureValueBuffer(),
                           IDENT+2);

    if (!area->rings[r].nodes.empty()) {
      std::cout << std::endl;

      for (size_t n=0; n<area->rings[r].nodes.size(); n++) {
        std::cout << "    node[" << n << "] {";

        if (n<area->rings[r].ids.size() &&
            area->rings[r].ids[n]!=0) {
          std::cout << " id: " << area->rings[r].ids[n];
        }

        std::cout << " lat: " << area->rings[r].nodes[n].GetLat() << " lon: "<< area->rings[r].nodes[n].GetLon() << " }" << std::endl;
      }
    }

    std::cout << "  }" << std::endl;
  }

  std::cout << "}" << std::endl;
}
コード例 #3
0
ファイル: DumpData.cpp プロジェクト: Dushistov/libosmscout
static void DumpArea(const osmscout::AreaRef area,
                     osmscout::Id id)
{
  osmscout::GeoBox   boundingBox;
  osmscout::GeoCoord center;

  area->GetBoundingBox(boundingBox);

  std::cout << "Area {" << std::endl;

  std::cout << "  OSM id: " << id << std::endl;
  std::cout << "  fileOffset: " << area->GetFileOffset() << std::endl;
  std::cout << "  type: " << area->GetType()->GetName() << std::endl;
  std::cout << "  boundingBox: " << boundingBox.GetDisplayText() << std::endl;
  std::cout << "  center: " << boundingBox.GetCenter().GetDisplayText() << std::endl;
  std::cout << "  cell level: " << CalculateCellLevel(boundingBox) << std::endl;

  std::cout << std::endl;

  DumpFeatureValueBuffer(area->rings.front().GetFeatureValueBuffer(),
                         IDENT);

  for (size_t r=0; r<area->rings.size(); r++) {
    if (!area->rings[r].nodes.empty()) {
      area->rings[r].GetBoundingBox(boundingBox);
    }

    std::cout << std::endl;

    size_t ident;
    if (area->rings[r].IsMasterRing()) {
      ident=IDENT;
    }
    else {
      std::cout << "  role[" << r << "] {" << std::endl;
      ident=IDENT+2;
    }

    if (area->rings[r].IsMasterRing()) {
      DumpIndent(ident);
      std::cout << "master" << std::endl;
    }
    else if (area->rings[r].IsOuterRing()) {
      DumpIndent(ident);
      std::cout << "outer" << std::endl;
      DumpIndent(ident);
      std::cout << "type: " << area->rings[r].GetType()->GetName() << std::endl;
    }
    else {
      DumpIndent(ident);
      std::cout << "ring: " << (size_t)area->rings[r].GetRing() << std::endl;
      DumpIndent(ident);
      std::cout << "type: " << area->rings[r].GetType()->GetName() << std::endl;
    }

    if (!area->rings[r].nodes.empty()) {
      DumpIndent(ident);
      std::cout << "boundingBox: " << boundingBox.GetDisplayText() << std::endl;
      DumpIndent(ident);
      std::cout << "center: " << boundingBox.GetCenter().GetDisplayText() << std::endl;
    }

    DumpFeatureValueBuffer(area->rings[r].GetFeatureValueBuffer(),
                           ident);

    if (!area->rings[r].nodes.empty()) {
      std::cout << std::endl;

      for (size_t n=0; n<area->rings[r].nodes.size(); n++) {
        DumpIndent(ident);
        std::cout << "node[" << n << "] {";

        if (area->rings[r].GetSerial(n)!=0) {
          std::cout << "serial: " << area->rings[r].GetSerial(n);
        }

        std::cout << " lat: " << area->rings[r].nodes[n].GetLat() << " lon: "<< area->rings[r].nodes[n].GetLon() << " }" << std::endl;
      }
    }

    if (!area->rings[r].IsMasterRing()) {
      ident-=2;
      DumpIndent(ident);
      std::cout << "}" << std::endl;
    }
  }

  std::cout << "}" << std::endl;
}