32 lines
871 B
Java
32 lines
871 B
Java
package com.ruoyi.airline.domain.util;
|
|
|
|
|
|
import com.ruoyi.airline.domain.model.kml.*;
|
|
import com.thoughtworks.xstream.XStream;
|
|
|
|
import java.io.InputStream;
|
|
|
|
/**
|
|
* 航线文件操作工具类
|
|
*/
|
|
public class KmlFileUtils {
|
|
/**
|
|
* kml文件解析
|
|
*
|
|
* @param inputStream 输入
|
|
* @return 输出
|
|
*/
|
|
public static KmlInfo parseKml(InputStream inputStream) {
|
|
XStream xStream = new XStream();
|
|
xStream.allowTypes(new Class[]{KmlInfo.class, KmlAction.class, KmlWayLineCoordinateSysParam.class, KmlPoint.class});
|
|
xStream.alias("kml", KmlInfo.class);
|
|
xStream.processAnnotations(KmlInfo.class);
|
|
xStream.autodetectAnnotations(true);
|
|
xStream.ignoreUnknownElements();
|
|
xStream.addImplicitCollection(KmlActionGroup.class, "action");
|
|
|
|
return (KmlInfo) xStream.fromXML(inputStream);
|
|
}
|
|
|
|
}
|