get_TargetCoordSys Method

WRAPPER_API CoordSys& get_TargetCoordSys()

WRAPPER_API const CoordSys& get_TargetCoordSys() const

 

Description

The get_TargetCoordSys method returns the CoordSys to which CoordPoints will be converted.

 

Example

void CoordTransform_getHasValidVerticalTransform(GeoCalcPBW::DataSource & data)

{

GeoCalcPBW::CoordTransform ct;

GeoCalcPBW::GeodeticCoordSys * source = data.GetGeodeticCoordSys(_towchar("BMG").c_str(), _towchar("WGS84_coordinate_system").c_str());

GeoCalcPBW::ProjectedCoordSys * target = data.GetProjectedCoordSys(_towchar("BMG").c_str(), _towchar("IA-27W").c_str());

GeoCalcPBW::VerticalReference * sourceVR = data.GetVerticalReference(_towchar("BMG").c_str(), _towchar("NGVD29_GEOID96").c_str());

GeoCalcPBW::VerticalReference * targetVR = data.GetVerticalReference(_towchar("BMG").c_str(), _towchar("ELLIPSOID_HEIGHT").c_str());

source->set_VerticalReference(sourceVR);

target->get_InnerGeodetic().set_VerticalReference(targetVR);

ct.set_SourceCoordSys(*source);

ct.set_TargetCoordSys(*target);

 

GeoCalcPBW::DatumShiftPreferences shiftPrefs;

int opt = GeoCalcPBW::DatumShiftPreferences::ProcFlags::Direct |

GeoCalcPBW::DatumShiftPreferences::ProcFlags::ViaIntermediary |

GeoCalcPBW::DatumShiftPreferences::ProcFlags::IgnoreArea |

GeoCalcPBW::DatumShiftPreferences::ProcFlags::IgnoreMethod;

shiftPrefs.set_Options(opt);

 

if(! data.EstablishDatumShift(ct, shiftPrefs))

{

AfxMessageBox("EstablishDatumShift failed");

}

 

if(! ct.InitializeVerticalTransform())

{

AfxMessageBox("InitializeVerticalTransform failed");

}

 

GeoCalcPBW::CoordPoint * sourcePt = ct.get_SourceCoordSys().get_PointStyle().CloneCoordPoint();

GeoCalcPBW::CoordPoint * targetPt = ct.get_TargetCoordSys().get_PointStyle().CloneCoordPoint();

if(ct.get_HasValidVerticalTransform())

{

sourcePt->set_InUnits(-14.27, 45.76, 139.77);

}

else

{

sourcePt->set_InUnits(-14.27, 45.76);

}

 

if(! ct.ConvertAhead(*sourcePt, *targetPt))

{

AfxMessageBox("ConvertAhead failed");

}

 

delete source;

delete target;

delete sourcePt;

delete targetPt;

}