コード例 #1
0
ファイル: DataFormat.java プロジェクト: Holdlen2DH/nest
  /**
   * Creates a new random access file data context.
   *
   * @param file the file object
   * @param mode the access mode, one of <tt>"r"</tt>, <tt>"rw"</tt>, <tt>"rws"</tt>, or
   *     <tt>"rwd"</tt>. See also mode description in {@link
   *     RandomAccessFile#RandomAccessFile(java.io.File, String)}.
   * @return The context.
   * @throws FileNotFoundException If in read-only mode and the file could nt be found.
   */
  public DataContext createContext(File file, String mode) throws FileNotFoundException {
    Assert.notNull(file, "file");
    Assert.notNull(mode, "mode");
    final RandomAccessFile raf = new RandomAccessFile(file, mode);
    return new DataContextImpl(this, new RandomAccessFileIOHandler(raf)) {
      private boolean disposed;

      @Override
      public synchronized void dispose() {
        super.dispose();
        disposed = true;
        try {
          raf.close();
        } catch (IOException e) {
          // ignore
        }
      }

      @Override
      protected void finalize() throws Throwable {
        super.finalize();
        if (!disposed) {
          dispose();
        }
      }
    };
  }
コード例 #2
0
ファイル: ExtensionImpl.java プロジェクト: Holdlen2DH/nest
 public ExtensionImpl(String point, ConfigurationElementImpl configurationElement, String id) {
   Assert.notNull(point, "point");
   Assert.notNull(configurationElement, "configurationElement");
   this.point = point;
   this.configurationElement = configurationElement;
   this.configurationElement.setDeclaringExtension(this);
   this.id = id;
 }
コード例 #3
0
 TimeRangeProductFilter(
     BinningProductFilter parent, ProductData.UTC rangeStart, ProductData.UTC rangeEnd) {
   setParent(parent);
   Assert.notNull(rangeStart, "rangeStart");
   Assert.notNull(rangeEnd, "rangeEnd");
   this.rangeStart = rangeStart.getAsDate();
   this.rangeEnd = rangeEnd.getAsDate();
 }
コード例 #4
0
 public ColorManipulationForm(TopComponent colorManipulationToolView, FormModel formModel) {
   Assert.notNull(colorManipulationToolView);
   Assert.notNull(formModel);
   this.toolView = colorManipulationToolView;
   this.formModel = formModel;
   productNodeListener = new ColorManipulationPNL();
   sceneViewChangeListener = new SceneViewImageInfoChangeListener();
   titlePrefix = this.formModel.getTitlePrefix();
   emptyForm = new EmptyImageInfoForm(this);
 }
コード例 #5
0
ファイル: RapidEyeL1Reader.java プロジェクト: stevefoga/s2tbx
 private void addBandToProduct(Product product, NITFReaderWrapper reader, int bandIndex) {
   Assert.notNull(product);
   Assert.notNull(reader);
   Band band = product.addBand(RapidEyeConstants.BAND_NAMES[bandIndex], metadata.getPixelFormat());
   band.setSpectralWavelength(RapidEyeConstants.WAVELENGTHS[bandIndex]);
   band.setUnit("nm");
   band.setSpectralBandwidth(RapidEyeConstants.BANDWIDTHS[bandIndex]);
   band.setSpectralBandIndex(bandIndex);
   band.setScalingFactor(metadata.getScaleFactor(bandIndex));
   readerMap.put(band, reader);
 }
コード例 #6
0
ファイル: DataFormat.java プロジェクト: Holdlen2DH/nest
 public void addTypeDef(String name, Type type) {
   Assert.notNull(name, "name");
   Assert.notNull(type, "type");
   Type oldType = typeDefMap.get(name);
   if (oldType != null && !oldType.equals(type)) {
     throw new IllegalArgumentException(
         MessageFormat.format(
             "Type definition ''{0}'' already known as ''{1}''", name, oldType.getName()));
   }
   typeDefMap.put(name, type);
 }
コード例 #7
0
    private BufferedImage createThumbNailImage(Dimension imgSize, ProgressMonitor pm) {
      Assert.notNull(pm, "pm");

      String thumbNailBandName = getThumbnailBandName();
      Band thumbNailBand = product.getBand(thumbNailBandName);

      Debug.trace(
          "ProductSubsetDialog: Reading thumbnail data for band '" + thumbNailBandName + "'...");
      pm.beginTask("Creating thumbnail image", 5);
      BufferedImage image = null;
      try {
        MultiLevelSource multiLevelSource =
            BandImageMultiLevelSource.create(thumbNailBand, SubProgressMonitor.create(pm, 1));
        final ImageLayer imageLayer = new ImageLayer(multiLevelSource);
        final int imageWidth = imgSize.width;
        final int imageHeight = imgSize.height;
        final int imageType = BufferedImage.TYPE_3BYTE_BGR;
        image = new BufferedImage(imageWidth, imageHeight, imageType);
        Viewport snapshotVp = new DefaultViewport(isModelYAxisDown(imageLayer));
        final BufferedImageRendering imageRendering = new BufferedImageRendering(image, snapshotVp);

        final Graphics2D graphics = imageRendering.getGraphics();
        graphics.setColor(getBackground());
        graphics.fillRect(0, 0, imageWidth, imageHeight);

        snapshotVp.zoom(imageLayer.getModelBounds());
        snapshotVp.moveViewDelta(snapshotVp.getViewBounds().x, snapshotVp.getViewBounds().y);
        imageLayer.render(imageRendering);

        pm.worked(4);
      } finally {
        pm.done();
      }
      return image;
    }
コード例 #8
0
 /**
  * Removes the given node from this group.
  *
  * @param node the node to be removed
  * @return true, if the node was removed
  */
 public boolean remove(T node) {
   Assert.notNull(node, "node");
   boolean removed = nodeList.remove(node);
   if (removed) {
     notifyRemoved(node);
   }
   return removed;
 }
コード例 #9
0
 @Override
 public Layer createLayer(LayerContext ctx, PropertySet configuration) {
   Assert.notNull(ctx, "ctx");
   final ProductLayerContext plc = (ProductLayerContext) ctx;
   final String vectorDataName = (String) configuration.getValue(PROPERTY_NAME_VECTOR_DATA);
   final VectorDataNode vectorDataNode = plc.getProduct().getVectorDataGroup().get(vectorDataName);
   return createLayer(vectorDataNode, configuration);
 }
コード例 #10
0
ファイル: TreeNode.java プロジェクト: Holdlen2DH/nest
 public void addChild(TreeNode<T> child) {
   Assert.notNull(child, "child");
   if (children == null) {
     children = new LinkedList<TreeNode<T>>();
   }
   children.add(child);
   child.setParent(this);
 }
コード例 #11
0
 /**
  * Adds the given node to this group.
  *
  * @param node the node to be added, ignored if <code>null</code>
  * @return true, if the node has been added
  */
 public boolean add(T node) {
   Assert.notNull(node, "node");
   boolean added = nodeList.add(node);
   if (added) {
     notifyAdded(node);
   }
   return added;
 }
コード例 #12
0
 public MaskCollectionLayer(
     MaskCollectionLayerType layerType, RasterDataNode raster, PropertySet configuration) {
   super(layerType, configuration, "Masks");
   Assert.notNull(raster, "raster");
   this.raster = raster;
   this.maskPNL = new MaskPNL();
   setId(ID);
   getProduct().addProductNodeListener(maskPNL);
   addListener(new VisibilityLL());
 }
コード例 #13
0
ファイル: TreeNode.java プロジェクト: Holdlen2DH/nest
 public boolean removeChild(TreeNode<T> child) {
   Assert.notNull(child, "child");
   boolean suceess = false;
   if (children != null) {
     suceess = children.remove(child);
     if (suceess) {
       child.setParent(null);
     }
   }
   return suceess;
 }
コード例 #14
0
ファイル: DataFormat.java プロジェクト: Holdlen2DH/nest
 public Type getTypeDef(String name) {
   Assert.notNull(name, "name");
   Type type = typeDefMap.get(name);
   if (type == null) {
     type = basisFormat != null ? basisFormat.getTypeDef(name) : null;
   }
   if (type == null) {
     throw new IllegalArgumentException(
         MessageFormat.format("Type definition ''{0}'' not found", name));
   }
   return type;
 }
コード例 #15
0
 private void setSampleStx(Stx stx) {
   Assert.notNull(stx, "stx");
   this.stx = stx;
 }
コード例 #16
0
 private void setSampleScaling(Scaling scaling) {
   Assert.notNull(scaling, "scaling");
   this.scaling = scaling;
 }
コード例 #17
0
ファイル: DirScanner.java プロジェクト: Holdlen2DH/nest
 public String[] scan(FilenameFilter filter) {
   Assert.notNull(filter, "filter");
   ArrayList<String> strings = new ArrayList<String>(16);
   collectFiles(filter, "", strings);
   return strings.toArray(new String[0]);
 }
コード例 #18
0
ファイル: DirScanner.java プロジェクト: Holdlen2DH/nest
 public DirScanner(File baseDir, boolean recursive, boolean filesOnly) {
   Assert.notNull(baseDir, "baseDir");
   this.baseDir = baseDir;
   this.recursive = recursive;
   this.filesOnly = filesOnly;
 }
コード例 #19
0
ファイル: DataFormat.java プロジェクト: Holdlen2DH/nest
 public boolean isTypeDef(String name) {
   Assert.notNull(name, "name");
   return typeDefMap.containsKey(name) || (basisFormat != null && basisFormat.isTypeDef(name));
 }
コード例 #20
0
ファイル: DataFormat.java プロジェクト: Holdlen2DH/nest
 public DataContext createContext(IOHandler ioHandler) {
   Assert.notNull(ioHandler, "ioHandler");
   return new DataContextImpl(this, ioHandler);
 }
コード例 #21
0
 /**
  * Adds the given node to this group.
  *
  * @param index the index.
  * @param node the node to be added, ignored if <code>null</code>
  */
 public void add(int index, T node) {
   Assert.notNull(node, "node");
   nodeList.add(index, node);
   notifyAdded(node);
 }
コード例 #22
0
 // todo - Put this into interface ReconfigurableProductReader and make DimapProductReader
 // implement it
 public void bindProduct(Object input, Product existingProduct) throws IOException {
   Assert.notNull(input, "input");
   Assert.notNull(existingProduct, "existingProduct");
   setInput(input);
   processProduct(existingProduct);
 }
コード例 #23
0
ファイル: DataFormat.java プロジェクト: Holdlen2DH/nest
 public DataContext createContext(RandomAccessFile raf) {
   Assert.notNull(raf, "raf");
   return new DataContextImpl(this, new RandomAccessFileIOHandler(raf));
 }
コード例 #24
0
ファイル: DataFormat.java プロジェクト: Holdlen2DH/nest
 public void setName(String name) {
   Assert.notNull(name, "name");
   this.name = name;
 }
コード例 #25
0
ファイル: DataFormat.java プロジェクト: Holdlen2DH/nest
 public void setType(CompoundType type) {
   Assert.notNull(type, "type");
   this.type = type;
 }
コード例 #26
0
ファイル: DataFormat.java プロジェクト: Holdlen2DH/nest
 public void setByteOrder(ByteOrder byteOrder) {
   Assert.notNull(byteOrder, "byteOrder");
   this.byteOrder = byteOrder;
 }
コード例 #27
0
ファイル: TreeNode.java プロジェクト: Holdlen2DH/nest
 public TreeNode(String id) {
   Assert.notNull(id, "id");
   this.id = id;
   this.children = new LinkedList<TreeNode<T>>();
 }
 public UndoableDisplacementBandsCreation(Product product, Band[] displacementBands) {
   Assert.notNull(product, "product");
   Assert.notNull(displacementBands, "displacementBands");
   this.product = product;
   this.displacementBands = displacementBands;
 }
コード例 #29
0
ファイル: DataFormat.java プロジェクト: Holdlen2DH/nest
 public void setVersion(String version) {
   Assert.notNull(version, "version");
   this.version = version;
 }
コード例 #30
0
ファイル: DataFormat.java プロジェクト: Holdlen2DH/nest
 public Type removeTypeDef(String name) {
   Assert.notNull(name, "name");
   return typeDefMap.remove(name);
 }