OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ossimGmlSupportData Class Reference

GML support data class. More...

#include <ossimGmlSupportData.h>

Public Member Functions

 ossimGmlSupportData ()
 default constructor More...
 
 ~ossimGmlSupportData ()
 destructor More...
 
bool initialize (const ossimImageGeometry *geom, const ossimIrect &rect)
 Initializes gml block from geometry file. More...
 
bool initialize (std::istream &in)
 Initializes from stream assumed to be a gml block. More...
 
bool write (std::ostream &os)
 Write xml doc to stream. More...
 
ossimRefPtr< ossimXmlDocumentgetXmlDoc () const
 
bool getImageGeometry (ossimKeywordlist &geomKwl) const
 Extracts geometry info to keyword list. More...
 

Private Member Functions

ossimRefPtr< ossimXmlNodegetGmljp2V1RootNode () const
 
ossimRefPtr< ossimXmlNodegetGmljp2V2RootNode () const
 
void getGeoOrigin (const ossimImageGeometry *geom, const ossimIpt &ul, ossimString &originString, ossimString &offsetVector1String, ossimString &offsetVector2String) const
 
void getMapOrigin (const ossimImageGeometry *geom, const ossimIpt &ul, ossimString &originString, ossimString &offsetVector1String, ossimString &offsetVector2String) const
 
void getLimits (const ossimIrect &rect, ossimString &gridHighString, ossimString &gridLowString) const
 
void getGeoBounds (const ossimImageGeometry *geom, const ossimIrect &rect, ossimString &upperCornerString, ossimString &lowerCornerString) const
 
bool configureGmljp2V2 (ossimRefPtr< ossimXmlNode > node, const ossimImageGeometry *geom, const ossimIrect &rect)
 
bool configureBounds (ossimRefPtr< ossimXmlNode > node, const ossimImageGeometry *geom, const ossimIrect &rect)
 
bool getImageGeometryFromSeonsorModel (ossimKeywordlist &geomKwl) const
 For sensor model data: More...
 
bool getImageGeometryFromRectifiedGrid (ossimKeywordlist &geomKwl) const
 For map projected data: More...
 
bool addLineSamps (const ossimString &xpath0, bool useGmlPrefix, ossimKeywordlist &geomKwl) const
 Adds line and sample to keyword list. More...
 
bool addTie (const ossimString &xpath0, bool useGmlPrefix, ossim_uint32 pcsCode, ossimKeywordlist &geomKwl) const
 Adds tie point to keyword list. More...
 
bool addScale (const ossimString &xpath0, bool useGmlPrefix, ossim_uint32 pcsCode, ossimKeywordlist &geomKwl) const
 Adds tie and scale to keyword list. More...
 

Private Attributes

ossimRefPtr< ossimXmlDocumentm_xmlDocument
 
ossim_uint32 m_pcsCodeMap
 
ossim_uint32 m_pcsCodeGeo
 
ossimString m_srsNameStringMap
 
ossimString m_srsNameStringGeo
 
ossimString m_srsDimensionString
 
ossimString m_axisLabelsStringMap
 
ossimString m_axisLabelsStringGeo
 
ossimString m_uomLabelsStringMap
 
ossimString m_uomLabelsStringGeo
 

Detailed Description

GML support data class.

Definition at line 29 of file ossimGmlSupportData.h.

Constructor & Destructor Documentation

◆ ossimGmlSupportData()

ossimGmlSupportData::ossimGmlSupportData ( )

default constructor

Definition at line 40 of file ossimGmlSupportData.cpp.

41  :
42  m_xmlDocument(0),
43  // m_use_gmljp2_version2(true),
46  m_srsNameStringMap("http://www.opengis.net/def/crs/EPSG/0/32767"),
47  m_srsNameStringGeo("http://www.opengis.net/def/crs/EPSG/0/32767"),
49  m_axisLabelsStringMap("X Y"),
50  m_axisLabelsStringGeo("Lat Long"),
51  m_uomLabelsStringMap("m m"),
52  m_uomLabelsStringGeo("deg deg")
53 {
54 }
ossimString m_srsDimensionString
ossimString m_axisLabelsStringMap
#define UNKNOWN_PCSCODE
ossimRefPtr< ossimXmlDocument > m_xmlDocument
ossimString m_axisLabelsStringGeo
ossimString m_uomLabelsStringMap
ossimString m_uomLabelsStringGeo

◆ ~ossimGmlSupportData()

ossimGmlSupportData::~ossimGmlSupportData ( )

destructor

Definition at line 56 of file ossimGmlSupportData.cpp.

57 {
58 }

Member Function Documentation

◆ addLineSamps()

bool ossimGmlSupportData::addLineSamps ( const ossimString xpath0,
bool  useGmlPrefix,
ossimKeywordlist geomKwl 
) const
private

Adds line and sample to keyword list.

Parameters
xpath0
useGmlPrefixIf true tack on "gml:" to paths.
geomKwlInitialized by this.

Definition at line 1177 of file ossimGmlSupportData.cpp.

References ossimKeywordlist::add(), ossimString::afterPos(), ossimString::beforePos(), ossimString::clear(), ossimString::find(), ossimXmlDocument::findNodes(), m_xmlDocument, ossimKeywordNames::NUMBER_LINES_KW, ossimKeywordNames::NUMBER_SAMPLES_KW, status, ossimString::toInt32(), and ossimRefPtr< T >::valid().

Referenced by getImageGeometryFromRectifiedGrid().

