WRAPPER_API CoordSys &get_BaseCoordSys()
WRAPPER_API const CoordSys &get_BaseCoordSys() const
The get_BaseCoordSys method returns the CoordSys from which this FittedCoordSys was constructed.
void FittedCoordSys_getBaseCoordSys(GeoCalcPBW::DataSource & data, GeoCalcPBW::CoordPointCollection & control, GeoCalcPBW::CoordPointCollection & observed)
{
GeoCalcPBW::FittedCoordSys fcs;
GeoCalcPBW::CoordSys * baseCS = data.GetProjectedCoordSys(L"BMG", L"AK9-27");
fcs.set_BaseCoordSys(*baseCS);
fcs.set_PointStyle(fcs.get_BaseCoordSys().get_PointStyle());
fcs.set_TransformAhead(GeoCalcPBW::MathTransform(GeoCalcPBW::MathTransform::ClassType::Affine));
if(fcs.get_TransformAhead().AddPointList(control, observed) < control.get_Count())
{
AfxMessageBox("AddPointList for TransformAhead failed to add all points");
}
if(! fcs.get_TransformAhead().Solve())
{
AfxMessageBox("Solve for TransformAhead failed");
}
fcs.set_TransformBack(GeoCalcPBW::MathTransform(GeoCalcPBW::MathTransform::ClassType::Affine));
if(fcs.get_TransformBack().AddPointList(observed, control) < observed.get_Count())
{
AfxMessageBox("AddPointList for TransformBack failed to add all points");
}
if(! fcs.get_TransformBack().Solve())
{
AfxMessageBox("Solve for TransformBack failed");
}
GeoCalcPBW::GeodeticPoint * basePt = data.GetGeodeticPoint(L"BMG", L"GEODETIC_POINT_DEGREES");
GeoCalcPBW::CoordPoint * fittedPt = fcs.get_PointStyle().CloneCoordPoint();
basePt->set_InUnits(-68.4, 46);
if(! fcs.FromGeodeticBase(*basePt, *fittedPt))
{
AfxMessageBox("FromGeodeticBase failed");
}
delete baseCS;
delete basePt;
delete fittedPt;
}