forked from ossimlabs/ossim
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathossimAigHeader.cpp
More file actions
77 lines (68 loc) · 2.33 KB
/
Copy pathossimAigHeader.cpp
File metadata and controls
77 lines (68 loc) · 2.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//*******************************************************************
//
// License: See top level LICENSE.txt file.
//
// Author: Garrett Potts (gpotts@imagelinks.com)
//
//*******************************************************************
// $Id: ossimAigHeader.cpp 9963 2006-11-28 21:11:01Z gpotts $
#include <ossim/support_data/ossimAigHeader.h>
#include <ossim/base/ossimEndian.h>
bool ossimAigHeader::writeStream(std::ostream& out)
{
ossimEndian endian;
double tempDouble;
ossim_uint32 tempInt;
if(endian.getSystemEndianType() == OSSIM_LITTLE_ENDIAN)
{
out.write((char*)theMagic, 8);
out.write((char*)theUnknownData, 8);
tempInt = theCellType;
endian.swap(tempInt);
out.write((char*)&tempInt, 4);
out.write((char*)theUnknownAssortedData, 236);
tempDouble = thePixelSizeX;
endian.swap(tempDouble);
out.write((char*)(&tempDouble), 8);
tempDouble = thePixelSizeY;
endian.swap(tempDouble);
out.write((char*)(&tempDouble), 8);
tempDouble = 0.0;
endian.swap(tempDouble);
out.write((char*)(&tempDouble), 8);
out.write((char*)(&tempDouble), 8);
tempInt = theNumberOfTilesPerRow;
endian.swap(tempInt);
out.write((char*)&tempInt, 4);
tempInt = theNumberOfTilesPerColumn;
endian.swap(tempInt);
out.write((char*)&tempInt, 4);
tempInt = theWidthOfTileInPixels;
endian.swap(tempInt);
out.write((char*)&tempInt, 4);
tempInt = theUnknownValue;
endian.swap(tempInt);
out.write((char*)&tempInt, 4);
tempInt = theHeightOfTileInPixels;
endian.swap(tempInt);
out.write((char*)&tempInt, 4);
}
else
{
out.write((char*)theMagic, 8);
out.write((char*)theUnknownData, 8);
out.write((char*)&theCellType, 4);
out.write((char*)theUnknownAssortedData, 236);
out.write((char*)(&thePixelSizeX), 8);
out.write((char*)(&thePixelSizeY), 8);
tempDouble = 0.0;
out.write((char*)(&tempDouble), 8);
out.write((char*)(&tempDouble), 8);
out.write((char*)&theNumberOfTilesPerRow, 4);
out.write((char*)&theNumberOfTilesPerColumn, 4);
out.write((char*)&theWidthOfTileInPixels, 4);
out.write((char*)&theUnknownValue, 4);
out.write((char*)&theHeightOfTileInPixels, 4);
}
return true;
}