本文整理汇总了Java中gov.nasa.worldwind.util.WWIO类的典型用法代码示例。如果您正苦于以下问题:Java WWIO类的具体用法?Java WWIO怎么用?Java WWIO使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WWIO类属于gov.nasa.worldwind.util包,在下文中一共展示了WWIO类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doGetOutputFile
import gov.nasa.worldwind.util.WWIO; //导入依赖的package包/类
protected File doGetOutputFile()
{
String suffix = WWIO.makeSuffixForMimeType(this.getRetriever().getContentType());
if (suffix == null)
{
Logging.logger().severe(
Logging.getMessage("generic.UnknownContentType", this.getRetriever().getContentType()));
return null;
}
String path = this.tile.getPathBase();
path += suffix;
File f = new File(path);
final File outFile = f.isAbsolute() ? f : getDataFileStore().newFile(path);
if (outFile == null)
return null;
return outFile;
}
示例2: formName
import gov.nasa.worldwind.util.WWIO; //导入依赖的package包/类
protected static String formName(Object kmlSource, KMLRoot kmlRoot)
{
KMLAbstractFeature rootFeature = kmlRoot.getFeature();
if (rootFeature != null && !WWUtil.isEmpty(rootFeature.getName()))
return rootFeature.getName();
if (kmlSource instanceof File)
return ((File) kmlSource).getName();
if (kmlSource instanceof URL)
return ((URL) kmlSource).getPath();
if (kmlSource instanceof String && WWIO.makeURL((String) kmlSource) != null)
return WWIO.makeURL((String) kmlSource).getPath();
return "KML Layer";
}
示例3: stageChanged
import gov.nasa.worldwind.util.WWIO; //导入依赖的package包/类
public void stageChanged(RenderingEvent event)
{
if (event.getStage().equals(RenderingEvent.AFTER_BUFFER_SWAP) && this.snapFile != null)
{
try
{
GLAutoDrawable glad = (GLAutoDrawable) event.getSource();
AWTGLReadBufferUtil glReadBufferUtil = new AWTGLReadBufferUtil(glad.getGLProfile(), false);
BufferedImage image = glReadBufferUtil.readPixelsToBufferedImage(glad.getGL(), true);
String suffix = WWIO.getSuffix(this.snapFile.getPath());
ImageIO.write(image, suffix, this.snapFile);
System.out.printf("Image saved to file %s\n", this.snapFile.getPath());
}
catch (IOException e)
{
e.printStackTrace();
}
finally
{
this.snapFile = null;
this.wwd.removeRenderingListener(this);
}
}
}
示例4: isTextureFileExpired
import gov.nasa.worldwind.util.WWIO; //导入依赖的package包/类
protected boolean isTextureFileExpired(TextureTile tile, java.net.URL textureURL, FileStore fileStore)
{
if (!WWIO.isFileOutOfDate(textureURL, tile.getLevel().getExpiryTime()))
return false;
// The file has expired. Delete it.
fileStore.removeFile(textureURL);
String message = Logging.getMessage("generic.DataFileExpired", textureURL);
Logging.logger().fine(message);
return true;
}
示例5: readTexture
import gov.nasa.worldwind.util.WWIO; //导入依赖的package包/类
/**
* Reads and returns the texture data at the specified URL, optionally converting it to the specified format and
* generating mip-maps. If <code>textureFormat</code> is a recognized mime type, this returns the texture data in
* the specified format. Otherwise, this returns the texture data in its native format. If <code>useMipMaps</code>
* is true, this generates mip maps for any non-DDS texture data, and uses any mip-maps contained in DDS texture
* data.
* <p/>
* Supported texture formats are as follows: <ul> <li><code>image/dds</code> - Returns DDS texture data, converting
* the data to DDS if necessary. If the data is already in DDS format it's returned as-is.</li> </ul>
*
* @param url the URL referencing the texture data to read.
* @param textureFormat the texture data format to return.
* @param useMipMaps true to generate mip-maps for the texture data or use mip maps already in the texture data,
* and false to read the texture data without generating or using mip-maps.
*
* @return TextureData the texture data from the specified URL, in the specified format and with mip-maps.
*/
protected TextureData readTexture(java.net.URL url, String textureFormat, boolean useMipMaps)
{
try
{
// If the caller has enabled texture compression, and the texture data is not a DDS file, then use read the
// texture data and convert it to DDS.
if ("image/dds".equalsIgnoreCase(textureFormat) && !url.toString().toLowerCase().endsWith("dds"))
{
// Configure a DDS compressor to generate mipmaps based according to the 'useMipMaps' parameter, and
// convert the image URL to a compressed DDS format.
DXTCompressionAttributes attributes = DDSCompressor.getDefaultCompressionAttributes();
attributes.setBuildMipmaps(useMipMaps);
ByteBuffer buffer = DDSCompressor.compressImageURL(url, attributes);
return OGLUtil.newTextureData(Configuration.getMaxCompatibleGLProfile(),
WWIO.getInputStreamFromByteBuffer(buffer), useMipMaps);
}
// If the caller has disabled texture compression, or if the texture data is already a DDS file, then read
// the texture data without converting it.
else
{
return OGLUtil.newTextureData(Configuration.getMaxCompatibleGLProfile(), url, useMipMaps);
}
}
catch (Exception e)
{
String msg = Logging.getMessage("layers.TextureLayer.ExceptionAttemptingToReadTextureFile", url);
Logging.logger().log(java.util.logging.Level.SEVERE, msg, e);
return null;
}
}
示例6: makeDisplayName
import gov.nasa.worldwind.util.WWIO; //导入依赖的package包/类
protected String makeDisplayName(Object source)
{
String name = WWIO.getSourcePath(source);
if (name != null)
name = WWIO.getFilename(name);
if (name == null)
name = "Shapefile";
return name;
}
示例7: initProductionParameters
import gov.nasa.worldwind.util.WWIO; //导入依赖的package包/类
protected void initProductionParameters(AVList params) {
// Preserve backward compatibility with previous versions of TiledImageProducer. If the caller specified a
// format suffix parameter, use it to compute the image format properties. This gives priority to the format
// suffix property to ensure applications which use format suffix continue to work.
if (params.getValue(AVKey.FORMAT_SUFFIX) != null) {
String s = WWIO.makeMimeTypeForSuffix(params.getValue(AVKey.FORMAT_SUFFIX).toString());
if (s != null) {
params.setValue(AVKey.IMAGE_FORMAT, s);
params.setValue(AVKey.AVAILABLE_IMAGE_FORMATS, new String[] { s });
}
}
if (params.getValue(AVKey.PIXEL_FORMAT) == null) {
params.setValue(AVKey.PIXEL_FORMAT, AVKey.IMAGE);
}
// Use the default image format if none exists.
if (params.getValue(AVKey.IMAGE_FORMAT) == null) {
params.setValue(AVKey.IMAGE_FORMAT, DEFAULT_IMAGE_FORMAT);
}
// Compute the available image formats if none exists.
if (params.getValue(AVKey.AVAILABLE_IMAGE_FORMATS) == null) {
params.setValue(AVKey.AVAILABLE_IMAGE_FORMATS, new String[] { params.getValue(AVKey.IMAGE_FORMAT).toString() });
}
// Compute the format suffix if none exists.
if (params.getValue(AVKey.FORMAT_SUFFIX) == null) {
params.setValue(AVKey.FORMAT_SUFFIX, WWIO.makeSuffixForMimeType(params.getValue(AVKey.IMAGE_FORMAT).toString()));
}
if (params.getValue("TRILOGIS") == null){
params.setValue("TRILOGIS", this.replaceWhitePixels);
}
}
示例8: doWrite
import gov.nasa.worldwind.util.WWIO; //导入依赖的package包/类
protected void doWrite(DataRaster raster, String formatSuffix, java.io.File file) throws java.io.IOException {
this.writeImage(raster, formatSuffix, file);
if (this.isWriteGeoreferenceFiles()) {
AVList worldFileParams = new AVListImpl();
this.initWorldFileParams(raster, worldFileParams);
java.io.File dir = file.getParentFile();
String base = WWIO.replaceSuffix(file.getName(), "");
String suffix = WWIO.getSuffix(file.getName());
String worldFileSuffix = this.suffixForWorldFile(suffix);
this.writeImageMetadata(new java.io.File(dir, base + "." + worldFileSuffix), worldFileParams);
}
}
示例9: initProductionParameters
import gov.nasa.worldwind.util.WWIO; //导入依赖的package包/类
protected void initProductionParameters(AVList params) {
// Preserve backward compatibility with previous versions of TiledImageProducer. If the caller specified a
// format suffix parameter, use it to compute the image format properties. This gives priority to the format
// suffix property to ensure applications which use format suffix continue to work.
if (params.getValue(AVKey.FORMAT_SUFFIX) != null) {
String s = WWIO.makeMimeTypeForSuffix(params.getValue(AVKey.FORMAT_SUFFIX).toString());
if (s != null) {
params.setValue(AVKey.IMAGE_FORMAT, s);
params.setValue(AVKey.AVAILABLE_IMAGE_FORMATS, new String[] { s });
}
}
if (params.getValue(AVKey.PIXEL_FORMAT) == null) {
params.setValue(AVKey.PIXEL_FORMAT, AVKey.IMAGE);
}
// Use the default image format if none exists.
if (params.getValue(AVKey.IMAGE_FORMAT) == null) {
params.setValue(AVKey.IMAGE_FORMAT, DEFAULT_IMAGE_FORMAT);
}
// Compute the available image formats if none exists.
if (params.getValue(AVKey.AVAILABLE_IMAGE_FORMATS) == null) {
params.setValue(AVKey.AVAILABLE_IMAGE_FORMATS, new String[] { params.getValue(AVKey.IMAGE_FORMAT).toString() });
}
// Compute the format suffix if none exists.
if (params.getValue(AVKey.FORMAT_SUFFIX) == null) {
params.setValue(AVKey.FORMAT_SUFFIX, WWIO.makeSuffixForMimeType(params.getValue(AVKey.IMAGE_FORMAT).toString()));
}
}
示例10: isTextureExpired
import gov.nasa.worldwind.util.WWIO; //导入依赖的package包/类
private boolean isTextureExpired( MercatorTextureTile tile, java.net.URL textureURL ) {
if (!WWIO.isFileOutOfDate(textureURL, tile.getLevel().getExpiryTime()))
return false;
// The file has expired. Delete it.
this.getDataFileStore().removeFile(textureURL);
String message = Logging.getMessage("generic.DataFileExpired", textureURL);
Logging.logger().fine(message);
return true;
}
示例11: isDeleteOnExit
import gov.nasa.worldwind.util.WWIO; //导入依赖的package包/类
protected boolean isDeleteOnExit(File outFile)
{
return outFile.getPath().contains(WWIO.DELETE_ON_EXIT_PREFIX);
}
示例12: saveBuffer
import gov.nasa.worldwind.util.WWIO; //导入依赖的package包/类
private void saveBuffer( java.nio.ByteBuffer buffer, java.io.File outFile ) throws java.io.IOException {
synchronized (this.fileLock) // synchronized with read of file in RequestTask.run()
{
WWIO.saveBuffer(buffer, outFile);
}
}
示例13: doWrite
import gov.nasa.worldwind.util.WWIO; //导入依赖的package包/类
protected void doWrite(DataRaster raster, String formatSuffix, File file) throws IOException
{
BufferedImageRaster bufferedImageRaster = (BufferedImageRaster) raster;
java.awt.image.BufferedImage image = bufferedImageRaster.getBufferedImage();
java.nio.ByteBuffer byteBuffer = ETC1DDSCompressor.compressImage(image);
// Do not force changes to the underlying filesystem. This drastically improves write performance.
boolean forceFilesystemWrite = false;
file = new File(file.getAbsolutePath().replace(".png", "") + ".dds");
WWIO.saveBuffer(byteBuffer, file, forceFilesystemWrite);
}
示例14: createConfigDoc
import gov.nasa.worldwind.util.WWIO; //导入依赖的package包/类
/**
* Returns a Layer configuration document which describes the tiled imagery produced by this TiledImageProducer. The
* document's contents are based on the configuration document for a TiledImageLayer, except this document describes
* an offline dataset. This returns null if the parameter list is null, or if the configuration document cannot be
* created for any reason.
*
* @param params
* the parameters which describe a Layer configuration document's contents.
* @return the configuration document, or null if the parameter list is null or does not contain the required
* parameters.
*/
protected Document createConfigDoc(AVList params) {
AVList configParams = params.copy();
// Determine a default display name if none exists.
if (configParams.getValue(AVKey.DISPLAY_NAME) == null) configParams.setValue(AVKey.DISPLAY_NAME, params.getValue(AVKey.DATASET_NAME));
// Set the SERVICE_NAME and NETWORK_RETRIEVAL_ENABLED parameters to indicate this dataset is offline.
if (configParams.getValue(AVKey.SERVICE_NAME) == null) configParams.setValue(AVKey.SERVICE_NAME, AVKey.SERVICE_NAME_OFFLINE);
configParams.setValue(AVKey.NETWORK_RETRIEVAL_ENABLED, Boolean.FALSE);
// Set the texture format to PKM. If the texture data is already in PKM format, this parameter is benign.
configParams.setValue(AVKey.TEXTURE_FORMAT, MIMETYPE);
// Set the USE_MIP_MAPS, and USE_TRANSPARENT_TEXTURES parameters to false. PKM don't support transparency
configParams.setValue(AVKey.USE_MIP_MAPS, Boolean.FALSE);
configParams.setValue(AVKey.USE_TRANSPARENT_TEXTURES, Boolean.FALSE);
configParams.setValue(AVKey.IMAGE_FORMAT, MIMETYPE);
configParams.setValue(AVKey.AVAILABLE_IMAGE_FORMATS, new String[] { MIMETYPE });
configParams.setValue(AVKey.FORMAT_SUFFIX, WWIO.makeSuffixForMimeType(MIMETYPE));
// Return a configuration file for a TiledPKMImageLayer.
return BasicTiledImageLayer.createTiledImageLayerConfigDocument(configParams);
}