Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Marble
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Education
Marble
Commits
34deafcc
Commit
34deafcc
authored
Jul 02, 2016
by
Bernhard Beschow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move static font and color properties from GeoDataFeature to StyleBuilder and make non-static
parent
3f3d7eb3
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
47 deletions
+47
-47
src/lib/marble/MarbleMap.cpp
src/lib/marble/MarbleMap.cpp
+3
-3
src/lib/marble/StyleBuilder.cpp
src/lib/marble/StyleBuilder.cpp
+32
-6
src/lib/marble/StyleBuilder.h
src/lib/marble/StyleBuilder.h
+12
-0
src/lib/marble/geodata/data/GeoDataFeature.cpp
src/lib/marble/geodata/data/GeoDataFeature.cpp
+0
-24
src/lib/marble/geodata/data/GeoDataFeature.h
src/lib/marble/geodata/data/GeoDataFeature.h
+0
-11
src/lib/marble/geodata/data/GeoDataFeature_p.h
src/lib/marble/geodata/data/GeoDataFeature_p.h
+0
-3
No files found.
src/lib/marble/MarbleMap.cpp
View file @
34deafcc
...
...
@@ -991,7 +991,7 @@ void MarbleMapPrivate::updateMapTheme()
m_placemarkLayer
.
setShowCraters
(
q
->
propertyValue
(
"craters"
)
);
m_placemarkLayer
.
setShowMaria
(
q
->
propertyValue
(
"maria"
)
);
GeoDataFeature
::
setDefaultLabelColor
(
m_model
->
mapTheme
()
->
map
()
->
labelColor
()
);
m_styleBuilder
.
setDefaultLabelColor
(
m_model
->
mapTheme
()
->
map
()
->
labelColor
()
);
m_placemarkLayer
.
requestStyleReset
();
foreach
(
RenderPlugin
*
renderPlugin
,
m_layerManager
.
renderPlugins
()
)
{
...
...
@@ -1250,12 +1250,12 @@ void MarbleMap::setDefaultAngleUnit( AngleUnit angleUnit )
QFont
MarbleMap
::
defaultFont
()
const
{
return
GeoDataFeature
::
defaultFont
();
return
d
->
m_styleBuilder
.
defaultFont
();
}
void
MarbleMap
::
setDefaultFont
(
const
QFont
&
font
)
{
GeoDataFeature
::
setDefaultFont
(
font
);
d
->
m_styleBuilder
.
setDefaultFont
(
font
);
d
->
m_placemarkLayer
.
requestStyleReset
();
}
...
...
src/lib/marble/StyleBuilder.cpp
View file @
34deafcc
...
...
@@ -17,10 +17,10 @@
#include "GeoDataTypes.h"
#include "GeoDataPlacemark.h"
#include "OsmPresetLibrary.h"
#include <QScreen>
#include <QApplication>
#include <QDebug>
#include <QApplication>
#include <QDate>
#include <QScreen>
namespace
Marble
{
...
...
@@ -61,10 +61,14 @@ public:
int
m_defaultMinZoomLevels
[
GeoDataFeature
::
LastIndex
];
int
m_maximumZoomLevel
;
QFont
m_defaultFont
;
QColor
m_defaultLabelColor
;
};
StyleBuilder
::
Private
::
Private
()
:
m_maximumZoomLevel
(
15
)
m_maximumZoomLevel
(
15
),
m_defaultFont
(
QStringLiteral
(
"Sans Serif"
)),
m_defaultLabelColor
(
Qt
::
black
)
{
for
(
int
i
=
0
;
i
<
GeoDataFeature
::
LastIndex
;
i
++
)
m_defaultMinZoomLevels
[
i
]
=
m_maximumZoomLevel
;
...
...
@@ -250,7 +254,7 @@ void StyleBuilder::Private::initializeDefaultStyles()
}
s_defaultStyleInitialized
=
true
;
QString
defaultFamily
=
GeoDataFeature
::
defaultFont
()
.
family
();
QString
defaultFamily
=
m_defaultFont
.
family
();
#ifdef Q_OS_MACX
int
defaultSize
=
10
;
...
...
@@ -258,7 +262,7 @@ void StyleBuilder::Private::initializeDefaultStyles()
int
defaultSize
=
8
;
#endif
QColor
const
defaultLabelColor
=
GeoDataFeature
::
defaultLabelColor
()
;
QColor
const
defaultLabelColor
=
m_defaultLabelColor
;
s_defaultStyle
[
GeoDataFeature
::
None
]
=
GeoDataStyle
::
Ptr
(
new
GeoDataStyle
(
QString
(),
...
...
@@ -792,6 +796,28 @@ StyleBuilder::~StyleBuilder()
delete
d
;
}
QFont
StyleBuilder
::
defaultFont
()
const
{
return
d
->
m_defaultFont
;
}
void
StyleBuilder
::
setDefaultFont
(
const
QFont
&
font
)
{
d
->
m_defaultFont
=
font
;
reset
();
}
QColor
StyleBuilder
::
defaultLabelColor
()
const
{
return
d
->
m_defaultLabelColor
;
}
void
StyleBuilder
::
setDefaultLabelColor
(
const
QColor
&
color
)
{
d
->
m_defaultLabelColor
=
color
;
reset
();
}
GeoDataStyle
::
ConstPtr
StyleBuilder
::
createStyle
(
const
StyleParameters
&
parameters
)
const
{
if
(
!
parameters
.
feature
)
{
...
...
src/lib/marble/StyleBuilder.h
View file @
34deafcc
...
...
@@ -14,6 +14,9 @@
#include <GeoDataStyle.h>
#include <GeoDataFeature.h>
#include <QColor>
#include <QFont>
namespace
Marble
{
class
StyleParameters
...
...
@@ -31,6 +34,15 @@ public:
StyleBuilder
();
~
StyleBuilder
();
/**
* Return the label font of the placemark.
*/
QFont
defaultFont
()
const
;
void
setDefaultFont
(
const
QFont
&
font
);
QColor
defaultLabelColor
()
const
;
void
setDefaultLabelColor
(
const
QColor
&
color
);
GeoDataStyle
::
ConstPtr
createStyle
(
const
StyleParameters
&
parameters
)
const
;
GeoDataStyle
::
ConstPtr
presetStyle
(
GeoDataFeature
::
GeoDataVisualCategory
visualCategory
)
const
;
...
...
src/lib/marble/geodata/data/GeoDataFeature.cpp
View file @
34deafcc
...
...
@@ -34,8 +34,6 @@
namespace
Marble
{
QFont
GeoDataFeaturePrivate
::
s_defaultFont
=
QFont
(
QStringLiteral
(
"Sans Serif"
));
QColor
GeoDataFeaturePrivate
::
s_defaultLabelColor
=
QColor
(
Qt
::
black
);
StyleBuilder
GeoDataFeaturePrivate
::
s_styleBuilder
;
GeoDataFeature
::
GeoDataFeature
()
...
...
@@ -168,28 +166,6 @@ QSharedPointer<const GeoDataStyle> GeoDataFeature::presetStyle( GeoDataVisualCat
return
GeoDataFeaturePrivate
::
s_styleBuilder
.
presetStyle
(
category
);
}
QFont
GeoDataFeature
::
defaultFont
()
{
return
GeoDataFeaturePrivate
::
s_defaultFont
;
}
void
GeoDataFeature
::
setDefaultFont
(
const
QFont
&
font
)
{
GeoDataFeaturePrivate
::
s_defaultFont
=
font
;
GeoDataFeaturePrivate
::
s_styleBuilder
.
reset
();
}
QColor
GeoDataFeature
::
defaultLabelColor
()
{
return
GeoDataFeaturePrivate
::
s_defaultLabelColor
;
}
void
GeoDataFeature
::
setDefaultLabelColor
(
const
QColor
&
color
)
{
GeoDataFeaturePrivate
::
s_defaultLabelColor
=
color
;
GeoDataFeaturePrivate
::
s_styleBuilder
.
reset
();
}
QString
GeoDataFeature
::
name
()
const
{
return
d
->
m_name
;
...
...
src/lib/marble/geodata/data/GeoDataFeature.h
View file @
34deafcc
...
...
@@ -15,8 +15,6 @@
#include <QString>
#include <QFont>
#include <QColor>
#include "GeoDataObject.h"
...
...
@@ -634,9 +632,6 @@ class GEODATA_EXPORT GeoDataFeature : public GeoDataObject
// ----------------------------------------------------------------
// The following functions are use for painting, and mostly for placemarks.
/**
* Return the label font of the placemark.
*/
static
void
resetDefaultStyles
();
/// Serialize the contents of the feature to @p stream.
...
...
@@ -644,12 +639,6 @@ class GEODATA_EXPORT GeoDataFeature : public GeoDataObject
/// Unserialize the contents of the feature from @p stream.
virtual
void
unpack
(
QDataStream
&
stream
);
static
QFont
defaultFont
();
static
void
setDefaultFont
(
const
QFont
&
font
);
static
QColor
defaultLabelColor
();
static
void
setDefaultLabelColor
(
const
QColor
&
color
);
static
QSharedPointer
<
const
GeoDataStyle
>
presetStyle
(
GeoDataVisualCategory
category
);
protected:
...
...
src/lib/marble/geodata/data/GeoDataFeature_p.h
View file @
34deafcc
...
...
@@ -155,9 +155,6 @@ class GeoDataFeaturePrivate
QAtomicInt
ref
;
// Static members
static
QFont
s_defaultFont
;
static
QColor
s_defaultLabelColor
;
static
StyleBuilder
s_styleBuilder
;
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment