Apply texture to lines #1798
-
Hello, I would like to apply a texture to a LineString geometry. To achieve this, I tried to apply a style with the imageURI property pointing to my texture with no success. mGeometry = new LineString();
mFeature = new Feature(mGeometry, geoSRS);
mFeature->geoInterp() = GEOINTERP_GREAT_CIRCLE;
setFeature(mFeature);
_style.getOrCreate<RenderSymbol>()->depthOffset()->enabled() = true;
_style.getOrCreate<LineSymbol>()->stroke()->smooth() = true;
_style.getOrCreate<LineSymbol>()->tessellationSize()->set(75000, Units::METERS);
_style.getOrCreate<LineSymbol>()->color() = Color::White;
_style.getOrCreate<LineSymbol>()->width() = 100;
_style.getOrCreate<LineSymbol>()->widthUnits() = Units::METERS;
_style.getOrCreate<LineSymbol>()->imageURI() = StringExpression("C:/Users/Public/CUBE/git/Core/Qml/Components/CoreProperties/OSGTextureProperties/images/zoneWeatherConflict.png");
_style.getOrCreate<AltitudeSymbol>()->clamping() = AltitudeSymbol::CLAMP_ABSOLUTE;
The lines appear just white, with no texture. Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
This shouldn't even compile, since you need _style.getOrCreate<LineSymbol>()->stroke()->color() = Color::White;
_style.getOrCreate<LineSymbol>()->stroke()->width() = 100;
_style.getOrCreate<LineSymbol>()->stroke()->widthUnits() = Units::METERS; Assuming the png file exists, it's possible that the shader is not installed properly. Is this a FeatureNode? Is it under the MapNode in the scene graph? |
Beta Was this translation helpful? Give feedback.
-
Yes you're right, my bad. Indeed, this happens in the constructor of a FeatureNode. |
Beta Was this translation helpful? Give feedback.
-
Thanks. I reproduced the problem and pushed a fix for it. This was a bug in the BuildGeometryFilter class that prevented the imageURI from working on the FeatureNode (or anything besides the FeatureModelLayer). Other issue exist with imageURI (since it is kind of an experimental feature) but this should at least solve your immediate issue. |
Beta Was this translation helpful? Give feedback.
Thanks. I reproduced the problem and pushed a fix for it. This was a bug in the BuildGeometryFilter class that prevented the imageURI from working on the FeatureNode (or anything besides the FeatureModelLayer).
Other issue exist with imageURI (since it is kind of an experimental feature) but this should at least solve your immediate issue.