本文整理汇总了Java中gov.nasa.worldwind.WorldWind类的典型用法代码示例。如果您正苦于以下问题:Java WorldWind类的具体用法?Java WorldWind怎么用?Java WorldWind使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WorldWind类属于gov.nasa.worldwind包,在下文中一共展示了WorldWind类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: retrieveLocalImage
import gov.nasa.worldwind.WorldWind; //导入依赖的package包/类
protected void retrieveLocalImage(TextureTile tile, String mimeType, int timeout) throws Exception
{
if (!WorldWind.getLocalRetrievalService().isAvailable())
return;
RetrieverFactory retrieverFactory = (RetrieverFactory) this.getValue(AVKey.RETRIEVER_FACTORY_LOCAL);
if (retrieverFactory == null)
return;
AVListImpl avList = new AVListImpl();
avList.setValue(AVKey.SECTOR, tile.getSector());
avList.setValue(AVKey.WIDTH, tile.getWidth());
avList.setValue(AVKey.HEIGHT, tile.getHeight());
avList.setValue(AVKey.FILE_NAME, tile.getPath());
avList.setValue(AVKey.IMAGE_FORMAT, mimeType);
Retriever retriever = retrieverFactory.createRetriever(avList, new CompositionRetrievalPostProcessor(tile));
Logging.logger().log(java.util.logging.Level.FINE, "Locally retrieving " + tile.getPath());
retriever.setReadTimeout(timeout);
retriever.call();
}
示例2: createPath
import gov.nasa.worldwind.WorldWind; //导入依赖的package包/类
private Path createPath(final Color color) {
final ShapeAttributes attrs = new BasicShapeAttributes();
attrs.setEnableLighting(true);
attrs.setOutlineMaterial(new Material(color));
attrs.setInteriorMaterial(new Material(new Color(color.getRed(), color.getGreen(), color.getBlue(), 50), 50));
attrs.setInteriorOpacity(0.3);
attrs.setOutlineWidth(_mapLineThickness);
attrs.setOutlineOpacity(0.7);
final Path path = new Path();
path.setExtrude(true);
path.setAttributes(attrs);
path.setVisible(true);
path.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND);
path.setPathType(AVKey.GREAT_CIRCLE);
path.setFollowTerrain(true);
return path;
}
示例3: doZoom
import gov.nasa.worldwind.WorldWind; //导入依赖的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: GridTileLayer
import gov.nasa.worldwind.WorldWind; //导入依赖的package包/类
public GridTileLayer(GridRetriever retriever, ImageResampler ImageResampler) {
super(makeLevels(retriever.getNumLevels()), new GridTiler(retriever, ImageResampler));
tiler = (GridTiler) getTiler();
tiler.renderTools.addChangeListener(this);
if (!WorldWind.getMemoryCacheSet().containsCache(TextureTile.class.getName()))
{
long size = Configuration.getLongValue(AVKey.TEXTURE_IMAGE_CACHE_SIZE, 3000000L);
MemoryCache cache = new BasicMemoryCache((long) (0.85 * size), size);
cache.setName("Texture Tiles");
WorldWind.getMemoryCacheSet().addCache(TextureTile.class.getName(), cache);
}
this.setUseTransparentTextures(true);
this.setDrawTileBoundaries(true);
}
示例5: retrieveLocalTexture
import gov.nasa.worldwind.WorldWind; //导入依赖的package包/类
protected void retrieveLocalTexture(TextureTile tile, DownloadPostProcessor postProcessor)
{
if (!WorldWind.getLocalRetrievalService().isAvailable())
return;
RetrieverFactory retrieverFactory = (RetrieverFactory) this.getValue(AVKey.RETRIEVER_FACTORY_LOCAL);
if (retrieverFactory == null)
return;
AVListImpl avList = new AVListImpl();
avList.setValue(AVKey.SECTOR, tile.getSector());
avList.setValue(AVKey.WIDTH, tile.getWidth());
avList.setValue(AVKey.HEIGHT, tile.getHeight());
avList.setValue(AVKey.FILE_NAME, tile.getPath());
Retriever retriever = retrieverFactory.createRetriever(avList, postProcessor);
WorldWind.getLocalRetrievalService().runRetriever(retriever, tile.getPriority());
}
示例6: createComponent
import gov.nasa.worldwind.WorldWind; //导入依赖的package包/类
protected static Object createComponent(WMSCapabilities caps, AVList params)
{
AVList configParams = params.copy(); // Copy to insulate changes from the caller.
// Some wms servers are slow, so increase the timeouts and limits used by world wind's retrievers.
configParams.setValue(AVKey.URL_CONNECT_TIMEOUT, 30000);
configParams.setValue(AVKey.URL_READ_TIMEOUT, 30000);
configParams.setValue(AVKey.RETRIEVAL_QUEUE_STALE_REQUEST_LIMIT, 60000);
try
{
String factoryKey = getFactoryKeyForCapabilities(caps);
Factory factory = (Factory) WorldWind.createConfigurationComponent(factoryKey);
return factory.createFromConfigSource(caps, params);
}
catch (Exception e)
{
// Ignore the exception, and just return null.
}
return null;
}
示例7: main
import gov.nasa.worldwind.WorldWind; //导入依赖的package包/类
public static void main(String[] args)
{
//List<File> cacheLocations = WorldWind.getDataFileStore().getCacheLocations();
// Analyse and cleanup (if needed) the write cache location
File writeCache = WorldWind.getDataFileStore().getWriteLocation();
// Analyse location
System.out.println("Analyzing: " + writeCache.getAbsolutePath());
CacheLocationData cld = analyseCacheLocation(writeCache);
System.out.println("Size: " + (int)(cld.sizeInBytes / Math.pow(2, 20)) + "Mb in " + cld.fileCount + " file(s) from " + cld.directories.size() + " dir(s)");
//for (CacheDirectory dir : cld.directories)
// System.out.println(new Date(dir.file.lastModified()) + " " + dir.sizeInBytes / 1024 + "Kb " + dir.file.getAbsolutePath());
// Any cleanup needed?
if (cld.sizeInBytes >= HIGH_WATER_IN_BYTES)
{
System.out.println("Cleaning down to " + (int)(LOW_WATER_IN_BYTES / Math.pow(2, 20)) + "Mb");
cleanupCacheLocation(cld, LOW_WATER_IN_BYTES);
System.out.println("Size: " + (int)(cld.sizeInBytes / Math.pow(2, 20)) + "Mb in " + cld.fileCount + " file(s)");
}
else
System.out.println("No cleanup needed until " + (int)(HIGH_WATER_IN_BYTES / Math.pow(2, 20)) + "Mb");
}
示例8: createComponent
import gov.nasa.worldwind.WorldWind; //导入依赖的package包/类
private Object createComponent(WMSCapabilities caps, AVList params) {
AVList configParams = params.copy(); // Copy to insulate changes from the caller.
// Some wms servers are slow, so increase the timeouts and limits used by world wind's retrievers.
configParams.setValue(AVKey.URL_CONNECT_TIMEOUT, 30000);
configParams.setValue(AVKey.URL_READ_TIMEOUT, 30000);
configParams.setValue(AVKey.RETRIEVAL_QUEUE_STALE_REQUEST_LIMIT, 60000);
try {
String factoryKey = getFactoryKeyForCapabilities(caps);
Factory factory = (Factory) WorldWind.createConfigurationComponent(factoryKey);
return factory.createFromConfigSource(caps, configParams);
} catch (Exception e) {
// Ignore the exception, and just return null.
}
return null;
}
示例9: addPoint
import gov.nasa.worldwind.WorldWind; //导入依赖的package包/类
private void addPoint( SimpleFeature pointFeature ) {
Geometry geometry = (Geometry) pointFeature.getDefaultGeometry();
if (geometry == null) {
return;
}
int numGeometries = geometry.getNumGeometries();
for( int i = 0; i < numGeometries; i++ ) {
Geometry geometryN = geometry.getGeometryN(i);
if (geometryN instanceof Point) {
Point point = (Point) geometryN;
FeaturePoint marker = new FeaturePoint(Position.fromDegrees(point.getY(), point.getX(), 0), featureStoreInfo);
marker.setFeature(pointFeature);
marker.setAltitudeMode(WorldWind.CLAMP_TO_GROUND);
marker.setAttributes(basicMarkerAttributes);
addRenderable(marker);
}
}
}
示例10: initWorldWindLayerModel
import gov.nasa.worldwind.WorldWind; //导入依赖的package包/类
private void initWorldWindLayerModel()
{
Model model = (Model) WorldWind.createConfigurationComponent(AVKey.MODEL_CLASS_NAME);
model.setShowWireframeExterior(false);
model.setShowWireframeInterior(false);
model.setShowTessellationBoundingVolumes(false);
if (is3DGlobe) {
model.setGlobe(new Earth());
} else {
model.setGlobe(new EarthFlat());
}
world = new WorldWindowGLCanvas();
world.setModel(model);
}
示例11: makeVerts
import gov.nasa.worldwind.WorldWind; //导入依赖的package包/类
protected void makeVerts(DrawContext dc, RectTile tile)
{
// First see if the vertices have been previously computed and are in the cache. Since the elevation model
// contents can change between frames, regenerate and re-cache vertices every second.
// TODO: Go back to event-generated geometry re-computation.
MemoryCache cache = WorldWind.getMemoryCache(CACHE_ID);
CacheKey cacheKey = this.createCacheKey(dc, tile);
tile.ri = (RenderInfo) cache.getObject(cacheKey);
if (tile.ri != null && tile.ri.time >= System.currentTimeMillis() - this.getUpdateFrequency())
return;
if (this.buildVerts(dc, tile, this.makeTileSkirts))
cache.add(cacheKey, tile.ri, tile.ri.getSizeInBytes());
}
示例12: dispose
import gov.nasa.worldwind.WorldWind; //导入依赖的package包/类
public void dispose() {
rwl.writeLock().lock();
isDisposed = true;
frame.dispose();
renderTools.setGrid(null);
if (centerGrid != null)
centerGrid.dispose();
centerGrid = null;
for (Grid2DOverlay grid : grids.values()) {
grid.dispose();
}
grids.clear();
for (TileKey tileKey : inMemory) {
TextureTile tile = (TextureTile)
WorldWind.getMemoryCache(TextureTile.class.getName())
.getObject(tileKey);
if (tile != null) {
WorldWind.getMemoryCache(TextureTile.class.getName())
.remove(tileKey);
}
}
invalid.addAll(valid);
inMemory.clear();
valid.clear();
rwl.writeLock().unlock();
}
示例13: sendRequests
import gov.nasa.worldwind.WorldWind; //导入依赖的package包/类
private void sendRequests()
{
Runnable task = this.requestQ.poll();
while (task != null)
{
if (!WorldWind.getTaskService().isFull())
{
WorldWind.getTaskService().addTask(task);
}
task = this.requestQ.poll();
}
}
示例14: sendRequests
import gov.nasa.worldwind.WorldWind; //导入依赖的package包/类
protected void sendRequests()
{
Runnable task = this.requestQ.poll();
while (task != null)
{
if (!WorldWind.getTaskService().isFull())
{
WorldWind.getTaskService().addTask(task);
}
task = this.requestQ.poll();
}
}
示例15: submitMissingTilesRequests
import gov.nasa.worldwind.WorldWind; //导入依赖的package包/类
protected synchronized void submitMissingTilesRequests() throws InterruptedException
{
RetrievalService rs = WorldWind.getRetrievalService();
int i = 0;
while (this.missingTiles.size() > i && rs.isAvailable())
{
Thread.sleep(1); // generates InterruptedException if thread has been interrupted
TextureTile tile = this.missingTiles.get(i);
if (this.layer.getLevels().isResourceAbsent(tile))
{
removeAbsentTile(tile); // tile is absent, count it off.
continue;
}
URL url = this.fileStore.findFile(tile.getPath(), false);
if (url != null)
{
// tile has been retrieved and is local now, count it as retrieved.
removeRetrievedTile(tile);
continue;
}
this.layer.retrieveRemoteTexture(tile, createBulkDownloadPostProcessor(tile));
i++;
}
}