1 #include <ossim/base/ossimNadconGridDatum.h>
2
3 RTTI_DEF1(ossimNadconGridDatum, "ossimNadconGridDatum", ossimThreeParamDatum);
ossimNadconGridDatum(const ossimFilename & datumDirectory,const ossimString & code,const ossimString & name,const ossimEllipsoid * anEllipsoid,double sigmaX,double sigmaY,double sigmaZ,double westLongitude,double eastLongitude,double southLatitude,double northLatitude,double param1,double param2,double param3)4 ossimNadconGridDatum::ossimNadconGridDatum(const ossimFilename& datumDirectory,
5 const ossimString &code, const ossimString &name,
6 const ossimEllipsoid* anEllipsoid,
7 double sigmaX,
8 double sigmaY,
9 double sigmaZ,
10 double westLongitude,
11 double eastLongitude,
12 double southLatitude,
13 double northLatitude,
14 double param1,
15 double param2,
16 double param3)
17 :ossimThreeParamDatum(code,
18 name,
19 anEllipsoid,
20 sigmaX,
21 sigmaY,
22 sigmaZ,
23 westLongitude,
24 eastLongitude,
25 southLatitude,
26 northLatitude,
27 param1,
28 param2,
29 param3),
30 theDatumDirectory(datumDirectory)
31 {
32 theCurrentGridRect.makeNan();
33
34 ossimNadconGridHeader header;
35 theConusRect.makeNan();
36 theHawaiiRect.makeNan();
37 theAlaskaRect.makeNan();
38 theStGeorgeRect.makeNan();
39 theLatStLaurenceRect.makeNan();
40 theStPaulRect.makeNan();
41 thePrviRect.makeNan();
42
43 if(header.readHeader(theDatumDirectory.dirCat("conus.las")))
44 {
45 theConusRect = header.getBoundingRect();
46 }
47 if(header.readHeader(theDatumDirectory.dirCat("hawaii.las")))
48 {
49 theHawaiiRect = header.getBoundingRect();
50 }
51 if(header.readHeader(theDatumDirectory.dirCat("alaska.las")))
52 {
53 theAlaskaRect = header.getBoundingRect();
54 }
55 if(header.readHeader(theDatumDirectory.dirCat("stgeorge.las")))
56 {
57 theStGeorgeRect = header.getBoundingRect();
58 }
59 if(header.readHeader(theDatumDirectory.dirCat("stlrnc.las")))
60 {
61 theLatStLaurenceRect = header.getBoundingRect();
62 }
63 if(header.readHeader(theDatumDirectory.dirCat("stpaul.las")))
64 {
65 theStPaulRect = header.getBoundingRect();
66 }
67 if(header.readHeader(theDatumDirectory.dirCat("prvi.las")))
68 {
69 thePrviRect = header.getBoundingRect();
70 }
71 }
72
checkGrid(const ossimDpt & latLon) const73 void ossimNadconGridDatum::checkGrid(const ossimDpt& latLon)const
74 {
75 if(theCurrentGridRect.pointWithin(latLon))
76 {
77 return;
78 }
79 else if(theConusRect.pointWithin(latLon))
80 {
81 theLatGrid.open(theDatumDirectory.dirCat("conus.las"));
82 theLonGrid.open(theDatumDirectory.dirCat("conus.los"));
83
84 theCurrentGridRect = theConusRect;
85 }
86 else if(theHawaiiRect.pointWithin(latLon))
87 {
88 theLatGrid.open(theDatumDirectory.dirCat("hawaii.las"));
89 theLonGrid.open(theDatumDirectory.dirCat("hawaii.los"));
90
91 theCurrentGridRect = theHawaiiRect;
92 }
93 else if(theAlaskaRect.pointWithin(latLon))
94 {
95 theLatGrid.open(theDatumDirectory.dirCat("alaska.las"));
96 theLonGrid.open(theDatumDirectory.dirCat("alaska.los"));
97
98 theCurrentGridRect = theAlaskaRect;
99 }
100 else if(theStGeorgeRect.pointWithin(latLon))
101 {
102 theLatGrid.open(theDatumDirectory.dirCat("stgeorge.las"));
103 theLonGrid.open(theDatumDirectory.dirCat("stgeorge.los"));
104
105 theCurrentGridRect = theStGeorgeRect;
106 }
107 else if(theLatStLaurenceRect.pointWithin(latLon))
108 {
109 theLatGrid.open(theDatumDirectory.dirCat("stlrnc.las"));
110 theLonGrid.open(theDatumDirectory.dirCat("stlrnc.los"));
111
112 theCurrentGridRect = theLatStLaurenceRect;
113 }
114 else if(theStPaulRect.pointWithin(latLon))
115 {
116 theLatGrid.open(theDatumDirectory.dirCat("stpaul.las"));
117 theLonGrid.open(theDatumDirectory.dirCat("stpaul.los"));
118
119 theCurrentGridRect = theStPaulRect;
120 }
121 else if(thePrviRect.pointWithin(latLon))
122 {
123 theLatGrid.open(theDatumDirectory.dirCat("prvi.las"));
124 theLonGrid.open(theDatumDirectory.dirCat("prvi.los"));
125
126 theCurrentGridRect = thePrviRect;
127 }
128 }
129
130