TA的每日心情 | 开心 昨天 15:23 |
---|
签到天数: 69 天 [LV.6]常住居民II
管理员
- 积分
- 2704
|
//------------------------------------------------------------------------------
void Goto(double dX, double dY, BOOL bZoom)
//------------------------------------------------------------------------------
{
Acad::ErrorStatus es = Acad::eOk;
AcDbDatabase* pDb = pApp->GetCurrentAcDb();
if (pDb != NULL)
{
// Get the viewport
es = acedVports2VportTableRecords();
AcDbViewportTable *pVpT = NULL;
AcDbViewportTableRecord *pActVp = NULL;
AcGePoint2d centerpt;
double height = 0.0L;
double width = 0.0L;
// Get the *Active view port
es = pDb->getViewportTable(pVpT, AcDb::kForRead);
if (pVpT != NULL)
{
es = pVpT->getAt(_T("*ACTIVE"), pActVp, AcDb::kForWrite);
es = pVpT->close();
if (pActVp != NULL)
{
centerpt = pActVp->centerPoint();
height = pActVp->height();
width = pActVp->width();
// Close the Active viewport
es = pActVp->close();
// Update the viewport
es = acedVportTableRecords2Vports();
}
}
// Notify
CString sMsg = _T("");
sMsg.Format(RESSTR(IDS_MOVINGTO), dX, dY);
pApp->DisplayMessage(0, sMsg);
// This is the same as ZoomTo - but without the unit conversion
centerpt.x = dX;
centerpt.y = dY;
// Adjust for UCS
acdbUcs2Wcs((double*)(¢erpt), (double*)(¢erpt), false);
// Adjust zoom state based on design size if required
DocSettings* pDocSettings = pApp->GetDocSettings();
if (bZoom && pDocSettings != NULL)
{
DistanceUnit unit;
pApp->GetUnitSettings()->GetUserUnit(&unit);
DocSettings::DesignSizes Sizes = pDocSettings->GetDesignSizes();
double basesize = Sizes.m_BaseSymbolSize.GetConvertedValue(unit);
(height > 10.0L * basesize) ? height = 10.0L * basesize : height;
(width > 10.0L * basesize) ? width = 10.0L * basesize : width;
}
// Got specified point
if (height > 0.001 || width > 0.001)
{
AcDbViewTableRecord mVTR;
mVTR.setCenterPoint(centerpt);
mVTR.setHeight(height);
mVTR.setWidth(width);
es = acedSetCurrentView(&mVTR, NULL);
}
}
} |
|