1180 {
1181  bool status = false;
1182 
1183  if ( m_xmlDocument.valid() )
1184  {
1185  vector< ossimRefPtr<ossimXmlNode> > xml_nodes;
1186 
1187  // Number of lines & samples, for either sensor or rectified imagery:
1188  ossimString xpath_limits_low;
1189  if (useGmlPrefix)
1190  {
1191  xpath_limits_low = "/gml:limits/gml:GridEnvelope/gml:low";
1192  }
1193  else
1194  {
1195  xpath_limits_low = "/limits/GridEnvelope/low";
1196  }
1197  ossimString xpath = xpath0 + xpath_limits_low;
1198  m_xmlDocument->findNodes( xpath, xml_nodes );
1199  if ( xml_nodes.size() == 1 )
1200  {
1201  const ossimString& lowerCorner = xml_nodes[0]->getText();
1202  size_t spacePos = lowerCorner.find( ' ' );
1203  ossimString lowerXString = lowerCorner.beforePos( spacePos );
1204  ossimString lowerYString = lowerCorner.afterPos ( spacePos );
1205  ossim_uint32 lowX = lowerXString.toInt32();
1206  ossim_uint32 lowY = lowerYString.toInt32();
1207 
1208  ossimString xpath_limits_high;
1209  if ( useGmlPrefix )
1210  {
1211  xpath_limits_high = "/gml:limits/gml:GridEnvelope/gml:high";
1212  }
1213  else
1214  {
1215  xpath_limits_high = "/limits/GridEnvelope/high";
1216  }
1217 
1218  xpath = xpath0 + xpath_limits_high;
1219  xml_nodes.clear();
1220  m_xmlDocument->findNodes( xpath, xml_nodes );
1221  if ( xml_nodes.size() == 1 )
1222  {
1223  const ossimString& higherCorner = xml_nodes[0]->getText();
1224  size_t spacePos = higherCorner.find( ' ' );
1225  ossimString higherXString = higherCorner.beforePos( spacePos );
1226  ossimString higherYString = higherCorner.afterPos ( spacePos );
1227  ossim_uint32 highX = higherXString.toInt32();
1228  ossim_uint32 highY = higherYString.toInt32();
1229 
1230  geomKwl.add( ossimKeywordNames::NUMBER_LINES_KW, highY - lowY + 1 );
1231  geomKwl.add( ossimKeywordNames::NUMBER_SAMPLES_KW, highX - lowX + 1 );
1232 
1233  status = true;
1234  }
1235  }
1236  }
1237 
1238  return status;
1239 
1240 } // ossimGmlSupportData::addLineSamps
void clear()
Erases the entire container.
Definition: ossimString.h:432
bool valid() const
Definition: ossimRefPtr.h:75
ossimString afterPos(std::string::size_type pos) const
static const char * NUMBER_LINES_KW
ossimRefPtr< ossimXmlDocument > m_xmlDocument
ossim_int32 toInt32() const
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
unsigned int ossim_uint32
return status
ossimString beforePos(std::string::size_type pos) const
void findNodes(const ossimString &xpath, std::vector< ossimRefPtr< ossimXmlNode > > &nodelist) const
Appends any matching nodes to the list supplied (should be empty):
static const char * NUMBER_SAMPLES_KW
std::string::size_type find(const std::string &s, std::string::size_type pos=0) const
Searches for s as a substring of *this, beginning at character pos of *this.
Definition: ossimString.h:753

◆ addScale()

bool ossimGmlSupportData::addScale ( const ossimString xpath0,
bool  useGmlPrefix,
ossim_uint32  pcsCode,
ossimKeywordlist geomKwl 
) const
private

Adds tie and scale to keyword list.

Parameters
xpath0
useGmlPrefixIf true tack on "gml:" to paths.
geomKwlInitialized by this.

Definition at line 1338 of file ossimGmlSupportData.cpp.

References ossim::acosd(), ossimKeywordlist::add(), ossimString::afterPos(), ossimString::beforePos(), ossimString::c_str(), ossimString::clear(), ossimString::find(), ossimXmlDocument::findNodes(), m_xmlDocument, ossimKeywordNames::ORIGIN_LATITUDE_KW, ossimKeywordNames::PIXEL_SCALE_UNITS_KW, ossimKeywordNames::PIXEL_SCALE_XY_KW, status, ossimString::toFloat64(), ossimDpt::toString(), ossimRefPtr< T >::valid(), ossimDpt::x, and ossimDpt::y.

Referenced by getImageGeometryFromRectifiedGrid().

1342 {
1343  bool status = false;
1344 
1345  if ( m_xmlDocument.valid() && (pcsCode != 32767 ) )
1346  {
1347  vector< ossimRefPtr<ossimXmlNode> > xml_nodes;
1348 
1349  //---
1350  // origin:
1351  // Note: In GML the origin is the tie point, NOT the projection origin.
1352  //---
1353 
1354  // axis labels for rectified imagery:
1355  ossimString xpath_axisLabels;
1356  if ( useGmlPrefix )
1357  {
1358  xpath_axisLabels = "/gml:axisLabels";
1359  }
1360  else
1361  {
1362  xpath_axisLabels = "/axisLabels";
1363  }
1364 
1365  ossimString xpath = xpath0 + xpath_axisLabels;
1366  m_xmlDocument->findNodes( xpath, xml_nodes );
1367  if ( xml_nodes.size() == 1 )
1368  {
1369  ossimString axisLabelsString = xml_nodes[0]->getText();
1370 
1371  ossimString xpath_offsetVector;
1372  if ( useGmlPrefix )
1373  {
1374  xpath_offsetVector = "/gml:offsetVector";
1375  }
1376  else
1377  {
1378  xpath_offsetVector = "/offsetVector";
1379  }
1380 
1381  xpath = xpath0 + xpath_offsetVector;
1382  xml_nodes.clear();
1383  m_xmlDocument->findNodes( xpath, xml_nodes );
1384  if ( xml_nodes.size() == 2 )
1385  {
1386  const ossimString& offsetVectorString0 = xml_nodes[0]->getText();
1387  const ossimString& offsetVectorString1 = xml_nodes[1]->getText();
1388 
1389  size_t spacePos0 = offsetVectorString0.find( ' ' );
1390  size_t spacePos1 = offsetVectorString1.find( ' ' );
1391 
1392  ossimString firstOffsetVectorString0 = offsetVectorString0.beforePos( spacePos0 );
1393  ossimString secondOffsetVectorString0 = offsetVectorString0.afterPos ( spacePos0 );
1394  ossimString firstOffsetVectorString1 = offsetVectorString1.beforePos( spacePos1 );
1395  ossimString secondOffsetVectorString1 = offsetVectorString1.afterPos ( spacePos1 );
1396 
1397  // TODO: Add for rotational matrix:
1398 
1399  std::string scale_xy;
1400  std::string scale_units;
1401  if ( pcsCode == 4326 )
1402  {
1403  scale_units = "degrees";
1404  }
1405  else
1406  {
1407  scale_units = "meters";
1408  }
1409 
1410  ossimDpt scale;
1411  if ( ( scale_units == "degrees" ) &&
1412  ( axisLabelsString == "Lat Long" ) )
1413  {
1414  scale.x = secondOffsetVectorString1.toFloat64();
1415  scale.y = firstOffsetVectorString0.toFloat64();
1416  }
1417  else
1418  {
1419  scale.x = firstOffsetVectorString0.toFloat64();
1420  scale.y = secondOffsetVectorString1.toFloat64();
1421  }
1422  if ( scale.y < 0.0 )
1423  {
1424  scale.y *= -1.0; // make positive
1425  }
1426 
1427  if ( ( scale_units == "degrees" ) && ( scale.x != scale.y ) )
1428  {
1429  // Compute/add the origin latitude of true scale.
1430  ossim_float64 origin_lat = ossim::acosd(scale.y/scale.x);
1431 
1432  geomKwl.add( ossimKeywordNames::ORIGIN_LATITUDE_KW, origin_lat );
1433  }
1434 
1436  geomKwl.add( ossimKeywordNames::PIXEL_SCALE_UNITS_KW, scale_units.c_str() );
1437  status = true;
1438  }
1439  }
1440 
1441  } // Matches: if ( m_xmlDocument.valid() && (pscCode != 32767 ) )
1442 
1443  return status;
1444 
1445 } // End: ossimGmlSupportData::addScale( ... )
void clear()
Erases the entire container.
Definition: ossimString.h:432
bool valid() const
Definition: ossimRefPtr.h:75
ossimString afterPos(std::string::size_type pos) const
double y
Definition: ossimDpt.h:165
double acosd(double x)
Definition: ossimCommon.h:264
ossimRefPtr< ossimXmlDocument > m_xmlDocument
static const char * PIXEL_SCALE_XY_KW
double ossim_float64
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
ossim_float64 toFloat64() const
static const char * ORIGIN_LATITUDE_KW
return status
ossimString toString(ossim_uint32 precision=15) const
Definition: ossimDpt.cpp:160
double x
Definition: ossimDpt.h:164
ossimString beforePos(std::string::size_type pos) const
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string&#39;s contents...
Definition: ossimString.h:396
void findNodes(const ossimString &xpath, std::vector< ossimRefPtr< ossimXmlNode > > &nodelist) const
Appends any matching nodes to the list supplied (should be empty):
std::string::size_type find(const std::string &s, std::string::size_type pos=0) const
Searches for s as a substring of *this, beginning at character pos of *this.
Definition: ossimString.h:753
static const char * PIXEL_SCALE_UNITS_KW

