WRAPPER_API bool ShiftForward(const GeodeticPoint &inputPoint, GeodeticPoint &outputPoint) const
The ShiftForward method performs this DatumShift on a GeodeticPoint. If get_ReverseUsage returns true, then ShiftForward will shift the point from the TargetDatum to the SourceDatum. If get_ReverseUsage returns false, the ShiftForward will shift the point from the SourceDatum to the TargetDatum. This method takes two arguments, the first of which is the point to convert, and the second of which is the point that will hold the result of the conversion. It returns a boolean value indicating the success of the operation.
void DatumShift_ShiftForward(GeoCalcPBW::DataSource & data)
{
GeoCalcPBW::DatumShift ds(GeoCalcPBW::DatumShift::ClassType::BursaWolfe);
GeoCalcPBW::HorizontalDatum * source = data.GetHorizontalDatum(L"BMG", L"CH1903");
GeoCalcPBW::HorizontalDatum * target = data.GetHorizontalDatum(L"BMG", L"WGS84");
GeoCalcPBW::Envelope * envelope = data.GetEnvelope(L"BMG", L"CH1903_coordinate_system_envelope");
ds.set_SourceDatum(*source);
ds.set_TargetDatum(*target);
ds.set_Envelope(*envelope);
if(ds.get_Parameters().Exists(L"dx"))
{
GeoCalcPBW::LinearValue lv;
lv.set_InMeters(660.077);
ds.get_Parameters().set_LinearItem(L"dx", lv);
}
if(ds.get_Parameters().Exists(L"dy"))
{
GeoCalcPBW::LinearValue lv;
lv.set_InMeters(13.551);
ds.get_Parameters().set_LinearItem(L"dy", lv);
}
if(ds.get_Parameters().Exists(L"dz"))
{
GeoCalcPBW::LinearValue lv;
lv.set_InMeters(369.344);
ds.get_Parameters().set_LinearItem(L"dz", lv);
}
GeoCalcPBW::AngularUnit * au = data.GetAngularUnit(L"BMG", L"ARCSECONDS");
GeoCalcPBW::AngularValue av;
av.set_Units(*au);
if(ds.get_Parameters().Exists(L"rx"))
{
av.set_InUnits(-0.804816);
ds.get_Parameters().set_AngularItem(L"rx", av);
}
if(ds.get_Parameters().Exists(L"ry"))
{
av.set_InUnits(-0.577692);
ds.get_Parameters().set_AngularItem(L"ry", av);
}
if(ds.get_Parameters().Exists(L"rz"))
{
av.set_InUnits(-0.952236);
ds.get_Parameters().set_AngularItem(L"rz", av);
}
if(ds.get_Parameters().Exists(L"k"))
{
ds.get_Parameters().set_FloatItem(L"k", 5.66);
}
GeoCalcPBW::GeodeticPoint * sourcePt = data.GetGeodeticPoint(L"BMG", L"GEODETIC_POINT_DEGREES");
GeoCalcPBW::GeodeticPoint * targetPt = data.GetGeodeticPoint(L"BMG", L"GEODETIC_POINT_DEGREES");
sourcePt->set_InUnits(0, 0);
if(! ds.ShiftForward(*sourcePt, *targetPt))
{
AfxMessageBox("ShiftForward failed");
}
delete source;
delete target;
delete envelope;
delete au;
delete sourcePt;
delete targetPt;
}