本文整理汇总了C++中Way类的典型用法代码示例。如果您正苦于以下问题:C++ Way类的具体用法?C++ Way怎么用?C++ Way使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Way类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例2: isChildOfArea
static bool isChildOfArea(Feature *mapFeature)
{
Way* R = Way::GetSingleParentRoadInner(mapFeature);
if (R)
return (R->area() > 0.0);
return false;
}
示例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);
}
}
示例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);
}
}
示例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();
}
}
示例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();
}
示例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);
}
}
}
示例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;
}
示例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);
}
}
}
示例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);
}
示例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;
}
}
示例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;
}
}
}
}
示例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;
}
示例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());
}
}
示例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;
}