本文整理汇总了C++中ConstElementPtr::getCircularError方法的典型用法代码示例。如果您正苦于以下问题:C++ ConstElementPtr::getCircularError方法的具体用法?C++ ConstElementPtr::getCircularError怎么用?C++ ConstElementPtr::getCircularError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConstElementPtr
的用法示例。
在下文中一共展示了ConstElementPtr::getCircularError方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: visit
void TranslatedTagCountVisitor::visit(const ConstElementPtr& e)
{
if (e->getTags().getInformationCount() > 0)
{
shared_ptr<Geometry> g = ElementConverter(_map->shared_from_this()).convertToGeometry(e);
Tags t = e->getTags();
t["error:circular"] = QString::number(e->getCircularError());
t["hoot:status"] = e->getStatusString();
// remove all the empty tags.
for (Tags::const_iterator it = e->getTags().begin(); it != e->getTags().end(); ++it)
{
if (t[it.key()] == "")
{
t.remove(it.key());
}
}
QString layerName;
vector<ScriptToOgrTranslator::TranslatedFeature> f = _translator->translateToOgr(t,
e->getElementType(), g->getGeometryTypeId());
// only write the feature if it wasn't filtered by the translation script.
for (size_t i = 0; i < f.size(); i++)
{
_countTags(f[i].feature);
}
}
}
示例2:
Handle<Value> ElementJs::getCircularError(const Arguments& args) {
HandleScope scope;
ConstElementPtr e = ObjectWrap::Unwrap<ElementJs>(args.This())->getConstElement();
return scope.Close(toV8(e->getCircularError()));
}
示例3: findMatch
WaySublineMatchString MaximalSublineStringMatcher::findMatch(const ConstOsmMapPtr& map,
const ConstElementPtr& e1, const ConstElementPtr& e2, Meters maxRelevantDistance) const
{
assert(_maxAngle >= 0);
if (maxRelevantDistance == -1)
{
maxRelevantDistance = e1->getCircularError() + e2->getCircularError();
}
// make sure the inputs are legit. If either element isn't legit then throw a NeedsReviewException
_validateElement(map, e1->getElementId());
_validateElement(map, e2->getElementId());
// extract the ways from the elements. In most cases it will return a vector of 1, but
// multilinestrings may contain multiple ways
vector<ConstWayPtr> ways1 = ExtractWaysVisitor::extractWays(map, e1);
vector<ConstWayPtr> ways2 = ExtractWaysVisitor::extractWays(map, e2);
if ((ways1.size() > 4 && ways2.size() > 4) || (ways1.size() + ways2.size() > 7))
{
throw NeedsReviewException("Elements contain too many ways and the computational complexity "
"is unreasonable.");
}
// Try with all combinations of forward and reversed ways. This is very expensive for
// multilinestrings with lots of ways in them. Though those shouldn't be common.
vector<bool> reversed1(ways1.size(), false), reversed2(ways2.size(), false);
ScoredMatch scoredResult = _findBestMatch(map, maxRelevantDistance, ways1, ways2, reversed1,
reversed2);
// convert the best match into a WaySublineStringMatch and return.
try
{
WaySublineMatchString result = scoredResult.matches;
// this likely shouldn't be necessary. See #4593
result.removeEmptyMatches();
return result;
}
catch(OverlappingMatchesException &e)
{
throw NeedsReviewException("Internal Error: Multiple overlapping way matches were found within "
"one set of ways. Please report this to [email protected]");
}
}
示例4: _writePartial
void OgrWriter::_writePartial(ElementProviderPtr& provider, const ConstElementPtr& e)
{
if (_translator.get() == 0)
{
throw HootException("You must call open before attempting to write.");
}
if (e->getTags().getInformationCount() > 0)
{
// There is probably a cleaner way of doing this.
// convertToGeometry calls getGeometryType which will throw an exception if it gets a relation
// that it doesn't know about. E.g. "route", "superroute", " turnlanes:turns" etc
shared_ptr<Geometry> g;
try
{
g = ElementConverter(provider).convertToGeometry(e);
}
catch (IllegalArgumentException& err)
{
LOG_WARN("Error converting geometry: " << err.getWhat() << " (" << e->toString() << ")");
g.reset((GeometryFactory::getDefaultInstance()->createEmptyGeometry()));
}
/*
LOG_DEBUG("After conversion to geometry, element is now a " <<
g->getGeometryType() );
*/
Tags t = e->getTags();
t["error:circular"] = QString::number(e->getCircularError());
t["hoot:status"] = e->getStatusString();
for (Tags::const_iterator it = e->getTags().begin(); it != e->getTags().end(); ++it)
{
if (t[it.key()] == "")
{
t.remove(it.key());
}
}
vector<ScriptToOgrTranslator::TranslatedFeature> tf = _translator->translateToOgr(t,
e->getElementType(), g->getGeometryTypeId());
// only write the feature if it wasn't filtered by the translation script.
for (size_t i = 0; i < tf.size(); i++)
{
OGRLayer* layer = _getLayer(tf[i].tableName);
if (layer != 0)
{
_addFeature(layer, tf[i].feature, g);
}
}
}
}
示例5: getSearchRadius
Meters getSearchRadius(const ConstElementPtr& e)
{
if (_getSearchRadius.IsEmpty())
{
return e->getCircularError() * _candidateDistanceSigma;
}
else
{
Handle<Value> jsArgs[1];
int argc = 0;
jsArgs[argc++] = ElementJs::New(e);
Handle<Value> f = _getSearchRadius->Call(getPlugin(), argc, jsArgs);
return toCpp<Meters>(f);
}
}
示例6: getSearchRadius
// See the "Calculating Search Radius" section in the user docs for more information.
Meters getSearchRadius(const ConstElementPtr& e)
{
Meters result;
if (_getSearchRadius.IsEmpty())
{
if (_customSearchRadius < 0)
{
//base the radius off of the element itself
result = e->getCircularError() * _candidateDistanceSigma;
}
else
{
//base the radius off some predefined radius
result = _customSearchRadius * _candidateDistanceSigma;
}
}
else
{
if (_searchRadiusCache.contains(e->getElementId()))
{
result = _searchRadiusCache[e->getElementId()];
}
else
{
Isolate* current = v8::Isolate::GetCurrent();
HandleScope handleScope(current);
Context::Scope context_scope(_script->getContext(current));
Handle<Value> jsArgs[1];
int argc = 0;
jsArgs[argc++] = ElementJs::New(e);
LOG_TRACE("Calling getSearchRadius...");
Handle<Value> f = ToLocal(&_getSearchRadius)->Call(getPlugin(), argc, jsArgs);
result = toCpp<Meters>(f) * _candidateDistanceSigma;
_searchRadiusCache[e->getElementId()] = result;
}
}
return result;
}