Esempio n. 1
0
CExternalChannel::CExternalChannel( PCIDSKBuffer &image_header, 
                                    uint64 ih_offset, 
                                    PCIDSKBuffer &file_header,
                                    std::string filename,
                                    int channelnum,
                                    CPCIDSKFile *file,
                                    eChanType pixel_type )
        : CPCIDSKChannel( image_header, ih_offset, file, pixel_type, channelnum)

{
    db = NULL;
    mutex = NULL;

/* -------------------------------------------------------------------- */
/*      Establish the data window.                                      */
/* -------------------------------------------------------------------- */
    exoff  = atoi(image_header.Get( 250, 8 ));
    eyoff  = atoi(image_header.Get( 258, 8 ));
    exsize = atoi(image_header.Get( 266, 8 ));
    eysize = atoi(image_header.Get( 274, 8 ));

    echannel = atoi(image_header.Get( 282, 8 ));

    if (echannel == 0) {
        echannel = channelnum;
    }

/* -------------------------------------------------------------------- */
/*      Establish the file we will be accessing.                        */
/* -------------------------------------------------------------------- */
    if( filename != "" )
        this->filename = filename;
    else
        image_header.Get(64,64,this->filename);
}
void CPCIDSKChannel::LoadHistory( const PCIDSKBuffer &image_header )

{
    // Read the history from the image header. PCIDSK supports
    // 8 history entries per channel.

    std::string hist_msg;
    history_.clear();
    for (unsigned int i = 0; i < 8; i++)
    {
        image_header.Get(384 + i * 80, 80, hist_msg);

        // Some programs seem to push history records with a trailing '\0'
        // so do some extra processing to cleanup.  FUN records on segment
        // 3 of eltoro.pix are an example of this.
        size_t size = hist_msg.size();
        while( size > 0 
               && (hist_msg[size-1] == ' ' || hist_msg[size-1] == '\0') )
            size--;

        hist_msg.resize(size);
        
        history_.push_back(hist_msg);
    }
}
CBandInterleavedChannel::CBandInterleavedChannel( PCIDSKBuffer &image_header,
                                                  uint64 ih_offsetIn,
                                                  CPL_UNUSED PCIDSKBuffer &file_header,
                                                  int channelnum,
                                                  CPCIDSKFile *fileIn,
                                                  uint64 image_offset,
                                                  eChanType pixel_typeIn )
        : CPCIDSKChannel( image_header, ih_offsetIn, fileIn, pixel_typeIn, channelnum)

{
    io_handle_p = NULL;
    io_mutex_p = NULL;

/* -------------------------------------------------------------------- */
/*      Establish the data layout.                                      */
/* -------------------------------------------------------------------- */
    if( strcmp(file->GetInterleaving().c_str(),"FILE") == 0 )
    {
        start_byte = atouint64(image_header.Get( 168, 16 ));
        pixel_offset = atouint64(image_header.Get( 184, 8 ));
        line_offset = atouint64(image_header.Get( 192, 8 ));
    }
    else
    {
        start_byte = image_offset;
        pixel_offset = DataTypeSize(pixel_type);
        line_offset = pixel_offset * width;
    }

/* -------------------------------------------------------------------- */
/*      Establish the file we will be accessing.                        */
/* -------------------------------------------------------------------- */
    image_header.Get(64,64,filename);

    filename = MassageLink( filename );

    if( filename.length() == 0 )
        file->GetIODetails( &io_handle_p, &io_mutex_p );

    else
        filename = MergeRelativePath( file->GetInterfaces()->io,
                                      file->GetFilename(), 
                                      filename );
}