• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ Way类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中Way的典型用法代码示例。如果您正苦于以下问题:C++ Way类的具体用法?C++ Way怎么用?C++ Way使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Way类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: matchWay

void HasNotTagSelector::matchWay(WayId wayID, const shared_ptr<TileIdentifier>& ti, RenderAttributes* attributes) const {
	Way* way = geodata->getWay(wayID);
	auto entry = way->getTags().find(tag);
	if (entry == way->getTags().end() || entry->second == precached_no || entry->second == precached_false) {
		next->matchWay(wayID, ti, attributes);
	}
}
开发者ID:DennisOSRM,项目名称:alacarte,代码行数:7,代码来源:hasnottag_selector.cpp


示例2: isChildOfArea

static bool isChildOfArea(Feature *mapFeature)
{
    Way* R =  Way::GetSingleParentRoadInner(mapFeature);
    if (R)
        return (R->area() > 0.0);
    return false;
}
开发者ID:liuzhidan,项目名称:merkaartor,代码行数:7,代码来源:PropertiesDock.cpp


示例3: matchWay

void TagEqualsSelector::matchWay(WayId wayID, const shared_ptr<TileIdentifier>& ti, RenderAttributes* attributes) const {
	Way* way = geodata->getWay(wayID);
	auto entry = way->getTags().find(tag);
	if (entry != way->getTags().end() && entry->second == value) {
		next->matchWay(wayID, ti, attributes);
	}
}
开发者ID:DennisOSRM,项目名称:alacarte,代码行数:7,代码来源:tagequals_selector.cpp


示例4: matchWay

void HasTagSelector::matchWay(WayId wayID, const shared_ptr<TileIdentifier>& ti, RenderAttributes* attributes) const {
	Way* way = geodata->getWay(wayID);
	auto& map = way->getTags();
	if (map.find(tag) != map.end()) {
		next->matchWay(wayID, ti, attributes);
	}
}
开发者ID:DennisOSRM,项目名称:alacarte,代码行数:7,代码来源:hastag_selector.cpp


示例5: it

void OSMDocument::test()
{
	//Node* tn = this->FindNodeAt(39.7814771, 117.0522314);
	//Node* tn = this->FindNodeAt(39.7814111, 117.0482403);
	//Node* tn = this->FindNodeAt(39.8027487,116.7982348);
	Node* tn = this->FindNode( 2272249421 );
	if ( tn == NULL )
	{
		std::cout << "no node found" << std::endl;
	}
	else
	{
		tn->printstr();
	}

	std::vector<Way*> ws = this->FindWaysWithRef( m_Ways, tn );

	std::vector<Way*>::const_iterator it(ws.begin());
	std::vector<Way*>::const_iterator last(ws.end());
	while(it!=last)
	{
		Way* w = *it++;
		w->printstr();
	}
}
开发者ID:ChenChuang,项目名称:osm2pgrouting,代码行数:25,代码来源:OSMDocument.cpp


示例6: clearNoSnap

void ScaleInteraction::snapMousePressEvent(QMouseEvent * anEvent, Feature* aLast)
{
    QList<Feature*> sel;
    if (view()->isSelectionLocked()) {
        if (theMain->properties()->selection(0))
            sel.append(theMain->properties()->selection(0));
        else
            sel.append(aLast);
    } else {
        sel = theMain->properties()->selection();
        if (!sel.size() && aLast)
            sel.append(aLast);
    }
    Radius = 1.0;
    clearNoSnap();
    Scaling.clear();
    OriginalPosition.clear();

    if (!sel.size())
        return;

    view()->setInteracting(true);

    StartDragPosition = XY_TO_COORD(anEvent->pos());
    OriginNode = NULL;
    NodeOrigin  = false;
    CoordBox selBB = sel[0]->boundingBox();
    for (int j=0; j<sel.size(); j++) {
        selBB.merge(sel[j]->boundingBox());
        if (CHECK_WAY(sel[j])) {
            Way* R = STATIC_CAST_WAY(sel[j]);
            for (int i=0; i<R->size(); ++i)
                if (std::find(Scaling.begin(),Scaling.end(),R->get(i)) == Scaling.end())
                    Scaling.push_back(R->getNode(i));
            addToNoSnap(R);
        } else if (CHECK_NODE(sel[j])) {
            if (!OriginNode && !NodeOrigin) {
                OriginNode = STATIC_CAST_NODE(sel[j]);
                NodeOrigin = true;
            } else {
                NodeOrigin = false;
            }
        }
    }
    if (Scaling.size() > 1) {
        if (NodeOrigin) {
            ScaleCenter = COORD_TO_XY(OriginNode->position());
        } else {
            ScaleCenter = COORD_TO_XY(selBB.center());
        }
        for (int i=0; i<Scaling.size(); ++i)
        {
            OriginalPosition.push_back(Scaling[i]->position());
            addToNoSnap(Scaling[i]);
        }
    } else
        Scaling.clear();
}
开发者ID:Harpalus,项目名称:merkaartor,代码行数:58,代码来源:ScaleInteraction.cpp


