當前位置: 首頁>>代碼示例>>Java>>正文


Java Debug類代碼示例

本文整理匯總了Java中org.esa.snap.core.util.Debug的典型用法代碼示例。如果您正苦於以下問題:Java Debug類的具體用法?Java Debug怎麽用?Java Debug使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Debug類屬於org.esa.snap.core.util包,在下文中一共展示了Debug類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getCompatibleProducts

import org.esa.snap.core.util.Debug; //導入依賴的package包/類
private Product[] getCompatibleProducts() {
    if (targetProduct == null) {
        return null;
    }
    final Vector<Product> compatibleProducts = new Vector<>();
    compatibleProducts.add(targetProduct);
        final float geolocationEps = 180;
        Debug.trace("BandArithmetikDialog.geolocationEps = " + geolocationEps);
        Debug.trace("BandArithmetikDialog.getCompatibleProducts:");
        Debug.trace("  comparing: " + targetProduct.getName());
        for (int i = 0; i < productsList.size(); i++) {
            final Product product = productsList.getAt(i);
            if (targetProduct != product) {
                Debug.trace("  with:      " + product.getDisplayName());
                final boolean compatibleProduct = targetProduct.isCompatibleProduct(product, geolocationEps);
                Debug.trace("  result:    " + compatibleProduct);
                if (compatibleProduct) {
                    compatibleProducts.add(product);
                }
            }
        }
    return compatibleProducts.toArray(new Product[compatibleProducts.size()]);
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:24,代碼來源:BandMathsOpUI.java

示例2: createEditExpressionButtonListener

import org.esa.snap.core.util.Debug; //導入依賴的package包/類
private ActionListener createEditExpressionButtonListener() {
    return new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            ProductExpressionPane pep = ProductExpressionPane.createGeneralExpressionPane(getCompatibleProducts(),
                    targetProduct, appContext.getPreferences());
            pep.setCode(paramExpression.getValueAsText());
            int status = pep.showModalDialog(SwingUtilities.getWindowAncestor(panel), "Arithmetic Expression Editor");
            if (status == ModalDialog.ID_OK) {
                paramExpression.setValue(pep.getCode(), null);
                Debug.trace("BandArithmetikDialog: expression is: " + pep.getCode());

                bandDesc.expression = paramExpression.getValueAsText();
            }
            pep.dispose();
            pep = null;
        }
    };
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:20,代碼來源:BandMathsOpUI.java

示例3: figureChanged

