/src/gdal/frmts/ceos2/ceossar.c
Line  | Count  | Source (jump to first uncovered line)  | 
1  |  | /******************************************************************************  | 
2  |  |  *  | 
3  |  |  * Project:  ASI CEOS Translator  | 
4  |  |  * Purpose:  Functions related to CeosSARVolume_t.  | 
5  |  |  * Author:   Paul Lahaie, pjlahaie@atlsci.com  | 
6  |  |  *  | 
7  |  |  ******************************************************************************  | 
8  |  |  * Copyright (c) 2000, Atlantis Scientific Inc  | 
9  |  |  *  | 
10  |  |  * SPDX-License-Identifier: MIT  | 
11  |  |  ****************************************************************************/  | 
12  |  |  | 
13  |  | #include "ceos.h"  | 
14  |  |  | 
15  |  | extern Link_t *RecipeFunctions;  | 
16  |  |  | 
17  |  | void InitCeosSARVolume(CeosSARVolume_t *volume, int32 file_name_convention)  | 
18  | 0  | { | 
19  | 0  |     volume->Flavor = volume->Sensor = volume->ProductType = 0;  | 
20  |  | 
  | 
21  | 0  |     volume->FileNamingConvention = file_name_convention;  | 
22  |  | 
  | 
23  | 0  |     volume->VolumeDirectoryFile = volume->SARLeaderFile =  | 
24  | 0  |         volume->SARTrailerFile = volume->NullVolumeDirectoryFile =  | 
25  | 0  |             volume->ImageDesc.ImageDescValid = FALSE;  | 
26  |  | 
  | 
27  | 0  |     volume->RecordList = NULL;  | 
28  | 0  | }  | 
29  |  |  | 
30  |  | void CalcCeosSARImageFilePosition(CeosSARVolume_t *volume, int channel,  | 
31  |  |                                   int line, int *record, int *file_offset)  | 
32  | 0  | { | 
33  | 0  |     struct CeosSARImageDesc *ImageDesc;  | 
34  | 0  |     int TotalRecords = 0, TotalBytes = 0;  | 
35  |  | 
  | 
36  | 0  |     if (record)  | 
37  | 0  |         *record = 0;  | 
38  | 0  |     if (file_offset)  | 
39  | 0  |         *file_offset = 0;  | 
40  |  | 
  | 
41  | 0  |     if (volume)  | 
42  | 0  |     { | 
43  | 0  |         if (volume->ImageDesc.ImageDescValid)  | 
44  | 0  |         { | 
45  | 0  |             ImageDesc = &(volume->ImageDesc);  | 
46  |  | 
  | 
47  | 0  |             switch (ImageDesc->ChannelInterleaving)  | 
48  | 0  |             { | 
49  | 0  |                 case CEOS_IL_PIXEL:  | 
50  | 0  |                     TotalRecords = (line - 1) * ImageDesc->RecordsPerLine;  | 
51  | 0  |                     TotalBytes = (TotalRecords) * (ImageDesc->BytesPerRecord);  | 
52  | 0  |                     break;  | 
53  | 0  |                 case CEOS_IL_LINE:  | 
54  | 0  |                     TotalRecords =  | 
55  | 0  |                         (ImageDesc->NumChannels * (line - 1) + (channel - 1)) *  | 
56  | 0  |                         ImageDesc->RecordsPerLine;  | 
57  | 0  |                     TotalBytes = (TotalRecords) * (ImageDesc->BytesPerRecord);  | 
58  | 0  |                     break;  | 
59  | 0  |                 case CEOS_IL_BAND:  | 
60  | 0  |                     TotalRecords = (((channel - 1) * ImageDesc->Lines) *  | 
61  | 0  |                                     ImageDesc->RecordsPerLine) +  | 
62  | 0  |                                    (line - 1) * ImageDesc->RecordsPerLine;  | 
63  | 0  |                     TotalBytes = (TotalRecords) * (ImageDesc->BytesPerRecord);  | 
64  | 0  |                     break;  | 
65  | 0  |             }  | 
66  | 0  |             if (file_offset)  | 
67  | 0  |                 *file_offset = ImageDesc->FileDescriptorLength + TotalBytes;  | 
68  | 0  |             if (record)  | 
69  | 0  |                 *record = TotalRecords + 1;  | 
70  | 0  |         }  | 
71  | 0  |     }  | 
72  | 0  | }  | 
73  |  |  | 
74  |  | int32 GetCeosSARImageData(CPL_UNUSED CeosSARVolume_t *volume,  | 
75  |  |                           CPL_UNUSED CeosRecord_t *processed_data_record,  | 
76  |  |                           CPL_UNUSED int channel, CPL_UNUSED int xoff,  | 
77  |  |                           CPL_UNUSED int xsize, CPL_UNUSED int bufsize,  | 
78  |  |                           CPL_UNUSED uchar *buffer)  | 
79  | 0  | { | 
80  | 0  |     return 0;  | 
81  | 0  | }  | 
82  |  |  | 
83  |  | void DetermineCeosSARPixelOrder(CPL_UNUSED CeosSARVolume_t *volume,  | 
84  |  |                                 CPL_UNUSED CeosRecord_t *record)  | 
85  | 0  | { | 
86  | 0  | }  | 
87  |  |  | 
88  |  | void GetCeosSAREmbeddedInfo(CPL_UNUSED CeosSARVolume_t *volume,  | 
89  |  |                             CPL_UNUSED CeosRecord_t *processed_data_record,  | 
90  |  |                             CPL_UNUSED CeosSAREmbeddedInfo_t *info)  | 
91  | 0  | { | 
92  | 0  | }  | 
93  |  |  | 
94  |  | void DeleteCeosSARVolume(CeosSARVolume_t *volume)  | 
95  | 0  | { | 
96  | 0  |     Link_t *Links;  | 
97  |  | 
  | 
98  | 0  |     if (volume)  | 
99  | 0  |     { | 
100  | 0  |         if (volume->RecordList)  | 
101  | 0  |         { | 
102  | 0  |             for (Links = volume->RecordList; Links != NULL; Links = Links->next)  | 
103  | 0  |             { | 
104  | 0  |                 if (Links->object)  | 
105  | 0  |                 { | 
106  | 0  |                     DeleteCeosRecord(Links->object);  | 
107  | 0  |                     Links->object = NULL;  | 
108  | 0  |                 }  | 
109  | 0  |             }  | 
110  | 0  |             DestroyList(volume->RecordList);  | 
111  | 0  |         }  | 
112  | 0  |         HFree(volume);  | 
113  | 0  |     }  | 
114  | 0  | }  |