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
No related branches found
No related tags found
No related merge requests found
...@@ -129,6 +129,13 @@ template <class TVectorData, class TImage> ...@@ -129,6 +129,13 @@ template <class TVectorData, class TImage>
m_StyleList.clear(); 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: protected:
/** Constructor */ /** Constructor */
VectorDataToImageFilter(); VectorDataToImageFilter();
...@@ -169,9 +176,14 @@ template <class TVectorData, class TImage> ...@@ -169,9 +176,14 @@ template <class TVectorData, class TImage>
//style list //style list
std::vector<std::string> m_StyleList; 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) //Projection in the proj.4 format (for mapnik)
std::string m_VectorDataProjectionProj4; std::string m_VectorDataProjectionProj4;
}; // end class }; // end class
} // end namespace otb } // end namespace otb
......
...@@ -47,7 +47,8 @@ namespace otb ...@@ -47,7 +47,8 @@ namespace otb
template <class TVectorData, class TImage> template <class TVectorData, class TImage>
VectorDataToImageFilter<TVectorData, TImage> VectorDataToImageFilter<TVectorData, TImage>
::VectorDataToImageFilter() : ::VectorDataToImageFilter() :
m_StyleList() m_StyleList(),
m_UseAsOverlay(true)
{ {
this->SetNumberOfRequiredInputs( 1 ); this->SetNumberOfRequiredInputs( 1 );
m_Spacing.Fill(1.0); m_Spacing.Fill(1.0);
...@@ -214,9 +215,15 @@ namespace otb ...@@ -214,9 +215,15 @@ namespace otb
mapnik::freetype_engine::register_font("/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf"); mapnik::freetype_engine::register_font("/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf");
//Set the default backgroup to transparent if(m_UseAsOverlay)
m_Map.set_background(mapnik::color(255,255,255,0)); {
//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 //Load the OSM styles using helper class
otb::VectorDataStyle::Pointer styleLoader = otb::VectorDataStyle::New(); otb::VectorDataStyle::Pointer styleLoader = otb::VectorDataStyle::New();
styleLoader->SetScaleFactor(m_ScaleFactor); 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