本文整理汇总了Java中gov.nasa.worldwind.geom.Position类的典型用法代码示例。如果您正苦于以下问题:Java Position类的具体用法?Java Position怎么用?Java Position使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Position类属于gov.nasa.worldwind.geom包,在下文中一共展示了Position类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: afterShow
import gov.nasa.worldwind.geom.Position; //导入依赖的package包/类
/**
* @see org.leo.traceroute.ui.AbstractRoutePanel#afterShow()
*/
@Override
public void afterShow(final Mode mode) {
super.afterShow(mode);
SwingUtilities.invokeLater(() -> {
_container.invalidate();
_container.revalidate();
final GeoPoint localGeo = _services.getGeo().getLocalIpGeoLocation();
final Position p = new Position(Angle.fromDegrees(localGeo.getLat()), Angle.fromDegrees(localGeo.getLon()), 2000);
((OrbitView) _controller.getWWd().getView()).setCenterPosition(p);
if (mode == Mode.TRACE_ROUTE) {
_route.renotifyRoute();
} else if (mode == Mode.SNIFFER) {
_sniffer.renotifyPackets();
} else {
_whois.renotifyWhoIs();
}
});
}
示例2: startCapture
import gov.nasa.worldwind.geom.Position; //导入依赖的package包/类
/**
* @see org.leo.traceroute.core.sniffer.IPacketListener#startCapture(boolean)
*/
@Override
public void startCapture() {
_mode = Mode.SNIFFER;
reinit();
_packetDestCoordToPath.clear();
final GeoPoint localGeo = _services.getGeo().getLocalIpGeoLocation();
_sourcePos = new Position(Position.fromDegrees(localGeo.getLat(), localGeo.getLon()), 1e4);
localGeo.setTown(youAreHere);
localGeo.setCountry(youAreHere);
pointAdded(localGeo, false);
_sourcePoint = _toAvoidDuplicatedLabels.get(localGeo.getCoordKey());
final AnnotationAttributes attrs = _sourcePoint.getRight().getAttributes();
final Color color = SOURCE_COLOR;
attrs.setTextColor(color);
attrs.setBackgroundColor(new Color(1f, 1f, 1f, 1f));
attrs.setBorderColor(color);
}
示例3: doZoom
import gov.nasa.worldwind.geom.Position; //导入依赖的package包/类
public void doZoom(Point2D p, double factor) {
LatLon dest = new LatLon(Angle.fromDegrees(p.getY()), Angle.fromDegrees(p.getX()));
double wwzoom = 2785 * Math.pow(factor, -.8311) * 10000;
final OrbitView view = (OrbitView) wwd.getView();
FlyToOrbitViewAnimator fto =
FlyToOrbitViewAnimator.createFlyToOrbitViewAnimator(
view,
view.getCenterPosition(), new Position(dest, 0),
view.getHeading(), Angle.fromDegrees(0),
view.getPitch(), Angle.fromDegrees(0),
view.getZoom(), wwzoom,
5000, WorldWind.CONSTANT); //was true
view.addAnimator(fto);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
((MapApp)getApp()).getFrame().toFront();
view.firePropertyChange(AVKey.VIEW, null, view);
}
});
}
示例4: updateLayer
import gov.nasa.worldwind.geom.Position; //导入依赖的package包/类
protected void updateLayer() {
iconLayer.disposeSubLayer(0);
for (Earthquake eq : all) {
DetailedIcon icon = new DetailedIcon(ICON_PATH, Position.fromDegrees(eq.lat, eq.lon, 0));
icon.setSize(new Dimension(ICON_SIZE, ICON_SIZE));
icon.setHighlightScale(2);
icon.setVisible(false);
icon.setIconElevation((int) eq.depth);
icon.setIconColor(Color.GREEN);
iconLayer.addItem(
new SceneItemIcon(icon, iconRenderer));
icons.add(icon);
}
processVisibility();
}
示例5: mouseMoved
import gov.nasa.worldwind.geom.Position; //导入依赖的package包/类
public void mouseMoved(MouseEvent e) {
super.mouseMoved(e);
iconLayer.removeIcon(icon);
int cdpN = cdpAt( e.getX() );
if (cdpN == -1) {
layerSet.firePropertyChange(AVKey.LAYER, null, layerSet);
return;
}
Point2D p = line.pointAtCDP( cdpN );
icon.setPosition(Position.fromDegrees(p.getY(), p.getX(), 0));
iconLayer.addIcon(icon);
layerSet.firePropertyChange(AVKey.LAYER, null, layerSet);
}
示例6: atMaxLevel
import gov.nasa.worldwind.geom.Position; //导入依赖的package包/类
private boolean atMaxLevel(DrawContext dc)
{
Position vpc = dc.getViewportCenterPosition();
if (dc.getView() == null || this.getLevels() == null || vpc == null)
return false;
if (!this.getLevels().getSector().contains(vpc.getLatitude(), vpc.getLongitude()))
return true;
Level nextToLast = this.getLevels().getNextToLastLevel();
if (nextToLast == null)
return true;
Sector centerSector = nextToLast.computeSectorForPosition(vpc.getLatitude(), vpc.getLongitude(),
this.levels.getTileOrigin());
//return this.needToSplit(dc, centerSector);
return this.needToSplit(dc, centerSector, nextToLast);
}
示例7: computeReferencePoint
import gov.nasa.worldwind.geom.Position; //导入依赖的package包/类
private Vec4 computeReferencePoint(DrawContext dc)
{
if (dc.getViewportCenterPosition() != null)
return dc.getGlobe().computePointFromPosition(dc.getViewportCenterPosition());
java.awt.geom.Rectangle2D viewport = dc.getView().getViewport();
int x = (int) viewport.getWidth() / 2;
for (int y = (int) (0.5 * viewport.getHeight()); y >= 0; y--)
{
Position pos = dc.getView().computePositionFromScreenPoint(x, y);
if (pos == null)
continue;
return dc.getGlobe().computePointFromPosition(pos.getLatitude(), pos.getLongitude(), 0d);
}
return null;
}
示例8: atMaxLevel
import gov.nasa.worldwind.geom.Position; //导入依赖的package包/类
protected boolean atMaxLevel(DrawContext dc)
{
Position vpc = dc.getViewportCenterPosition();
if (dc.getView() == null || this.getLevels() == null || vpc == null)
return false;
if (!this.getLevels().getSector().contains(vpc.getLatitude(), vpc.getLongitude()))
return true;
Level nextToLast = this.getLevels().getNextToLastLevel();
if (nextToLast == null)
return true;
Sector centerSector = nextToLast.computeSectorForPosition(vpc.getLatitude(), vpc.getLongitude(),
this.levels.getTileOrigin());
return this.needToSplit(dc, centerSector);
}
示例9: computeReferencePoint
import gov.nasa.worldwind.geom.Position; //导入依赖的package包/类
protected Vec4 computeReferencePoint(DrawContext dc)
{
if (dc.getViewportCenterPosition() != null)
return dc.getGlobe().computePointFromPosition(dc.getViewportCenterPosition());
java.awt.geom.Rectangle2D viewport = dc.getView().getViewport();
int x = (int) viewport.getWidth() / 2;
for (int y = (int) (0.5 * viewport.getHeight()); y >= 0; y--)
{
Position pos = dc.getView().computePositionFromScreenPoint(x, y);
if (pos == null)
continue;
return dc.getGlobe().computePointFromPosition(pos.getLatitude(), pos.getLongitude(), 0d);
}
return null;
}
示例10: getSamples
import gov.nasa.worldwind.geom.Position; //导入依赖的package包/类
private LatLon[] getSamples(DrawContext dc) {
Rectangle rec = dc.getView().getViewport();
Position upperLeft = scanForPosition(dc,0,0);
Position upperRight = scanForPosition(dc,rec.width,0);
Position lowerLeft = scanForPosition(dc,0,rec.height);
Position lowerRight = scanForPosition(dc,rec.width,rec.height);
Position middleTop = scanForPosition(dc,rec.width/2,0);
Position middleBottom = scanForPosition(dc,rec.width/2,rec.height);
Position middleUpThird = scanForPosition(dc,rec.width/2,rec.height/3);
Position middle = scanForPosition(dc,rec.width/2,rec.height/2-1);
return new LatLon[]{
upperLeft,
upperRight,
lowerLeft,
lowerRight,
middleTop,
middleBottom,
middleUpThird,
middle
};
}
示例11: 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);
}
示例12: createContent
import gov.nasa.worldwind.geom.Position; //导入依赖的package包/类
protected ContentAnnotation createContent(Marker marker)
{
Position position = marker.getPosition();
if(marker instanceof TridasMarker)
{
return createTridasAnnotation(this, position, "Title", ((TridasMarker) marker).getEntity());
}
else if (marker instanceof ITRDBMarker)
{
return createITRDBAnnotation(this, position, "Title", ((ITRDBMarker) marker));
}
return null;
}
示例13: moveToLocation
import gov.nasa.worldwind.geom.Position; //导入依赖的package包/类
public static void moveToLocation(WorldWindow wwd, Sector sector, Double altitude)
{
OrbitView view = (OrbitView) wwd.getView();
Globe globe = wwd.getModel().getGlobe();
if (altitude == null || altitude == 0)
{
double t = sector.getDeltaLonRadians() > sector.getDeltaLonRadians()
? sector.getDeltaLonRadians() : sector.getDeltaLonRadians();
double w = 0.5 * t * 6378137.0;
altitude = w / wwd.getView().getFieldOfView().tanHalfAngle();
}
if (globe != null && view != null)
{
wwd.getView().goTo(new Position(sector.getCentroid(), 0), altitude);
}
}
示例14: addMarkerForTridasEntity
import gov.nasa.worldwind.geom.Position; //导入依赖的package包/类
private boolean addMarkerForTridasEntity(TridasLocationGeometry geom, ITridas entity)
{
if(geom.isSetPoint())
{
GMLPointSRSHandler tph = new GMLPointSRSHandler(geom.getPoint());
if(tph.hasPointData())
{
markers.add(new TridasMarker(Position.fromDegrees(tph.getWGS84LatCoord(), tph.getWGS84LongCoord()),
getMarkerAttributesForEntity(entity.getClass()), entity));
return true;
}
}
return false;
}
示例15: goToDefaultView
import gov.nasa.worldwind.geom.Position; //导入依赖的package包/类
/**
* Go to a view of a list of positions. This method computes a view looking straight down from
* an altitude that brings all of the positions into view.
*
* @param positions
* List of positions to bring into view
*/
public void goToDefaultView(final List<? extends Position> positions) {
final View view = this.wwd.getView();
final Globe globe = view.getGlobe();
if (globe == null) {
/*
* this happenes when a tour is selected and the 3d map is not yet opened but is being
* opened with an action button
*/
StatusUtil.logInfo("globe == null"); //$NON-NLS-1$
// try again
Display.getCurrent().timerExec(200, new Runnable() {
public void run() {
gotoView(positions);
}
});
return;
}
gotoView(positions);
}