1 : /******************************************************************************
2 : * $Id: ceossar.c 10645 2007-01-18 02:22:39Z warmerdam $
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 : CPL_CVSID("$Id: ceossar.c 10645 2007-01-18 02:22:39Z warmerdam $");
33 :
34 : extern Link_t *RecipeFunctions;
35 :
36 : void InitCeosSARVolume(CeosSARVolume_t *volume, int32 file_name_convention)
37 1 : {
38 1 : volume->Flavour = \
39 : volume->Sensor = \
40 : volume->ProductType = 0;
41 :
42 1 : volume->FileNamingConvention = file_name_convention ;
43 :
44 1 : volume->VolumeDirectoryFile =
45 : volume->SARLeaderFile =
46 : volume->SARTrailerFile =
47 : volume->NullVolumeDirectoryFile =
48 : volume->ImageDesc.ImageDescValid = FALSE;
49 :
50 1 : volume->RecordList = NULL;
51 1 : }
52 :
53 :
54 : void CalcCeosSARImageFilePosition(CeosSARVolume_t *volume, int channel, int line, int *record, int *file_offset)
55 9 : {
56 : struct CeosSARImageDesc *ImageDesc;
57 9 : int TotalRecords=0, TotalBytes=0;
58 :
59 9 : if(record)
60 0 : *record = 0;
61 9 : if(file_offset)
62 9 : *file_offset = 0;
63 :
64 9 : if( volume )
65 : {
66 9 : if( volume->ImageDesc.ImageDescValid )
67 : {
68 9 : ImageDesc = &( volume->ImageDesc );
69 :
70 9 : switch( ImageDesc->ChannelInterleaving )
71 : {
72 : case __CEOS_IL_PIXEL:
73 0 : TotalRecords = (line - 1) * ImageDesc->RecordsPerLine;
74 0 : TotalBytes = (TotalRecords) * ( ImageDesc->BytesPerRecord );
75 0 : break;
76 : case __CEOS_IL_LINE:
77 0 : TotalRecords = (ImageDesc->NumChannels * (line - 1) +
78 : (channel - 1)) * ImageDesc->RecordsPerLine;
79 0 : TotalBytes = (TotalRecords) * ( ImageDesc->BytesPerRecord ) ;
80 0 : break;
81 : case __CEOS_IL_BAND:
82 9 : TotalRecords = (((channel - 1) * ImageDesc->Lines) *
83 : ImageDesc->RecordsPerLine) +
84 : (line - 1) * ImageDesc->RecordsPerLine;
85 :
86 9 : TotalBytes = (TotalRecords) * ( ImageDesc->BytesPerRecord );
87 : break;
88 : }
89 9 : if(file_offset)
90 9 : *file_offset = ImageDesc->FileDescriptorLength + TotalBytes;
91 9 : if(record)
92 0 : *record = TotalRecords + 1;
93 : }
94 : }
95 9 : }
96 :
97 : int32 GetCeosSARImageData(CeosSARVolume_t *volume, CeosRecord_t *processed_data_record, int channel, int xoff, int xsize, int bufsize, uchar *buffer)
98 0 : {
99 0 : return 0;
100 : }
101 :
102 : void DetermineCeosSARPixelOrder( CeosSARVolume_t *volume, CeosRecord_t *record )
103 0 : {
104 :
105 0 : }
106 :
107 : void GetCeosSAREmbeddedInfo(CeosSARVolume_t *volume, CeosRecord_t *processed_data_record, CeosSAREmbeddedInfo_t *info)
108 0 : {
109 0 : }
110 :
111 : void DeleteCeosSARVolume(CeosSARVolume_t *volume)
112 0 : {
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 : }
132 :
|