Ejemplo n.º 1
0
    osg::Node* makePlaceNode(FilterContext&     context,
                             Feature*           feature,
                             const Style&       style,
                             NumericExpression& priorityExpr )
    {
        osg::Vec3d center = feature->getGeometry()->getBounds().center();

        AltitudeMode mode = ALTMODE_ABSOLUTE;

        const AltitudeSymbol* alt = style.getSymbol<AltitudeSymbol>();
        if (alt &&
                (alt->clamping() == AltitudeSymbol::CLAMP_TO_TERRAIN || alt->clamping() == AltitudeSymbol::CLAMP_RELATIVE_TO_TERRAIN) &&
                alt->technique() == AltitudeSymbol::TECHNIQUE_SCENE)
        {
            mode = ALTMODE_RELATIVE;
        }

        GeoPoint point(feature->getSRS(), center.x(), center.y(), center.z(), mode);

        PlaceNode* node = new PlaceNode(0L, point, style, context.getDBOptions());

        if ( !priorityExpr.empty() )
        {
            float val = feature->eval(priorityExpr, &context);
            node->setPriority( val >= 0.0f ? val : FLT_MAX );
        }

        return node;
    }