示例7: matchWay

void TagMatchesSelector::matchWay(WayId wayID, const shared_ptr<TileIdentifier>& ti, RenderAttributes* attributes) const {
	Way* way = geodata->getWay(wayID);
	auto entry = way->getTags().find(tag);
	if (entry != way->getTags().end()) {
		if (boost::regex_match(entry->second.str(), expression)) {
			next->matchWay(wayID, ti, attributes);
		}
	}
}
开发者ID:AMDmi3,项目名称:alacarte,代码行数:9,代码来源:tagmatches_selector.cpp


示例8: main

int main()
{
	Way wayNode;
	wayNode.SetId("123");
	wayNode.SetName("jan");
	AreaDataRepository::Instance().SetOnGoingWay(wayNode);

	std::cout << AreaDataRepository::Instance().GetOnGoingWay().GetId();

	std::cin.get();
	return 0;
}
开发者ID:CCJY,项目名称:coliru,代码行数:12,代码来源:main.cpp


示例9: matchWay

void LineSelector::matchWay(WayId wayID, const shared_ptr<TileIdentifier>& ti, RenderAttributes* attributes) const {
	Way* way = geodata->getWay(wayID);
	auto& nodes = way->getNodeIDs();

	// (area is open) or (area is set and area == no)
	if (nodes.front() != nodes.back()) {
		next->matchWay(wayID, ti, attributes);
	} else {
		auto entry = way->getTags().find(precached_area);
		if (entry != way->getTags().end() && entry->second == precached_no) {
			next->matchWay(wayID, ti, attributes);
		}
	}
}
开发者ID:DennisOSRM,项目名称:alacarte,代码行数:14,代码来源:line_selector.cpp


示例10: Area

 /// Construct an Area object from a Way object.
 Area(const Way& way) :
     Object(way),
     m_node_list(way.nodes()),
     m_relation_member_list(),
     m_geos_geometry() {
     id(id() * 2);
 }
开发者ID:skaringa,项目名称:osmium,代码行数:8,代码来源:area.hpp


示例11: ElementConverter

bool WayBufferFilter::isFiltered(const Way& w) const
{
  try
  {
    bool result = true;
    shared_ptr<LineString> ls2 = ElementConverter(_map).
        convertToLineString(_map->getWay(w.getId()));

    if (fabs((w.getCircularError() + _buffer) - _bufferAccuracy) > 0.1)
    {
      _bufferAccuracy = w.getCircularError() + _buffer;

      _baseBuffered.reset(_baseLs->buffer(_bufferAccuracy, 3,
                                          geos::operation::buffer::BufferOp::CAP_ROUND));
      _boundsPlus = *_baseBuffered->getEnvelopeInternal();
    }

    if (ls2->getEnvelopeInternal()->intersects(_boundsPlus))
    {

      shared_ptr<Geometry> g(_baseBuffered->intersection(ls2.get()));
      double ls2Length = ls2->getLength();
      double ls2IntersectLength = g->getLength();

      if (ls2IntersectLength / ls2Length >= _matchPercent)
      {
        shared_ptr<Geometry> ls2Buffer(ls2->buffer(_bufferAccuracy, 3,
                                                   geos::operation::buffer::BufferOp::CAP_ROUND));
        g.reset(ls2Buffer->intersection(_baseLs.get()));
        double ls1IntersectLength = g->getLength();

        if (ls1IntersectLength / _baseLength >= _matchPercent)
        {
          result = false;
        }
      }
    }

    return result;
  }
  catch (geos::util::TopologyException& e)
  {
    LOG_WARN(ElementConverter(_map).convertToLineString(_map->getWay(w.getId())));
    throw e;
  }
}
开发者ID:drew-bower,项目名称:hootenanny,代码行数:46,代码来源:WayBufferFilter.cpp


