Changeset 6541 in main
- Timestamp:
- 06/12/14 00:14:39 (7 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ibisph-view/src/main/webapp/WEB-INF/web.xml
r6460 r6541 193 193 </servlet> 194 194 195 <servlet> 196 <description> 197 Converts posted SVG to an image. 198 </description> 199 <servlet-name>svgToImageServlet</servlet-name> 200 <servlet-class>org.ibisph.web.servlet.SVGToRasterServlet</servlet-class> 201 </servlet> 195 202 196 203 <!-- ======================================= S E R V L E T M A P P I N G S --> … … 256 263 <servlet-name>captchaServlet</servlet-name> 257 264 <url-pattern>/captcha/*</url-pattern> 265 </servlet-mapping> 266 267 <servlet-mapping> 268 <servlet-name>svgToImageServlet</servlet-name> 269 <url-pattern>/svgtoimage/*</url-pattern> 258 270 </servlet-mapping> 259 271 -
trunk/ibisph-view/src/main/webapp/xslt/html/LeafletMapGraphic.xslt
r6514 r6541 80 80 <div id="{$mapContainerID}"></div> 81 81 </div><br/> 82 <input type="button" onclick="getMapImage()" value="Convert to PNG"/> 83 82 84 </xsl:template> 83 85 -
trunk/ibisph-view/src/main/webapp/xslt/html/indicator/profile/Kendo.xslt
r6482 r6541 70 70 <div id="chart">Chart place holder...</div> 71 71 </div> 72 73 <input type="button" onclick="getChartImage()" value="Convert to PNG"/> 74 <div id="rasterImage"/> 72 75 73 76 <script type="text/javascript"> -
trunk/ibisph-view/src/main/webapp/xslt/html/indicator/profile/view_complete/SiteSpecific.xslt
r6513 r6541 124 124 // has to all be within the ready because the elements *MIGHT* not be defined in the DOM... 125 125 // another solution is to simply have the xslt build the options and then pass the options... 126 var kendoChart; 126 127 $(document).ready(function() 127 128 { … … 129 130 130 131 $("#grid").kendoGrid(baseKendoGridOptionsJSON); 131 $("#chart").kendoChart(baseKendoChartOptionsJSON);132 kendoChart = $("#chart").kendoChart(baseKendoChartOptionsJSON); 132 133 kendoDataSource.read(); // have to have after grid and chart because .autoBind = false. 133 134 … … 139 140 140 141 }); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ End of Function ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 142 143 144 function getChartImage() 145 { 146 var svg = kendoChart.data("kendoChart").svg(); 147 getImage(svg); 148 }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ End of Function ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 149 150 151 function getMapImage() 152 { 153 <![CDATA[ 154 var svg = "<?xml version='1.0'?>" + $(".leaflet-overlay-pane").html(); 155 svg = svg.replace("<?xml version='1.0'?><svg", "<?xml version='1.0'?><svg xmlns='http://www.w3.org/2000/svg' version='1.1' "); 156 getImage(svg); 157 ]]> 158 }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ End of Function ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 159 160 161 function getImage(svg) 162 { 163 //svg = $(svg).replaceAll("stroke=''", ""); 164 alert("SVG: " +svg); 165 166 this.xhr = $.ajax({ 167 type: "POST" 168 ,url: "http://localhost/ibisph-view/svgtoimage/download.png" 169 ,crossDomain: true 170 ,headers: { 171 "accept": "image/png" 172 ,"content-Type": "image/svg+xml" 173 } 174 ,data: svg 175 ,success: function(data, textStatus, jqXHR) 176 { 177 console.log("Converting SVG to Image - success status: "+ textStatus); 178 insertImageData(data); 179 } 180 ,error: function (jqXHR, textStatus, errorThrown) 181 { 182 console.log("Converting SVG to Image - ERROR: "+ errorThrown+", Status: ", textStatus); 183 } 184 // ,dataType: "xml" 185 }); 186 }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ End of Function ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 187 188 189 function insertImageData(imageData) 190 { 191 <![CDATA[ 192 var imgSrc = "data:image/png;base64," + imageData; 193 var imgHTML = "<img src=\"" + imgSrc + "\"/>"; 194 $("#rasterImage").html(imgHTML); 195 ]]> 196 }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ End of Function ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 197 141 198 </script> 142 199 </xsl:template> -
trunk/ibisph/src/main/java/org/ibisph/util/XMLLib.java
r6283 r6541 1 1 package org.ibisph.util; 2 2 3 import java.io.InputStream; 3 4 import java.util.ArrayList; 4 5 import java.util.List; … … 52 53 throws TransformerException 53 54 { 54 org.w3c.dom.Document w3c QueryModuleDocument = null;55 org.w3c.dom.Document w3cDocument = null; 55 56 SAXSource source = new DocumentSource(dom4jDocument); 56 57 DOMResult result = new DOMResult(); 57 58 Transformer transformer = TransformerFactory.newInstance().newTransformer(); 58 59 transformer.transform(source, result); 59 w3cQueryModuleDocument = (org.w3c.dom.Document)result.getNode(); 60 return(w3cQueryModuleDocument); 61 } //------------------------------ End of Method --------------------------- 62 63 64 65 60 w3cDocument = (org.w3c.dom.Document)result.getNode(); 61 return(w3cDocument); 62 } //------------------------------ End of Method --------------------------- 63 64 65 public static org.w3c.dom.Document getW3CDocument(String xml) throws org.xml.sax.SAXException, java.io.IOException { 66 return( getW3CDocument(new java.io.ByteArrayInputStream(xml.getBytes())) ); 67 } //------------------------------ End of Method --------------------------- 68 69 public static org.w3c.dom.Document getW3CDocument(InputStream inputStream) 70 throws org.xml.sax.SAXException, java.io.IOException 71 { 72 javax.xml.parsers.DocumentBuilderFactory factory = javax.xml.parsers.DocumentBuilderFactory.newInstance(); 73 factory.setNamespaceAware(true); 74 javax.xml.parsers.DocumentBuilder builder = null; 75 try { 76 builder = factory.newDocumentBuilder(); 77 } 78 catch(javax.xml.parsers.ParserConfigurationException ex) { 79 } 80 org.w3c.dom.Document document = builder.parse(inputStream); 81 inputStream.close(); 82 return document; 83 } //------------------------------ End of Method --------------------------- 84 85 66 86 /** 67 87 * Localizes the parsing of an XML String into a new element.
Note: See TracChangeset
for help on using the changeset viewer.