Hello All,

    I seem to be unable to clone the SVGGraphics2D object.

    As I am drawing a large map, I would like to cache it and only draw the figures each time.

    However, the copied SVGGraphics2D object does not seem to have saved any of the information.

    Is there a trick to creating an exact and duplicate SVGGraphics2D?

thanks in advance,
Mike

      SVGMapGenerator mg;
      SVGGraphics2D svgGenerator;
     
      mg =  new SVGMapGenerator( game, user  );
      mg.init();
     
     
      svgGenerator = game.getBasemap();

if ( svgGenerator == null )
{
s_trace.traceInfo("no cached base map");
// Get a DOMImplementation

DOMImplementation domImpl = GenericDOMImplementation
.getDOMImplementation();

// Create an instance of org.w3c.dom.Document

Document document = domImpl.createDocument(
"http://www.w3.org/2000/svg", "svg", null);

svgGenerator = new SVGGraphics2D(document);
svgGenerator.setSVGCanvasSize(new Dimension(game.getMap().getMaxX()
* GlobalSettings.rectSize, game.getMap().getMaxY()
* GlobalSettings.rectSize));

// Add the basic script

mg.addScript(svgGenerator, document);

// Create an instance of the SVG Generator

mg.getBaseMapImage(svgGenerator);

game.setBasemap(svgGenerator);


} else {
 
  s_trace.traceInfo( "using a cached base map" );
 
  }

  


      mg.generateImage(unit, svgGenerator);
     
     

Reply via email to