◆ addTie()

bool ossimGmlSupportData::addTie ( const ossimString xpath0,
bool  useGmlPrefix,
ossim_uint32  pcsCode,
ossimKeywordlist geomKwl 
) const
private

Adds tie point to keyword list.

Parameters
xpath0
useGmlPrefixIf true tack on "gml:" to paths.
geomKwlInitialized by this.

Definition at line 1242 of file ossimGmlSupportData.cpp.

References ossimKeywordlist::add(), ossimString::afterPos(), ossimString::beforePos(), ossimString::clear(), ossimString::find(), ossimXmlDocument::findNodes(), m_xmlDocument, status, ossimString::string(), ossimKeywordNames::TIE_POINT_UNITS_KW, ossimKeywordNames::TIE_POINT_XY_KW, and ossimRefPtr< T >::valid().

Referenced by getImageGeometryFromRectifiedGrid().

1246 {
1247  bool status = false;
1248 
1249  if ( m_xmlDocument.valid() && (pcsCode != 32767 ) )
1250  {
1251  vector< ossimRefPtr<ossimXmlNode> > xml_nodes;
1252 
1253  //---
1254  // origin:
1255  // Note: In GML the origin is the tie point, NOT the projection origin.
1256  //---
1257 
1258  // axis labels for rectified imagery:
1259  ossimString xpath_axisLabels;
1260  if ( useGmlPrefix )
1261  {
1262  xpath_axisLabels = "/gml:axisLabels";
1263  }
1264  else
1265  {
1266  xpath_axisLabels = "/axisLabels";
1267  }
1268 
1269  ossimString xpath = xpath0 + xpath_axisLabels;
1270  m_xmlDocument->findNodes( xpath, xml_nodes );
1271  if ( xml_nodes.size() == 1 )
1272  {
1273  ossimString axisLabelsString = xml_nodes[0]->getText();
1274 
1275  ossimString xpath_originPoint;
1276 
1277  if ( useGmlPrefix )
1278  {
1279  xpath_originPoint = "/gml:origin/gml:Point";
1280  }
1281  else
1282  {
1283  xpath_originPoint = "/origin/Point";
1284  }
1285 
1286  xpath = xpath0 + xpath_originPoint;
1287  xml_nodes.clear();
1288  m_xmlDocument->findNodes( xpath, xml_nodes );
1289  if ( xml_nodes.size() == 1 )
1290  {
1291  const ossimString& originString = xml_nodes[0]->getChildTextValue( ossimString( "pos" ) );
1292  size_t spacePos = originString.find( ' ' );
1293  ossimString firstOriginString = originString.beforePos( spacePos );
1294  ossimString secondOriginString = originString.afterPos ( spacePos );
1295 
1296  std::string tie_point_xy;
1297  std::string tie_point_units;
1298 
1299  if ( pcsCode == 4326 ) // map projection
1300  {
1301  // Longitude first, e.g. (lon,lat)
1302  tie_point_units = "degrees";
1303  }
1304  else
1305  {
1306  tie_point_units = "meters";
1307  }
1308 
1309  if ( ( tie_point_units == "degrees" ) &&
1310  ( axisLabelsString == "Lat Long" ) )
1311  {
1312  tie_point_xy = "(";
1313  tie_point_xy += secondOriginString.string();
1314  tie_point_xy += ",";
1315  tie_point_xy += firstOriginString.string();
1316  tie_point_xy += ")";
1317  }
1318  else
1319  {
1320  tie_point_xy = "(";
1321  tie_point_xy += firstOriginString.string();
1322  tie_point_xy += ",";
1323  tie_point_xy += secondOriginString.string();
1324  tie_point_xy += ")";
1325  }
1326  geomKwl.add( ossimKeywordNames::TIE_POINT_XY_KW, tie_point_xy.c_str() );
1327  geomKwl.add( ossimKeywordNames::TIE_POINT_UNITS_KW, tie_point_units.c_str() );
1328  status = true;
1329  }
1330  }
1331 
1332  } // Matches: if ( m_xmlDocument.valid() && (pscCode != 32767 ) )
1333 
1334  return status;
1335 
1336 } // End: ossimGmlSupportData::addTie( ... )
void clear()
Erases the entire container.
Definition: ossimString.h:432
bool valid() const
Definition: ossimRefPtr.h:75
ossimString afterPos(std::string::size_type pos) const
ossimRefPtr< ossimXmlDocument > m_xmlDocument
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
static const char * TIE_POINT_XY_KW
return status
ossimString beforePos(std::string::size_type pos) const
void findNodes(const ossimString &xpath, std::vector< ossimRefPtr< ossimXmlNode > > &nodelist) const
Appends any matching nodes to the list supplied (should be empty):
std::string::size_type find(const std::string &s, std::string::size_type pos=0) const
Searches for s as a substring of *this, beginning at character pos of *this.
Definition: ossimString.h:753
static const char * TIE_POINT_UNITS_KW
const std::string & string() const
Definition: ossimString.h:414

◆ configureBounds()

bool ossimGmlSupportData::configureBounds ( ossimRefPtr< ossimXmlNode node,
const ossimImageGeometry geom,
const ossimIrect rect 
)
private

Definition at line 377 of file ossimGmlSupportData.cpp.

References ossimXmlNode::addAttribute(), ossimXmlNode::addChildNode(), getGeoBounds(), m_axisLabelsStringGeo, m_srsDimensionString, m_srsNameStringGeo, m_uomLabelsStringGeo, and ossimXmlAttribute::setNameValue().

Referenced by configureGmljp2V2().

