Closed GoogleCodeExporter closed 9 years ago
I did a little work on this to suit my own needs for a project. While far from
complete, maybe you could comment on whether I'm taking the right direction for
it? I've attached a diff with my changes compared to trunk rev 38.
Basically the new code just checks to see if there is an inline <Style> node in
the placemark, and if there is uses that instead of a shared style. I grab an
id, but don't really do anything like trying to look up the shared style yet.
Since my kml only has icons, I create a object that closely mirrors IconStyle
elements. I also just yanked the href from the Icon child node, since it's the
only value.
icon = {
styleURL: String,
scale: float,
heading: float,
iconURL: String,
hotSpot: Object (I didn't bother implementing since it wasn't being used)
}
and the style would be different as well, and can contain any of the 'specific'
styles like IconStyle, LabelStyle, etc...
style = {
id: String,
icon: Object,
label: Object,
line: Object,
poly: Object,
balloon: Object,
list: Object
}
For now all I implemented was most of IconStyle but I'd be happy to try and
help with the others.
Original comment by kevin.r....@gmail.com
on 2 Dec 2010 at 8:20
I screwed up my diff, sorry about that. Fixed.
Original comment by kevin.r....@gmail.com
on 2 Dec 2010 at 8:37
Attachments:
you wrote:
Any help would be appreciated, I didn't think adding inline styles
would be too difficult, but my first attempt didn't pan out to well.
Your code might give me some ideas on where I went wrong.
Test cases to test the code before committing it would be appreciated as well.
No problem.
It seems like a good start, but when applied to geoxml3.js for
testing, there are errors when creating the marker in the createMarker
function (placemark.style.icon is currently expected to be a valid
MarkerImage object after running processStyles). That might just be a
bad choice of how to store the icon in the output json object or an
error in my understanding of your change.
Are there any test cases available that show this working?
My current testcase that is failing is at:
http://www.geocodezip.com/geoxml3_test/geoxml3_test_mtrmtrip_local.html
-- Larry
Original comment by geocodezip
on 4 Dec 2010 at 5:00
The code I wrote doesn't take into account the StyleMap element. I'll work on
adding that. This is just a small start, I wanted to get some feedback before
pouring a lot of time into it :) I don't have any publicly available KML that
this works with, but a document with an inline Style element (as opposed to
StyleMap) may work. I'll try and get you a good test case.
Original comment by kevin.r....@gmail.com
on 6 Dec 2010 at 7:19
I have moved forward on an implementation that supports inline code.
See the local version of geoxml3 used in this test case:
http://www.geocodezip.com/geoxml3_test/geoxml3_test_mtrmtrip_local.html
It still has a couple of issues, the main one being that the default icon
definition changed, I think before check it in I would like to include support
for the "hotspot" tag, so the icon's anchor can be adjusted from the KML.
If you could test it for your needs and provide feedback, that would be great.
Original comment by geocodezip
on 6 Dec 2010 at 9:19
implemented inline styles in polys branch
Original comment by geocodezip
on 8 Dec 2010 at 6:50
Original issue reported on code.google.com by
geocodezip
on 15 Nov 2010 at 7:58