Revision 38

View differences:

1.10/trunk/libraries/lib3DMap/src/org/gvsig/gvsig3d/simbology3D/geometry3D/Abstract3DGeometry.java
27 27
	protected float 			_heigth;
28 28
	protected Terrain 		_terrain;
29 29
	private static Logger 	_logger = Logger.getLogger(Abstract3DGeometry.class.getName());
30

  
30
	private Vec3 			_pos = new Vec3();//Tests to reduce load time
31
	
32
	
33
	final double _radiusEquator = 6378137.0;
34
	final double _radiusPolar = 6356752.3142;
35
	//(falttening= _radiusEquator-_radiusPolar)/_radiusEquator;
36
	//final double			_flatt = .00335281067183097509;
37
	 //_eccent = 2*_flatt - _flatt*_flatt;
38
	final double					_ecc= .00669438000426080651;
31 39
	public Abstract3DGeometry(IGeometry geometry) {
32 40
		_geometry = geometry;
33 41
	}
......
114 122
		if (geometry instanceof FGeometry) {
115 123
			g3D = (FGeometry) geometry;
116 124
		}
117
		Vec3 posGeo = null;
118
		Vec3 pos = null;
125
		//Vec3 posGeo = null;
126
		//Vec3 pos = null;
119 127
		double h = 0;
120 128
		if (isZEnable()) {
121 129
			if ((_geomType & FShape.Z) == FShape.Z) {
......
126 134
		} else {
127 135
			h = heigth;
128 136
		}
129

  
137
		
138
		//long nano1 = System.nanoTime();
130 139
		if (_terrain.getCoordinateSystemType() == Terrain.CoordinateSystemType.GEOCENTRIC) {
131
			posGeo = new Vec3(dataLine[1], dataLine[0], h);
132
			pos = _terrain.convertLatLongHeightToXYZ(posGeo);
140
		//Calculating coordinates, if use terrain_getEllipsoid model memory increases
141
		// and speed decreases.
142
				double lat = Math.toRadians(dataLine[1]);
143
				double lon = Math.toRadians(dataLine[0]);
144
				double sin_latitude = Math.sin(lat);
145
			    double cos_latitude = Math.cos(lat);
146
			    double N = _radiusEquator / Math.sqrt( 1.0 - _ecc*sin_latitude*sin_latitude);
147
			    double x = (N+h)*cos_latitude*Math.cos(lon);
148
			    double y = (N+h)*cos_latitude*Math.sin(lon);
149
			    double z = (N*(1-_ecc)+h)*sin_latitude;
150
				_pos.set(x,y,z);
133 151
		} else {
134
			pos = new Vec3(dataLine[0], dataLine[1], h);
152
			_pos.set(dataLine[0], dataLine[1], h);
135 153
		}
136
		return pos;
154
		return _pos;
137 155
	}
138 156

  
139 157
	public int getGeomType() {

Also available in: Unified diff