Пример #1
0
 /// Parses relation as simple relation with non-relation children. If child is single, then
 /// calls visitor with this child instead of relation.
 void processSimpleRelation(Visitor &visitor, std::uint32_t featureId, const ptree &feature) const {
   auto relation = parseRelation(featureId, feature.get_child("geometry.coordinates"));
   if (relation.elements.size()==1) {
     parseProperties(*relation.elements[0], featureId, feature.get_child("properties"));
     visitor.add(*relation.elements[0]);
   } else {
     parseProperties(relation, featureId, feature.get_child("properties"));
     visitor.add(relation);
   }
 }
Пример #2
0
inline void for_each_gridpoint (
        const protobuf::HyperPrior::GammaPoisson & grid,
        Visitor & visitor)
{
    for (auto alpha : grid.alpha()) {
        visitor.add().alpha = alpha;
    }
    visitor.done();

    for (auto inv_beta : grid.inv_beta()) {
        visitor.add().inv_beta = inv_beta;
    }
    visitor.done();
}
Пример #3
0
inline void for_each_gridpoint (
        const protobuf::HyperPrior::DirichletProcessDiscrete & grid,
        Visitor & visitor)
{
    for (auto gamma : grid.gamma()) {
        visitor.add().gamma = gamma;
    }
    visitor.done();

    for (auto alpha : grid.alpha()) {
        visitor.add().alpha = alpha;
    }
    visitor.done();
}
Пример #4
0
inline void for_each_gridpoint (
        const protobuf::HyperPrior::BetaBernoulli & grid,
        Visitor & visitor)
{
    for (auto alpha : grid.alpha()) {
        visitor.add().alpha = alpha;
    }
    visitor.done();

    for (auto beta : grid.beta()) {
        visitor.add().beta = beta;
    }
    visitor.done();
}
Пример #5
0
inline void for_each_gridpoint (
        const protobuf::HyperPrior::BetaNegativeBinomial & grid,
        Visitor & visitor)
{
    for (auto alpha : grid.alpha()) {
        visitor.add().alpha = alpha;
    }
    visitor.done();

    for (auto beta : grid.beta()) {
        visitor.add().beta = beta;
    }
    visitor.done();

    for (auto r : grid.r()) {
        visitor.add().r = r;
    }
    visitor.done();
}
Пример #6
0
inline void for_each_gridpoint (
        const protobuf::HyperPrior::DirichletDiscrete & grid,
        Visitor & visitor)
{
    int dim = visitor.shared().dim;

    for (int i = 0; i < dim; ++i) {
        for (auto alpha : grid.alpha()) {
            visitor.add().alphas[i] = alpha;
        }
        visitor.done();
    }
}
Пример #7
0
inline void for_each_gridpoint (
        const protobuf::HyperPrior::NormalInverseChiSq & grid,
        Visitor & visitor)
{
    for (auto mu : grid.mu()) {
        visitor.add().mu = mu;
    }
    visitor.done();

    for (auto kappa : grid.kappa()) {
        visitor.add().kappa = kappa;
    }
    visitor.done();

    for (auto sigmasq : grid.sigmasq()) {
        visitor.add().sigmasq = sigmasq;
    }
    visitor.done();

    for (auto nu : grid.nu()) {
        visitor.add().nu = nu;
    }
    visitor.done();
}
Пример #8
0
 /// Parses relation with relations from multipolygon and notifies visitor.
 void parseMultiPolygon(Visitor &visitor, std::uint32_t featureId, const ptree &feature) const {
   utymap::entities::Relation relation;
   parseProperties(relation, featureId, feature.get_child("properties"));
   for (const ptree::value_type &geometry : feature.get_child("geometry.coordinates")) {
     auto child = parseRelation(featureId, geometry.second);
     if (child.elements.size()==1) {
       FoldRelation fold;
       child.elements[0]->accept(fold);
       relation.elements.push_back(fold.element);
     } else {
       relation.elements.push_back(std::make_shared<utymap::entities::Relation>(child));
     }
   }
   visitor.add(relation);
 }
Пример #9
0
 /// Parses node from point and notifies visitor.
 void parsePoint(Visitor &visitor, std::uint32_t featureId, const ptree &feature) const {
   utymap::entities::Node node;
   parseProperties(node, featureId, feature.get_child("properties"));
   node.coordinate = parseCoordinate(feature.get_child("geometry.coordinates"));
   visitor.add(node);
 }
Пример #10
0
 /// Parses way from line string and notifies visitor.
 void parseLineString(Visitor &visitor, std::uint32_t featureId, const ptree &feature) const {
   utymap::entities::Way way;
   parseProperties(way, featureId, feature.get_child("properties"));
   way.coordinates = parseCoordinates(feature.get_child("geometry.coordinates"));
   visitor.add(way);
 }