OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimPointCloudGeometry.cpp
Go to the documentation of this file.
1 //**************************************************************************************************
2 //
3 // OSSIM (http://trac.osgeo.org/ossim/)
4 //
5 // License: LGPL -- See LICENSE.txt file in the top level directory for more details.
6 //
7 //**************************************************************************************************
8 // $Id$
9 
15 
16 RTTI_DEF1(ossimPointCloudGeometry, "ossimPointCloudGeometry" , ossimObject);
17 
19  : m_format(GEOGRAPHIC),
20  m_projection(0),
21  m_datum(ossimDatumFactory::instance()->wgs84())
22 {
23  // Establish projection from WKT:
24  m_projection = dynamic_cast<ossimMapProjection*>(
26 
27  if (m_projection.valid())
28  {
30  if (!m_projection->isGeographic())
32  }
33 }
34 
36 {
37  if (m_format != other.m_format)
38  return false;
39 
40  if (m_projection.valid() && other.m_projection.valid() && (*m_projection == *(other.m_projection)))
41  return true;
42 
43  return false;
44 }
45 
46 void ossimPointCloudGeometry::convertPos(const ossimDpt3d& oldPt, ossimGpt& converted_gpos) const
47 {
48  converted_gpos.makeNan();
49 
50  // If the data buffer has existing points, transform them into the new projection and datum:
51  if (m_format == GEOGRAPHIC)
52  {
53  ossimGpt gpt (oldPt.y, oldPt.x, oldPt.z, m_datum);
54  gpt.changeDatum(converted_gpos.datum());
55  converted_gpos = gpt;
56  }
57  else if ((m_format == MAP_PROJECTED) && m_projection.valid())
58  {
60  double coord_scale = uct.getMeters();
61 
62  //Need to convert map E, N to lat, lon
63  ossimDpt oldMapPt(oldPt.x*coord_scale, oldPt.y*coord_scale);
64  ossimGpt gpt(getProjection()->inverse(oldMapPt));
65  gpt.changeDatum(m_datum);
66  gpt.hgt = oldPt.z*coord_scale;
67  gpt.changeDatum(converted_gpos.datum());
68  converted_gpos = gpt;
69  }
70  else if (m_format == ECF_METERS)
71  {
72  ossimEcefPoint oldEcfPt(oldPt);
73  converted_gpos = ossimGpt (oldEcfPt, converted_gpos.datum());
74  }
75 
76  return;
77 }
78 
RTTI_DEF1(ossimPointCloudGeometry, "ossimPointCloudGeometry", ossimObject)
bool valid() const
Definition: ossimRefPtr.h:75
void makeNan()
Definition: ossimGpt.h:130
virtual bool isGeographic() const
ossim_float64 hgt
Height in meters above the ellipsiod.
Definition: ossimGpt.h:274
ossimRefPtr< ossimMapProjection > m_projection
void changeDatum(const ossimDatum *datum)
This will actually perform a shift.
Definition: ossimGpt.cpp:316
const ossimDatum * datum() const
datum().
Definition: ossimGpt.h:196
double z
Definition: ossimDpt3d.h:145
virtual const ossimDatum * getDatum() const
virtual ossimProjection * createProjection(const ossimFilename &filename, ossim_uint32 entryIdx) const
STUB. Not implemented.
void convertPos(const ossimDpt3d &stored_pos, ossimGpt &converted_gpos) const
Method converts a generic 3D point as stored in the argument ossim3Dpt object, and converts it to an ...
const ossimMapProjection * getProjection() const
ossimUnitType getProjectionUnits() const
OSSIM considers all map projection coordinates (including false eastings and northings) to be in mete...
double x
Definition: ossimDpt3d.h:143
bool operator==(const ossimPointCloudGeometry &other) const
ossimPointCloudGeometry(const ossimString &wkt)
Constructs from WKT specification.
double y
Definition: ossimDpt3d.h:144
static ossimWktProjectionFactory * instance()
Implements singleton pattern.