本文整理汇总了C++中setPoint函数的典型用法代码示例。如果您正苦于以下问题:C++ setPoint函数的具体用法?C++ setPoint怎么用?C++ setPoint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setPoint函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: point
void TextBuffer::backwardWord()
{
// Emacs M-b word motion. search line by line scanning for next
// word.
String str;
int pos, bol, len, loc;
pos = point(); // pos is EXCLUSIVE upper bound
bol = pointBOL();
while (true)
{
len=pos-bol;
if (len > 0)
{
str = getTextSubstring(bol,pos);
loc = skip_syntax(syntax->syntab, str, T("^w_"), len-1, -1);
if (loc > -1)
{
loc = skip_syntax(syntax->syntab, str, T("w_"), loc, -1);
// loc is now -1 or on nonword
setPoint(bol+loc+1);
return;
}
}
if (moveLine(-1))
{
bol=point();
pos=pointEOL();
}
else
break;
}
setPoint(bol);
}
示例2: draw
void draw (double x_center, double y_center)
{
setPoint(x_center-dimension/2,y_center-dimension/2);
setPoint(x_center-dimension/2,y_center+dimension/2);
setPoint(x_center+dimension/2,y_center+dimension/2);
setPoint(x_center+dimension/2,y_center-dimension/2);
};
示例3: insertPoint
/**
* This method simply ensures presence of two points and
* adds the needed points for self associations.
*/
void AssociationLine::calculateInitialEndPoints()
{
if (m_associationWidget->isSelf() && count() < 4) {
for (int i = count(); i < 4; ++i) {
insertPoint(i, QPointF());
}
UMLWidget *wid = m_associationWidget->widgetForRole(Uml::RoleType::B);
if (!wid) {
uError() << "AssociationWidget is partially constructed."
"UMLWidget for role B is null.";
return;
}
const QRectF rect = m_associationWidget->mapFromScene(
mapToScene(wid->rect()).boundingRect()).boundingRect();
qreal l = rect.left() + .25 * rect.width();
qreal r = rect.left() + .75 * rect.width();
bool drawAbove = rect.top() >= SelfAssociationMinimumHeight;
qreal y = drawAbove ? rect.top() : rect.bottom();
qreal yOffset = SelfAssociationMinimumHeight;
if (drawAbove) {
yOffset *= -1.0;
}
setPoint(0, QPointF(l, y));
setPoint(1, QPointF(l, y + yOffset));
setPoint(2, QPointF(r, y + yOffset));
setPoint(3, QPointF(r, y));
} else if (!m_associationWidget->isSelf() && count() < 2) {
setEndPoints(QPointF(), QPointF());
}
}
示例4: setCaretVisible
bool TextBuffer::indentToColumn(int col)
{
// reindent current line so that there are col white spaces before
// the first non-white char in line
int bol=pointBOL();
int top=bol+currentIndent(); // current pos of first non-white or eol
int loc=bol+col; // goal pos for indentation
setCaretVisible(false);
setScrollToShowCursor(false);
if (loc < top)
{
//std::cout << "deleting " << top-loc << " spaces.\n";
setPoint(bol);
setHighlightedRegion(bol, (top-loc));
insertTextAtCursor(String::empty);
}
else if (loc > top)
{
setPoint(bol);
String pad=String::empty;
for (int i=top; i<loc; i++)
pad << T(" ");
//std::cout << "inserting " << pad.length() << " spaces.\n";
insertTextAtCursor(pad);
}
setPoint(loc);
setCaretVisible(true);
setScrollToShowCursor(true);
return (loc!=top);
}
示例5: setPoint
void GraphView::mousePressEvent ( QMouseEvent * me){
/* Select the closest point */
Vert p;
setPoint(me->x(), me->y(), p);
if(disc){
double bestdist = DIST_2D(p.x,p.y,disc->verts[0].x,disc->verts[0].y);
sPoint = 0;
for(int i = 0; i < disc->numVert; i++){
cout << DIST_2D(p.x,p.y,disc->verts[i].x,disc->verts[i].y) << " ";
if(bestdist > DIST_2D(p.x,p.y,disc->verts[i].x,disc->verts[i].y)){
bestdist = DIST_2D(p.x,p.y,disc->verts[i].x,disc->verts[i].y);
sPoint = i;
}
}
}
cout << disc->vertLabels[sPoint] << " (" << sPoint << ")"<< endl;
setPoint(me->x(), me->y(), disc->verts[sPoint]);
emit pointChanged(sPoint,disc->verts[sPoint].x,disc->verts[sPoint].y);
mouseTrack = 1;
repaint(true);
}
示例6: setPoint
bool QPointArray::setPoints( int nPoints, int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3)
{
if ( !resize(nPoints) )
return FALSE;
setPoint( 0, x0, y0 );
setPoint( 1, x1, y1 );
setPoint( 2, x2, y2 );
setPoint( 3, x3, y3 );
return TRUE;
}
示例7: removeDeadCharacter
void GameTeam::update(float dm)
{
//CCLOG("GameTeam::update");
// 首先删除当前处于死亡状态的成员
removeDeadCharacter();
// 队伍级别的大脑思考一下
m_teamBrain->process();
// 调用该队的所有成员的update
for (auto tmpIterator = m_members.begin(); tmpIterator != m_members.end(); tmpIterator++)
{
(*tmpIterator)->update(dm);
}
// 再删除处于死亡状态的队员
removeDeadCharacter();
// 更新队伍位置
auto tmpTeamPos = m_formation.getFormationAnchor();
if (iscollectiveForwardState())
{
tmpTeamPos.setPoint(tmpTeamPos.x + dm * m_advanceRate, tmpTeamPos.y);
m_formation.setFormationAnchor(tmpTeamPos);
}
else if (isFollowPlayerState())
{
// 否则队伍就始终跟随最前面的人
auto tmpFormationX = 0;
for (auto tmpIterator = m_members.begin(); tmpIterator != m_members.end(); tmpIterator++)
{
auto tmpXPos = (*tmpIterator)->getMovingEntity().getPosition().x;
if (m_formation.getFormationType() == Formation::FORMATION_TYPE_RIGHT &&
tmpFormationX < tmpXPos)
{
tmpFormationX = tmpXPos;
}
if (m_formation.getFormationType() == Formation::FORMATION_TYPE_LEFT &&
tmpFormationX > tmpXPos)
{
tmpFormationX = tmpXPos;
}
}
tmpTeamPos.setPoint(tmpFormationX, tmpTeamPos.y);
m_formation.setFormationAnchor(tmpTeamPos);
}
// 判断是否可以被删除
if (m_members.size() == 0)
{
setCanRemove();
}
}
示例8: getPoint
void OGRLinearRing::reverseWindingOrder()
{
int pos = 0;
OGRPoint tempPoint;
for( int i = 0; i < nPointCount / 2; i++ )
{
getPoint( i, &tempPoint );
pos = nPointCount - i - 1;
setPoint( i, getX(pos), getY(pos), getZ(pos) );
setPoint( pos, tempPoint.getX(), tempPoint.getY(), tempPoint.getZ() );
}
}
示例9: forwardTopLevelText
void TextBuffer::forwardExpr()
{
if (isSyntax(TextIDs::Sal) || isSyntax(TextIDs::Sal2))
{
String text = forwardTopLevelText();
int typ, loc, pos=point(), end=text.length();
typ=scan_sexpr(syntax->syntab,text,0,end,SCAN_CODE,&loc,NULL);
if (typ == SCAN_UNLEVEL)
PlatformUtilities::beep();
else if (typ == SCAN_UNMATCHED)
PlatformUtilities::beep();
else
setPoint(pos+loc);
}
else if (isSyntax(TextIDs::Lisp) )
{
String text;
int end, typ, loc;
int top=-1;
int pos=point();
gotoEOL();
while (true)
{
text=getTextSubstring(pos, point());
end=text.length();
typ=scan_sexpr(syntax->syntab,text,0,end,SCAN_CODE,&loc,NULL);
if ((typ==SCAN_LIST) || (typ==SCAN_TOKEN) || (typ==SCAN_STRING))
{
top=pos+loc;
break;
}
if (!moveLine(1))
break;
}
if (top>-1)
{
//std::cout << "parsed='" << getTextSubstring(pos,top).toUTF8()
//<< "'\n";
setPoint(top);
}
else
{
PlatformUtilities::beep();
setPoint(pos);
}
}
else
PlatformUtilities::beep();
}
示例10: resize
void QPolygon::setPoints(int nPoints, int firstx, int firsty, ...)
{
va_list ap;
resize(nPoints);
setPoint(0, firstx, firsty);
int i = 0, x, y;
va_start(ap, firsty);
while (--nPoints) {
x = va_arg(ap, int);
y = va_arg(ap, int);
setPoint(++i, x, y);
}
va_end(ap);
}
示例11: getPoint
/** Reverse order of points.
*/
void OGRLinearRing::reverseWindingOrder()
{
OGRPoint pointA;
OGRPoint pointB;
for( int i = 0; i < nPointCount / 2; i++ )
{
getPoint( i, &pointA );
const int pos = nPointCount - i - 1;
getPoint( pos, &pointB );
setPoint( i, &pointB );
setPoint( pos, &pointA );
}
}
示例12: forwardWord
void TextBuffer::changeCase(int flag)
{
// change case of word at point. 0=lower,1=upper,2=capitalize
int beg=point();
forwardWord();
int end=point();
String text=getTextSubstring(beg, end);
if (text==String::empty)
return;
deleteRegion(beg,end);
if (flag==0)
insertTextAtCursor(text.toLowerCase());
else if (flag==1)
insertTextAtCursor(text.toUpperCase());
else if (flag==2)
{
int len=text.length();
// get first alphachar
int loc=skip_syntax(syntax->syntab, text, T("^w"), 0, len);
insertTextAtCursor(text.substring(0,loc));
if (loc<len)
{
insertTextAtCursor(text.substring(loc,loc+1).toUpperCase());
insertTextAtCursor(text.substring(loc+1,len));
}
}
beg=point();
//colorizeAfterChange(CommandIDs::EditorIndent); // recolorize whole line for now..
setPoint(beg);
setFlag(EditFlags::NeedsSave);
}
示例13: getQtPoint
void GLEText::moveBy(QPointF offset)
{
pointHash.clear();
// Moves relative to storedPointHash
QPointF start = getQtPoint(ReferencePoint, true);
setPoint(ReferencePoint, start + offset);
}
示例14: promptForString
void Sudoku::setBoard()
{
// Get file
string file = promptForString("What file would you like to use? ");
// Get a valid file
while(!fileExists(file))
{
cout << "INVALID FILE" << endl;
file = promptForString("Which file would you like to use? ");
}
int point;
ifstream read(file);
// Populate the grid now
for(unsigned int y = 0; y < size_; ++y)
{
for(unsigned int x = 0; x < size_; ++x)
{
read >> point;
setPoint(x, y, point);
}
}
}
示例15: setPoint
void TextBuffer::startMatching(int pos1, int pos2)
{
setPoint(pos1);
setColour(TextEditor::caretColourId, Colours::red);
matchpos=pos2;
startTimer(1000);
}