| | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.ard.route.domain.*; |
| | | import com.ard.route.domain.kml.*; |
| | | import com.ard.route.domain.djuav.*; |
| | | import com.ard.route.domain.djuav.kml.*; |
| | | import com.ard.route.enums.kml.*; |
| | | import com.ard.route.constant.FileTypeConstants; |
| | | import com.thoughtworks.xstream.XStream; |
| | |
| | | */ |
| | | public static KmlInfo parseKml(InputStream inputStream) { |
| | | XStream xStream = new XStream(); |
| | | xStream.allowTypes(new Class[]{KmlInfo.class, KmlAction.class, KmlWayLineCoordinateSysParam.class, KmlPoint.class}); |
| | | xStream.allowTypes(new Class[]{ |
| | | KmlInfo.class, |
| | | KmlAction.class, |
| | | KmlWayLineCoordinateSysParam.class, |
| | | KmlPoint.class, |
| | | KmlActionGroup.class |
| | | }); |
| | | xStream.alias("kml", KmlInfo.class); |
| | | xStream.processAnnotations(KmlInfo.class); |
| | | xStream.autodetectAnnotations(true); |
| | | xStream.ignoreUnknownElements(); |
| | | xStream.addImplicitCollection(KmlActionGroup.class, "action"); |
| | | xStream.addImplicitCollection(KmlPlacemark.class, "actionGroup"); |
| | | return (KmlInfo) xStream.fromXML(inputStream); |
| | | } |
| | | |
| | |
| | | * @param wpmlInfo wpml 文件信息 |
| | | * @return 本地文件路径 |
| | | */ |
| | | public static String buildKmz(String fileName, KmlInfo kmlInfo, KmlInfo wpmlInfo, String kmzFilePath) { |
| | | public static String buildKmzA(String fileName, KmlInfo kmlInfo, KmlInfo wpmlInfo, String kmzFilePath) { |
| | | XStream xStream = new XStream(new DomDriver()); |
| | | xStream.processAnnotations(KmlInfo.class); |
| | | xStream.addImplicitCollection(KmlActionGroup.class, "action"); |
| | | xStream.addImplicitCollection(KmlPlacemark.class, "actionGroup"); |
| | | |
| | | String kml = XML_HEADER + xStream.toXML(kmlInfo); |
| | | String wpml = XML_HEADER + xStream.toXML(wpmlInfo); |