diff --git a/Code/Common/otbVectorDataToImageFilter.h b/Code/Common/otbVectorDataToImageFilter.h index 80bdeda3cb210ed2672e4365c3b8d8bbc0156f55..afc5d0025d88eda7e53d5ef134c01d829937f34a 100644 --- a/Code/Common/otbVectorDataToImageFilter.h +++ b/Code/Common/otbVectorDataToImageFilter.h @@ -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 diff --git a/Code/Common/otbVectorDataToImageFilter.txx b/Code/Common/otbVectorDataToImageFilter.txx index 25eb26a640e177300d9045d9c71ce4e72ffdc43d..eb2ea34d9533717427fd3721c1d9a13399868ad5 100644 --- a/Code/Common/otbVectorDataToImageFilter.txx +++ b/Code/Common/otbVectorDataToImageFilter.txx @@ -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);