Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Youssefi
otb
Commits
c746bea9
Commit
c746bea9
authored
16 years ago
by
Emmanuel Christophe
Browse files
Options
Downloads
Patches
Plain Diff
ENH: separating style from the main code (done)
parent
5d310795
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
CMakeLists.txt
+1
-1
1 addition, 1 deletion
CMakeLists.txt
otbVectorDataStyle.cxx
+75
-0
75 additions, 0 deletions
otbVectorDataStyle.cxx
otbVectorDataStyle.h
+28
-2
28 additions, 2 deletions
otbVectorDataStyle.h
otbVectorDataToImageFilter.txx
+5
-56
5 additions, 56 deletions
otbVectorDataToImageFilter.txx
with
109 additions
and
59 deletions
CMakeLists.txt
+
1
−
1
View file @
c746bea9
...
@@ -24,5 +24,5 @@ TARGET_LINK_LIBRARIES(myOwnMapnik mapnik)
...
@@ -24,5 +24,5 @@ TARGET_LINK_LIBRARIES(myOwnMapnik mapnik)
ADD_EXECUTABLE
(
mapnikFromVectorData mapnikFromVectorData.cxx
)
ADD_EXECUTABLE
(
mapnikFromVectorData mapnikFromVectorData.cxx
)
TARGET_LINK_LIBRARIES
(
mapnikFromVectorData OTBCommon OTBIO mapnik
)
TARGET_LINK_LIBRARIES
(
mapnikFromVectorData OTBCommon OTBIO mapnik
)
ADD_EXECUTABLE
(
mapnikOTBClasses mapnikOTBClasses.cxx
)
ADD_EXECUTABLE
(
mapnikOTBClasses mapnikOTBClasses.cxx
otbVectorDataStyle.cxx
)
TARGET_LINK_LIBRARIES
(
mapnikOTBClasses OTBCommon OTBIO mapnik
)
TARGET_LINK_LIBRARIES
(
mapnikOTBClasses OTBCommon OTBIO mapnik
)
This diff is collapsed.
Click to expand it.
otbVectorDataStyle.cxx
+
75
−
0
View file @
c746bea9
...
@@ -18,3 +18,78 @@
...
@@ -18,3 +18,78 @@
#include
"otbVectorDataStyle.h"
#include
"otbVectorDataStyle.h"
namespace
otb
{
/**
* PrintSelf Method
*/
void
VectorDataStyle
::
PrintSelf
(
std
::
ostream
&
os
,
itk
::
Indent
indent
)
const
{
Superclass
::
PrintSelf
(
os
,
indent
);
}
void
VectorDataStyle
::
LoadOSMStyle
(
mapnik
::
Map
&
mapnikMap
)
const
{
{
mapnik
::
feature_type_style
style
;
mapnik
::
rule_type
rule
;
rule
.
set_max_scale
(
250000000000LLU
);
rule
.
set_min_scale
(
600000
);
rule
.
append
(
mapnik
::
line_symbolizer
(
mapnik
::
color
(
"#f2efe9"
)));
// rule.append(mapnik::polygon_symbolizer(mapnik::Color(242,239,233)));
style
.
add_rule
(
rule
);
mapnikMap
.
insert_style
(
"world"
,
style
);
}
{
mapnik
::
feature_type_style
style
;
mapnik
::
rule_type
rule
;
rule
.
set_max_scale
(
600000
);
rule
.
append
(
mapnik
::
line_symbolizer
(
mapnik
::
color
(
"#f2efe9"
)));
// rule.append(mapnik::polygon_symbolizer(mapnik::Color(242,239,233)));
style
.
add_rule
(
rule
);
mapnikMap
.
insert_style
(
"coast-poly"
,
style
);
}
{
mapnik
::
feature_type_style
style
;
mapnik
::
rule_type
rule
;
rule
.
set_max_scale
(
600000
);
rule
.
append
(
mapnik
::
line_symbolizer
(
mapnik
::
color
(
"#e46d71"
)));
// rule.append(mapnik::polygon_symbolizer(mapnik::Color(242,239,233)));
style
.
add_rule
(
rule
);
mapnikMap
.
insert_style
(
"coast-poly"
,
style
);
}
{
mapnik
::
feature_type_style
style
;
mapnik
::
rule_type
rule
;
rule
.
set_max_scale
(
100000000
);
// rule.set_max_scale(1000000);
// rule.set_min_scale(500000);
// rule.append(mapnik::line_symbolizer(mapnik::color("#809bc0"),8.0));
rule
.
append
(
mapnik
::
line_symbolizer
(
mapnik
::
color
(
"#80c09b"
),
8.0
));
mapnik
::
text_symbolizer
textSymb
(
"name"
,
"DejaVu Sans Book"
,
9
,
mapnik
::
color
(
"#000"
));
textSymb
.
set_label_placement
(
mapnik
::
LINE_PLACEMENT
);
rule
.
append
(
textSymb
);
style
.
add_rule
(
rule
);
mapnikMap
.
insert_style
(
"roads"
,
style
);
}
{
mapnik
::
feature_type_style
style
;
mapnik
::
rule_type
rule
;
rule
.
set_max_scale
(
100000000
);
// rule.set_max_scale(1000000);
// rule.set_min_scale(500000);
rule
.
append
(
mapnik
::
line_symbolizer
(
mapnik
::
color
(
"#b5d0d0"
),
10
));
mapnik
::
text_symbolizer
textSymb
(
"name"
,
"DejaVu Sans Book"
,
10
,
mapnik
::
color
(
"#6699cc"
));
textSymb
.
set_label_placement
(
mapnik
::
LINE_PLACEMENT
);
rule
.
append
(
textSymb
);
style
.
add_rule
(
rule
);
mapnikMap
.
insert_style
(
"river"
,
style
);
}
}
}
This diff is collapsed.
Click to expand it.
otbVectorDataStyle.h
+
28
−
2
View file @
c746bea9
...
@@ -20,11 +20,13 @@
...
@@ -20,11 +20,13 @@
#define __otbVectorDataStyle_h
#define __otbVectorDataStyle_h
#include
"itkLightObject.h"
#include
"itkLightObject.h"
#include
"itkObjectFactory.h"
#include
<mapnik/map.hpp>
namespace
otb
namespace
otb
{
{
/** \class VectorDataStyle
/** \class VectorDataStyle
* \brief
Render a vector data into an image
* \brief
Load style into a mapnik::Map
*
*
*/
*/
...
@@ -32,7 +34,31 @@ namespace otb
...
@@ -32,7 +34,31 @@ namespace otb
class
ITK_EXPORT
VectorDataStyle
:
public
itk
::
LightObject
class
ITK_EXPORT
VectorDataStyle
:
public
itk
::
LightObject
{
{
public:
public:
/** Standard class typedefs. */
typedef
VectorDataStyle
Self
;
typedef
itk
::
LightObject
Superclass
;
typedef
itk
::
SmartPointer
<
Self
>
Pointer
;
typedef
itk
::
SmartPointer
<
const
Self
>
ConstPointer
;
/** Method for creation through the object factory. */
itkNewMacro
(
Self
);
/** Run-time type information (and related methods). */
itkTypeMacro
(
VectorDataStyle
,
LightObject
);
void
LoadOSMStyle
(
mapnik
::
Map
&
mapnikMap
)
const
;
protected:
/** Constructor */
VectorDataStyle
()
{};
/** Destructor */
virtual
~
VectorDataStyle
()
{};
/**PrintSelf method */
virtual
void
PrintSelf
(
std
::
ostream
&
os
,
itk
::
Indent
indent
)
const
;
private
:
VectorDataStyle
(
const
Self
&
);
//purposely not implemented
void
operator
=
(
const
Self
&
);
//purposely not implemented
};
// end class
};
// end class
}
// end namespace otb
}
// end namespace otb
...
...
This diff is collapsed.
Click to expand it.
otbVectorDataToImageFilter.txx
+
5
−
56
View file @
c746bea9
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
#include "otbVectorDataToImageFilter.h"
#include "otbVectorDataToImageFilter.h"
#include "itkImageRegionIterator.h"
#include "itkImageRegionIterator.h"
#include "otbVectorDataStyle.h"
#include <mapnik/datasource_cache.hpp>
#include <mapnik/datasource_cache.hpp>
#include <mapnik/font_engine_freetype.hpp>
#include <mapnik/font_engine_freetype.hpp>
...
@@ -250,62 +251,10 @@ namespace otb
...
@@ -250,62 +251,10 @@ namespace otb
m_Map.set_background(mapnik::color("#f2efe9"));//TODO set to transparent later
m_Map.set_background(mapnik::color("#f2efe9"));//TODO set to transparent later
//TODO the code bellow will be in another class later on
otb::VectorDataStyle::Pointer styleLoader = otb::VectorDataStyle::New();
{
styleLoader->LoadOSMStyle(m_Map);
mapnik::feature_type_style style;
mapnik::rule_type rule;
rule.set_max_scale(250000000000LLU);
rule.set_min_scale(600000);
rule.append(mapnik::line_symbolizer(mapnik::color("#f2efe9")));
// rule.append(mapnik::polygon_symbolizer(mapnik::Color(242,239,233)));
style.add_rule(rule);
m_Map.insert_style("world",style);
}
{
mapnik::feature_type_style style;
mapnik::rule_type rule;
rule.set_max_scale(600000);
rule.append(mapnik::line_symbolizer(mapnik::color("#f2efe9")));
// rule.append(mapnik::polygon_symbolizer(mapnik::Color(242,239,233)));
style.add_rule(rule);
m_Map.insert_style("coast-poly",style);
}
{
mapnik::feature_type_style style;
mapnik::rule_type rule;
rule.set_max_scale(600000);
rule.append(mapnik::line_symbolizer(mapnik::color("#e46d71")));
// rule.append(mapnik::polygon_symbolizer(mapnik::Color(242,239,233)));
style.add_rule(rule);
m_Map.insert_style("coast-poly",style);
}
{
mapnik::feature_type_style style;
mapnik::rule_type rule;
rule.set_max_scale(100000000);
// rule.set_max_scale(1000000);
// rule.set_min_scale(500000);
// rule.append(mapnik::line_symbolizer(mapnik::color("#809bc0"),8.0));
rule.append(mapnik::line_symbolizer(mapnik::color("#80c09b"),8.0));
mapnik::text_symbolizer textSymb("name", "DejaVu Sans Book", 9, mapnik::color("#000"));
textSymb.set_label_placement(mapnik::LINE_PLACEMENT);
rule.append(textSymb);
style.add_rule(rule);
m_Map.insert_style("roads",style);
}
{
mapnik::feature_type_style style;
mapnik::rule_type rule;
rule.set_max_scale(100000000);
// rule.set_max_scale(1000000);
// rule.set_min_scale(500000);
rule.append(mapnik::line_symbolizer(mapnik::color("#b5d0d0"),10));
mapnik::text_symbolizer textSymb("name", "DejaVu Sans Book", 10, mapnik::color("#6699cc"));
textSymb.set_label_placement(mapnik::LINE_PLACEMENT);
rule.append(textSymb);
style.add_rule(rule);
m_Map.insert_style("river",style);
}
}
}
template <class TVectorData, class TImage>
template <class TVectorData, class TImage>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment