Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- print: function ( map )
- {
- var div = dom.byId( "printOutput" );
- div.innerHTML = " ";
- this.test( div, this.printLayers( map ) );
- this.test( div, this.printSvg( map ) );
- },
- printSvg: function ( map )
- {
- var viewBoxItems = query( "svg", map ).filter( function ( item )
- {
- return item.viewBox;
- } );
- var images = [];
- array.forEach( viewBoxItems, function ( viewBoxItem )
- {
- array.forEach( query( "g img", viewBoxItem ), function ( img )
- {
- images.push( img );
- } );
- } );
- var pos = array.map( images, function ( img )
- {
- var pos;
- pos = dojo.position( img );
- pos.src = img.href.baseVal;
- return pos;
- } );
- var polylines = [];
- array.forEach( viewBoxItems, function ( viewBoxItem )
- {
- array.forEach( query( "g polyline", viewBoxItem ), function ( shape )
- {
- polylines.push( shape.points );
- } );
- } );
- return {
- images: pos,
- polylines: polylines
- };
- },
- printLayers: function ( map )
- {
- var images = query( "div img", map ).filter( function ( img )
- {
- return 256 === domStyle.get( img, "width" );
- } );
- var pos = array.map( images, function ( img )
- {
- var pos;
- pos = dojo.position( img );
- pos.src = img.src;
- return pos;
- } );
- return { images: pos };
- },
- test: function ( div, imagery )
- {
- var images = imagery.images;
- if ( images )
- {
- images = array.map( images, function ( item )
- {
- var img = dojo.create( "img", {
- src: item.src
- } );
- domStyle.set( img, {
- position: "absolute",
- left: item.x + "px",
- top: item.y + "px",
- width: item.w + "px",
- height: item.h + "px"
- } );
- return img;
- } );
- }
- array.forEach( images, function ( img )
- {
- div.appendChild( img );
- } );
- if ( imagery.polylines )
- {
- // render vector data
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement