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:
Paulo Gustavo Veiga 2011-04-06 17:34:17 -03:00
commit c5aa23dbc4
5 changed files with 57 additions and 42 deletions

View File

@ -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");
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;
}

View File

@ -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 ...
Document document;
try {
final Reader in = new CharArrayReader(svgXml.toCharArray());
final InputSource is = new InputSource(in);
final Document document = documentBuilder.parse(is);
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);
}
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();
=======
*/

View File

@ -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>

View File

View File

@ -0,0 +1,33 @@
<svg preserveAspectRatio="none" viewBox="-560 -98.69999999999999 1120 197.39999999999998" height="282" width="1600"
id="workspace" focusable="true">
<path fill-opacity="1.0999999999999999" visibility="visible" d="M0,0 C-38,0 -54,-40 -92,-40"
stroke-opacity="1.0999999999999999" stroke="#495879" stroke-width="1px" style="fill: none;"></path>
<g visibility="visible" transform="translate(-23, -17) scale(1)" height="100" width="100" focusable="true"
preserveAspectRatio="none">
<rect style="cursor: default;" fill-opacity="0" stroke-opacity="0" fill="#dbe2e6" stroke="#77555a"
stroke-width="1px" y="-3" x="-2" ry="6.1499999999999995" rx="6.1499999999999995" height="41"
width="50"></rect>
<rect style="cursor: default;" stroke="#023BB9" fill="#f7f7f7" stroke-width="0.5px" y="0" x="0" ry="5.25"
rx="5.25" height="35" width="46"></rect>
<text visibility="visible" x="18" y="19" style="cursor: default;" fill="#023BB9" font-weight="bold"
font-style="normal" font-size="13.4375" font-family="verdana" focusable="true">t
</text>
</g>
<g fill-opacity="1.0999999999999999" stroke-opacity="1.0999999999999999" visibility="visible"
transform="translate(-174, -51) scale(1)" height="100" width="100" focusable="true" preserveAspectRatio="none">
<rect style="cursor: move;" fill-opacity="1" stroke-opacity="1" fill="#c7d8ff" stroke="#77555a"
stroke-width="1px" y="-3" x="-2" ry="4.2" rx="4.2" height="28" width="88"></rect>
<rect visibility="visible" style="cursor: move;" fill="#E0E5EF" stroke="#023BB9" stroke-width="0.5px" y="0"
x="0" ry="3.3" rx="3.3" height="22" width="84"></rect>
<text fill-opacity="1.0999999999999999" stroke-opacity="1.0999999999999999" visibility="visible" x="22" y="12"
style="cursor: move;" fill="#525c61" font-weight="normal" font-style="normal" font-size="10.75"
font-family="verdana" focusable="true">Main Topic
</text>
<ellipse fill-opacity="1.0999999999999999" stroke-opacity="1.0999999999999999" stroke="#023BB9"
visibility="hidden" style="cursor: default;" fill="#E0E5EF" stroke-width="1px" cy="3" cx="3" ry="3"
rx="3" height="6" width="6"></ellipse>
<g transform="translate(8, 2) scale(1)" height="12" width="14" focusable="true" preserveAspectRatio="none">
<image x="2" y="0" height="12" width="12" href="../icons/onoff_clock.png">
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.5 KiB