Solve Method

WRAPPER_API bool Solve()

 

Description

The Solve method is used to find the Parameters and Settings that define this MathTransform by analyzing the list of control and observed point pairs that have been added with the AddPoint and AddPointList methods.  There must be at least three linearly independent pairs of control and observed points in order to Solve the MathTransform.  If there is an insufficient number of points, a GeoCalcException will be thrown with an ErrorCode of InsufficientPoints.  The method returns a boolean value indicating the success of the operation.

 

Example

void MathTransform_Solve(GEOCALCPBW_NAMESPACE::CoordPointCollection & controlCPC, GEOCALCPBW_NAMESPACE::CoordPointCollection & observedCPC)

{

GEOCALCPBW_NAMESPACE::MathTransform::ClassType mtType = GEOCALCPBW_NAMESPACE::MathTransform::ClassType::SecondOrderPolynomial;

GEOCALCPBW_NAMESPACE::MathTransform * mt = GEOCALCPBW_NAMESPACE::MathTransform::CreateMathTransform(mtType);

if(mt->AddPointList(controlCPC, observedCPC) < controlCPC.get_Count())

{

AfxMessageBox("MathTransform::AddPointList : Not all points could be added");

}

try

{

if(! mt->Solve())

{

AfxMessageBox("Solve failed");

}

}

catch(GEOCALCPBW_NAMESPACE::GeoCalcException & ex)

{

if(ex.get_ErrorCode() == GEOCALCPBW_NAMESPACE::GeoCalcException::Code::InsufficientPoints)

{

AfxMessageBox("Insufficent points to Solve the MathTransform");

}

else

{

AfxMessageBox(_tochar(ex.get_FullMessage()).c_str());

}

}

delete mt;

}