Beispiel #1
0
void Style::addData(TileData& _data, MapTile& _tile, const MapProjection& _mapProjection) {
    onBeginBuildTile(_tile);

    std::shared_ptr<VboMesh> mesh(newMesh());

    for (auto& layer : _data.layers) {

        // Skip any layers that this style doesn't have a rule for
        auto it = m_layers.begin();
        while (it != m_layers.end() && it->first != layer.name) { ++it; }
        if (it == m_layers.end()) { continue; }

        // Loop over all features
        for (auto& feature : layer.features) {

            /*
             * TODO: do filter evaluation for each feature for sublayer!
             *     construct a unique ID for a the set of filters matched
             *     use this ID pass to the style's parseStyleParams method to construct styleParam cache
             *     NOTE: for the time being use layerName as ID for cache
             */

            feature.props.numericProps["zoom"] = _tile.getID().z;

            switch (feature.geometryType) {
                case GeometryType::POINTS:
                    // Build points
                    for (auto& point : feature.points) {
                        buildPoint(point, parseStyleParams(it->first, it->second), feature.props, *mesh);
                    }
                    break;
                case GeometryType::LINES:
                    // Build lines
                    for (auto& line : feature.lines) {
                        buildLine(line, parseStyleParams(it->first, it->second), feature.props, *mesh);
                    }
                    break;
                case GeometryType::POLYGONS:
                    // Build polygons
                    for (auto& polygon : feature.polygons) {
                        buildPolygon(polygon, parseStyleParams(it->first, it->second), feature.props, *mesh);
                    }
                    break;
                default:
                    break;
            }
        }
    }

    onEndBuildTile(_tile, mesh);

    if (mesh->numVertices() == 0) {
        mesh.reset();
    } else {
        mesh->compileVertexBuffer();

        _tile.addGeometry(*this, mesh);
    }
}
Beispiel #2
0
void Style::buildFeature(Tile& _tile, const Feature& _feat, const DrawRule& _rule) const {

    if (!checkRule(_rule)) { return; }

    bool visible;
    if (_rule.get(StyleParamKey::visible, visible) && !visible) {
        return;
    }

    auto& mesh = _tile.getMesh(*this);

    if (!mesh) {
        mesh.reset(newMesh());
    }

    switch (_feat.geometryType) {
        case GeometryType::points:
            for (auto& point : _feat.points) {
                buildPoint(point, _rule, _feat.props, *mesh, _tile);
            }
            break;
        case GeometryType::lines:
            for (auto& line : _feat.lines) {
                buildLine(line, _rule, _feat.props, *mesh, _tile);
            }
            break;
        case GeometryType::polygons:
            for (auto& polygon : _feat.polygons) {
                buildPolygon(polygon, _rule, _feat.props, *mesh, _tile);
            }
            break;
        default:
            break;
    }

}
Beispiel #3
0
void TextStyle::buildPolygon(const Polygon& _polygon, const DrawRule& _rule,
                             const Properties& _props, VboMesh& _mesh, Tile& _tile) const {
    Point p = glm::vec3(centroid(_polygon), 0.0);
    buildPoint(p, _rule, _props, _mesh, _tile);
}
Beispiel #4
0
BuildingPoint  BuildingPoint::getObject(vector<string> param,string sepOut) {
	BuildingPoint buildPoint(param,sepOut);
	return buildPoint;
}