Skip to content

Commit

Permalink
KML bug fixing. Support inline Styles
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Dec 31, 2013
1 parent e4c8ce3 commit 5acbe33
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion OSMBonusPack/src/org/osmdroid/bonuspack/kml/KmlDocument.java
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,15 @@ public void endElement(String uri, String localName, String name)
if (mCurrentStyle != null && mCurrentStyle.iconColorStyle != null)
mCurrentStyle.iconHref = mString;
} else if (localName.equals("Style")){
putStyle(mCurrentStyleId, mCurrentStyle);
if (mCurrentStyleId != null)
putStyle(mCurrentStyleId, mCurrentStyle);
else {
mCurrentStyleId = addStyle(mCurrentStyle);
if (mKmlCurrentObject != null){
//this is an inline style. Set its style id to the KmlObject container:
mKmlCurrentObject.mStyle = mCurrentStyleId;
}
}
mCurrentStyle = null;
}
}
Expand Down
2 changes: 1 addition & 1 deletion OSMBonusPack/src/org/osmdroid/bonuspack/kml/KmlObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ public Overlay buildOverlays(Context context, MapView map, Drawable marker, KmlD
polygonOverlay.setPoints(mCoordinates);
polygonOverlay.setTitle(mName);
polygonOverlay.setSnippet(mDescription);
if (!mName.equals("") || !mDescription.equals("")){
if ((mName!=null && !"".equals(mName)) || (mDescription!=null && !"".equals(mDescription))){
String packageName = context.getPackageName();
int layoutResId = context.getResources().getIdentifier("layout/bonuspack_bubble", null, packageName);
polygonOverlay.setInfoWindow(layoutResId, map);
Expand Down

0 comments on commit 5acbe33

Please sign in to comment.