本文整理汇总了C++中CFX_FloatRect::Contains方法的典型用法代码示例。如果您正苦于以下问题:C++ CFX_FloatRect::Contains方法的具体用法?C++ CFX_FloatRect::Contains怎么用?C++ CFX_FloatRect::Contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFX_FloatRect
的用法示例。
在下文中一共展示了CFX_FloatRect::Contains方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetLinkAtPoint
CPDF_Link CPDF_LinkList::GetLinkAtPoint(CPDF_Page* pPage,
FX_FLOAT pdf_x,
FX_FLOAT pdf_y,
int* z_order) {
const std::vector<CPDF_Dictionary*>* pPageLinkList = GetPageLinks(pPage);
if (!pPageLinkList)
return CPDF_Link();
for (size_t i = pPageLinkList->size(); i > 0; --i) {
size_t annot_index = i - 1;
CPDF_Dictionary* pAnnot = (*pPageLinkList)[annot_index];
if (!pAnnot)
continue;
CPDF_Link link(pAnnot);
CFX_FloatRect rect = link.GetRect();
if (!rect.Contains(pdf_x, pdf_y))
continue;
if (z_order)
*z_order = annot_index;
return link;
}
return CPDF_Link();
}
示例2: GetControlAtPoint
CPDF_FormControl* CPDF_InterForm::GetControlAtPoint(CPDF_Page* pPage,
FX_FLOAT pdf_x,
FX_FLOAT pdf_y,
int* z_order) const {
CPDF_Array* pAnnotList = pPage->m_pFormDict->GetArrayBy("Annots");
if (!pAnnotList)
return nullptr;
for (size_t i = pAnnotList->GetCount(); i > 0; --i) {
size_t annot_index = i - 1;
CPDF_Dictionary* pAnnot = pAnnotList->GetDictAt(annot_index);
if (!pAnnot)
continue;
const auto it = m_ControlMap.find(pAnnot);
if (it == m_ControlMap.end())
continue;
CPDF_FormControl* pControl = it->second;
CFX_FloatRect rect = pControl->GetRect();
if (!rect.Contains(pdf_x, pdf_y))
continue;
if (z_order)
*z_order = static_cast<int>(annot_index);
return pControl;
}
return nullptr;
}
示例3: GetIndexAtPos
int CRF_TextPage::GetIndexAtPos(CPDF_Point point, FX_FLOAT xTorelance, FX_FLOAT yTorelance) const
{
int index = -1, i = 0, j = 0;
FPDF_CHAR_INFO info;
CFX_FloatRect rectTmp;
FX_FLOAT MinDistance = 1000, DistanceTmp = 0;
FX_FLOAT rect_bottom = point.x - xTorelance;
CFX_FloatRect TorelanceRect(rect_bottom <= 0 ? 0 : rect_bottom, point.y - yTorelance, point.x + xTorelance, point.y + yTorelance);
int count = CountChars();
for(i = 0; i < count; i++) {
GetCharInfo(i, info);
rectTmp = info.m_CharBox;
if(rectTmp.Contains(point.x, point.y)) {
index = i;
break;
} else if(_IsIntersect(rectTmp, TorelanceRect)) {
DistanceTmp = _GetDistance(rectTmp, point);
if(DistanceTmp < MinDistance) {
MinDistance = DistanceTmp;
index = i;
}
}
}
return index;
}
示例4: FocusGetData
void CPDF_ReflowedPage::FocusGetData(const CFX_AffineMatrix matrix, FX_INT32 x, FX_INT32 y, CFX_ByteString& str)
{
if (NULL == m_pReflowed) {
return;
}
CFX_AffineMatrix revMatrix;
revMatrix.SetReverse(matrix);
FX_FLOAT x1, y1;
revMatrix.Transform((float)x, (float)y, x1, y1);
int count = m_pReflowed->GetSize();
FX_FLOAT dx = 1000, dy = 1000;
FX_INT32 pos = 0;
FX_INT32 i;
for(i = 0; i < count; i++) {
CRF_Data* pData = (*m_pReflowed)[i];
FX_FLOAT tempdy = FXSYS_fabs(pData->m_PosY - y1);
if(FXSYS_fabs(tempdy - dy) < 1) {
continue;
}
CFX_FloatRect rect (0, pData->m_PosY + pData->m_Height, this->m_PageWidth, pData->m_PosY);
if(rect.Contains(x1, y1)) {
pos = i;
dx = 0;
dy = 0;
break;
} else if(tempdy < dy) {
dy = tempdy;
dx = FXSYS_fabs(pData->m_PosX - x1);
pos = i;
} else if (tempdy == dy) {
FX_FLOAT tempdx = FXSYS_fabs(pData->m_PosX - x1);
if(tempdx < dx) {
dx = tempdx;
pos = i;
}
} else if (tempdy > dy) {
break;
}
}
if(dx != 0 || dy != 0) {
count = count < (pos + 10) ? count : (pos + 10);
for(i = 0 > (pos - 10) ? 0 : (pos - 10); i < count; i++) {
CRF_Data* pData = (*m_pReflowed)[i];
FX_FLOAT tempdy = FXSYS_fabs(pData->m_PosY - y1);
if(tempdy < dy) {
dy = tempdy;
dx = FXSYS_fabs(pData->m_PosX - x1);
pos = i;
} else if (tempdy == dy) {
FX_FLOAT tempdx = FXSYS_fabs(pData->m_PosX - x1);
if(tempdx < dx) {
dx = tempdx;
pos = i;
}
}
}
}
str.Format("%d", pos);
}
示例5: Annot_HitTest
FX_BOOL CFFL_IFormFiller::Annot_HitTest(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
CFX_FloatPoint point) {
CFX_FloatRect rc = pAnnot->GetRect();
if (rc.Contains(point.x, point.y))
return TRUE;
return FALSE;
}
示例6: GetFocusBox
CFX_FloatRect CFFL_FormFiller::GetFocusBox(CPDFSDK_PageView* pPageView) {
if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) {
CFX_FloatRect rcFocus = FFLtoWnd(pPageView, PWLtoFFL(pWnd->GetFocusRect()));
CFX_FloatRect rcPage = pPageView->GetPDFPage()->GetPageBBox();
if (rcPage.Contains(rcFocus))
return rcFocus;
}
return CFX_FloatRect(0, 0, 0, 0);
}
示例7: HitTest
FX_BOOL CPDFSDK_WidgetHandler::HitTest(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
const CFX_FloatPoint& point) {
ASSERT(pPageView);
ASSERT(pAnnot);
CFX_FloatRect rect = GetViewBBox(pPageView, pAnnot);
return rect.Contains(point.x, point.y);
}
示例8: GetClientRect
CFX_FloatRect CPWL_Wnd::GetClientRect() const {
CFX_FloatRect rcWindow = GetWindowRect();
CFX_FloatRect rcClient = CPWL_Utils::DeflateRect(
rcWindow, (FX_FLOAT)(GetBorderWidth() + GetInnerBorderWidth()));
if (CPWL_ScrollBar* pVSB = GetVScrollBar())
rcClient.right -= pVSB->GetScrollBarWidth();
rcClient.Normalize();
return rcWindow.Contains(rcClient) ? rcClient : CFX_FloatRect();
}
示例9: GetPDFAnnotAtPoint
const CPDF_Annot* CPDFSDK_PageView::GetPDFAnnotAtPoint(FX_FLOAT pageX,
FX_FLOAT pageY) {
for (const CPDF_Annot* pAnnot : m_pAnnotList->All()) {
CFX_FloatRect annotRect;
pAnnot->GetRect(annotRect);
if (annotRect.Contains(pageX, pageY))
return pAnnot;
}
return nullptr;
}
示例10: GetIndexAtPos
int CPDF_TextPage::GetIndexAtPos(const CFX_PointF& point,
const CFX_SizeF& tolerance) const {
if (!m_bIsParsed)
return -3;
int pos;
int NearPos = -1;
double xdif = 5000;
double ydif = 5000;
const int nCount = CountChars();
for (pos = 0; pos < nCount; ++pos) {
PAGECHAR_INFO charinfo = m_CharList[pos];
CFX_FloatRect charrect = charinfo.m_CharBox;
if (charrect.Contains(point))
break;
if (tolerance.width <= 0 && tolerance.height <= 0)
continue;
CFX_FloatRect charRectExt;
charrect.Normalize();
charRectExt.left = charrect.left - tolerance.width / 2;
charRectExt.right = charrect.right + tolerance.width / 2;
charRectExt.top = charrect.top + tolerance.height / 2;
charRectExt.bottom = charrect.bottom - tolerance.height / 2;
if (!charRectExt.Contains(point))
continue;
double curXdif =
std::min(fabs(point.x - charrect.left), fabs(point.x - charrect.right));
double curYdif =
std::min(fabs(point.y - charrect.bottom), fabs(point.y - charrect.top));
if (curYdif + curXdif < xdif + ydif) {
ydif = curYdif;
xdif = curXdif;
NearPos = pos;
}
}
return pos < nCount ? pos : NearPos;
}
示例11: OnLButtonDown
FX_BOOL CFFL_Button::OnLButtonDown(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
FX_UINT nFlags,
const CFX_FloatPoint& point) {
CFX_FloatRect rcAnnot = pAnnot->GetRect();
if (!rcAnnot.Contains(point.x, point.y))
return FALSE;
m_bMouseDown = TRUE;
m_bValid = TRUE;
FX_RECT rect = GetViewBBox(pPageView, pAnnot);
InvalidateRect(rect.left, rect.top, rect.right, rect.bottom);
return TRUE;
}
示例12: GetPDFAnnotAtPoint
CPDF_Annot* CPDFSDK_PageView::GetPDFAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT pageY)
{
int nCount = m_pAnnotList->Count();
for(int i = 0 ; i<nCount; i++)
{
CPDF_Annot* pAnnot = m_pAnnotList->GetAt(i);
CFX_FloatRect annotRect;
pAnnot->GetRect(annotRect);
if(annotRect.Contains(pageX, pageY))
return pAnnot;
}
return NULL;
}