Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make KML parser available as public API #1440

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*
* Copyright 2020 Google Inc.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -27,7 +27,7 @@
/**
* Parses a given KML file into KmlStyle, KmlPlacemark, KmlGroundOverlay and KmlContainer objects
*/
/* package */ class KmlParser {
public class KmlParser {

private final static String STYLE = "Style";

Expand Down Expand Up @@ -66,7 +66,7 @@
*
* @param parser parser containing the KML file to parse
*/
/* package */ KmlParser(XmlPullParser parser) {
public KmlParser(XmlPullParser parser) {
mParser = parser;
mPlacemarks = new HashMap<>();
mContainers = new ArrayList<>();
Expand All @@ -78,7 +78,7 @@
/**
* Parses the KML file and stores the created KmlStyle and KmlPlacemark
*/
/* package */ void parseKml() throws XmlPullParserException, IOException {
public void parseKml() throws XmlPullParserException, IOException {
int eventType = mParser.getEventType();
while (eventType != XmlPullParser.END_DOCUMENT) {
if (eventType == XmlPullParser.START_TAG) {
Expand Down Expand Up @@ -112,35 +112,35 @@
/**
* @return List of styles created by the parser
*/
/* package */ HashMap<String, KmlStyle> getStyles() {
public HashMap<String, KmlStyle> getStyles() {
return mStyles;
}

/**
* @return A list of Kml Placemark objects
*/
/* package */ HashMap<KmlPlacemark, Object> getPlacemarks() {
public HashMap<KmlPlacemark, Object> getPlacemarks() {
return mPlacemarks;
}

/**
* @return A list of Kml Style Maps
*/
/* package */ HashMap<String, String> getStyleMaps() {
public HashMap<String, String> getStyleMaps() {
return mStyleMaps;
}

/**
* @return A list of Kml Folders
*/
/* package */ ArrayList<KmlContainer> getContainers() {
public ArrayList<KmlContainer> getContainers() {
return mContainers;
}

/**
* @return A list of Ground Overlays
*/
/* package */ HashMap<KmlGroundOverlay, GroundOverlay> getGroundOverlays() {
public HashMap<KmlGroundOverlay, GroundOverlay> getGroundOverlays() {
return mGroundOverlays;
}

Expand All @@ -149,8 +149,7 @@
*
* @param parser XmlPullParser
*/
/*package*/
static void skip(XmlPullParser parser)
public static void skip(XmlPullParser parser)
throws XmlPullParserException, IOException {
if (parser.getEventType() != XmlPullParser.START_TAG) {
throw new IllegalStateException();
Expand Down