Line data Source code
1 : /****************************************************************************** 2 : * $Id$ 3 : * 4 : * Project: ASI CEOS Translator 5 : * Purpose: Functions related to CeosSARVolume_t. 6 : * Author: Paul Lahaie, pjlahaie@atlsci.com 7 : * 8 : ****************************************************************************** 9 : * Copyright (c) 2000, Atlantis Scientific Inc 10 : * 11 : * Permission is hereby granted, free of charge, to any person obtaining a 12 : * copy of this software and associated documentation files (the "Software"), 13 : * to deal in the Software without restriction, including without limitation 14 : * the rights to use, copy, modify, merge, publish, distribute, sublicense, 15 : * and/or sell copies of the Software, and to permit persons to whom the 16 : * Software is furnished to do so, subject to the following conditions: 17 : * 18 : * The above copyright notice and this permission notice shall be included 19 : * in all copies or substantial portions of the Software. 20 : * 21 : * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 22 : * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 : * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 24 : * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 : * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 26 : * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 27 : * DEALINGS IN THE SOFTWARE. 28 : ****************************************************************************/ 29 : 30 : #include "ceos.h" 31 : 32 : extern Link_t *RecipeFunctions; 33 : 34 4 : void InitCeosSARVolume(CeosSARVolume_t *volume, int32 file_name_convention) 35 : { 36 4 : volume->Flavor = volume->Sensor = volume->ProductType = 0; 37 : 38 4 : volume->FileNamingConvention = file_name_convention; 39 : 40 4 : volume->VolumeDirectoryFile = volume->SARLeaderFile = 41 4 : volume->SARTrailerFile = volume->NullVolumeDirectoryFile = 42 4 : volume->ImageDesc.ImageDescValid = FALSE; 43 : 44 4 : volume->RecordList = NULL; 45 4 : } 46 : 47 20 : void CalcCeosSARImageFilePosition(CeosSARVolume_t *volume, int channel, 48 : int line, int *record, int *file_offset) 49 : { 50 : struct CeosSARImageDesc *ImageDesc; 51 20 : int TotalRecords = 0, TotalBytes = 0; 52 : 53 20 : if (record) 54 0 : *record = 0; 55 20 : if (file_offset) 56 20 : *file_offset = 0; 57 : 58 20 : if (volume) 59 : { 60 20 : if (volume->ImageDesc.ImageDescValid) 61 : { 62 20 : ImageDesc = &(volume->ImageDesc); 63 : 64 20 : switch (ImageDesc->ChannelInterleaving) 65 : { 66 0 : case CEOS_IL_PIXEL: 67 0 : TotalRecords = (line - 1) * ImageDesc->RecordsPerLine; 68 0 : TotalBytes = (TotalRecords) * (ImageDesc->BytesPerRecord); 69 0 : break; 70 0 : case CEOS_IL_LINE: 71 0 : TotalRecords = 72 0 : (ImageDesc->NumChannels * (line - 1) + (channel - 1)) * 73 0 : ImageDesc->RecordsPerLine; 74 0 : TotalBytes = (TotalRecords) * (ImageDesc->BytesPerRecord); 75 0 : break; 76 20 : case CEOS_IL_BAND: 77 20 : TotalRecords = (((channel - 1) * ImageDesc->Lines) * 78 20 : ImageDesc->RecordsPerLine) + 79 20 : (line - 1) * ImageDesc->RecordsPerLine; 80 20 : TotalBytes = (TotalRecords) * (ImageDesc->BytesPerRecord); 81 20 : break; 82 : } 83 20 : if (file_offset) 84 20 : *file_offset = ImageDesc->FileDescriptorLength + TotalBytes; 85 20 : if (record) 86 0 : *record = TotalRecords + 1; 87 : } 88 : } 89 20 : } 90 : 91 0 : int32 GetCeosSARImageData(CPL_UNUSED CeosSARVolume_t *volume, 92 : CPL_UNUSED CeosRecord_t *processed_data_record, 93 : CPL_UNUSED int channel, CPL_UNUSED int xoff, 94 : CPL_UNUSED int xsize, CPL_UNUSED int bufsize, 95 : CPL_UNUSED uchar *buffer) 96 : { 97 0 : return 0; 98 : } 99 : 100 0 : void DetermineCeosSARPixelOrder(CPL_UNUSED CeosSARVolume_t *volume, 101 : CPL_UNUSED CeosRecord_t *record) 102 : { 103 0 : } 104 : 105 0 : void GetCeosSAREmbeddedInfo(CPL_UNUSED CeosSARVolume_t *volume, 106 : CPL_UNUSED CeosRecord_t *processed_data_record, 107 : CPL_UNUSED CeosSAREmbeddedInfo_t *info) 108 : { 109 0 : } 110 : 111 0 : void DeleteCeosSARVolume(CeosSARVolume_t *volume) 112 : { 113 : Link_t *Links; 114 : 115 0 : if (volume) 116 : { 117 0 : if (volume->RecordList) 118 : { 119 0 : for (Links = volume->RecordList; Links != NULL; Links = Links->next) 120 : { 121 0 : if (Links->object) 122 : { 123 0 : DeleteCeosRecord(Links->object); 124 0 : Links->object = NULL; 125 : } 126 : } 127 0 : DestroyList(volume->RecordList); 128 : } 129 0 : HFree(volume); 130 : } 131 0 : }