Skip to content
Snippets Groups Projects
Commit 7a0c16a0 authored by Emmanuel Christophe's avatar Emmanuel Christophe
Browse files

ENH: add overlay option (change background behaviour)

parent 5a21f385
Branches
Tags
No related merge requests found
......@@ -129,6 +129,13 @@ template <class TVectorData, class TImage>
m_StyleList.clear();
}
/** Specify if the output image is to be uses as an overlar
* (with transparent background) or not (with blue background).
*/
itkSetMacro(UseAsOverlay, bool);
itkGetMacro(UseAsOverlay, bool);
itkBooleanMacro(UseAsOverlay)
protected:
/** Constructor */
VectorDataToImageFilter();
......@@ -169,9 +176,14 @@ template <class TVectorData, class TImage>
//style list
std::vector<std::string> m_StyleList;
//Overlay option: change the backgroup (blue or transparent)
bool m_UseAsOverlay;
//Projection in the proj.4 format (for mapnik)
std::string m_VectorDataProjectionProj4;
}; // end class
} // end namespace otb
......
......@@ -47,7 +47,8 @@ namespace otb
template <class TVectorData, class TImage>
VectorDataToImageFilter<TVectorData, TImage>
::VectorDataToImageFilter() :
m_StyleList()
m_StyleList(),
m_UseAsOverlay(true)
{
this->SetNumberOfRequiredInputs( 1 );
m_Spacing.Fill(1.0);
......@@ -214,9 +215,15 @@ namespace otb
mapnik::freetype_engine::register_font("/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf");
//Set the default backgroup to transparent
m_Map.set_background(mapnik::color(255,255,255,0));
if(m_UseAsOverlay)
{
//Set the default backgroup to transparent
m_Map.set_background(mapnik::color(255,255,255,0));
}
else
{
m_Map.set_background(mapnik::color("#b5d0d0"));
}
//Load the OSM styles using helper class
otb::VectorDataStyle::Pointer styleLoader = otb::VectorDataStyle::New();
styleLoader->SetScaleFactor(m_ScaleFactor);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment