예제 #1
0
  /**
   * 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
 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;
 }
 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();
 }
 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
 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
 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;
    }
 /**
  * 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
 public void addChild(TreeNode<T> child) {
   Assert.notNull(child, "child");
   if (children == null) {
     children = new LinkedList<TreeNode<T>>();
   }
   children.add(child);
   child.setParent(this);
 }
 /**
  * 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;
 }
 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
 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
 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;
 }
 private void setSampleStx(Stx stx) {
   Assert.notNull(stx, "stx");
   this.stx = stx;
 }
 private void setSampleScaling(Scaling scaling) {
   Assert.notNull(scaling, "scaling");
   this.scaling = scaling;
 }
예제 #17
0
 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
 public DirScanner(File baseDir, boolean recursive, boolean filesOnly) {
   Assert.notNull(baseDir, "baseDir");
   this.baseDir = baseDir;
   this.recursive = recursive;
   this.filesOnly = filesOnly;
 }
예제 #19
0
 public boolean isTypeDef(String name) {
   Assert.notNull(name, "name");
   return typeDefMap.containsKey(name) || (basisFormat != null && basisFormat.isTypeDef(name));
 }
예제 #20
0
 public DataContext createContext(IOHandler ioHandler) {
   Assert.notNull(ioHandler, "ioHandler");
   return new DataContextImpl(this, ioHandler);
 }
 /**
  * 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);
 }
 // 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
 public DataContext createContext(RandomAccessFile raf) {
   Assert.notNull(raf, "raf");
   return new DataContextImpl(this, new RandomAccessFileIOHandler(raf));
 }
예제 #24
0
 public void setName(String name) {
   Assert.notNull(name, "name");
   this.name = name;
 }
예제 #25
0
 public void setType(CompoundType type) {
   Assert.notNull(type, "type");
   this.type = type;
 }
예제 #26
0
 public void setByteOrder(ByteOrder byteOrder) {
   Assert.notNull(byteOrder, "byteOrder");
   this.byteOrder = byteOrder;
 }
예제 #27
0
 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
 public void setVersion(String version) {
   Assert.notNull(version, "version");
   this.version = version;
 }
예제 #30
0
 public Type removeTypeDef(String name) {
   Assert.notNull(name, "name");
   return typeDefMap.remove(name);
 }