本文整理汇总了C++中PathVector类的典型用法代码示例。如果您正苦于以下问题:C++ PathVector类的具体用法?C++ PathVector怎么用?C++ PathVector使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PathVector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dirs
PathVector Path::dirs() const
{
PathVector ret;
bfs::directory_iterator dit(_p->path);
for (; dit != bfs::directory_iterator(); ++dit) {
if (bfs::is_directory(*dit))
ret.push_back(Path(*dit));
}
return ret;
}
示例2: files
PathVector Path::files() const
{
PathVector ret;
bfs::directory_iterator dit(_p->path);
for (; dit != bfs::directory_iterator(); ++dit) {
if (bfs::is_regular_file(*dit))
ret.push_back(Path(new PrivatePath(*dit)));
}
return ret;
}
示例3: path
void
LPECopyRotate::addCanvasIndicators(SPLPEItem const */*lpeitem*/, std::vector<Geom::PathVector> &hp_vec)
{
using namespace Geom;
Path path(start_pos);
path.appendNew<LineSegment>((Geom::Point) origin);
path.appendNew<LineSegment>(rot_pos);
PathVector pathv;
pathv.push_back(path);
hp_vec.push_back(pathv);
}
示例4: draw_areas
void draw_areas(cairo_t *cr, Areas const &areas, PathVector const &pa) {
PathVector ps = areas_to_paths(pa, areas);
for(unsigned i = 0; i < ps.size(); i++) {
double area;
Point centre;
Geom::centroid(ps[i].toPwSb(), centre, area);
double d = 5.;
if(area < 0) cairo_set_dash(cr, &d, 1, 0);
cairo_path(cr, ps[i]);
cairo_stroke(cr);
cairo_set_dash(cr, &d, 0, 0);
}
}
示例5: addVector
void Path::addVector(PathVector vector)
{
if(m_pathPoints.empty())
{
m_pathPoints.push_back(vector.getEdge().getStart());
m_pathPoints.push_back(vector.getEdge().getEnd());
}
else
{
m_pathPoints.push_back(vector.getEdge().getEnd());
}
m_path.push_back(vector);
}
示例6: getLinearComponents
//
// Get all the paths corresponding to the linear components of the graph
// Precondition: all vertices have in/out degree at most 1 (no branching)
//
PathVector Bigraph::getLinearComponents()
{
PathVector outPaths;
setColors(GC_WHITE);
VertexPtrMapIter iter = m_vertices.begin();
for(; iter != m_vertices.end(); ++iter)
{
// Output the linear path containing this vertex if it hasnt been visited already
if(iter->second->getColor() != GC_BLACK)
{
outPaths.push_back(constructLinearPath(iter->second->getID()));
}
}
assert(checkColors(GC_BLACK));
return outPaths;
}
示例7: assert
bool SGPairedPathResolveVisitor::visit(StringGraph* /*pGraph*/, Vertex* /*pVertex*/)
{
assert(false);
#if 0
if(pVertex->getColor() == GC_BLACK)
return false; // has been resolved already
// Get the vertex of the pair
std::string pairID = getPairID(pVertex->getID());
Vertex* pPair = pGraph->getVertex(pairID);
if(pPair != NULL)
{
PathVector paths;
// get the expected direction between the vertices based on the PE info
EdgeDir dir = SGPairedAlgorithms::getDirectionToPair(pVertex->getID());
SGPairedAlgorithms::searchPaths(pVertex, pPair, dir, 300, paths);
pVertex->setColor(GC_BLACK);
pPair->setColor(GC_BLACK);
std::cout << "Found " << paths.size() << " paths from " << pVertex->getID()
<< " to " << pPair->getID() << "\n";
if(paths.size() == 1)
{
std::string fragment = SGPairedAlgorithms::pathToString(pVertex, paths[0]);
SeqRecord record;
record.id = pVertex->getID();
record.seq = fragment;
record.write(*m_pWriter);
}
else
{
SeqRecord recordX;
recordX.id = pVertex->getID();
recordX.seq = pVertex->getSeq().toString();
recordX.write(*m_pWriter);
SeqRecord recordY;
recordY.id = pVertex->getID();
recordY.seq = pVertex->getSeq().toString();
recordY.write(*m_pWriter);
}
}
#endif
return false;
}
示例8: CleanupPaths
/**
* Clean up paths that lead nowhere and the root path.
* @param source_id ID of the root node.
* @param paths Paths to be cleaned up.
*/
void MultiCommodityFlow::CleanupPaths(NodeID source_id, PathVector &paths)
{
Path *source = paths[source_id];
paths[source_id] = NULL;
for (PathVector::iterator i = paths.begin(); i != paths.end(); ++i) {
Path *path = *i;
if (path == NULL) continue;
if (path->GetParent() == source) path->Detach();
while (path != source && path != NULL && path->GetFlow() == 0) {
Path *parent = path->GetParent();
path->Detach();
if (path->GetNumChildren() == 0) {
paths[path->GetNode()] = NULL;
delete path;
}
path = parent;
}
}
delete source;
paths.clear();
}
示例9: col
std::string ContextGen::printable(const PathVector& val)
{
std::string res;
if(val.empty())
return "(empty vector)";
else
res = "(vector)";
Color col(getColorMode());
for(PathVector::const_iterator it = val.begin(); it != val.end(); ++it)
{
res.append(col.red("\n * "));
if(it->isNative()) res.append(col.yellow("[NATIVE] "));
else if(it->isForeign()) res.append(col.yellow("[FOREIGN] "));
else res.append(col.yellow("[NEITHER] ")); // is ok, if windows parity build and unix path with windows backend
res.append(it->get());
}
return res;
}
示例10: parseNode
Entity Serializer::parseNode(QDomElement const & domElement)
{
QString name = domElement.attribute(nodeNameKey, "");
PathVector components;
QString path = domElement.attribute(pathKey, "");
if (!path.isEmpty())
{
components = Parser::stringToPath(path);
}
else
{
QDomNodeList geometricElements = domElement.elementsByTagName(lineKey);
for (int i = 0; i < geometricElements.size(); i++)
{
QDomElement geometricElement = geometricElements.at(i).toElement();
Line line(geometricElement);
components.push_back(line.getCurve());
}
geometricElements = domElement.elementsByTagName(ellipseKey);
for (int i = 0; i < geometricElements.size(); i++)
{
QDomElement geometricElement = geometricElements.at(i).toElement();
Ellipse ellipse(geometricElement);
components.push_back(ellipse.getCurve());
}
geometricElements = domElement.elementsByTagName(rectangleKey);
for (int i = 0; i < geometricElements.size(); i++)
{
QDomElement geometricElement = geometricElements.at(i).toElement();
Rectangle rectangle(geometricElement);
components.push_back(rectangle.getCurve());
}
}
Entity entity;
entity.first = name;
entity.second = components;
return entity;
}
示例11: BuildPackage
void BuildPackage( const std::string& FolderName, std::string FileName )
{
if( FileName.empty() )
{
fs::path Path( FolderName );
FileName = Path.filename().string() + ".pkg";
}
AutoFile f( new OsFile( FileName, std::ios_base::out | std::ios_base::trunc ) );
PackageWriter writer( f );
PathVector Paths;
fs::path Dir( FolderName );
BuildFilesList( Dir, Paths );
fs::path BasePath = Dir.is_absolute() ? Dir : fs::current_path() / FolderName;
for( PathVector::const_iterator i = Paths.begin(), e = Paths.end(); i != e; ++i )
{
const fs::path& RelPath = *i;
const fs::path PathInPack = RelativePath( BasePath, RelPath );
LOG( "Adding %s as %s\n", RelPath.string().c_str(), PathInPack.string().c_str() );
writer.Add( RelPath, PathInPack );
}
writer.Save();
LOG( "All done." );
}
示例12: runRange
bool Triggers::parseRunsElement(const XMLElement* runs) {
Range<unsigned> runRange(runs->UnsignedAttribute("from"), runs->UnsignedAttribute("to"));
PathVector runPaths;
const XMLElement* paths = runs->FirstChildElement("path");
for (; paths; paths = paths->NextSiblingElement("path")) {
const std::string name = paths->FirstChildElement("name")->GetText();
const XMLElement* pt = paths->FirstChildElement("pt");
Range<float> ptRange(pt->FloatAttribute("from"), pt->FloatAttribute("to"));
const XMLElement* weightElement = paths->FirstChildElement("weight");
float weight = weightElement->FloatAttribute("value");
Trigger t { ptRange, weight };
runPaths.push_back(std::make_pair(boost::regex(name, boost::regex_constants::icase), t));
}
mTriggers[runRange] = runPaths;
return true;
}
示例13: split_vec
static void split_vec(PathVector &full_vec, PathVector &new_vec,
const Path &split_path){
PathVector old_full;
old_full.insert(old_full.begin(),full_vec.begin(),full_vec.end());
full_vec.erase(full_vec.begin(),full_vec.end());
for( PathVector::const_iterator path=old_full.begin() ; path!=old_full.end()
; path++ ){
if(starts_with(*path,split_path))
new_vec.push_back(*path);
else
full_vec.push_back(*path);
}
}
示例14: BuildFilesList
void BuildFilesList( fs::path Dir, PathVector& Elems )
{
if( !fs::exists( Dir ) || !fs::is_directory( Dir ) )
{
return;
}
for( fs::recursive_directory_iterator dir_iter( Dir ), end_iter; dir_iter != end_iter; ++dir_iter )
{
if( !fs::is_regular_file( dir_iter->status() ) )
{
continue;
}
const fs::path& p = *dir_iter;
Elems.push_back( p );
}
}
示例15: Dijkstra
void MultiCommodityFlow::Dijkstra(NodeID source_node, PathVector &paths)
{
typedef std::set<Tannotation *, typename Tannotation::Comparator> AnnoSet;
Tedge_iterator iter(this->job);
uint size = this->job.Size();
AnnoSet annos;
paths.resize(size, nullptr);
for (NodeID node = 0; node < size; ++node) {
Tannotation *anno = new Tannotation(node, node == source_node);
anno->UpdateAnnotation();
annos.insert(anno);
paths[node] = anno;
}
while (!annos.empty()) {
typename AnnoSet::iterator i = annos.begin();
Tannotation *source = *i;
annos.erase(i);
NodeID from = source->GetNode();
iter.SetNode(source_node, from);
for (NodeID to = iter.Next(); to != INVALID_NODE; to = iter.Next()) {
if (to == from) continue; // Not a real edge but a consumption sign.
Edge edge = this->job[from][to];
uint capacity = edge.Capacity();
if (this->max_saturation != UINT_MAX) {
capacity *= this->max_saturation;
capacity /= 100;
if (capacity == 0) capacity = 1;
}
/* punish in-between stops a little */
uint distance = DistanceMaxPlusManhattan(this->job[from].XY(), this->job[to].XY()) + 1;
Tannotation *dest = static_cast<Tannotation *>(paths[to]);
if (dest->IsBetter(source, capacity, capacity - edge.Flow(), distance)) {
annos.erase(dest);
dest->Fork(source, capacity, capacity - edge.Flow(), distance);
dest->UpdateAnnotation();
annos.insert(dest);
}
}
}
}