mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-22 06:07:57 +01:00
Change export controller path and keep compatibility with old SVG images.
This commit is contained in:
parent
9849414abb
commit
5d939a1e78
@ -25,6 +25,7 @@ import com.wisemapping.view.MindMapBean;
|
|||||||
import com.wisemapping.exporter.ExportProperties;
|
import com.wisemapping.exporter.ExportProperties;
|
||||||
import com.wisemapping.filter.UserAgent;
|
import com.wisemapping.filter.UserAgent;
|
||||||
import org.apache.batik.transcoder.TranscoderException;
|
import org.apache.batik.transcoder.TranscoderException;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
import org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException;
|
import org.springframework.web.servlet.mvc.multiaction.NoSuchRequestHandlingMethodException;
|
||||||
|
|
||||||
@ -106,14 +107,14 @@ public class ExportController extends BaseMultiActionController {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setBaseBaseImgUrl(ExportFormat format, ExportProperties properties) {
|
private void setBaseBaseImgUrl(ExportFormat format, @NotNull ExportProperties properties) {
|
||||||
|
|
||||||
final String baseUrl;
|
final String baseUrl;
|
||||||
if (format == ExportFormat.SVG) {
|
if (format == ExportFormat.SVG) {
|
||||||
baseUrl = "http://www.wisemapping.com/images";
|
baseUrl = "http://www.wisemapping.com/images";
|
||||||
} else {
|
} else {
|
||||||
final ServletContext servletContext = this.getServletContext();
|
final ServletContext servletContext = this.getServletContext();
|
||||||
baseUrl = "file://" + servletContext.getRealPath("/images/");
|
baseUrl = "file://" + servletContext.getRealPath("/icons/");
|
||||||
}
|
}
|
||||||
properties.setBaseImagePath(baseUrl);
|
properties.setBaseImagePath(baseUrl);
|
||||||
}
|
}
|
||||||
|
@ -187,13 +187,18 @@ public class SvgExporter {
|
|||||||
Element elem = (Element) node;
|
Element elem = (Element) node;
|
||||||
|
|
||||||
// Cook image href ...
|
// Cook image href ...
|
||||||
String imgName = elem.getAttribute("href");
|
final String imgUrl = elem.getAttribute("href");
|
||||||
int index = imgName.lastIndexOf("/");
|
int index = imgUrl.lastIndexOf("/");
|
||||||
elem.removeAttribute("href");
|
elem.removeAttribute("href");
|
||||||
if (index != -1)
|
if (index != -1) {
|
||||||
{
|
final String iconName = imgUrl.substring(index);
|
||||||
imgName = imgName.substring(index);
|
// Hack for backward compatibility . This can be removed in 2012. :)
|
||||||
final String imgPath = imgBaseUrl + imgName;
|
String imgPath;
|
||||||
|
if (imgUrl.contains("images")) {
|
||||||
|
imgPath = imgBaseUrl + "../images/" + imgUrl;
|
||||||
|
} else {
|
||||||
|
imgPath = imgBaseUrl + imgUrl;
|
||||||
|
}
|
||||||
elem.setAttribute("xlink:href", imgPath);
|
elem.setAttribute("xlink:href", imgPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -231,7 +236,7 @@ public class SvgExporter {
|
|||||||
final NodeList groupChildren = node.getChildNodes();
|
final NodeList groupChildren = node.getChildNodes();
|
||||||
for (int idx = 0; idx < groupChildren.getLength(); idx++) {
|
for (int idx = 0; idx < groupChildren.getLength(); idx++) {
|
||||||
final Node rectNode = groupChildren.item(idx);
|
final Node rectNode = groupChildren.item(idx);
|
||||||
float curentHeight = 0 ;
|
float curentHeight = 0;
|
||||||
float curentWidth = 0;
|
float curentWidth = 0;
|
||||||
|
|
||||||
// If has a rect use the rect to calcular the real width of the topic
|
// If has a rect use the rect to calcular the real width of the topic
|
||||||
|
Loading…
Reference in New Issue
Block a user