Style buildStyle( const osg::Vec4 &color, float width ) { // Define a style for the feature data. Since we are going to render the // vectors as lines, configure the line symbolizer: Style style; LineSymbol* ls = style.getOrCreateSymbol<LineSymbol>(); ls->stroke()->color() = color; ls->stroke()->width() = width; ls->tessellation() = 10; AltitudeSymbol* as = style.getOrCreate<AltitudeSymbol>(); as->clamping() = AltitudeSymbol::CLAMP_TO_TERRAIN; as->technique() = AltitudeSymbol::TECHNIQUE_SCENE; RenderSymbol* rs = style.getOrCreateSymbol<RenderSymbol>(); rs->depthOffset()->enabled() = true; rs->depthOffset()->minBias() = 1000; return style; }
void RenderSymbol::parseSLD(const Config& c, Style& style) { RenderSymbol defaults; if ( match(c.key(), "render-depth-test") ) { style.getOrCreate<RenderSymbol>()->depthTest() = as<bool>(c.value(), *defaults.depthTest()); } else if ( match(c.key(), "render-lighting") ) { style.getOrCreate<RenderSymbol>()->lighting() = as<bool>(c.value(), *defaults.lighting()); } else if ( match(c.key(), "render-depth-offset") ) { style.getOrCreate<RenderSymbol>()->depthOffset()->enabled() = as<bool>(c.value(), *defaults.depthOffset()->enabled() ); } else if ( match(c.key(), "render-depth-offset-min-bias") ) { style.getOrCreate<RenderSymbol>()->depthOffset()->minBias() = as<float>(c.value(), *defaults.depthOffset()->minBias() ); style.getOrCreate<RenderSymbol>()->depthOffset()->automatic() = false; } else if ( match(c.key(), "render-depth-offset-max-bias") ) { style.getOrCreate<RenderSymbol>()->depthOffset()->maxBias() = as<float>(c.value(), *defaults.depthOffset()->maxBias() ); } else if ( match(c.key(), "render-depth-offset-min-range") ) { style.getOrCreate<RenderSymbol>()->depthOffset()->minRange() = as<float>(c.value(), *defaults.depthOffset()->minRange() ); } else if ( match(c.key(), "render-depth-offset-max-range") ) { style.getOrCreate<RenderSymbol>()->depthOffset()->maxRange() = as<float>(c.value(), *defaults.depthOffset()->maxRange() ); } else if ( match(c.key(), "render-depth-offset-auto") ) { style.getOrCreate<RenderSymbol>()->depthOffset()->automatic() = as<bool>(c.value(), *defaults.depthOffset()->automatic() ); } else if ( match(c.key(), "render-backface-culling") ) { style.getOrCreate<RenderSymbol>()->backfaceCulling() = as<bool>(c.value(), *defaults.backfaceCulling() ); } else if ( match(c.key(), "render-order") ) { style.getOrCreate<RenderSymbol>()->order() = !c.value().empty() ? NumericExpression(c.value()) : *defaults.order(); } }