当前位置: 首页>>代码示例>>Java>>正文


Java Position.getLongitude方法代码示例

本文整理汇总了Java中gov.nasa.worldwind.geom.Position.getLongitude方法的典型用法代码示例。如果您正苦于以下问题:Java Position.getLongitude方法的具体用法?Java Position.getLongitude怎么用?Java Position.getLongitude使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gov.nasa.worldwind.geom.Position的用法示例。


在下文中一共展示了Position.getLongitude方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createPlace

import gov.nasa.worldwind.geom.Position; //导入方法依赖的package包/类
@Override
protected MapPlace createPlace(MapPlace root, String text, double x,
		double y, double zoom) {
	WorldWindowGLCanvas wwd = ((WWMap) map).wwd;
	OrbitView view = (OrbitView) wwd.getView();

	zoom = ((WWMap) map).getGMAZoom();
	Position pos = view.getCenterPosition();
	double pitch = view.getPitch().degrees;
	double heading = view.getHeading().degrees;
	double zoom2 = view.getZoom();
	double ve = wwd.getSceneController().getVerticalExaggeration();

	return new WWMapPlace( 
			root,
			text, 
			pos.getLongitude().degrees,
			pos.getLatitude().degrees,
			zoom,
			pitch,
			heading,
			zoom2,
			ve);
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:25,代码来源:WWMapPlaces.java

示例2: mouseClicked

import gov.nasa.worldwind.geom.Position; //导入方法依赖的package包/类
@Override
	public void mouseClicked(MouseEvent evt) {
		if(evt.isControlDown())return;

		OrbitView view = (OrbitView) ww.getView();

		Position pos =
			view.computePositionFromScreenPoint(evt.getX(), evt.getY());

		if (pos == null) return;

		double x = pos.getLongitude().degrees;
		double y = pos.getLatitude().degrees;

		if (currentCruise != null && 
				currentCruise.getBounds().contains(x, y)) {
			// Do nothing
		} else {
			// Select Area
			int k = cruiseList.getSelectedIndex();
			k=k%cruises.length;
			int k0 = k;
			while(true)  {	
				if(cruises[k].getBounds().contains(x, y) ) {
					mouseE = true;
					cruiseList.setSelectedItem(cruises[k]);
					evt.consume();
//					setSelectedCruise(cruises[k]);
					return;
				}
				k = (k+1)%cruises.length;
				if(k==k0)
					break;
			} 
		}
	}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:37,代码来源:WWXMCS.java

示例3: addItem

import gov.nasa.worldwind.geom.Position; //导入方法依赖的package包/类
public void addItem(SceneItem item, int subLayer) {
	// Node not full
	int count = getItemCount(subLayer);
	if (count < items_per_node)
	{
		getItems(subLayer).add(item);
		return;
	}
	
	if (children == null) 
		createChildren();
	 
	// Add Child
	Position p = item.getPosition();
	double lat = p.getLatitude().degrees;
	double lon = p.getLongitude().degrees;
	
	int index;
	if (lat < centerLat)
		if (lon < centerLon)
			index = 0;
		else 
			index = 1;
	else
		if (lon < centerLon)
			index = 2;
		else
			index = 3;
	
	addItemToChild(item, index, subLayer);
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:32,代码来源:WWSceneGraph.java

示例4: removeItem

import gov.nasa.worldwind.geom.Position; //导入方法依赖的package包/类
public boolean removeItem(SceneItem item, int subLayer) {
	List<SceneItem> list = getItems(subLayer);
	int index = list.indexOf(item);
	if (index != -1) {
		list.remove(index);
		return true;
	}
		
	if (children != null)
	{
		Position p = item.getPosition();
		double lat = p.getLatitude().degrees;
		double lon = p.getLongitude().degrees;
		
		if (lat < centerLat)
			if (lon < centerLon)
				index = 0;
			else 
				index = 1;
		else
			if (lon < centerLon)
				index = 2;
			else
				index = 3;
		
		if (children[index] != null)
			return children[index].removeItem(item, subLayer);
	}
	return false;
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:31,代码来源:WWSceneGraph.java

示例5: computeCenterPosition

import gov.nasa.worldwind.geom.Position; //导入方法依赖的package包/类
/**
 * Compute a center position from an eye position and an orientation. If the view is looking at
 * the earth, the center position is the intersection point of the globe and a ray beginning at
 * the eye point, in the direction of the forward vector. If the view is looking at the horizon,
 * the center position is the eye position. Otherwise, the center position is null.
 * 
 * @param eyePosition
 *            The eye position.
 * @param forward
 *            The forward vector.
 * @param pitch
 *            View pitch.
 * @param altitudeMode
 *            Altitude mode of {@code eyePosition}.
 * @return The center position of the view.
 */
protected Position computeCenterPosition(	final Position eyePosition,
											final Vec4 forward,
											final Angle pitch,
											final int altitudeMode) {
	double height;

	final Angle latitude = eyePosition.getLatitude();
	final Angle longitude = eyePosition.getLongitude();

	final Globe globe = _wwCanvas.getModel().getGlobe();

	if (altitudeMode == WorldWind.CLAMP_TO_GROUND) {
		height = globe.getElevation(latitude, longitude);
	} else if (altitudeMode == WorldWind.RELATIVE_TO_GROUND) {
		height = globe.getElevation(latitude, longitude) + eyePosition.getAltitude();
	} else {
		height = eyePosition.getAltitude();
	}

	final Vec4 eyePoint = globe.computePointFromPosition(new Position(latitude, longitude, height));

	// Find the intersection of the globe and the camera's forward vector. Looking at the horizon (tilt == 90)
	// is a special case because it is a valid view, but the view vector does not intersect the globe.
	Position lookAtPosition;
	final double tolerance = 0.001;
	if (Math.abs(pitch.degrees - 90.0) > tolerance) {
		lookAtPosition = globe.getIntersectionPosition(new Line(eyePoint, forward));
	} else {
		lookAtPosition = globe.computePositionFromPoint(eyePoint);
	}

	return lookAtPosition;
}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:50,代码来源:Map3View.java

示例6: insertVertex

import gov.nasa.worldwind.geom.Position; //导入方法依赖的package包/类
public final void insertVertex(final Position newVertex) {
    double distance = Double.MAX_VALUE;
    int closestVertexIndex = -1;
    final List<LatLon> locationList = obstacle.locations();
    for (int index = 0; index < locationList.size(); index++) {
        final double d = LatLon.greatCircleDistance(locationList.get(index), newVertex).degrees;
        if (d < distance) {
            distance = d;
            closestVertexIndex = index;
        }
    }
    
    final int previousVertexIndex = closestVertexIndex == 0 ? locationList.size() - 1 : closestVertexIndex - 1;
    final int nextVertexIndex = closestVertexIndex == locationList.size() - 1 ? 0 : closestVertexIndex + 1;

    final LatLon closestVertex = locationList.get(closestVertexIndex);
    final LatLon previousVertex = locationList.get(previousVertexIndex);
    final LatLon nextVertex = locationList.get(nextVertexIndex);

    final Vec4 vClosest = new Vec4(closestVertex.getLongitude().radians, closestVertex.getLatitude().radians, 0);
    final Vec4 vPrevious = new Vec4(previousVertex.getLongitude().radians, previousVertex.getLatitude().radians, 0);
    final Vec4 vNext = new Vec4(nextVertex.getLongitude().radians, nextVertex.getLatitude().radians, 0);
    final Vec4 vNew = new Vec4(newVertex.getLongitude().radians, newVertex.getLatitude().radians, 0);

    final int insertIndex;
    if (Line.fromSegment(vClosest, vNext).isPointBehindLineOrigin(vNew)) {
        insertIndex = closestVertexIndex;
    } else if (Line.fromSegment(vClosest, vPrevious).isPointBehindLineOrigin(vNew)) {
        insertIndex = nextVertexIndex;
    } else {
        throw new IllegalStateException("Could not find a suitable edge to insert position: " + newVertex.toString());
    }
    locationList.add(insertIndex, newVertex);

    obstacle.newLocations(locationList);
    fireObstacleChanged();
}
 
开发者ID:ofmooseandmen,项目名称:sherpa,代码行数:38,代码来源:ObstacleEditor.java

示例7: mouseClicked

import gov.nasa.worldwind.geom.Position; //导入方法依赖的package包/类
public void mouseClicked( MouseEvent evt) {
			if(evt.isControlDown())return;
			
			OrbitView view = (OrbitView) ww.getView();
			Globe globe = ww.getModel().getGlobe();
			
			Position pos =
				view.computePositionFromScreenPoint(evt.getX(), evt.getY());
			
			if (pos == null) return;
			
			double pixelSizeD = Angle.fromRadians(view.computePixelSizeAtDistance(view.getZoom())
					/ globe.getEquatorialRadius()).degrees;
			
			double x = pos.getLongitude().degrees;
			double y = pos.getLatitude().degrees;
//			
			Nearest nearest = new Nearest(null, 0, 0, 2 * pixelSizeD );
			
			if( image.getCruise() !=null && 
					firstNearPoint(image.getCruise().getNav(), x, y, nearest)) {
				image.scrollTo( 
						(int)(image.getCruise().getTime(nearest)/1000L) );

				selCruise = -1;
				makeSelectedTrack();
				return;
			}
			int c = selCruise;
			int kk0 = c;
			for( int kk=0 ; kk<=cruises.length ; kk++) {
				int ic = (kk+kk0+1)%cruises.length;
				while( ic>=cruises.length ) ic -= cruises.length;
				try {
					if( !cruises[ic].contains(x, y ) ) continue;
				} catch( NullPointerException ex) {
					System.out.println("null pointer, ic = "+ic);
					continue;
				}
				if( !firstNearPoint(
						cruises[ic].getNav(), x, y, nearest) ) continue;
				
				String text = cruises[ic].getName() +" "+ 
						SCSCruise.dateString(cruises[ic].getTime(nearest));
				
				selPanel = cruises[ic].getPanel( cruises[ic].getTime(nearest) );
				selPath = cruises[ic].getPanelPath( selPanel );
				selCruise = ic;
				
				label.setText( text );
				
				makeSelectedTrack();
				makeSegmentPath();
				if (evt.getClickCount() == 2)
					WWSCS.this.view.doClick();
				
				evt.consume();

				return;
			}
			
				if (selCruise != -1) evt.consume();
			
			selCruise = -1;
			selPath = image.getPaths();
			
			makeSelectedTrack();
			makeSegmentPath();
		}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:70,代码来源:WWSCS.java

示例8: mouseClicked

import gov.nasa.worldwind.geom.Position; //导入方法依赖的package包/类
@Override
		public void mouseClicked(MouseEvent evt) {
			if( evt.isControlDown() )return;
			
			OrbitView view = (OrbitView) ww.getView();
			Globe globe = ww.getModel().getGlobe();
			
			Position pos =
				view.computePositionFromScreenPoint(evt.getX(), evt.getY());
			
			if (pos == null) return;
			
			double pixelSizeD = Angle.fromRadians(view.computePixelSizeAtDistance(view.getZoom())
					/ globe.getEquatorialRadius()).degrees;
			
			double x = pos.getLongitude().degrees;
			double y = pos.getLatitude().degrees;
//			
			Nearest nearest = new Nearest(null, 0, 0, pixelSizeD );
			boolean back = evt.isShiftDown();
			int i0 = selectedIndex;
			while( i0<0 ) i0+=size;
			if( back ) i0+=size;
			for( int k=0 ; k<size ; k++) {
				int i = back ?
					(i0 - (1+k))%size :
					(i0 + 1+k )%size;
					
				if( (types & tracks[i].getTypes()) ==0 ) continue;
				if( !tracks[i].contains(x, y) ) continue;
				if( firstNearPoint(tracks[i], x, y, nearest) ) {
				//	if(i==selectedIndex)return;
					int index = model.indexOf(tracks[i]);
					if( index<0 ) break;
					list.setSelectedIndex(index);
					list.ensureIndexIsVisible(index);
					evt.consume();
					return;
				}
			}
			if(selectedIndex==-1) return;
			list.clearSelection();
			selectedIndex = -1;
			evt.consume();
		}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:46,代码来源:WWMGG.java

示例9: draw

import gov.nasa.worldwind.geom.Position; //导入方法依赖的package包/类
protected void draw(DrawContext dc)
{
    this.referencePoint = this.computeReferencePoint(dc);

    Position pos = dc.getView().getEyePosition();
    this.centerPoint = new LatLon(pos.getLatitude(), pos.getLongitude());
    
    this.assembleTiles(dc); // Determine the tiles to draw.

    if (this.currentTiles.size() >= 1)
    {
        TextureTile[] sortedTiles = new TextureTile[this.currentTiles.size()];
        sortedTiles = this.currentTiles.toArray(sortedTiles);
        Arrays.sort(sortedTiles, levelComparer);

        //GL gl = dc.getGL();
        GL2 gl = dc.getGL().getGL2(); // GL initialization checks for GL2 compatibility.

        if (this.isUseTransparentTextures() || this.getOpacity() < 1)
        {
            gl.glPushAttrib(GL.GL_COLOR_BUFFER_BIT | GL2.GL_POLYGON_BIT | GL2.GL_CURRENT_BIT);
            gl.glColor4d(1d, 1d, 1d, this.getOpacity());
            gl.glEnable(GL.GL_BLEND);
            gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);
        }
        else
        {
            gl.glPushAttrib(GL.GL_COLOR_BUFFER_BIT | GL2.GL_POLYGON_BIT);
        }

        gl.glPolygonMode(GL.GL_FRONT, GL2.GL_FILL);
        gl.glEnable(GL.GL_CULL_FACE);
        gl.glCullFace(GL.GL_BACK);

        dc.setPerFrameStatistic(PerformanceStatistic.IMAGE_TILE_COUNT, this.tileCountName,
            this.currentTiles.size());
        dc.getGeographicSurfaceTileRenderer().renderTiles(dc, this.currentTiles);

        gl.glPopAttrib();

        if (this.drawTileIDs)
            this.drawTileIDs(dc, this.currentTiles);

        if (this.drawBoundingVolumes)
            this.drawBoundingVolumes(dc, this.currentTiles);

        this.currentTiles.clear();
    }

    this.sendRequests();
    this.requestQ.clear();
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:53,代码来源:DynamicImageTileLayer.java


注:本文中的gov.nasa.worldwind.geom.Position.getLongitude方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。