コード例 #1
0
ファイル: HPoint.cpp プロジェクト: DavidNicholls/heekscad
/* static */ gp_Pnt HPoint::GetOffset(gp_Pnt location)
{
	wxString message(_("Enter offset in X,Y,Z format (with commas between them)"));
	wxString caption(_("Apply Offset To Selected Location"));
	wxString default_value(_T("0,0,0"));

	wxString value = wxGetTextFromUser(message, caption, default_value);
	wxStringTokenizer tokens(value,_T(":,\t\n"));

	for (int i=0; i<3; i++)
	{
		if (tokens.HasMoreTokens())
		{
			double offset = 0.0;
			wxString token = tokens.GetNextToken();
			wxString evaluated_version;
			if (PropertyDouble::EvaluateWithPython( NULL, token, evaluated_version ))
			{
				evaluated_version.ToDouble(&offset);
				offset *= wxGetApp().m_view_units;
				switch(i)
				{
				case 0:
					location.SetX( location.X() + offset );
					break;

				case 1:
					location.SetY( location.Y() + offset );
					break;

				case 2:
					location.SetZ( location.Z() + offset );
					break;
				}

			}
		}
	}

	return(location);
}