Examples of ImageInstance


Examples of de.ailis.jollada.model.ImageInstance

        catch (final URISyntaxException e)
        {
            throw new ParserException(urlString + " is not a valid URI: " + e,
                e);
        }
        final ImageInstance imageInstance = new ImageInstance(url);
        imageInstance.setName(attributes.getValue("name"));
        imageInstance.setSid(attributes.getValue("sid"));
        ((Sampler2DParam) this.profileParam).setImageInstance(imageInstance);
        enterElement(ParserMode.INSTANCE_IMAGE);
    }
View Full Code Here

Examples of org.photovault.imginfo.ImageInstance

        digester.addFactoryCreate( "*/instance/crop", new RectangleFactory() );
        digester.addSetNext( "*/instance/crop", "setCropBounds" );
        digester.addRule( "*/instance/hash", new Rule() {
            public void body( String namespace, String name, String text ) {
                byte[] hash = Base64.decode( text );
                ImageInstance i = (ImageInstance) digester.peek();
                i.setHash( hash );
            }
        } );
        digester.addRuleSet( new ChannelMapRuleSet( "*/instance/") );
        digester.addRule( "*/instance/color-mapping", new Rule() {
            public void end( String namespace, String name ) {
                ImageInstance i = (ImageInstance) digester.peek(1);
                ChannelMapOperationFactory f =
                        (ChannelMapOperationFactory) digester.peek();
                i.setColorChannelMapping( f.create() );               
            }
        });
        // Raw conversion parsing was already specified earlier. We just need a
        // method for binding the RawConversionSettings object to instance
        digester.addObjectCreate( "*/instance/raw-conversion", RawSettingsFactory.class );
        digester.addRule( "*/instance/raw-conversion", new Rule() {
            public void end( String namespace, String name ) {
                ImageInstance i = (ImageInstance)digester.peek(1);
                RawSettingsFactory f = (RawSettingsFactory) digester.peek();
                try {
                    i.setRawSettings( f.create() );
                } catch (PhotovaultException ex) {
                    digester.createSAXException( ex );
                }
            }
        })
View Full Code Here

