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


Java ProgressMonitor类代码示例

本文整理汇总了Java中com.bc.ceres.core.ProgressMonitor的典型用法代码示例。如果您正苦于以下问题:Java ProgressMonitor类的具体用法?Java ProgressMonitor怎么用?Java ProgressMonitor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: main

import com.bc.ceres.core.ProgressMonitor; //导入依赖的package包/类
public static void main(String[] args) {
    try {
        Product product = ProductIO.readProduct("C:/Projects/BEAM/data/MER_RR__1P_A.N1");
        int width = product.getSceneRasterWidth();
        int height = product.getSceneRasterHeight();
        Band band = product.getBand("radiance_13");
        float[] scan = new float[width];
        for (int y = 0; y < height; y += 100) {
            band.readPixels(0, y, width, 1, scan, ProgressMonitor.NULL);
            for (int x = 0; x < width; x += 100) {
                float value = scan[x];
                System.out.println(value + " ");
            }
        }
        System.out.println();
        product.dispose();
    } catch (IOException e) {
        e.printStackTrace();  //To change body of catch statement use Options | File Templates.
    }

}
 
开发者ID:senbox-org,项目名称:snap-examples,代码行数:22,代码来源:BandEx.java

示例2: adjustImageInfos

import com.bc.ceres.core.ProgressMonitor; //导入依赖的package包/类
private void adjustImageInfos(RasterDataNode raster) {
    if (!isAdjustingImageInfos) {
        try {
            isAdjustingImageInfos = true;
            final String variableName = AbstractTimeSeries.rasterToVariableName(raster.getName());
            final List<Band> bandList = getBandsForVariable(variableName);
            final ImageInfo imageInfo = raster.getImageInfo(ProgressMonitor.NULL);
            if (imageInfo != null) {
                for (Band band : bandList) {
                    if (band != raster) {
                        band.setImageInfo(imageInfo.createDeepCopy());
                    }
                }
            }
        } finally {
            isAdjustingImageInfos = false;
        }
    }
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:20,代码来源:TimeSeriesImpl.java

示例3: nomalizeHSVExpressions

import com.bc.ceres.core.ProgressMonitor; //导入依赖的package包/类
private static void nomalizeHSVExpressions(final Product product, String[] hsvExpressions) {
    // normalize
    //range = max - min;
    //normvalue = min(max(((v- min)/range),0), 1);
    boolean modified = product.isModified();

    int i = 0;
    for (String exp : hsvExpressions) {
        if (exp.isEmpty()) continue;

        final String checkForNoDataValue = "";//getCheckForNoDataExpression(product, exp);

        final Band virtBand = createVirtualBand(product, exp, "tmpVirtBand" + i);

        final Stx stx = virtBand.getStx(false, ProgressMonitor.NULL);
        if (stx != null) {
            final double min = stx.getMinimum();
            final double range = stx.getMaximum() - min;
            hsvExpressions[i] = checkForNoDataValue + "min(max((((" + exp + ")- " + min + ")/" + range + "), 0), 1)";
        }
        product.removeBand(virtBand);
        ++i;
    }
    product.setModified(modified);
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:26,代码来源:OpenHSVImageViewAction.java

示例4: writeBandRasterData

import com.bc.ceres.core.ProgressMonitor; //导入依赖的package包/类
@Override
public void writeBandRasterData(Band sourceBand, int sourceOffsetX, int sourceOffsetY, int sourceWidth, int sourceHeight, ProductData sourceBuffer, ProgressMonitor pm) throws IOException {
    final Product sourceProduct = sourceBand.getProduct();
    final int numBands = sourceProduct.getNumBands();
    boolean shouldFinalize = numBands == processedCount.get();
    if (!shouldFinalize) {
        if (!this.processedBands.containsKey(sourceBand)) {
            this.processedBands.put(sourceBand, getScaledImage(sourceBand));
            processedCount.incrementAndGet();
            shouldFinalize = numBands == processedCount.get();
        }
        if (shouldFinalize) {
            finalizeWrite();
        }
    }
}
 
开发者ID:senbox-org,项目名称:s2tbx,代码行数:17,代码来源:JP2ProductWriter.java

示例5: start

import com.bc.ceres.core.ProgressMonitor; //导入依赖的package包/类
@Override
public void start() {
    Path sourceDirPath = ResourceInstaller.findModuleCodeBasePath(getClass()).resolve("auxdata/openjpeg");
    Path auxdataDirectory = OpenJpegExecRetriever.getOpenJPEGAuxDataPath();
    if (auxdataDirectory == null) {
        SystemUtils.LOG.severe("OpenJPEG configuration error: failed to retrieve auxdata path");
        return;
    }
    final ResourceInstaller resourceInstaller = new ResourceInstaller(sourceDirPath, auxdataDirectory);

    try {
        resourceInstaller.install(".*", ProgressMonitor.NULL);
        fixUpPermissions(auxdataDirectory);
    } catch (IOException e) {
        SystemUtils.LOG.severe("OpenJPEG configuration error: failed to create " + auxdataDirectory);
        return;
    }
}
 
开发者ID:senbox-org,项目名称:s2tbx,代码行数:19,代码来源:OpenJPEGActivator.java

示例6: loadImage

import com.bc.ceres.core.ProgressMonitor; //导入依赖的package包/类
private static void loadImage(final Product product, final Quicklook quicklook) {
    final StatusProgressMonitor qlPM = new StatusProgressMonitor(StatusProgressMonitor.TYPE.SUBTASK);
    qlPM.beginTask("Creating quicklook " + product.getName() + "... ", 100);

    ProgressMonitorSwingWorker<BufferedImage, Object> loader = new ProgressMonitorSwingWorker<BufferedImage, Object>
            (SnapApp.getDefault().getMainFrame(), "Loading quicklook image...") {

        @Override
        protected BufferedImage doInBackground(com.bc.ceres.core.ProgressMonitor pm) throws Exception {

            return quicklook.getImage(qlPM);
        }

        @Override
        protected void done() {
            qlPM.done();
        }
    };
    loader.execute();
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:21,代码来源:QuicklookToolView.java

示例7: readGeometry

import com.bc.ceres.core.ProgressMonitor; //导入依赖的package包/类
private VectorDataNode readGeometry(final SnapApp snapApp,
                                    final File file,
                                    final Product product)
        throws IOException, ExecutionException, InterruptedException {

    ProgressMonitorSwingWorker<VectorDataNode, Object> worker = new ProgressMonitorSwingWorker<VectorDataNode, Object>(snapApp.getMainFrame(), "Loading vector data") {
        @Override
        protected VectorDataNode doInBackground(ProgressMonitor pm) throws Exception {
            return reader.readVectorDataNode(file, product, pm);
        }

        @Override
        protected void done() {
            super.done();
        }
    };

    worker.executeWithBlocking();
    return worker.get();
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:21,代码来源:VectorDataNodeImporter.java

示例8: setBands

import com.bc.ceres.core.ProgressMonitor; //导入依赖的package包/类
public void setBands(Band[] bands) {
    Debug.assertNotNull(bands);
    this.bands = bands.clone();
    Arrays.sort(this.bands, new Comparator<Band>() {
        @Override
        public int compare(Band band1, Band band2) {
            final float v = band1.getSpectralWavelength() - band2.getSpectralWavelength();
            return v < 0.0F ? -1 : v > 0.0F ? 1 : 0;
        }
    });
    if (wavelengths == null || wavelengths.length != this.bands.length) {
        wavelengths = new double[this.bands.length];
    }
    if (energies == null || energies.length != this.bands.length) {
        energies = new double[this.bands.length];
    }
    for (int i = 0; i < wavelengths.length; i++) {
        wavelengths[i] = this.bands[i].getSpectralWavelength();
        energies[i] = 0.0f;
    }
    Range.computeRangeDouble(wavelengths, IndexValidator.TRUE, wavelengthRange, ProgressMonitor.NULL);
    Range.computeRangeDouble(energies, IndexValidator.TRUE, energyRange, ProgressMonitor.NULL);
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:24,代码来源:SpectrumGraph.java

示例9: allProductsOnSameGrid

import com.bc.ceres.core.ProgressMonitor; //导入依赖的package包/类
@SuppressWarnings({"MethodWithMoreThanThreeNegations"})
private boolean allProductsOnSameGrid() {
    Product refProduct = null;
    final List<ProductLocation> productLocations = getAssistantModel().getProductLocationsModel().getProductLocations();
    for (ProductLocation productLocation : productLocations) {
        for (Product product : productLocation.getProducts(ProgressMonitor.NULL).values()) {
            if (refProduct != null) {
                if (product != null && !refProduct.isCompatibleProduct(product, 0.1E-4f)) {
                    return false;
                }
            } else {
                if (product != null) {
                    refProduct = product;
                }
            }
        }
    }
    return true;
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:20,代码来源:TimeSeriesAssistantPage_SourceProducts.java

示例10: setImage

import com.bc.ceres.core.ProgressMonitor; //导入依赖的package包/类
private void setImage(final Product product, final Quicklook quicklook) {

        final BufferedImage img;
        if(quicklook != null && (quicklook.hasImage() || quicklook.hasCachedImage())) {
            img = quicklook.getImage(ProgressMonitor.NULL);
        } else {
            img = noDataImage;
        }

        if(currentProduct == product && imgPanel.getImage() == img) {
            return;
        }
        currentProduct = product;
        nameLabel.setText(product.getDisplayName());
        imgPanel.setImage(img);

        updateButtons();
    }
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:19,代码来源:QuicklookToolView.java

示例11: doInBackground

import com.bc.ceres.core.ProgressMonitor; //导入依赖的package包/类
@Override
protected Object doInBackground(ProgressMonitor pm) throws Exception {
    UIUtils.setRootFrameWaitCursor(ImageInfoEditor2.this);
    if (parentForm.getFormModel().isValid()) {
        final RasterDataNode[] rasters = parentForm.getFormModel().getRasters();
        try {
            pm.beginTask("Computing statistics", rasters.length);
            for (RasterDataNode raster : rasters) {
                raster.getStx(true, SubProgressMonitor.create(pm, 1));
            }
        } finally {
            pm.done();
        }
    }
    return null;
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:17,代码来源:ImageInfoEditor2.java

示例12: createS2LookupTable

import com.bc.ceres.core.ProgressMonitor; //导入依赖的package包/类
private void createS2LookupTable() throws IOException {
    File lutFile;
    URL lutResource;
    if (pathToLut != null && (new File(pathToLut)).exists()) {
        lutFile = new File(pathToLut);
    } else if ((lutResource = S2LutAccessor.class.getResource("sentinel-2a_lut_smsi_v0.6.memmap.d")) != null) {
        // search in resources as backup
        lutFile = new File(lutResource.getPath());
    } else {
        throw new IOException("");
    }

    S2LutAccessor s2LutAccessor = new S2LutAccessor(lutFile);
    s2Lut = s2LutAccessor.readLut(ProgressMonitor.NULL);
    aotGrid = s2Lut.getDimension(1).getSequence();
}
 
开发者ID:senbox-org,项目名称:s2tbx,代码行数:17,代码来源:S2AerosolOp.java

示例13: computeTile

import com.bc.ceres.core.ProgressMonitor; //导入依赖的package包/类
@Override
public void computeTile(Band targetBand, Tile targetTile, ProgressMonitor pm) throws OperatorException {
    Rectangle tarRec = targetTile.getRectangle();
    String targetBandName = targetBand.getName();
    final Rectangle srcRec = calcSourceRectangle(tarRec);

    Band sourceBand = lowresProduct.getBand(targetBandName);
    Tile sourceTile = getSourceTile(sourceBand, srcRec);
    Tile validTile = getSourceTile(validBand, tarRec);

    if (!targetBand.isFlagBand()) {
        upscaleTileBilinear(sourceTile, validTile, targetTile, tarRec);
    } else {
        upscaleFlagCopy(sourceTile, targetTile, tarRec);
    }
}
 
开发者ID:senbox-org,项目名称:s2tbx,代码行数:17,代码来源:S2AerosolUpscaleOp.java

示例14: createProductSceneImageRGB

import com.bc.ceres.core.ProgressMonitor; //导入依赖的package包/类
private ProductSceneImage createProductSceneImageRGB(String name, final Product product, String[] rgbaExpressions,
                                                     ProgressMonitor pm) throws Exception {
    Band[] rgbBands = null;
    boolean errorOccurred = false;
    ProductSceneImage productSceneImage = null;
    try {
        pm.beginTask("Creating RGB image...", 2);
        rgbBands = allocateRgbBands(product, rgbaExpressions);
        productSceneImage = new ProductSceneImage(name, rgbBands[0],
                                                  rgbBands[1],
                                                  rgbBands[2],
                                                  SnapApp.getDefault().getPreferencesPropertyMap(),
                                                  SubProgressMonitor.create(pm, 1));
        productSceneImage.initVectorDataCollectionLayer();
        productSceneImage.initMaskCollectionLayer();
    } catch (Exception e) {
        errorOccurred = true;
        throw e;
    } finally {
        pm.done();
        if (rgbBands != null) {
            releaseRgbBands(rgbBands, errorOccurred);
        }
    }
    return productSceneImage;
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:27,代码来源:OpenRGBImageViewAction.java

示例15: readVectorDataNode

import com.bc.ceres.core.ProgressMonitor; //导入依赖的package包/类
@Override
public VectorDataNode readVectorDataNode(File file, Product product, ProgressMonitor pm) throws IOException {

    DefaultFeatureCollection featureCollection = FeatureUtils.loadShapefileForProduct(file,
                                                                                      product,
                                                                                      crsProvider,
                                                                                      pm);
    Style[] styles = SLDUtils.loadSLD(file);
    ProductNodeGroup<VectorDataNode> vectorDataGroup = product.getVectorDataGroup();
    String name = VectorDataNodeImporter.findUniqueVectorDataNodeName(featureCollection.getSchema().getName().getLocalPart(),
                                                                      vectorDataGroup);
    if (styles.length > 0) {
        SimpleFeatureType featureType = SLDUtils.createStyledFeatureType(featureCollection.getSchema());


        VectorDataNode vectorDataNode = new VectorDataNode(name, featureType);
        DefaultFeatureCollection styledCollection = vectorDataNode.getFeatureCollection();
        String defaultCSS = vectorDataNode.getDefaultStyleCss();
        SLDUtils.applyStyle(styles[0], defaultCSS, featureCollection, styledCollection);
        return vectorDataNode;
    } else {
        return new VectorDataNode(name, featureCollection);
    }
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:25,代码来源:ImportVectorDataNodeFromShapefileAction.java


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