<HTML><HEAD>
<META content="text/html; charset=iso-8859-15" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.7600.16535"></HEAD>
<BODY style="MARGIN: 4px 4px 1px; FONT: 10pt Segoe UI">
<DIV>I don't have any physical code that can be shared, but I can tell you what I did in order to get it to work. You can probably apply this to whatever programming language you are using.</DIV>
<DIV> </DIV>
<DIV>We are using ASP.NET and took advantage of the System.Drawing namespace to draw the vectors back on the image.</DIV>
<DIV> </DIV>
<DIV>Here's the client code that I am able to share:</DIV>
<DIV> </DIV>
<DIV> $j.each(layer.features, function() {<BR> if (this.onScreen() == true) {<BR> /* it's on screen */<BR> var opacity = layer.opacity ? parseInt(100 * layer.opacity) : 100;</DIV>
<DIV> </DIV>
<DIV> /* get the coordinates, remove any non coordinate text and split it at the comma's */</DIV>
<DIV> </DIV>
<DIV> var coords = this.geometry.toString().replace(/[^\d\,\s\.]*/gi, "").split(",");<BR> var vectorCoords = [];</DIV>
<DIV> </DIV>
<DIV> $j.each(coords, function() {<BR> /* get the screen coord */<BR> var xy = this.split(" ");<BR> var screen = map.getLayerPxFromLonLat(new OpenLayers.LonLat(xy[0], xy[1])); </DIV>
<DIV> vectorCoords.push({ x: screen.x, y: screen.y });<BR> });</DIV>
<DIV> </DIV>
<DIV> /* the server needs to know what type of vector it has to draw */<BR> var vectorType = "";<BR> if (this.geometry.CLASS_NAME.search(/polygon$/i) >= 0) {<BR> vectorType = "polygon";<BR> } else if (this.geometry.CLASS_NAME.search(/point$/i) >= 0) {<BR> vectorType = "point";<BR> } else if (this.geometry.CLASS_NAME.search(/linestring$/i) >= 0) {<BR> vectorType = "line";<BR> } else {<BR> vectorType = "unknown";<BR> }</DIV>
<DIV> </DIV>
<DIV> var vectorLabel;<BR> try {<BR> if (typeof (this.attributes.label) != "undefined") {<BR> vectorLabel = this.attributes.label;<BR> } else {<BR> /* no label */<BR> vectorLabel = "";<BR> }<BR> } catch (e) { vectorLabel = ""; }</DIV>
<DIV> </DIV>
<DIV> vectors.push({ t: vectorType, o: opacity, c: vectorCoords, l: vectorLabel });<BR> }<BR> });</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>The code goes through each feature in my infoLayer, and then goes through each coordinate in each feature and pulls the client side x / y out. It checks for any possible labels and sends the vector type (poly, line, etc.) to the server via JSON.</DIV>
<DIV> </DIV>
<DIV>On the server, it takes the x/y and just uses that to draw the vectors onto the image on the server side.</DIV>
<DIV> The server then goes through each vector object (from the client side vectors array) and takes the coordinates (c) and using the System.Drawing.Graphic class (DrawLines, DrawEllipse, FillRectangle, etc), it draws the lines/poly's/circles on the in-memory (system.drawing.bitmap) object. Hopefully this will give you a kick in the right direction to get you started.</DIV>
<DIV> </DIV>
<DIV>If you are not a .net person, at least the client side code will get you thinking.</DIV>
<DIV> </DIV>
<DIV>Shawn<BR>>>> On 4/26/2010 at 3:29 PM, guillaumev <guillaume@viguierjust.com> wrote:<BR></DIV>
<DIV style="BORDER-LEFT: #050505 1px solid; BACKGROUND-COLOR: #f3f3f3; MARGIN: 0px 0px 0px 15px; PADDING-LEFT: 7px"><BR>Hi,<BR><BR>soatley > I'm trying to do the exact same thing (server side stitching of<BR>the different layers of the map). However, after using the code here:<BR><A href="http://trac.openlayers.org/wiki/Printing,">http://trac.openlayers.org/wiki/Printing,</A> the vector layers do NOT get<BR>printed. Do you have some reusable code that you would be willing to share,<BR>in order to properly print the vector layers ? Thank you.<BR>-- <BR>View this message in context: <A href="http://osgeo">http://osgeo</A>-org.1803224.n2.nabble.com/How-to-print-map-area-with-openlayers-tp4901023p4964522.html<BR>Sent from the OpenLayers Users mailing list archive at Nabble.com.<BR>_______________________________________________<BR>Users mailing list<BR>Users@openlayers.org<BR><A href="http://openlayers.org/mailman/listinfo/users">http://openlayers.org/mailman/listinfo/users</A><BR></DIV></BODY></HTML>