Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fastkml
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Aurélien Vermylen
fastkml
Commits
366313b8
Commit
366313b8
authored
Oct 20, 2014
by
Ian Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a bug when the fill or outline attributes of a PolyStyle are float strings, e.g. "0.0"
parent
8b88dc6b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
2 deletions
+52
-2
docs/HISTORY.txt
docs/HISTORY.txt
+2
-0
fastkml/styles.py
fastkml/styles.py
+2
-2
fastkml/test_main.py
fastkml/test_main.py
+48
-0
No files found.
docs/HISTORY.txt
View file @
366313b8
...
...
@@ -4,6 +4,8 @@ Changelog
0.10 (unreleased)
-----------------
- Fix bug when the fill or outline attributes of a PolyStyle are float strings
0.9 (2014/10/17)
-----------------
...
...
fastkml/styles.py
View file @
366313b8
...
...
@@ -353,10 +353,10 @@ class PolyStyle(_ColorStyle):
super
(
PolyStyle
,
self
).
from_element
(
element
)
fill
=
element
.
find
(
'%sfill'
%
self
.
ns
)
if
fill
is
not
None
:
self
.
fill
=
int
(
f
ill
.
text
)
self
.
fill
=
int
(
f
loat
(
fill
.
text
)
)
outline
=
element
.
find
(
'%soutline'
%
self
.
ns
)
if
outline
is
not
None
:
self
.
outline
=
int
(
outline
.
text
)
self
.
outline
=
int
(
float
(
outline
.
text
)
)
class
LabelStyle
(
_ColorStyle
):
...
...
fastkml/test_main.py
View file @
366313b8
...
...
@@ -934,6 +934,12 @@ class StyleTestCase(unittest.TestCase):
f2
.
from_string
(
f
.
to_string
(
prettyprint
=
True
))
self
.
assertEqual
(
f
.
to_string
(),
f2
.
to_string
())
def
test_polystyle_fill
(
self
):
style
=
styles
.
PolyStyle
()
def
test_polystyle_outline
(
self
):
style
=
styles
.
PolyStyle
()
class
StyleUsageTestCase
(
unittest
.
TestCase
):
def
test_create_document_style
(
self
):
...
...
@@ -1164,6 +1170,48 @@ class StyleFromStringTestCase(unittest.TestCase):
k2
.
from_string
(
k
.
to_string
())
self
.
assertEqual
(
k
.
to_string
(),
k2
.
to_string
())
def
test_polystyle_float_fill
(
self
):
doc
=
"""<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>PolygonStyle.kml</name>
<open>1</open>
<Style id="examplePolyStyle">
<PolyStyle>
<fill>0.0</fill>
</PolyStyle>
</Style>
</Document>
</kml>"""
k
=
kml
.
KML
()
k
.
from_string
(
doc
)
style
=
list
(
list
(
list
(
k
.
features
())[
0
].
styles
())[
0
].
styles
())[
0
]
self
.
assertTrue
(
isinstance
(
style
,
styles
.
PolyStyle
))
self
.
assertEqual
(
style
.
fill
,
0
)
k2
=
kml
.
KML
()
k2
.
from_string
(
k
.
to_string
())
self
.
assertEqual
(
k
.
to_string
(),
k2
.
to_string
())
def
test_polystyle_float_outline
(
self
):
doc
=
"""<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
<name>PolygonStyle.kml</name>
<open>1</open>
<Style id="examplePolyStyle">
<PolyStyle>
<outline>0.0</outline>
</PolyStyle>
</Style>
</Document>
</kml>"""
k
=
kml
.
KML
()
k
.
from_string
(
doc
)
style
=
list
(
list
(
list
(
k
.
features
())[
0
].
styles
())[
0
].
styles
())[
0
]
self
.
assertTrue
(
isinstance
(
style
,
styles
.
PolyStyle
))
self
.
assertEqual
(
style
.
outline
,
0
)
k2
=
kml
.
KML
()
k2
.
from_string
(
k
.
to_string
())
self
.
assertEqual
(
k
.
to_string
(),
k2
.
to_string
())
def
test_styles
(
self
):
doc
=
"""<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
...
...
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