import org.esa.snap.core.util.Debug; //導入依賴的package包/類
@Override
public void figureChanged(FigureChangeEvent event) {
    final Figure sourceFigure = event.getSourceFigure();
    if (sourceFigure instanceof SimpleFeatureFigure) {
        SimpleFeatureFigure featureFigure = (SimpleFeatureFigure) sourceFigure;
        try {
            final VectorDataNode vectorDataNode = getVectorDataNode();
            final SimpleFeature simpleFeature = featureFigure.getSimpleFeature();
            Debug.trace("VectorDataLayer$FigureChangeHandler: vectorDataNode=" + vectorDataNode.getName() +
                                ", featureType=" + simpleFeature.getFeatureType().getTypeName());
            reactingAgainstFigureChange = true;
            vectorDataNode.fireFeaturesChanged(simpleFeature);
            // checkme - we could do better by computing changed modelRegion instead of passing null (nf)
            fireLayerDataChanged(null);
        } finally {
            reactingAgainstFigureChange = false;
        }
    }
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:20,代碼來源:VectorDataLayer.java

示例4: actionPerformed

import org.esa.snap.core.util.Debug; //導入依賴的package包/類
@Override
public void actionPerformed(ActionEvent e) {
    ProductChooser productChooser = new ProductChooser(appContext.getApplicationWindow(), "Add product",
                                                       ModalDialog.ID_OK_CANCEL, null,
                                                       filterProducts());
    if (productChooser.show() != ModalDialog.ID_OK) {
        return;
    }
    try {
        if (productChooser.getSelectedProducts().size() > 0) {
            listModel.addElements(productChooser.getSelectedProducts().toArray());
        }
    } catch (ValidationException ve) {
        Debug.trace(ve);
    }
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:17,代碼來源:AddProductAction.java

示例5: insertFigures

import org.esa.snap.core.util.Debug; //導入依賴的package包/類
@Override
public void insertFigures(boolean performInsert, Figure... figures) {
    Debug.trace("VectorDataFigureEditor.insertFigures " + performInsert + ", " + figures.length);
    if (vectorDataNode != null) {
        List<SimpleFeature> simpleFeatures = toSimpleFeatureList(figures);
        vectorDataNode.getFeatureCollection().addAll(simpleFeatures);
        getUndoContext().postEdit(new FigureInsertEdit(this, performInsert, figures) {
            @Override
            public void undo() throws CannotUndoException {
                super.undo();
                vectorDataNode.getFeatureCollection().removeAll(simpleFeatures);
            }

            @Override
            public void redo() throws CannotRedoException {
                super.redo();
                vectorDataNode.getFeatureCollection().addAll(simpleFeatures);
            }
        });
    } else {
        // warn
        super.insertFigures(performInsert, figures);
    }
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:25,代碼來源:VectorDataFigureEditor.java

示例6: deleteFigures

import org.esa.snap.core.util.Debug; //導入依賴的package包/類
@Override
public void deleteFigures(boolean performDelete, Figure... figures) {
    Debug.trace("VectorDataFigureEditor.deleteFigures " + performDelete + ", " + figures.length);
    if (vectorDataNode != null) {
        List<SimpleFeature> simpleFeatures = toSimpleFeatureList(figures);
        vectorDataNode.getFeatureCollection().removeAll(simpleFeatures);
        getUndoContext().postEdit(new FigureDeleteEdit(this, performDelete, figures) {
            @Override
            public void undo() throws CannotUndoException {
                super.undo();
                vectorDataNode.getFeatureCollection().addAll(simpleFeatures);
            }

            @Override
            public void redo() throws CannotRedoException {
                super.redo();
                vectorDataNode.getFeatureCollection().removeAll(simpleFeatures);
            }
        });
    } else {
        // warn
        super.deleteFigures(performDelete, figures);
    }
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:25,代碼來源:VectorDataFigureEditor.java

示例7: getCompatibleProducts

import org.esa.snap.core.util.Debug; //導入依賴的package包/類
private static Product[] getCompatibleProducts(final Product targetProduct, final Product[] productsList) {
    final List<Product> compatibleProducts = new ArrayList<>(1);
    compatibleProducts.add(targetProduct);
    final float geolocationEps = 180;
    Debug.trace("BandMathsDialog.geolocationEps = " + geolocationEps);
    Debug.trace("BandMathsDialog.getCompatibleProducts:");
    Debug.trace("  comparing: " + targetProduct.getName());
    if (productsList != null) {
        for (final Product product : productsList) {
            if (targetProduct != product) {
                Debug.trace("  with:      " + product.getDisplayName());
                final boolean isCompatibleProduct = targetProduct.isCompatibleProduct(product, geolocationEps);
                Debug.trace("  result:    " + isCompatibleProduct);
                if (isCompatibleProduct) {
                    compatibleProducts.add(product);
                }
            }
        }
    }
    return compatibleProducts.toArray(new Product[compatibleProducts.size()]);
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:22,代碼來源:RGBImageProfilePane.java

示例8: actionPerformed

import org.esa.snap.core.util.Debug; //導入依賴的package包/類
@Override
public void actionPerformed(ActionEvent event) {
    JFileChooser fileChooser = new JFileChooser();
    FileNameExtensionFilter parameterFileFilter = createParameterFileFilter();
    fileChooser.addChoosableFileFilter(parameterFileFilter);
    fileChooser.setFileFilter(parameterFileFilter);
    fileChooser.setDialogTitle(TITLE);
    fileChooser.setDialogType(JFileChooser.OPEN_DIALOG);
    applyCurrentDirectory(fileChooser);
    int response = fileChooser.showDialog(parentComponent, "Load");
    if (JFileChooser.APPROVE_OPTION == response) {
        try {
            preserveCurrentDirectory(fileChooser);
            readFromFile(fileChooser.getSelectedFile());
        } catch (Exception e) {
            Debug.trace(e);
            AbstractDialog.showErrorDialog(parentComponent, "Could not load parameters.\n" + e.getMessage(), TITLE);
        }
    }
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:21,代碼來源:OperatorMenu.java

示例9: setBands

import org.esa.snap.core.util.Debug; //導入依賴的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

示例10: readValues

import org.esa.snap.core.util.Debug; //導入依賴的package包/類
public void readValues() {
    Debug.assertNotNull(bands);
    for (int i = 0; i < bands.length; i++) {
        final Band band = bands[i];
        if (placemark != null) {
            // position of placemark is given in image (L0) coordinates
            // we have to transform them to the current level
            final MultiLevelModel multiLevelModel = band.getMultiLevelModel();
            final AffineTransform i2mTransform = multiLevelModel.getImageToModelTransform(0);
            final AffineTransform m2iTransform = multiLevelModel.getModelToImageTransform(0);
            final Point2D modelPixel = i2mTransform.transform(placemark.getPixelPos(), null);
            final Point2D imagePixel = m2iTransform.transform(modelPixel, null);
            int pixelX = (int) Math.floor(imagePixel.getX());
            int pixelY = (int) Math.floor(imagePixel.getY());
            energies[i] = getSample(band, pixelX, pixelY, 0);
        }
    }
    IndexValidator validator = new IndexValidator() {
        @Override
        public boolean validateIndex(int index) {
            return energies[index] != bands[index].getGeophysicalNoDataValue();
        }
    };
    Range.computeRangeDouble(energies, validator, energyRange, ProgressMonitor.NULL);
    // no invalidate() call here, SpectrumDiagram does this
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:27,代碼來源:SpectrumGraph.java

示例11: createProductSceneImage

import org.esa.snap.core.util.Debug; //導入依賴的package包/類
private ProductSceneImage createProductSceneImage(final RasterDataNode raster, ProductSceneView existingView, com.bc.ceres.core.ProgressMonitor pm) {
    Debug.assertNotNull(raster);
    Debug.assertNotNull(pm);

    try {
        pm.beginTask("Creating image...", 1);

        ProductSceneImage sceneImage;
        if (existingView != null) {
            sceneImage = new ProductSceneImage(raster, existingView);
        } else {
            sceneImage = new ProductSceneImage(raster,
                                               SnapApp.getDefault().getPreferencesPropertyMap(),
                                               SubProgressMonitor.create(pm, 1));
        }
        sceneImage.initVectorDataCollectionLayer();
        sceneImage.initMaskCollectionLayer();
        return sceneImage;
    } finally {
        pm.done();
    }
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:23,代碼來源:OpenImageViewAction.java

示例12: updateBandList

import org.esa.snap.core.util.Debug; //導入依賴的package包/類
private void updateBandList(final Product product, final Property bandProperty, boolean considerReferenceSize) {
    if (product == null) {
        return;
    }

    final ValueSet bandValueSet = new ValueSet(createAvailableBandList(product, considerReferenceSize));
    bandProperty.getDescriptor().setValueSet(bandValueSet);
    if (bandValueSet.getItems().length > 0) {
        RasterDataNode currentRaster = getRaster();
        if (bandValueSet.contains(getRaster())) {
            currentRaster = getRaster();
        }
        try {
            bandProperty.setValue(currentRaster);
        } catch (ValidationException ignored) {
            Debug.trace(ignored);
        }
    }
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:20,代碼來源:DensityPlotPanel.java

示例13: createOpenPatchProductAction

import org.esa.snap.core.util.Debug; //導入依賴的package包/類
public Action createOpenPatchProductAction(final Patch patch) {
    File patchProductFile = null;
    if (getSession().hasClassifier()) {
        try {
            patchProductFile = getSession().getPatchProductFile(patch);
        } catch (IOException ignore) {
            Debug.trace(ignore);
        }
    }

    if (patchProductFile == null || !patchProductFile.exists()) {
        return null;
    }

    return new ShowPatchInProductAction("Open Patch Product", patch, patchProductFile);
}
 
開發者ID:bcdev,項目名稱:esa-pfa,代碼行數:17,代碼來源:PatchContextMenuFactory.java

示例14: createProjectedImage

import org.esa.snap.core.util.Debug; //導入依賴的package包/類
private MultiLevelImage createProjectedImage(final GeoCoding sourceGeoCoding, final MultiLevelImage sourceImage,
                                             MultiLevelModel sourceModel, final Band targetBand, final Interpolation resampling,
                                             MultiLevelModel targetModel, Reproject reprojection) {
    final CoordinateReferenceSystem sourceModelCrs = Product.findModelCRS(sourceGeoCoding);
    final CoordinateReferenceSystem targetModelCrs = Product.findModelCRS(targetBand.getGeoCoding());
    final AffineTransform sourceImageToMapTransform = Product.findImageToModelTransform(sourceGeoCoding);
    final AffineTransform targetImageToMapTransform = Product.findImageToModelTransform(targetBand.getGeoCoding());

    return new DefaultMultiLevelImage(new AbstractMultiLevelSource(targetModel) {

        @Override
        public RenderedImage createImage(int targetLevel) {
            final double targetScale = targetModel.getScale(targetLevel);
            final int sourceLevel = sourceImage.getModel().getLevel(targetScale);
            RenderedImage leveledSourceImage = sourceImage.getImage(sourceLevel);

            final Rectangle sourceBounds = new Rectangle(leveledSourceImage.getMinX(),
                    leveledSourceImage.getMinY(),
                    leveledSourceImage.getWidth(),
                    leveledSourceImage.getHeight());

            // the following transformation maps the source level image to level zero and then to the model,
            // which either is a map or an image CRS
            final AffineTransform i2mSource = sourceModel.getImageToModelTransform(sourceLevel);
            i2mSource.concatenate(sourceModel.getModelToImageTransform(0));
            i2mSource.concatenate(sourceImageToMapTransform);
            ImageGeometry sourceGeometry = new ImageGeometry(sourceBounds,
                    sourceModelCrs,
                    i2mSource);

            ImageLayout imageLayout = ImageManager.createSingleBandedImageLayout(
                    ImageManager.getDataBufferType(targetBand.getDataType()),
                    targetBand.getRasterWidth(),
                    targetBand.getRasterHeight(),
                    targetProduct.getPreferredTileSize(),
                    ResolutionLevel.create(getModel(), targetLevel));
            Rectangle targetBounds = new Rectangle(imageLayout.getMinX(null), imageLayout.getMinY(null),
                    imageLayout.getWidth(null), imageLayout.getHeight(null));

            // the following transformation maps the target level image to level zero and then to the model,
            // which always is a map
            final AffineTransform i2mTarget = getModel().getImageToModelTransform(targetLevel);
            i2mTarget.concatenate(getModel().getModelToImageTransform(0));
            i2mTarget.concatenate(targetImageToMapTransform);

            ImageGeometry targetGeometry = new ImageGeometry(targetBounds,
                    targetModelCrs,
                    i2mTarget);
            Hints hints = new Hints(JAI.KEY_IMAGE_LAYOUT, imageLayout);
            hints.put(Hints.LENIENT_DATUM_SHIFT, Boolean.TRUE);

            Dimension tileSize = ImageManager.getPreferredTileSize(targetProduct);
            try {
                return reprojection.reproject(leveledSourceImage, sourceGeometry, targetGeometry,
                        targetBand.getNoDataValue(), resampling, hints, targetLevel,
                        tileSize);
            } catch (FactoryException | TransformException e) {
                Debug.trace(e);
                throw new RuntimeException(e);
            }
        }
    });
}
 
開發者ID:senbox-org,項目名稱:s2tbx,代碼行數:64,代碼來源:S2tbxReprojectionOp.java

示例15: addProduct

import org.esa.snap.core.util.Debug; //導入依賴的package包/類
/**
 * Allows clients to add single products.
 *
 * @param product A product to add.
 */
public void addProduct(Product product) {
    if (product != null) {
        try {
            listModel.addElements(product);
        } catch (ValidationException ve) {
            Debug.trace(ve);
        }
    }
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:15,代碼來源:SourceProductList.java


注:本文中的org.esa.snap.core.util.Debug類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。