381 {
382  bool success = true;
383  const ossimString BLANK = "";
384 
385  ossimString upperCornerString;
386  ossimString lowerCornerString;
387  getGeoBounds( geom, rect, upperCornerString, lowerCornerString );
388 
389  ossimString path = "boundedBy";
390  ossimRefPtr<ossimXmlNode> node1 = node0->addChildNode( path, BLANK );
391 
392  path = "Envelope";
393  ossimRefPtr<ossimXmlNode> node1a = node1->addChildNode( path, BLANK );
394 
396  ossimString name;
397 
398  attr = new ossimXmlAttribute();
399  name = "srsName";
400  attr->setNameValue( name, m_srsNameStringGeo );
401  node1a->addAttribute( attr );
402 
403  attr = new ossimXmlAttribute();
404  name = "axisLabels";
405  attr->setNameValue( name, m_axisLabelsStringGeo );
406  node1a->addAttribute( attr );
407 
408  attr = new ossimXmlAttribute();
409  name = "uomLabels";
410  attr->setNameValue( name, m_uomLabelsStringGeo );
411  node1a->addAttribute( attr );
412 
413  attr = new ossimXmlAttribute();
414  name = "srsDimension";
415  attr->setNameValue( name, m_srsDimensionString );
416  node1a->addAttribute( attr );
417 
418  path = "lowerCorner";
419  ossimRefPtr<ossimXmlNode> node1a1 =
420  node1a->addChildNode( path, lowerCornerString );
421 
422  path = "upperCorner";
423  ossimRefPtr<ossimXmlNode> node1a2 =
424  node1a->addChildNode( path, upperCornerString );
425 
426  return success;
427 }
ossimString m_srsDimensionString
void getGeoBounds(const ossimImageGeometry *geom, const ossimIrect &rect, ossimString &upperCornerString, ossimString &lowerCornerString) const
ossimString m_axisLabelsStringGeo
void addAttribute(ossimRefPtr< ossimXmlAttribute > attribute)
ossimString m_uomLabelsStringGeo
void addChildNode(ossimRefPtr< ossimXmlNode > node)

◆ configureGmljp2V2()

bool ossimGmlSupportData::configureGmljp2V2 ( ossimRefPtr< ossimXmlNode node,
const ossimImageGeometry geom,
const ossimIrect rect 
)
private

Definition at line 183 of file ossimGmlSupportData.cpp.

References ossimXmlNode::addAttribute(), ossimXmlNode::addChildNode(), configureBounds(), ossimImageGeometry::getAsMapProjection(), getGeoOrigin(), getLimits(), getMapOrigin(), ossimMapProjection::isGeographic(), m_axisLabelsStringGeo, m_axisLabelsStringMap, m_srsNameStringGeo, m_srsNameStringMap, ossimXmlAttribute::setNameValue(), ossimIrect::ul(), and ossimRefPtr< T >::valid().

Referenced by initialize().

186 {
187  bool success = false;
188 
190  if ( mapProj.valid() )
191  {
192  bool isGeographic = mapProj->isGeographic();
193 
194  const ossimString BLANK = "";
195 
197  ossimString name;
198  ossimString value;
199 
200  ossimString gridHighString;
201  ossimString gridLowString;
202  getLimits( rect, gridHighString, gridLowString );
203 
204  configureBounds( node0, geom, rect );
205 
206  ossimString path = "domainSet";
208  node0->addChildNode( path, BLANK );
209 
210  path = "rangeSet";
212  node0->addChildNode( path, BLANK );
213 
214  path = "File";
216  node3->addChildNode( path, BLANK );
217 
218  path = "rangeParameters";
219  ossimRefPtr<ossimXmlNode> node3a1 =
220  node3a->addChildNode( path, BLANK );
221 
222  path = "fileName";
223  ossimRefPtr<ossimXmlNode> node3a2 =
224  node3a->addChildNode( path, "gmljp2://codestream" );
225 
226  path = "fileStructure";
227  ossimRefPtr<ossimXmlNode> node3a3 =
228  node3a->addChildNode( path, "inapplicable" );
229 
230  path = "gmlcov:rangeType";
232  node0->addChildNode( path, BLANK );
233 
234  path = "gmljp2:featureMember";
236  node0->addChildNode( path, BLANK );
237 
238  path = "gmljp2:GMLJP2RectifiedGridCoverage";
240  node5->addChildNode( path, BLANK );
241 
242  attr = new ossimXmlAttribute();
243  name = "gml:id";
244  value = "CodeStream_0";
245  attr->setNameValue( name, value );
246  node5a->addAttribute( attr );
247 
248  path = "domainSet";
249  ossimRefPtr<ossimXmlNode> node5a1 =
250  node5a->addChildNode( path, BLANK );
251 
252  path = "RectifiedGrid";
253  ossimRefPtr<ossimXmlNode> node5a1a =
254  node5a1->addChildNode( path, BLANK );
255 
256  attr = new ossimXmlAttribute();
257  name = "gml:id";
258  value = "RG0001";
259  attr->setNameValue( name, value );
260  node5a1a->addAttribute( attr );
261 
262  attr = new ossimXmlAttribute();
263  name = "dimension";
264  value = "2";
265  attr->setNameValue( name, value );
266  node5a1a->addAttribute( attr );
267 
268  attr = new ossimXmlAttribute();
269  name = "srsName";
270  attr->setNameValue( name, m_srsNameStringMap );
271  node5a1a->addAttribute( attr );
272 
273  path = "limits";
274  ossimRefPtr<ossimXmlNode> node5a1a1 =
275  node5a1a->addChildNode( path, BLANK );
276 
277  path = "GridEnvelope";
278  ossimRefPtr<ossimXmlNode> node5a1a1a =
279  node5a1a1->addChildNode( path, BLANK );
280 
281  path = "low";
282  ossimRefPtr<ossimXmlNode> node5a1a1a1 =
283  node5a1a1a->addChildNode( path, gridLowString );
284 
285  path = "high";
286  ossimRefPtr<ossimXmlNode> node5a1a1a2 =
287  node5a1a1a->addChildNode( path, gridHighString );
288 
289  path = "axisLabels";
290  ossimRefPtr<ossimXmlNode> node5a1a2 =
291  node5a1a->addChildNode( path,
292  mapProj->isGeographic() ?
294 
295  path = "origin";
296  ossimRefPtr<ossimXmlNode> node5a1a3 =
297  node5a1a->addChildNode( path, BLANK );
298 
299  path = "Point";
300  ossimRefPtr<ossimXmlNode> node5a1a3a =
301  node5a1a3->addChildNode( path, BLANK );
302 
303  attr = new ossimXmlAttribute();
304  name = "gml:id";
305  value = "P0001";
306  attr->setNameValue( name, value );
307  node5a1a3a->addAttribute( attr );
308 
309  attr = new ossimXmlAttribute();
310  name = "srsName";
311  attr->setNameValue( name, m_srsNameStringMap );
312  node5a1a3a->addAttribute( attr );
313 
314  ossimString originString;
315  ossimString offsetVector1String;
316  ossimString offsetVector2String;
317  if ( isGeographic )
318  {
319  getGeoOrigin( geom, rect.ul(), originString,
320  offsetVector1String, offsetVector2String );
321  }
322  else
323  {
324  getMapOrigin( geom, rect.ul(), originString,
325  offsetVector1String, offsetVector2String );
326  }
327 
328  path = "pos";
329  ossimRefPtr<ossimXmlNode> node5a1a3a1 =
330  node5a1a3a->addChildNode( path, originString );
331 
332  path = "offsetVector";
333  ossimRefPtr<ossimXmlNode> node5a1a4 =
334  node5a1a->addChildNode( path, offsetVector1String );
335 
336  attr = new ossimXmlAttribute();
337  name = "srsName";
338  attr->setNameValue( name,
339  (isGeographic ? m_srsNameStringGeo : m_srsNameStringMap ) );
340  node5a1a4->addAttribute( attr );
341 
342  path = "offsetVector";
343  ossimRefPtr<ossimXmlNode> node5a1a5 =
344  node5a1a->addChildNode( path, offsetVector2String );
345 
346  attr = new ossimXmlAttribute();
347  name = "srsName";
348  attr->setNameValue( name, (isGeographic ? m_srsNameStringGeo : m_srsNameStringMap) );
349  node5a1a5->addAttribute( attr );
350 
351  path = "rangeSet";
352  ossimRefPtr<ossimXmlNode> node5a2 =
353  node5a->addChildNode( path, BLANK );
354 
355  path = "File";
356  ossimRefPtr<ossimXmlNode> node5a2a =
357  node5a2->addChildNode( path, BLANK );
358 
359  path = "rangeParameters";
360  ossimRefPtr<ossimXmlNode> node5a2a1 =
361  node5a2a->addChildNode( path, BLANK );
362 
363  path = "fileName";
364  ossimRefPtr<ossimXmlNode> node5a2a2 =
365  node5a2a->addChildNode( path, "gmljp2://codestream" );
366 
367  path = "fileStructure";
368  ossimRefPtr<ossimXmlNode> node5a2a3 =
369  node5a2a->addChildNode( path, "inapplicable" );
370 
371  success = true;
372  }
373 
374  return success;
375 }
void getLimits(const ossimIrect &rect, ossimString &gridHighString, ossimString &gridLowString) const
bool valid() const
Definition: ossimRefPtr.h:75
const ossimMapProjection * getAsMapProjection() const
ossimString m_axisLabelsStringMap
virtual bool isGeographic() const
const ossimIpt & ul() const
Definition: ossimIrect.h:274
ossimString m_axisLabelsStringGeo
void getGeoOrigin(const ossimImageGeometry *geom, const ossimIpt &ul, ossimString &originString, ossimString &offsetVector1String, ossimString &offsetVector2String) const
void getMapOrigin(const ossimImageGeometry *geom, const ossimIpt &ul, ossimString &originString, ossimString &offsetVector1String, ossimString &offsetVector2String) const
void addAttribute(ossimRefPtr< ossimXmlAttribute > attribute)
void addChildNode(ossimRefPtr< ossimXmlNode > node)
bool configureBounds(ossimRefPtr< ossimXmlNode > node, const ossimImageGeometry *geom, const ossimIrect &rect)

◆ getGeoBounds()

void ossimGmlSupportData::getGeoBounds ( const ossimImageGeometry geom,
const ossimIrect rect,
ossimString upperCornerString,
ossimString lowerCornerString 
) const
private

Definition at line 1048 of file ossimGmlSupportData.cpp.

References ossimImageGeometry::getAsMapProjection(), ossimGpt::lat, ossimImageGeometry::localToWorld(), ossimGpt::lon, ossimIrect::lr(), os2, ossimIrect::ul(), and ossimRefPtr< T >::valid().

Referenced by configureBounds().

1052 {
1053  if ( geom )
1054  {
1056  if ( mapProj.valid() )
1057  {
1058  // Get the bounding rect. This assumes North up.
1059  ossimGpt ulGpt;
1060  ossimGpt lrGpt;
1061  geom->localToWorld( rect.ul(), ulGpt );
1062  geom->localToWorld( rect.lr(), lrGpt );
1063 
1064  std::ostringstream os;
1065  os.precision(15);
1066  os << ulGpt.lat << " " << ulGpt.lon;
1067  upperCornerString = os.str();
1068 
1070  os2.precision(15);
1071  os2 << lrGpt.lat << " " << lrGpt.lon;
1072  lowerCornerString = os2.str();
1073  }
1074  }
1075 
1076 } // End: ossimGmlSupportData::getGeoBounds
std::ostringstream os2
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: ossimIosFwd.h:35
bool valid() const
Definition: ossimRefPtr.h:75
const ossimMapProjection * getAsMapProjection() const
const ossimIpt & ul() const
Definition: ossimIrect.h:274
ossim_float64 lon
Definition: ossimGpt.h:266
bool localToWorld(const ossimDpt &local_pt, ossimGpt &world_pt) const
Exposes the 3D projection from image to world coordinates.
const ossimIpt & lr() const
Definition: ossimIrect.h:276
ossim_float64 lat
Definition: ossimGpt.h:265

◆ getGeoOrigin()

void ossimGmlSupportData::getGeoOrigin ( const ossimImageGeometry geom,
const ossimIpt ul,
ossimString originString,
ossimString offsetVector1String,
ossimString offsetVector2String 
) const
private

Definition at line 971 of file ossimGmlSupportData.cpp.

References ossimImageGeometry::getDegreesPerPixel(), ossimGpt::lat, ossimImageGeometry::localToWorld(), ossimGpt::lon, os2, ossimDpt::x, and ossimDpt::y.

Referenced by configureGmljp2V2().

977 {
978  if ( geom )
979  {
980  // Get the gsd:
981  ossimDpt gsd;
982  geom->getDegreesPerPixel( gsd );
983 
984  // Get tie point:
985  ossimGpt tie;
986  geom->localToWorld( ul, tie );
987 
989  os.precision(15);
990  os << tie.lat << " " << tie.lon;
991  originString = os.str();
992 
994  os2.precision(15);
995  os2 << -gsd.y << " " << "0.0";
996  offsetVector1String = os2.str();
997 
998  std::ostringstream os3;
999  os3.precision(15);
1000  os3 << "0.0" << " " << gsd.x;
1001  offsetVector2String = os3.str();
1002  }
1003 
1004 } // End: ossimGmlSupportData::getGeoOrigin
std::ostringstream os2
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: ossimIosFwd.h:35
double y
Definition: ossimDpt.h:165
ossimDpt getDegreesPerPixel() const
Returns the resolution of this image in degrees/pixel.
ossim_float64 lon
Definition: ossimGpt.h:266
bool localToWorld(const ossimDpt &local_pt, ossimGpt &world_pt) const
Exposes the 3D projection from image to world coordinates.
double x
Definition: ossimDpt.h:164
ossim_float64 lat
Definition: ossimGpt.h:265

◆ getGmljp2V1RootNode()

ossimRefPtr< ossimXmlNode > ossimGmlSupportData::getGmljp2V1RootNode ( ) const
private

Definition at line 486 of file ossimGmlSupportData.cpp.

References ossimXmlNode::addAttribute(), ossimXmlAttribute::setNameValue(), and ossimXmlNode::setTag().

Referenced by initialize().

487 {
489 
490  ossimString os = "gml:FeatureCollection";
491  node->setTag( os );
492 
494  ossimString name;
495  ossimString value;
496 
497  attr = new ossimXmlAttribute();
498  name = "xmlns";
499  value = "http://www.opengis.net/gml";
500  attr->setNameValue( name, value );
501  node->addAttribute( attr );
502 
503  attr = new ossimXmlAttribute();
504  name = "xmlns:gml";
505  value = "http://www.opengis.net/gml";
506  attr->setNameValue( name, value );
507  node->addAttribute( attr );
508 
509  attr = new ossimXmlAttribute();
510  name = "xmlns:xsi";
511  value = "http://www.w3.org/2001/XMLSchema-instance";
512  attr->setNameValue( name, value );
513  node->addAttribute( attr );
514 
515  attr = new ossimXmlAttribute();
516  name = "xsi:schemaLocation";
517  value = "http://www.opengis.net/gml gmlJP2Profile.xsd";
518  attr->setNameValue( name, value );
519  node->addAttribute( attr );
520 
521  return node;
522 
523 } // ossimGmlSupportData::getGmljp2V1Node()
void setTag(const ossimString &tag)
void addAttribute(ossimRefPtr< ossimXmlAttribute > attribute)

◆ getGmljp2V2RootNode()

ossimRefPtr< ossimXmlNode > ossimGmlSupportData::getGmljp2V2RootNode ( ) const
private

Definition at line 429 of file ossimGmlSupportData.cpp.

References ossimXmlNode::addAttribute(), ossimXmlAttribute::setNameValue(), and ossimXmlNode::setTag().

Referenced by initialize().

430 {
432 
433  ossimString os = "gmljp2:GMLJP2CoverageCollection";
434  node->setTag( os );
435 
437  ossimString name;
438  ossimString value;
439 
440  attr = new ossimXmlAttribute();
441  name = "gml:id";
442  value = "JPEG2000_0";
443  attr->setNameValue( name, value );
444  node->addAttribute( attr );
445 
446  attr = new ossimXmlAttribute();
447  name = "xmlns";
448  value = "http://www.opengis.net/gml/3.2";
449  attr->setNameValue( name, value );
450  node->addAttribute( attr );
451 
452  attr = new ossimXmlAttribute();
453  name = "xmlns:gml";
454  value = "http://www.opengis.net/gml/3.2";
455  attr->setNameValue( name, value );
456  node->addAttribute( attr );
457 
458  attr = new ossimXmlAttribute();
459  name = "xmlns:gmlcov";
460  value = "http://www.opengis.net/gmlcov/1.0";
461  attr->setNameValue( name, value );
462  node->addAttribute( attr );
463 
464  attr = new ossimXmlAttribute();
465  name = "xmlns:gmljp2";
466  value = "http://www.opengis.net/gmljp2/2.0";
467  attr->setNameValue( name, value );
468  node->addAttribute( attr );
469 
470  attr = new ossimXmlAttribute();
471  name = "xmlns:xsi";
472  value = "http://www.w3.org/2001/XMLSchema-instance";
473  attr->setNameValue( name, value );
474  node->addAttribute( attr );
475 
476  attr = new ossimXmlAttribute();
477  name = "xsi:schemaLocation";
478  value = "http://www.opengis.net/gmljp2/2.0 http://schemas.opengis.net/gmljp2/2.0/gmljp2.xsd";
479  attr->setNameValue( name, value );
480  node->addAttribute( attr );
481 
482  return node;
483 
484 } // ossimGmlSupportData::getGmljp2V2Node()
void setTag(const ossimString &tag)
void addAttribute(ossimRefPtr< ossimXmlAttribute > attribute)

◆ getImageGeometry()

bool ossimGmlSupportData::getImageGeometry ( ossimKeywordlist geomKwl) const

Extracts geometry info to keyword list.

Populates the keyword list with image geometry information. This method is used to relay projection/model information to users.

Parameters
geomKwlKeyword list that will be initialized with geometry info.
Returns
true if geometry info is present, false if not.

Definition at line 544 of file ossimGmlSupportData.cpp.

References getImageGeometryFromRectifiedGrid(), and getImageGeometryFromSeonsorModel().

545 {
546  // Try for map projected geometry first...
547  bool success = getImageGeometryFromRectifiedGrid( geomKwl );
548  if ( !success )
549  {
550  // Look for sensor model block.
552  }
553 
554  return success;
555 }
bool getImageGeometryFromRectifiedGrid(ossimKeywordlist &geomKwl) const
For map projected data:
bool getImageGeometryFromSeonsorModel(ossimKeywordlist &geomKwl) const
For sensor model data:

◆ getImageGeometryFromRectifiedGrid()

bool ossimGmlSupportData::getImageGeometryFromRectifiedGrid ( ossimKeywordlist geomKwl) const
private

For map projected data:

Parameters
geomKwlInitialized by this.

Definition at line 1117 of file ossimGmlSupportData.cpp.

References ossimKeywordlist::add(), addLineSamps(), addScale(), addTie(), ossimString::after(), ossimString::c_str(), ossimXmlDocument::findNodes(), ossimXmlAttribute::getValue(), m_xmlDocument, ossimKeywordNames::PCS_CODE_KW, ossimKeywordNames::SRS_NAME_KW, status, ossimString::string(), ossimString::toUInt32(), ossimKeywordNames::TYPE_KW, and ossimRefPtr< T >::valid().

Referenced by getImageGeometry().

1118 {
1119  bool status = false;
1120 
1121  if ( m_xmlDocument.valid() )
1122  {
1123  bool useGmlPrefix = false;
1124 
1125  vector< ossimRefPtr<ossimXmlNode> > xml_nodes;
1126 
1127  ossimString xpath0 = "/gmljp2:GMLJP2CoverageCollection/gmljp2:featureMember/gmljp2:GMLJP2RectifiedGridCoverage/domainSet/RectifiedGrid";
1128  m_xmlDocument->findNodes( xpath0, xml_nodes );
1129  if ( !xml_nodes.size() )
1130  {
1131  xpath0 = "/gmljp2:GMLJP2CoverageCollection/gmljp2:featureMember/gmljp2:GMLJP2RectifiedGridCoverage/gml:domainSet/gml:RectifiedGrid";
1132  m_xmlDocument->findNodes( xpath0, xml_nodes );
1133  if ( xml_nodes.size() )
1134  {
1135  useGmlPrefix = true;
1136  }
1137  }
1138 
1139  if ( xml_nodes.size() )
1140  {
1141  const ossimString SRS_NAME( "srsName" );
1142  const ossimString PCS_CODE_DEFINITION_STR( "http://www.opengis.net/def/crs/EPSG/0/" );
1143 
1144  const ossimRefPtr<ossimXmlAttribute> hrefAttribute =
1145  xml_nodes[0]->findAttribute( SRS_NAME );
1146  const ossimString& originSrsName = hrefAttribute->getValue();
1147 
1148  ossimString pcsCodeStr = originSrsName.after( PCS_CODE_DEFINITION_STR.string() );
1149  ossim_uint32 pcsCode = pcsCodeStr.toUInt32();
1150 
1151  if ( pcsCode != 32767 )
1152  {
1153  // Add the pcs code.
1154  geomKwl.add( ossimKeywordNames::PCS_CODE_KW, pcsCodeStr.c_str() );
1155  if ( pcsCode == 4326 )
1156  {
1157  ossimString srsName = "EPSG:";
1158  srsName += pcsCodeStr;
1159  geomKwl.add( ossimKeywordNames::SRS_NAME_KW, srsName.c_str() );
1160  geomKwl.add( ossimKeywordNames::TYPE_KW, "ossimEquDistCylProjection");
1161  }
1162 
1163  if ( addLineSamps( xpath0, useGmlPrefix, geomKwl ) )
1164  {
1165  if ( addTie( xpath0, useGmlPrefix, pcsCode, geomKwl ) )
1166  {
1167  status = addScale( xpath0, useGmlPrefix, pcsCode, geomKwl );
1168  }
1169  }
1170  }
1171  }
1172  }
1173 
1174  return status;
1175 }
bool valid() const
Definition: ossimRefPtr.h:75
bool addLineSamps(const ossimString &xpath0, bool useGmlPrefix, ossimKeywordlist &geomKwl) const
Adds line and sample to keyword list.
ossim_uint32 toUInt32() const
const ossimString & getValue() const
static const char * TYPE_KW
bool addTie(const ossimString &xpath0, bool useGmlPrefix, ossim_uint32 pcsCode, ossimKeywordlist &geomKwl) const
Adds tie point to keyword list.
ossimRefPtr< ossimXmlDocument > m_xmlDocument
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
bool addScale(const ossimString &xpath0, bool useGmlPrefix, ossim_uint32 pcsCode, ossimKeywordlist &geomKwl) const
Adds tie and scale to keyword list.
unsigned int ossim_uint32
return status
static const char * PCS_CODE_KW
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string&#39;s contents...
Definition: ossimString.h:396
void findNodes(const ossimString &xpath, std::vector< ossimRefPtr< ossimXmlNode > > &nodelist) const
Appends any matching nodes to the list supplied (should be empty):
ossimString after(const ossimString &str, std::string::size_type pos=0) const
METHOD: after(str, pos) Returns string immediately after the token str.
static const char * SRS_NAME_KW

◆ getImageGeometryFromSeonsorModel()

bool ossimGmlSupportData::getImageGeometryFromSeonsorModel ( ossimKeywordlist geomKwl) const
private

For sensor model data:

Parameters
geomKwlInitialized by this.

Definition at line 1096 of file ossimGmlSupportData.cpp.

References ossimXmlDocument::findNodes(), m_xmlDocument, status, and ossimRefPtr< T >::valid().

Referenced by getImageGeometry().

1097 {
1098  bool status = false;
1099 
1100  if ( m_xmlDocument.valid() )
1101  {
1102  vector< ossimRefPtr<ossimXmlNode> > xml_nodes;
1103  ossimString xpath0 = "/gmljp2:GMLJP2CoverageCollection/gmljp2:featureMember/gmljp2:GMLJP2ReferenceableGridCoverage/gml:domainSet/gmlcov:ReferenceableGridBySensorModel";
1104 
1105  m_xmlDocument->findNodes( xpath0, xml_nodes );
1106  if ( xml_nodes.size() >= 1 )
1107  {
1108  // Put sensor model code here...
1109 
1110  status = true;
1111  }
1112  }
1113 
1114  return status;
1115 }
bool valid() const
Definition: ossimRefPtr.h:75
ossimRefPtr< ossimXmlDocument > m_xmlDocument
return status
void findNodes(const ossimString &xpath, std::vector< ossimRefPtr< ossimXmlNode > > &nodelist) const
Appends any matching nodes to the list supplied (should be empty):

◆ getLimits()

void ossimGmlSupportData::getLimits ( const ossimIrect rect,
ossimString gridHighString,
ossimString gridLowString 
) const
private

Definition at line 1078 of file ossimGmlSupportData.cpp.

References ossimIrect::hasNans(), ossimIrect::height(), and ossimIrect::width().

Referenced by configureGmljp2V2().

1081 {
1082  if ( rect.hasNans() == false )
1083  {
1084  // Zero based image rect.
1085  gridLowString = "0 0";
1086 
1087  ossim_uint32 w = rect.width();
1088  ossim_uint32 h = rect.height();
1089 
1090  std::ostringstream os;
1091  os << (w-1) << " " << (h-1);
1092  gridHighString = os.str();
1093  }
1094 }
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: ossimIosFwd.h:35
ossim_uint32 height() const
Definition: ossimIrect.h:487
unsigned int ossim_uint32
ossim_uint32 width() const
Definition: ossimIrect.h:500
bool hasNans() const
Definition: ossimIrect.h:337

◆ getMapOrigin()

void ossimGmlSupportData::getMapOrigin ( const ossimImageGeometry geom,
const ossimIpt ul,
ossimString originString,
ossimString offsetVector1String,
ossimString offsetVector2String 
) const
private

Definition at line 1007 of file ossimGmlSupportData.cpp.

References ossimMapProjection::forward(), ossimImageGeometry::getAsMapProjection(), ossimImageGeometry::getMetersPerPixel(), ossimImageGeometry::localToWorld(), os2, ossimRefPtr< T >::valid(), ossimDpt::x, and ossimDpt::y.

Referenced by configureGmljp2V2().

1013 {
1014  if ( geom )
1015  {
1017  if ( mapProj.valid() != 0 )
1018  {
1019  // Get the tie point:
1020  ossimGpt gpt;
1021  geom->localToWorld( ul, gpt );
1022 
1023  ossimDpt tie = mapProj->forward( gpt );
1024 
1025  std::ostringstream os;
1026  os.precision(15);
1027  os << tie.x << " " << tie.y;
1028  originString = os.str();
1029  }
1030 
1031  // Get the projected CS gsd:
1032  ossimDpt gsdMap;
1033  geom->getMetersPerPixel( gsdMap );
1034 
1036  os2.precision(15);
1037  os2 << gsdMap.x << " " << "0.0";
1038  offsetVector1String = os2.str();
1039 
1040  std::ostringstream os3;
1041  os3.precision(15);
1042  os3 << "0.0" << " " << -gsdMap.y;
1043  offsetVector2String = os3.str();
1044  }
1045 
1046 } // End: ossimGmlSupportData::getMapBounds
std::ostringstream os2
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: ossimIosFwd.h:35
bool valid() const
Definition: ossimRefPtr.h:75
const ossimMapProjection * getAsMapProjection() const
double y
Definition: ossimDpt.h:165
bool localToWorld(const ossimDpt &local_pt, ossimGpt &world_pt) const
Exposes the 3D projection from image to world coordinates.
ossimDpt getMetersPerPixel() const
Returns the GSD associated with this image in the active projection.
virtual ossimDpt forward(const ossimGpt &worldPoint) const =0
All map projections will convert the world coordinate to an easting northing (Meters).
double x
Definition: ossimDpt.h:164

◆ getXmlDoc()

ossimRefPtr< ossimXmlDocument > ossimGmlSupportData::getXmlDoc ( ) const
Returns
Reference to xml doc.

Definition at line 539 of file ossimGmlSupportData.cpp.

References m_xmlDocument.

540 {
541  return m_xmlDocument;
542 }
ossimRefPtr< ossimXmlDocument > m_xmlDocument

◆ initialize() [1/2]

bool ossimGmlSupportData::initialize ( const ossimImageGeometry geom,
const ossimIrect rect 
)

Initializes gml block from geometry file.

Parameters
geom
rectOutput rectangle (view rect).

Definition at line 78 of file ossimGmlSupportData.cpp.

References configureGmljp2V2(), ossimImageGeometry::getAsMapProjection(), getGmljp2V1RootNode(), getGmljp2V2RootNode(), ossimMapProjection::getPcsCode(), ossimXmlDocument::initRoot(), m_pcsCodeGeo, m_pcsCodeMap, m_srsNameStringGeo, m_srsNameStringMap, m_xmlDocument, ossimFilename::NIL, os2, ossimNotify(), ossimNotifyLevel_DEBUG, status, and ossimRefPtr< T >::valid().

Referenced by ossimOpjCompressor::writeGmlBox(), and ossimKakaduCompressor::writeGmlBox().

80 {
81  static const char MODULE[] = "ossimGmlSupportData::initialize(geom)";
82 
83  bool status = false;
84 
85  if ( geom )
86  {
87  // ossim_uint32 code = UNKNOWN_PCSCODE; // unknown code
88 
90  if ( mapProj.valid() )
91  {
92  // Get the PCS code:
93  m_pcsCodeMap = mapProj->getPcsCode();
94  m_pcsCodeGeo = mapProj->getPcsCode();
95 
96  // Create an SRS Name for the map projection
98  os << "http://www.opengis.net/def/crs/EPSG/0/" << m_pcsCodeMap;
99  m_srsNameStringMap = os.str();
100 
101  // Create an SRS Name for the projection datum
103  os2 << "http://www.opengis.net/def/crs/EPSG/0/" << m_pcsCodeGeo;
104  m_srsNameStringGeo = os2.str();
105 
107 
108  // if ( m_use_gmljp2_version2 == true )
109  // {
110 
112  m_xmlDocument->initRoot( rootNode );
113  status = configureGmljp2V2( rootNode, geom, rect );
114  // }
115 
116 #if 0
117  else
118  {
120  m_xmlDocument->initRoot( rootNode );
121  status = configureGmljp2V1( rootNode, geom, rect );
122  }
123 #endif
124 
125  // cout << "gmljp2Node: " << *(gmljp2Node.get()) << endl;
126 
127  // cout << "xmlDoc: " << *(m_xmlDocument.get()) << endl;
128  }
129  }
130 
131  if ( status == false )
132  {
134  << MODULE << " DEBUG Entered...\n";
135 
136  }
137 
138  return status;
139 
140 } // End: ossimGmlSupportData::initialize( geom, mapProj )
std::ostringstream os2
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Definition: ossimIosFwd.h:35
static const ossimFilename NIL
This was taken from Wx widgets for performing touch and access date stamps.
Definition: ossimFilename.h:40
bool valid() const
Definition: ossimRefPtr.h:75
const ossimMapProjection * getAsMapProjection() const
virtual ossim_uint32 getPcsCode() const
Returns the EPSG PCS code or 32767 if the projection is a custom (non-EPSG) projection.
ossimRefPtr< ossimXmlDocument > m_xmlDocument
ossimRefPtr< ossimXmlNode > getGmljp2V1RootNode() const
ossimRefPtr< ossimXmlNode > getGmljp2V2RootNode() const
return status
bool configureGmljp2V2(ossimRefPtr< ossimXmlNode > node, const ossimImageGeometry *geom, const ossimIrect &rect)
void initRoot(ossimRefPtr< ossimXmlNode > node)
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ initialize() [2/2]

bool ossimGmlSupportData::initialize ( std::istream &  in)

Initializes from stream assumed to be a gml block.

Parameters
in

Definition at line 60 of file ossimGmlSupportData.cpp.

References m_xmlDocument, ossimXmlDocument::read(), and status.

61 {
62  bool status = false;
63 
64  if ( in.good() )
65  {
67  m_xmlDocument->read( in );
68  status = true;
69  }
70  else
71  {
72  m_xmlDocument = 0;
73  }
74 
75  return status;
76 }
ossimRefPtr< ossimXmlDocument > m_xmlDocument
return status
bool read(std::istream &in)

◆ write()

bool ossimGmlSupportData::write ( std::ostream &  os)

Write xml doc to stream.

Definition at line 525 of file ossimGmlSupportData.cpp.

References ossimRefPtr< T >::get(), m_xmlDocument, status, and ossimRefPtr< T >::valid().

Referenced by ossimOpjCompressor::writeGmlBox(), and ossimKakaduCompressor::writeGmlBox().

526 {
527  bool status = false;
528 
529  if ( m_xmlDocument.valid() )
530  {
531  os << *(m_xmlDocument.get());
532 
533  status = true;
534  }
535 
536  return status;
537 }
bool valid() const
Definition: ossimRefPtr.h:75
ossimRefPtr< ossimXmlDocument > m_xmlDocument
return status

Member Data Documentation

◆ m_axisLabelsStringGeo

ossimString ossimGmlSupportData::m_axisLabelsStringGeo
private

Definition at line 164 of file ossimGmlSupportData.h.

Referenced by configureBounds(), and configureGmljp2V2().

◆ m_axisLabelsStringMap

ossimString ossimGmlSupportData::m_axisLabelsStringMap
private

Definition at line 163 of file ossimGmlSupportData.h.

Referenced by configureGmljp2V2().

◆ m_pcsCodeGeo

ossim_uint32 ossimGmlSupportData::m_pcsCodeGeo
private

Definition at line 159 of file ossimGmlSupportData.h.

Referenced by initialize().

◆ m_pcsCodeMap

ossim_uint32 ossimGmlSupportData::m_pcsCodeMap
private

Definition at line 158 of file ossimGmlSupportData.h.

Referenced by initialize().

◆ m_srsDimensionString

ossimString ossimGmlSupportData::m_srsDimensionString
private

Definition at line 162 of file ossimGmlSupportData.h.

Referenced by configureBounds().

◆ m_srsNameStringGeo

ossimString ossimGmlSupportData::m_srsNameStringGeo
private

Definition at line 161 of file ossimGmlSupportData.h.

Referenced by configureBounds(), configureGmljp2V2(), and initialize().

◆ m_srsNameStringMap

ossimString ossimGmlSupportData::m_srsNameStringMap
private

Definition at line 160 of file ossimGmlSupportData.h.

Referenced by configureGmljp2V2(), and initialize().

◆ m_uomLabelsStringGeo

ossimString ossimGmlSupportData::m_uomLabelsStringGeo
private

Definition at line 166 of file ossimGmlSupportData.h.

Referenced by configureBounds().

◆ m_uomLabelsStringMap

ossimString ossimGmlSupportData::m_uomLabelsStringMap
private

Definition at line 165 of file ossimGmlSupportData.h.

◆ m_xmlDocument

ossimRefPtr<ossimXmlDocument> ossimGmlSupportData::m_xmlDocument
private

The documentation for this class was generated from the following files: