本文整理汇总了C++中CComObject::GotCenter方法的典型用法代码示例。如果您正苦于以下问题:C++ CComObject::GotCenter方法的具体用法?C++ CComObject::GotCenter怎么用?C++ CComObject::GotCenter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CComObject
的用法示例。
在下文中一共展示了CComObject::GotCenter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getInput
// input may either return RTNORM (from command line) or RTMODELESS (from OPM)
// if it is RTMODELSS, the entity already has that value set.
// if it not RTMODELSS, we process as before, setting the value on m_pPoly
void CPolyCommand::getInput()
{
ads_point tmpc;
char tmpBuf[133];
if (!m_pPolyCmd->GotNumSides()) {
int nSides;
acedInitGet(INP_NNEG, "");
if ((m_retval = acedGetInt("\nEnter number of sides: ", &nSides))
== RTNORM)
{
if (nSides < 3) {
acutPrintf("\nNeed at least 3 sides.");
return;
}
m_pPoly->put_NumSides(nSides);
}
} else if (!m_pPolyCmd->GotCenter()) {
if ((m_retval = acedGetPoint(NULL,
"\nLocate center of polygon: ", tmpc)) == RTNORM)
{
AcAxPoint2d pt2d(tmpc[0],tmpc[1]);
m_pPoly->put_Center(*pt2d.asVariantPtr());
}
} else if (!m_pPolyCmd->GotStartPoint()) {
AcAxPoint2d pt2dCtr(0.0,0.0);
VARIANT *pVar = pt2dCtr.asVariantPtr();
m_pPoly->get_Center(pVar);
pt2dCtr = pVar;
ads_point cp = { pt2dCtr.x, pt2dCtr.y };
if ((m_retval = acedGetPoint(cp,
"\nLocate start point of polygon: ", tmpc)) == RTNORM)
{
AcAxPoint2d pt2d(tmpc[0],tmpc[1]);
if (pt2dCtr == pt2d) {
acutPrintf("\nPick a point different from the center.");
return;
}
m_pPoly->put_StartPoint(*pt2d.asVariantPtr());
}
} else if (!m_pPolyCmd->GotTextString()) {
if ((m_retval = acedGetString(Adesk::kTrue,
"\nEnter polygon name: ",tmpBuf)) == RTNORM)
{
m_pPoly->put_TextString(_bstr_t(tmpBuf));
}
} else if (!m_pPolyCmd->GotTextStyleName()) {
if ((m_retval = acedGetString(Adesk::kTrue,
"\nEnter text style: ", tmpBuf)) == RTNORM)
{
AcDbObjectId tsId;
if (tmpBuf[0] == '\0' ) {
// Get default text style
struct resbuf result ;
if ( acedGetVar ("TEXTSTYLE", &result) != RTNORM ) {
acutPrintf(
"\nError while reading default AutoCAD text style setting");
fail();
return;
}
strcpy (tmpBuf, result.resval.rstring) ;
acdbFree (result.resval.rstring) ;
}
if ( rx_getTextStyleId(tmpBuf,
acdbHostApplicationServices()->workingDatabase(),
tsId) != Acad::eOk)
{
acutPrintf("\nInvalid text style name");
fail();
return;
}
m_pPoly->put_TextStyleName(_bstr_t(tmpBuf));
}
} else
m_bDone = true;
if (m_retval != RTNORM && m_retval != RTMODELESS)
fail();
}