WaySublineMatchString MaximalNearestSublineMatcher::findMatch(const ConstOsmMapPtr &map, const ConstWayPtr& way1, const ConstWayPtr &way2, double &score, Meters maxRelevantDistance) const { score = 0; Meters mrd = maxRelevantDistance == -1 ? way1->getCircularError() + way2->getCircularError() : maxRelevantDistance; vector<long> wayIds; wayIds.push_back(way1->getId()); wayIds.push_back(way2->getId()); OsmMapPtr mapCopy(map->copyWays(wayIds)); WayPtr way1NonConst = mapCopy->getWay(way1->getId()); WayPtr way2NonConst = mapCopy->getWay(way2->getId()); MaximalNearestSubline mns1( mapCopy, way1NonConst, way2NonConst, _minSplitSize, mrd, _maxRelevantAngle, _headingDelta); // use the maximal nearest subline code to find the best subline std::vector<WayLocation> interval1 = mns1.getInterval(); if (!interval1[0].isValid() || !interval1[1].isValid() || interval1[0] == interval1[1]) { // if the interval isn't valid then return an invalid result. return WaySublineMatchString(); } _snapToEnds(map, interval1); WayPtr subline1 = WaySubline(interval1[0], interval1[1]).toWay(mapCopy); MaximalNearestSubline mns2(mapCopy, way2NonConst, subline1, _minSplitSize, -1, -1, _headingDelta); std::vector<WayLocation> interval2 = mns2.getInterval(); if (!interval2[0].isValid() || !interval2[1].isValid() || interval2[0] == interval2[1]) { return WaySublineMatchString(); } _snapToEnds(map, interval2); WaySublineMatch match = WaySublineMatch(WaySubline(interval1[0], interval1[1]), WaySubline(interval2[0], interval2[1])); if (subline1->getNodeCount() > 1) { shared_ptr<LineString> ls = ElementConverter(mapCopy).convertToLineString(subline1); if (ls->isValid()) { score = ls->getLength(); } } vector<WaySublineMatch> v; // switch the subline match to reference a different map. v.push_back(WaySublineMatch(match, map)); return WaySublineMatchString(v); }
/* Get IL to native offsets map */ HRESULT GetMethodNativeMap(MethodDesc* methodDesc, ULONG32* numMap, DebuggerILToNativeMap** map) { // Use the DebugInfoStore to get IL->Native maps. // It doesn't matter whether we're jitted, ngenned etc. DebugInfoRequest request; TADDR nativeCodeStartAddr = PCODEToPINSTR(methodDesc->GetNativeCode()); request.InitFromStartingAddr(methodDesc, nativeCodeStartAddr); // Bounds info. ULONG32 countMapCopy; NewHolder<ICorDebugInfo::OffsetMapping> mapCopy(NULL); BOOL success = DebugInfoManager::GetBoundariesAndVars(request, DebugInfoStoreNew, NULL, // allocator &countMapCopy, &mapCopy, NULL, NULL); if (!success) { return E_FAIL; } // Need to convert map formats. *numMap = countMapCopy; *map = new (nothrow) DebuggerILToNativeMap[countMapCopy]; if (!*map) { return E_OUTOFMEMORY; } ULONG32 i; for (i = 0; i < *numMap; i++) { (*map)[i].ilOffset = mapCopy[i].ilOffset; (*map)[i].nativeStartOffset = mapCopy[i].nativeOffset; if (i > 0) { (*map)[i - 1].nativeEndOffset = (*map)[i].nativeStartOffset; } (*map)[i].source = mapCopy[i].source; } if (*numMap >= 1) { (*map)[i - 1].nativeEndOffset = 0; } return S_OK; }
bool FlatPointCloudVisualization::visualize(const grid_map::GridMap& map) { if (!isActive()) return true; sensor_msgs::PointCloud2 pointCloud; grid_map::GridMap mapCopy(map); mapCopy.add("flat", height_); grid_map::GridMapRosConverter::toPointCloud(mapCopy, "flat", pointCloud); publisher_.publish(pointCloud); return true; }
void InspectorController::pruneResources(ResourcesMap* resourceMap, DocumentLoader* loaderToKeep) { ASSERT_ARG(resourceMap, resourceMap); ResourcesMap mapCopy(*resourceMap); ResourcesMap::iterator end = mapCopy.end(); for (ResourcesMap::iterator it = mapCopy.begin(); it != end; ++it) { InspectorResource* resource = (*it).second.get(); if (resource == m_mainResource) continue; if (!loaderToKeep || resource->loader != loaderToKeep) { removeResource(resource); if (windowVisible() && resource->scriptObject) removeScriptResource(resource); } } }
void MapStatus::setCollectables(std::map<int, bool> collectables) { mapCopy(&collectables,'c'); }
void MapStatus::setMinibosses(std::map<int, bool> minibosses) { mapCopy(&minibosses,'m'); }
void MapStatus::setPuzzles(std::map<int, bool> puzzles) { mapCopy(&puzzles,'p'); }
void MapStatus::setDoors(std::map<int, bool> doors) { mapCopy(&doors,'d'); }