Revision 4753 trunk/extensions/extGPS/src/org/gvsig/gps/GPSExtension.java

View differences:

GPSExtension.java
43 43
*
44 44
* $Id$
45 45
* $Log$
46
* Revision 1.4  2006-04-06 10:34:58  jaume
46
* Revision 1.5  2006-04-07 08:27:48  jaume
47 47
* *** empty log message ***
48 48
*
49
* Revision 1.4  2006/04/06 10:34:58  jaume
50
* *** empty log message ***
51
*
49 52
* Revision 1.3  2006/04/05 17:08:18  jaume
50 53
* *** empty log message ***
51 54
*
......
66 69
import java.awt.geom.Point2D;
67 70
import java.util.ArrayList;
68 71

  
72
import org.cresques.cts.ICoordTrans;
73
import org.cresques.cts.IProjection;
74
import org.cresques.cts.ProjectionPool;
75
import org.cresques.cts.gt2.CoordSys;
76
import org.cresques.cts.gt2.CoordTrans;
69 77
import org.gvsig.gps.panel.GPSControlPanel;
70 78
import org.gvsig.gps.panel.TestPanel;
71 79

  
......
89 97
	}
90 98

  
91 99
	public void execute(String actionCommand) {
92
		
93
		PluginServices.getMDIManager().addView(new GPSControlPanel());
100
		PluginServices.getMDIManager().addView(GPSControlPanel.getInstance());
94 101
	}
95 102

  
96 103
	public boolean isEnabled() {
......
133 140
		for (int i = 0; i < views.length; i++) {
134 141
			MapControl mc = views[i].getMapControl();
135 142
			GraphicLayer graph = mc.getMapContext().getGraphicsLayer();
143
			
144
			// Remove old graphics
136 145
			graph.clearAllGraphics();
137 146
			graph.clearSymbolsGraphics();
138 147
			
148
			// Obtain the current view's projection
149
			IProjection reqProj = mc.getProjection();
150
			
151
			// the geodesic projection
152
			IProjection latLonProj = ProjectionPool.get("EPSG:4326");
153
			
154
			// create a translator from geodesic to the current view's projection
155
			ICoordTrans ct = new CoordTrans((CoordSys) latLonProj, (CoordSys) reqProj);
156
			
157
			Point2D pDst = new Point2D.Double();
158
			
159
			// reproject the point
160
			pDst = ct.convert(location, pDst);
161
			
162
			// add and draw the FSymbol to the reprojected location.
139 163
			graph.addSymbol(symbol);
140
			graph.addGraphic(new FGraphic(ShapeFactory.createPoint2D(new FPoint2D(location)), 0));
164
			graph.addGraphic(new FGraphic(ShapeFactory.createPoint2D(new FPoint2D(pDst)), 0));
141 165
			mc.drawGraphics();
142 166
		}
143 167
	}

Also available in: Unified diff