Revision 76 1.10/trunk/libraries/lib3DMap/src/org/gvsig/gvsig3d/map3d/ViewPort3D.java

View differences:

ViewPort3D.java
161 161

  
162 162
		return pWorld;
163 163
	}
164
	
165
	public Point2D toMapPoint(int x, int y)
166
	{
167
		return toMapPoint(new Point2D.Double(x,y));
168
	}
169
	
164 170

  
165 171
	/**
166 172
	 * Returns geographic distance from pixel distance
167
	 * 
168
	 * @param d
169
	 *            Pixel distance
170
	 * 
171
	 * @return geographic distance
173
	  * @param d distance in pixels
174
	 *
175
	 * @return distance equivalent in <i>map coordinates</i>
172 176
	 */
173
	public double toMapDistance(int d) {
174
		double zoom = _terrain.getZoom(); // distance to center in meters
175

  
176
		return zoom; // TEST
177
	public double toMapDistance(int d) {	
178
		Point2D p1 = toMapPoint(0, 0);
179
		Point2D p2 = toMapPoint(1, 0);
180
		
181
		double scaleX = p2.distance(p1) ;
182
		
183
		double dist = d * scaleX;
184
		
185
		if(dist <= 0) dist = 0.1;
186
		
187
		return  dist;
177 188
	}
178 189

  
179 190
	public void mouseClicked(MouseEvent e) {

Also available in: Unified diff