示例12: styleWays

	void styleWays(const shared_ptr<std::vector<WayId> >& ids, RenderAttributes& attr) const
	{
		for (auto id : *ids)
		{
			Way* w = data->getWay(id);
			auto& tags = w->getTags();

			auto name = tags.find(CachedString("name"));
			if (name != tags.end())
			{
				auto style = styles.find(name->second);
				if (style != styles.end()) {
					Style* s = attr.getNewStyle(id);
					*s = style->second;
				}
			}
		}
	}
开发者ID:AMDmi3,项目名称:alacarte,代码行数:18,代码来源:feature_test.cpp


示例13: Process

  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;
  }
开发者ID:camiloMS,项目名称:libosmscout,代码行数:43,代码来源:SortWayDat.cpp


示例14: abs

 /**
  * Ways can be ordered by id and version.
  * Note that we use the absolute value of the id for a
  * better ordering of objects with negative ids.
  */
 inline bool operator<(const Way& lhs, const Way& rhs) {
     if (lhs.id() == rhs.id()) {
         return lhs.version() < rhs.version();
     } else {
         return abs(lhs.id()) < abs(rhs.id());
     }
 }
开发者ID:AMDmi3,项目名称:osmium,代码行数:12,代码来源:way.hpp


示例15: CanUseBackward

  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;
  }
开发者ID:Framstag,项目名称:libosmscout,代码行数:39,代码来源:RoutingProfile.cpp


示例16: strcpy

void Map::StreetCollision(Node *node, Point M, int &insidePoints)
{
	if (node == NULL)
		return;
	Point nodeCenter = node->GetCenter();
	std::vector<long> adjacentWays = node->GetWays();
	if (Tools::PointInsideCircle(M, nodeCenter, NODE_DIAMETER / 2))
	{
		insidePoints++;
		for (int adjW = 0; adjW < adjacentWays.size(); adjW++)
		{
			int index = ways[adjacentWays[adjW]]->GetIndex(node);
			int size = ways[adjacentWays[adjW]]->GetNodes().size();
			if ((index == 0 || index == size - 1) && insidePoints == 0)
			{
				Tools::UpdateIntersections(node->GetId());
			}
		}
		return;
	}
	
	for (int adjW = 0; adjW < adjacentWays.size(); adjW++)
	{
		Way* adjacentWay = ways[adjacentWays[adjW]];
		int nodeWayIndex = adjacentWay->GetIndex(node);
		Street *portionStreet = adjacentWay->GetPortionStreet(nodeWayIndex);
		if (portionStreet != NULL && Tools::PointInsideRectangle(M, portionStreet->corners[0], portionStreet->corners[1], portionStreet->corners[2], portionStreet->corners[3]))
		{
			if (insidePoints == 0)
			{
				if (currentWayName == NULL)
				{
					currentWayName = new char[70];
				}
				strcpy(currentWayName, adjacentWay->GetName());
			}
			insidePoints++;
			return;
		}
		portionStreet = adjacentWay->GetPortionStreet(nodeWayIndex - 1);
		if (portionStreet != NULL && Tools::PointInsideRectangle(M, portionStreet->corners[0], portionStreet->corners[1], portionStreet->corners[2], portionStreet->corners[3]))
		{
			if (insidePoints == 0)
			{
				if (currentWayName == NULL)
				{
					currentWayName = new char[70];
				}
				strcpy(currentWayName, adjacentWay->GetName());
			}
			insidePoints++;
			return;
		}
	}
}
开发者ID:lordarpad6,项目名称:TampaTaxi,代码行数:55,代码来源:Map.cpp


示例17: view

