use of com.dexels.navajo.document.metadata.FormatDescription in project navajo by Dexels.
the class KMLMap method getKmlData.
/**
* TODO: Make thread safe
* @return
*/
public Binary getKmlData() {
try {
if (!isPointFile()) {
File kmz = createKmlFile(inMessage);
myKmzData = new Binary(kmz, false);
kmz.delete();
FormatDescription fd = new FormatDescription();
fd.addFileExtension("kmz");
fd.addMimeType("application/vnd.google-earth.kmz");
myKmzData.setMimeType("application/vnd.google-earth.kmz");
myKmzData.setFormatDescriptor(fd);
return myKmzData;
} else {
File kml = createPointKmlFile(inMessage, messagePath);
myKmzData = new Binary(kml, false);
kml.delete();
FormatDescription fd = new FormatDescription();
fd.addFileExtension("kml");
fd.addMimeType("application/vnd.google-earth.kml");
myKmzData.setMimeType("application/vnd.google-earth.kml");
myKmzData.setFormatDescriptor(fd);
return myKmzData;
}
} catch (XMLParseException e) {
logger.error("Error: ", e);
} catch (IOException e) {
logger.error("Error: ", e);
}
return null;
}
use of com.dexels.navajo.document.metadata.FormatDescription in project navajo by Dexels.
the class KMLMap method getSvgData.
public Binary getSvgData() throws IOException {
if (myKmzData == null) {
getKmlData();
}
InputStream bis = myKmzData.getDataAsStream();
ZipInputStream zis = new ZipInputStream(bis);
ZipEntry ze = null;
do {
ze = zis.getNextEntry();
if (ze != null && ze.getName().equals("doc.kml")) {
SvgRenderer sr = new SvgRenderer();
mySvgData = sr.renderToBinary(zis);
FormatDescription fd = new FormatDescription();
fd.addFileExtension("svg");
fd.addMimeType("image/svg");
myKmzData.setMimeType("image/svg");
zis.close();
return mySvgData;
}
} while (ze != null);
zis.close();
return null;
}
Aggregations