bool	GetAnArc (const char*	prompt,
				  API_Coord*	origin,
				  API_Coord*	startPos,
				  API_Coord*	endPos,
				  bool*			isArcNegative /*= NULL*/)
{
	API_GetPointType	pointInfo;
	API_GetLineType		lineInfo;
	API_GetArcType		arcInfo;
	GSErrCode			err;

	BNZeroMemory (&pointInfo, sizeof (API_GetPointType));
	BNZeroMemory (&lineInfo, sizeof (API_GetLineType));
	BNZeroMemory (&arcInfo, sizeof (API_GetArcType));

	CHTruncate (prompt, pointInfo.prompt, sizeof (pointInfo.prompt));
	err = ACAPI_Interface (APIIo_GetPointID, &pointInfo, NULL);

	if (err == NoError) {
		CHTruncate (prompt, lineInfo.prompt, sizeof (lineInfo.prompt));
		lineInfo.startCoord = pointInfo.pos;						// line starts with the clicked point
		lineInfo.disableDefaultFeedback = false;					// draw the default thick rubber line

		err = ACAPI_Interface (APIIo_GetLineID, &lineInfo, NULL);
	}

	if (err == NoError) {
		CHTruncate (prompt, arcInfo.prompt, sizeof (arcInfo.prompt));
		arcInfo.origo = lineInfo.startCoord;						// set arc origo
		arcInfo.startCoord = lineInfo.pos;							// arc starts with the second clicked point
		arcInfo.startCoordGiven = true;
		arcInfo.disableDefaultFeedback = false;						// draw the default thick rubber line
		err = ACAPI_Interface (APIIo_GetArcID, &arcInfo, NULL);
	}

	if (err == NoError) {
		if (origin != NULL)
			*origin = ToCoord (arcInfo.origo);
		if (startPos != NULL)
			*startPos = ToCoord (arcInfo.startCoord);
		if (endPos != NULL)
			*endPos = ToCoord (arcInfo.pos);
		if (isArcNegative != NULL)
			*isArcNegative = arcInfo.negArc ? true : false;
	}

	return (err == NoError);
}		// GetAnArc
Пример #2
0
void EditRatioWindow::setValue(Geometry::Ratio value_)
 {
  if( value_.rex )
    {
     value=Geometry::Ratio(1);
     a=0;
     b=1;
    }
  else
    {
     value=value_;

     Geometry::Real x=value_.val;

     Geometry::Real d=Geometry::Real::Den(x,50);

     b=ToCoord(d);

     a=ToCoord(Geometry::Real::RoundMul(d,Cap<Geometry::Real>(MinCoord/d,x,MaxCoord/d)));
    }

  redraw();
 }