void CreateRoundaboutInteraction::mousePressEvent(QMouseEvent * event)
{
    if (event->buttons() & Qt::LeftButton)
    {
        if (!HaveCenter)
        {
            HaveCenter = true;
            view()->setInteracting(true);
            Center = XY_TO_COORD(event->pos());
        }
        else
        {
            calculatePoints();
            if (Points.size() == 0) return;

            QPointF Prev = Points[0];
            Node* First = g_backend.allocNode(theMain->document()->getDirtyOrOriginLayer(), XY_TO_COORD(Prev.toPoint()));
            Way* R = g_backend.allocWay(theMain->document()->getDirtyOrOriginLayer());
            CommandList* L  = new CommandList(MainWindow::tr("Create Roundabout %1").arg(R->id().numId), R);
            L->add(new AddFeatureCommand(theMain->document()->getDirtyOrOriginLayer(),R,true));
            R->add(First);
            L->add(new AddFeatureCommand(theMain->document()->getDirtyOrOriginLayer(),First,true));
            if (M_PREFS->getAutoSourceTag()) {
                QStringList sl = theMain->document()->getCurrentSourceTags();
                if (sl.size())
                    R->setTag("source", sl.join(";"));
            }
            // "oneway" is implied on roundabouts
            //R->setTag("oneway","yes");
            if (DockData.type->currentIndex() == 0)
                R->setTag("junction","roundabout");
            for (int i = 1; i < Points.size(); i++ ) {
                QPointF Next = Points[i];
                Node* New = g_backend.allocNode(theMain->document()->getDirtyOrOriginLayer(), XY_TO_COORD(Next.toPoint()));
                L->add(new AddFeatureCommand(theMain->document()->getDirtyOrOriginLayer(),New,true));
                R->add(New);
            }
            R->add(First);
            for (FeatureIterator it(document()); !it.isEnd(); ++it) {
                Way* W1 = CAST_WAY(it.get());
                if (W1 && (W1 != R))
                    Way::createJunction(theMain->document(), L, R, W1, true);
            }
            theMain->properties()->setSelection(R);
            document()->addHistory(L);
            view()->setInteracting(false);
            view()->invalidate(true, true, false);
            theMain->launchInteraction(0);
        }
    }
    else
        Interaction::mousePressEvent(event);
}
开发者ID:chxyfish,项目名称:merkaartor,代码行数:53,代码来源:CreateRoundaboutInteraction.cpp


示例18: ScanWayIds

  bool OptimizeAreaWayIdsGenerator::ScanWayIds(const ImportParameter& parameter,
                                               Progress& progress,
                                               const TypeConfig& typeConfig,
                                               NodeUseMap& nodeUseMap)
  {
    FileScanner scanner;
    uint32_t    dataCount=0;

    progress.SetAction("Scanning ids from 'wayway.tmp'");

    if (!scanner.Open(AppendFileToDir(parameter.GetDestinationDirectory(),
                                      "wayway.tmp"),
                                      FileScanner::Sequential,
                                      parameter.GetWayDataMemoryMaped())) {
      progress.Error(std::string("Cannot open '")+scanner.GetFilename()+"'");
      return false;
    }

    if (!scanner.Read(dataCount)) {
      progress.Error("Error while reading number of data entries in file");
      return false;
    }

    for (uint32_t current=1; current<=dataCount; current++) {
      uint8_t type;
      Id      id;
      Way     data;

      progress.SetProgress(current,dataCount);

      if (!scanner.Read(type) ||
          !scanner.Read(id) ||
          !data.Read(typeConfig,
                     scanner)) {
        progress.Error(std::string("Error while reading data entry ")+
                       NumberToString(current)+" of "+
                       NumberToString(dataCount)+
                       " in file '"+
                       scanner.GetFilename()+"'");

        return false;
      }

      if (!data.GetType()->CanRoute()) {
        continue;
      }

      std::unordered_set<Id> nodeIds;

      for (const auto& id : data.ids) {
        if (nodeIds.find(id)==nodeIds.end()) {
          nodeUseMap.SetNodeUsed(id);

          nodeIds.insert(id);
        }
      }

      // If we have a circular way, we "fake" a double usage,
      // to make sure, that the node id of the first node
      // is not dropped later on, and we cannot detect
      // circular ways anymore
      if (data.ids.front()==data.ids.back()) {
        nodeUseMap.SetNodeUsed(data.ids.back());
      }
    }

    if (!scanner.Close()) {
      progress.Error(std::string("Error while closing file '")+
                     scanner.GetFilename()+"'");
      return false;
    }

    return true;
  }
开发者ID:jojva,项目名称:libosmscout,代码行数:74,代码来源:GenOptimizeAreaWayIds.cpp


示例19: COORD_TO_XY

