View Javadoc

1   /*
2    * @(#) GisRenderable2D.java Dec 29, 2004
3    * 
4   * 
5    * Copyright (c) 2003-2005 Delft University of Technology, Jaffalaan 5, 2628 BX
6    * Delft, the Netherlands. All rights reserved.
7    * 
8    * See for project information <a href="http://www.simulation.tudelft.nl/">
9    * www.simulation.tudelft.nl </a>.
10   * 
11   * The source code and binary code of this software is proprietary information
12   * of Delft University of Technology.
13   */
14  package org.gscg.gameleader.animation2D;
15  
16  import java.net.URL;
17  
18  import nl.tudelft.simulation.dsol.context.ContextUtil;
19  import nl.tudelft.simulation.dsol.simulators.SimulatorInterface;
20  
21  /***
22   * An implementation suitable for deserialization. We implemented some extra
23   * logic for binding into the context.
24   * <p>
25   * 
26   * Copyright (c) 2003-2005 Delft University of Technology, Jaffalaan 5, 2628 BX
27   * Delft, the Netherlands. All rights reserved.
28   * 
29   * See for project information <a href="http://www.simulation.tudelft.nl/">
30   * www.simulation.tudelft.nl </a>.
31   * 
32   * The source code and binary code of this software is proprietary information
33   * of Delft University of Technology.
34   * 
35   * @author <a
36   *         href="http://www.tbm.tudelft.nl/webstaf/stijnh/index.htm">Stijn-Pieter
37   *         van Houten </a>
38   * @version $Revision: 1.1 $ $Date: 2005/06/16 12:34:02 $
39   * @since 1.0
40   */
41  public class GisRenderable2D extends
42  		nl.tudelft.simulation.dsol.animation.D2.GisRenderable2D
43  {
44  	/*** the serial version uid */
45  	private static final long serialVersionUID = 11L;
46  
47  	/***
48  	 * constructs a new GisRenderable2D
49  	 */
50  	public GisRenderable2D()
51  	{
52  		super();
53  	}
54  
55  	/***
56  	 * constructs a new GisRenderable2D
57  	 * 
58  	 * @param arg0 the simulator
59  	 * @param arg1 the URL for the map file
60  	 * @param contextName the name of the context to bind the renderale into
61  	 *        should only be used in case of deserialization; should be null
62  	 *        otherwise
63  	 */
64  	public GisRenderable2D(final SimulatorInterface arg0, final URL arg1,
65  			final String contextName)
66  	{
67  		super(arg0, arg1);
68  		this.bindToContext(contextName);
69  	}
70  
71  	/***
72  	 * binds the renderable to the context
73  	 * 
74  	 * @param contextName the name of the context to bind the renderale into
75  	 *        should only be used in case of deserialization; should be null
76  	 *        otherwise
77  	 */
78  	protected void bindToContext(final String contextName)
79  	{
80  		if (contextName == null)
81  		{
82  			super.bind2Context();
83  		} else
84  		{
85  			ContextUtil.bindToContext(contextName, this);
86  		}
87  	}
88  
89  	/***
90  	 * @see nl.tudelft.simulation.dsol.animation.D2.GisRenderable2D#bind2Context()
91  	 */
92  	protected void bind2Context()
93  	{
94  		this.bindToContext(null);
95  	}
96  }