Merge branch 'master' of ssh://wisemapping.com/var/git-repos/wise-source
Conflicts: wise-webapp/src/main/java/com/wisemapping/exporter/ExporterFactory.java
This commit is contained in:
@@ -150,6 +150,7 @@ public class ExportController extends BaseMultiActionController {
|
||||
exportImage(response, mapSvg, bos, false);
|
||||
} catch (Throwable e) {
|
||||
logger.error("Unexpexted error generating the image", e);
|
||||
logger.error("map: "+mapSvg);
|
||||
}
|
||||
|
||||
BASE64Encoder encoder = new BASE64Encoder();
|
||||
@@ -164,11 +165,11 @@ public class ExportController extends BaseMultiActionController {
|
||||
}
|
||||
|
||||
public ModelAndView image(HttpServletRequest request, HttpServletResponse response) throws TranscoderException, IOException, JAXBException {
|
||||
try {
|
||||
logger.info("Export Controller: generating image WiseMap action");
|
||||
logger.info("Export Controller: generating image WiseMap action");
|
||||
|
||||
final String mapIdStr = request.getParameter(MAP_ID_PARAMETER);
|
||||
final String mapSvg = request.getParameter(MAP_SVG_PARAMETER);
|
||||
final String mapIdStr = request.getParameter(MAP_ID_PARAMETER);
|
||||
final String mapSvg = request.getParameter(MAP_SVG_PARAMETER);
|
||||
try {
|
||||
final ServletOutputStream outputStream = response.getOutputStream();
|
||||
|
||||
exportImage(response, mapSvg, outputStream, true);
|
||||
@@ -176,6 +177,7 @@ public class ExportController extends BaseMultiActionController {
|
||||
|
||||
} catch (Throwable e) {
|
||||
logger.error("Unexpexted error generating the image", e);
|
||||
logger.error("map: "+mapSvg);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@@ -131,17 +131,27 @@ public class ExporterFactory {
|
||||
}
|
||||
}
|
||||
|
||||
private static Document normalizeSvg(String svgXml, final String imgBaseUrl) throws XMLStreamException, ParserConfigurationException, IOException, SAXException, TransformerException {
|
||||
private static Document normalizeSvg(@NotNull String svgXml, final String imgBaseUrl) throws XMLStreamException, ParserConfigurationException, IOException, SAXException, TransformerException {
|
||||
|
||||
final DocumentBuilder documentBuilder = getDocumentBuilder();
|
||||
svgXml = svgXml.replaceFirst("<svg ", "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" ");
|
||||
|
||||
final Reader in = new CharArrayReader(svgXml.toCharArray());
|
||||
|
||||
// Load document ...
|
||||
final InputSource is = new InputSource(in);
|
||||
Document document;
|
||||
try {
|
||||
final Reader in = new CharArrayReader(svgXml.toCharArray());
|
||||
final InputSource is = new InputSource(in);
|
||||
|
||||
document = documentBuilder.parse(is);
|
||||
} catch (SAXException e) {
|
||||
// It must be a corrupted SVG format. Try to hack it and try again ...
|
||||
svgXml = svgXml.replaceAll("<image([^>]+)>", "<image$1/>");
|
||||
|
||||
final Reader in = new CharArrayReader(svgXml.toCharArray());
|
||||
final InputSource is = new InputSource(in);
|
||||
document = documentBuilder.parse(is);
|
||||
}
|
||||
|
||||
final Document document = documentBuilder.parse(is);
|
||||
|
||||
fitSvg(document);
|
||||
|
||||
@@ -191,7 +201,7 @@ public class ExporterFactory {
|
||||
// find all groups
|
||||
if (GROUP_NODE_NAME.equals(node.getNodeName())) {
|
||||
// Must continue looking ....
|
||||
fixImageTagHref(document,(Element) node, imgBaseUrl);
|
||||
fixImageTagHref(document, (Element) node, imgBaseUrl);
|
||||
|
||||
} else if (IMAGE_NODE_NAME.equals(node.getNodeName())) {
|
||||
|
||||
@@ -290,34 +300,4 @@ public class ExporterFactory {
|
||||
return transate.split(",");
|
||||
}
|
||||
|
||||
// @NotNull
|
||||
// static private String convertBrowserSvgToXmlSvg(@NotNull String mapSvg)
|
||||
// throws IOException, JAXBException, SAXException, TransformerException {
|
||||
// String buff = "<?xml version='1.0' encoding='UTF-8'?>\n" + mapSvg;
|
||||
//
|
||||
// // Add namespace...
|
||||
// buff = buff.replaceFirst("<svg ", "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" ");
|
||||
//
|
||||
// final Document document = documentBuilder.parse(buff);
|
||||
//
|
||||
// TransformerFactory transfac = TransformerFactory.newInstance();
|
||||
// Transformer trans = transfac.newTransformer();
|
||||
//
|
||||
// //create string from xml tree
|
||||
// StringWriter sw = new StringWriter();
|
||||
// StreamResult result = new StreamResult(sw);
|
||||
// DOMSource source = new DOMSource(document);
|
||||
// trans.transform(source, result);
|
||||
//
|
||||
// return result.toString();
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
result = result.replaceAll("<image([^>]+)>", "<image$1/>");
|
||||
result = result.replaceAll("<image([^>]+)//+>", "<image$1></image>");
|
||||
return result.toCharArray();
|
||||
=======
|
||||
*/
|
@@ -220,9 +220,9 @@
|
||||
rel="moodalbox 600px 400px" title="<spring:message code="EXPORT_DETAILS"/>">
|
||||
<spring:message code="EXPORT"/>
|
||||
</a>--%>
|
||||
<a href="javascript:printMap(${mindmap.id});">
|
||||
<%--<a href="javascript:printMap(${mindmap.id});">
|
||||
<spring:message code="PRINT"/>
|
||||
</a>
|
||||
</a>--%>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
Reference in New Issue
Block a user