Examples of org.photovault.imginfo.ImageInstance

        }
       
        public Object createObject( Attributes attrs ) {
            String uuidStr = attrs.getValue( "id" );
            UUID uuid = UUID.fromString( uuidStr );
            ImageInstance i = null;
            i = ImageInstance.retrieveByUuid(uuid);
            if ( i == null ) {
                i = ImageInstance.create( uuid );
            }
            String type = attrs.getValue( "type" );
            if ( type != null ) {
                if ( type.equals( "original" ) ) {
                    i.setInstanceType( ImageInstance.INSTANCE_TYPE_ORIGINAL );
                } else if ( type.equals( "thumbnail" ) ) {
                    i.setInstanceType( ImageInstance.INSTANCE_TYPE_THUMBNAIL );
                } else if ( type.equals( "modified" ) ) {
                    i.setInstanceType( ImageInstance.INSTANCE_TYPE_MODIFIED );
                } else {
                    log.error( "ERROR: Unknown instance type \"" + type +
                            "\" for instance with uuid " + uuid );
                }
               
View Full Code Here

Examples of org.photovault.imginfo.ImageInstance

        ColorCurve c = cm.getChannelCurve( "value" );
        assertEquals( 0.4, c.getY( 1 ) );
        assertEquals( 0.5, c.getX( 1 ) );
        boolean foundOrig = false;
        for ( int n = 0; n < p.getNumInstances(); n++ ) {
            ImageInstance i = p.getInstance( n );
            if ( i.getInstanceType() == ImageInstance.INSTANCE_TYPE_ORIGINAL ) {
                cm = i.getColorChannelMapping();
                c = cm.getChannelCurve( "value" );
                assertEquals( 0.2, c.getY( 1 ) );
                assertEquals( 0.6, c.getX( 1 ) );               
                foundOrig = true;
            }
View Full Code Here

Examples of org.photovault.imginfo.ImageInstance

        // Write instances
        writer.write( getIndent() + "<instances>" );
        writer.newLine();
        indent += 2;
        for ( int n = 0; n < p.getNumInstances(); n++ ) {
            ImageInstance i = p.getInstance( n );
            writeInstance( i );
        }
        indent -= 2;
        writer.write( getIndent() + "</instances>" );
        writer.newLine();
View Full Code Here

Examples of org.photovault.imginfo.ImageInstance

        log.debug( "entry: indexFile " + f.getAbsolutePath() );
        currentEvent.setIndexedFile( f );
        indexedFileCount++;
       
        // Check if the instance already exists n database
        ImageInstance oldInstance = null;
        try {
            oldInstance = ImageInstance.retrieve( volume,
                    volume.mapFileToVolumeRelativeName(f ) );
        } catch ( PhotoNotFoundException e ) {
            // No action, there just were no matching instances in database
        }
        if ( oldInstance != null ) {
            // There is an existing instance, check whether the data matches
            if ( oldInstance.doConsistencyCheck() ) {
                PhotoInfo photo = null;
                try {
                    photo = PhotoInfo.retrievePhotoInfo(oldInstance.getPhotoUid());
                } catch (PhotoNotFoundException ex) {
                    ex.printStackTrace();
                }
                return photo;
            } else {
                PhotoInfo photo = null;
                try {
                    photo = PhotoInfo.retrievePhotoInfo(oldInstance.getPhotoUid());
                } catch (PhotoNotFoundException ex) {
                    ex.printStackTrace();
                }
                Vector instances = photo.getInstances();
                int instNum = instances.indexOf( oldInstance );
                if ( instNum >= 0 ) {
                    photo.removeInstance( instNum );
                }
            }
        }
       
       
        // Check whether this is really an image file
       
        ODMGXAWrapper txw = new ODMGXAWrapper();
        ImageInstance instance = null;
        try {
            instance = ImageInstance.create( volume, f );
        } catch ( Exception e ) {
            currentEvent.setResult( ExtVolIndexerEvent.RESULT_ERROR );
            return null;
        }
        if ( instance == null ) {
            currentEvent.setResult( ExtVolIndexerEvent.RESULT_NOT_IMAGE );
            /*
             ImageInstance already aborts transaction if reading image file
             was unsuccessfull.
             */
            return null;
        }
        byte[] hash = instance.getHash();
       
        // Check whether there is already an image instance with the same hash
        PhotoInfo matchingPhotos[] = PhotoInfo.retrieveByOrigHash( hash );
        PhotoInfo photo = null;
        if ( matchingPhotos != null && matchingPhotos.length > 0 ) {
View Full Code Here

Examples of org.photovault.imginfo.ImageInstance

        Iterator photoIter = result.iterator();
        while ( photoIter.hasNext() ) {
            PhotoInfo p = (PhotoInfo) photoIter.next();
            Vector instances = p.getInstances();
            for ( int i = instances.size()-1; i >= 0; i-- ) {
                ImageInstance inst = (ImageInstance) instances.get( i );
                Date checkTime = inst.getCheckTime();
                if ( inst.getVolume() == volume
                        && (checkTime == null || checkTime.before( startTime )) ) {
                    p.removeInstance( i );
                }
            }
        }
View Full Code Here

Examples of org.photovault.imginfo.ImageInstance

        // Check that both instances of p2 can be found
        boolean found[] = {false, false};
        File files[] = {photo2inst1, photo2inst2};
        for ( n = 0; n < p2.getNumInstances(); n++ ) {
            ImageInstance i = p2.getInstance( n );
            for ( int m = 0; m < found.length; m++ ) {
                if ( files[m].equals( i.getImageFile() ) ) {
                    found[m] = true;
                }
            }
        }
        for ( n = 0; n < found.length; n++ ) {
View Full Code Here

Examples of org.photovault.imginfo.ImageInstance

        log.debug( "PhotoViewer.setPhoto: " + photo.getUid());

  photo.addChangeListener( this );

  // Find the original file
  ImageInstance original = null;
  Vector instances = photo.getInstances();
  for ( int n = 0; n < instances.size(); n++ ) {
      ImageInstance instance = (ImageInstance) instances.get( n );
      if ( instance.getInstanceType() == ImageInstance.INSTANCE_TYPE_ORIGINAL ) {
    original = instance;
    break;
      }
  }
  if ( original == null ) {
View Full Code Here

Examples of org.photovault.imginfo.ImageInstance

     */
    private void showBestInstance() throws PhotovaultException {
  // Find the original file
        EnumSet<ImageOperations> allowedOps = EnumSet.allOf( ImageOperations.class );
        allowedOps.removeAll( dynOps );
        ImageInstance instance = photo.getPreferredInstance(
                EnumSet.noneOf( ImageOperations.class ),
                allowedOps,
                imageView.getWidth(), imageView.getHeight() );
        if ( instance != null ) {
            File imageFile = instance.getImageFile();
            if ( imageFile != null && imageFile.canRead() ) {
                // TODO: is this really needed?
                String fname = imageFile.getName();
                int lastDotPos = fname.lastIndexOf( "." );
                if ( lastDotPos <= 0 || lastDotPos >= fname.length()-1 ) {
                    // TODO: error handling needs thinking!!!!
                    // throw new IOException( "Cannot determine file type extension of " + imageFile.getAbsolutePath() );
                    fireViewChangeEvent();
                    return;
                }
                PhotovaultImageFactory imageFactory = new PhotovaultImageFactory();
                PhotovaultImage img = null;
                try {
                        /*
                         Do not read the image yet since setting raw conversion
                         parameters later may force a re-read.
                         */
                    img = imageFactory.create(imageFile, false, false);
                } catch (PhotovaultException ex) {
                    final JAIPhotoViewer component = this;
                    final String msg = ex.getMessage();
                    SwingUtilities.invokeLater( new Runnable() {
                        public void run() {
                            JOptionPane.showMessageDialog( component,
                                    msg, "Error loading file",
                                    JOptionPane.ERROR_MESSAGE );
                        }
                    });
                }
                if ( img != null ) {
                    if ( rawImage != null ) {
                        rawImage.removeChangeListener( this );
                    }
                    if ( img instanceof RawImage ) {
                        rawImage = (RawImage) img;
                        rawImage.setRawSettings(
                                localRawSettings != null ?
                                    localRawSettings : photo.getRawSettings() );
                        rawImage.addChangeListener( this );
                        // Check the correct resolution for this image
                        if ( isFit ) {
                            fit();
                        } else {
                            setScale( getScale() );
                        }
                    } else {
                        rawImage = null;
                        rawConvScaling = 1.0f;
                    }
                }
                appliedOps = instance.getAppliedOperations();
                if ( !appliedOps.contains( ImageOperations.COLOR_MAP ) ) {
                    img.setColorAdjustment(
                            localChanMap != null ?
                                localChanMap : photo.getColorChannelMapping() );
                }
                setImage( img );
                if ( !appliedOps.contains( ImageOperations.CROP ) ) {
                    instanceRotation = instance.getRotated();
                    double rot = photo.getPrefRotation() - instanceRotation;
                    imageView.setRotation( rot );
                    imageView.setCrop( photo.getCropBounds() );
                }
                fireViewChangeEvent();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.