void CreateSingleWayInteraction::snapMouseMoveEvent(QMouseEvent* ev, Feature* lastSnap)
{
    if (Node* Pt = dynamic_cast<Node*>(lastSnap))
        LastCursor = COORD_TO_XY(Pt);
    else if (Way* R = dynamic_cast<Way*>(lastSnap))
    {
        Coord P(XY_TO_COORD(ev->pos()));
        findSnapPointIndex(R, P);
        LastCursor = COORD_TO_XY(P);
    }
    else if (theRoad && theRoad->size() > 1 && SnapAngle)
    {
        QLineF l1(COORD_TO_XY(theRoad->getNode(theRoad->size()-1)), COORD_TO_XY(theRoad->getNode(theRoad->size()-2)));
        QLineF l2(COORD_TO_XY(theRoad->getNode(theRoad->size()-1)), ev->pos());
        qreal a = l1.angleTo(l2);
        a = qRound(a/SnapAngle) * SnapAngle;
        l2.setAngle(l1.angle() + a);
        LastCursor = l2.p2().toPoint();
    }
    else if (HaveFirst && ParallelMode)
    {
#define CLEAR_DISTANCE 200
        QPointF PreviousPoint;
        if (theRoad && theRoad->size() && !Prepend)
            PreviousPoint = COORD_TO_XY(CAST_NODE(theRoad->get(theRoad->size()-1))->position());
        else
            PreviousPoint = COORD_TO_XY(FirstPoint);

        CoordBox HotZone(XY_TO_COORD(ev->pos()-QPoint(CLEAR_DISTANCE, CLEAR_DISTANCE)),XY_TO_COORD(ev->pos()+QPoint(CLEAR_DISTANCE, CLEAR_DISTANCE)));
        qreal BestDistanceNW = 9999, AngleNW = 0;
        qreal BestDistanceNE = 9999, AngleNE = 0;
        qreal* BestDistance = &BestDistanceNW;
        qreal* BestAngle = &BestDistanceNE;
        qreal curAngle = 666;

        Way* R;
        for (int j=0; j<document()->layerSize(); ++j) {
            QList < Feature* > ret = g_backend.indexFind(document()->getLayer(j), HotZone);
            foreach(Feature* F, ret) {
                if (!(R = CAST_WAY(F)))
                    continue;

                if (R->isHidden())
                    continue;
                if (R->notEverythingDownloaded())
                    continue;

                for (int i=0; i<R->size()-1; ++i)
                {
                    LineF F(COORD_TO_XY(R->getNode(i)),COORD_TO_XY(R->getNode(i+1)));
                    qreal D = F.capDistance(ev->pos());
                    if (D < CLEAR_DISTANCE) {
                        QLineF l(COORD_TO_XY(R->getNode(i)), COORD_TO_XY(R->getNode(i+1)));
                        qreal a = l.angle();
                        if ((a >= 0 && a < 90) || (a < -270 && a >= -360)) {
                            BestDistance = &BestDistanceNE;
                            BestAngle = &AngleNE;
                            curAngle = a;
                        } else if ((a >= 90 && a < 180) || (a < -180 && a >= -270)) {
                            BestDistance = &BestDistanceNW;
                            BestAngle = &AngleNW;
                            curAngle = a;
                        } else if ((a >= 180 && a < 270) || (a < -90 && a >= -180)) {
                            BestDistance = &BestDistanceNE;
                            BestAngle = &AngleNE;
                            curAngle = a - 180;
                        } else if ((a >= 270 && a < 360) || (a < 0 && a >= -90)) {
                            BestDistance = &BestDistanceNW;
                            BestAngle = &AngleNW;
                            curAngle = a - 180;
                        }

                        if (D < *BestDistance) {
                            *BestDistance = D;
                            *BestAngle = curAngle;
                        }
                    }
                }

                qDebug() << BestDistanceNE << BestDistanceNW << AngleNE << AngleNW;
            }
        }

        /* Check if for some reason not a single angle was found. */
        Q_ASSERT(curAngle >= -360 && curAngle <= 360);

        QLineF l(PreviousPoint, ev->pos());
        qreal a = l.angle();
        if ((a >= 0 && a < 90) || (a < -270 && a >= -360)) {
            if (BestDistanceNE < 9999)
                a = AngleNE;
        } else if ((a >= 90 && a < 180) || (a < -180 && a >= -270)) {
            if (BestDistanceNW < 9999)
                a = AngleNW;
        } else if ((a >= 180 && a < 270) || (a < -90 && a >= -180)) {
            if (BestDistanceNE < 9999)
                a = AngleNE - 180;
        } else if ((a >= 270 && a < 360) || (a < 0 && a >= -90)) {
            if (BestDistanceNW < 9999)
                a = AngleNW - 180;
//.........这里部分代码省略.........
开发者ID:chxyfish,项目名称:merkaartor,代码行数:101,代码来源:CreateSingleWayInteraction.cpp


示例20: while

  bool AreaWayIndexGenerator::Import(const ImportParameter& parameter,
                                     Progress& progress,
                                     const TypeConfig& typeConfig)
  {
    FileScanner           wayScanner;
    FileWriter            writer;
    std::set<TypeId>      remainingWayTypes;
    std::vector<TypeData> wayTypeData;
    size_t                level;
    size_t                maxLevel=0;

    wayTypeData.resize(typeConfig.GetTypes().size());

    if (!wayScanner.Open(AppendFileToDir(parameter.GetDestinationDirectory(),
                                         "ways.dat"),
                         FileScanner::Sequential,
                         parameter.GetWayDataMemoryMaped())) {
      progress.Error("Cannot open 'ways.dat'");
      return false;
    }

    //
    // Scanning distribution
    //

    progress.SetAction("Scanning level distribution of way types");

    for (size_t i=0; i<typeConfig.GetTypes().size(); i++) {
      if (typeConfig.GetTypeInfo(i).CanBeWay() &&
          !typeConfig.GetTypeInfo(i).GetIgnore()) {
        remainingWayTypes.insert(i);
      }
    }

    level=parameter.GetAreaWayMinMag();
    while (!remainingWayTypes.empty()) {
      uint32_t                   wayCount=0;
      std::set<TypeId>           currentWayTypes(remainingWayTypes);
      double                     cellWidth=360.0/pow(2.0,(int)level);
      double                     cellHeight=180.0/pow(2.0,(int)level);
      std::vector<CoordCountMap> cellFillCount(typeConfig.GetTypes().size());

      progress.Info("Scanning Level "+NumberToString(level)+" ("+NumberToString(remainingWayTypes.size())+" types remaining)");

      wayScanner.GotoBegin();

      if (!wayScanner.Read(wayCount)) {
        progress.Error("Error while reading number of data entries in file");
        return false;
      }

      Way way;

      for (uint32_t w=1; w<=wayCount; w++) {
        progress.SetProgress(w,wayCount);

        if (!way.Read(wayScanner)) {
          progress.Error(std::string("Error while reading data entry ")+
                         NumberToString(w)+" of "+
                         NumberToString(wayCount)+
                         " in file '"+
                         wayScanner.GetFilename()+"'");
          return false;
        }

        // Count number of entries per current type and coordinate
        if (currentWayTypes.find(way.GetType())==currentWayTypes.end()) {
          continue;
        }

        double minLon;
        double maxLon;
        double minLat;
        double maxLat;

        way.GetBoundingBox(minLon,maxLon,minLat,maxLat);

        //
        // Calculate minimum and maximum tile ids that are covered
        // by the way
        // Renormated coordinate space (everything is >=0)
        //
        uint32_t minxc=(uint32_t)floor((minLon+180.0)/cellWidth);
        uint32_t maxxc=(uint32_t)floor((maxLon+180.0)/cellWidth);
        uint32_t minyc=(uint32_t)floor((minLat+90.0)/cellHeight);
        uint32_t maxyc=(uint32_t)floor((maxLat+90.0)/cellHeight);

        for (uint32_t y=minyc; y<=maxyc; y++) {
          for (uint32_t x=minxc; x<=maxxc; x++) {
            cellFillCount[way.GetType()][Pixel(x,y)]++;
          }
        }
      }

      // Check if cell fill for current type is in defined limits
      for (size_t i=0; i<typeConfig.GetTypes().size(); i++) {
        if (currentWayTypes.find(i)!=currentWayTypes.end()) {
          CalculateStatistics(level,wayTypeData[i],cellFillCount[i]);

          if (!FitsIndexCriteria(parameter,
//.........这里部分代码省略.........
开发者ID:fingon,项目名称:osmscout,代码行数:101,代码来源:GenAreaWayIndex.cpp



注:本文中的Way类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ WayPoints类代码示例发布时间:2022-05-31
下一篇:
C++ Waves类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap