• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ setPoint函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中setPoint函数的典型用法代码示例。如果您正苦于以下问题:C++ setPoint函数的具体用法?C++ setPoint怎么用?C++ setPoint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了setPoint函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:josephzizys,项目名称:CM,代码行数:33,代码来源:TextEditor.cpp


示例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);
		};
开发者ID:Maria300196,项目名称:CPP_COURSE,代码行数:7,代码来源:inherit_virtual.cpp


示例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());
    }
}
开发者ID:behlingc,项目名称:umbrello-behlingc,代码行数:36,代码来源:associationline.cpp


示例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);
}
开发者ID:josephzizys,项目名称:CM,代码行数:33,代码来源:TextEditor.cpp


示例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);
}
开发者ID:phillipstanleymarbell,项目名称:sunflower-simulator,代码行数:25,代码来源:GraphView.C


示例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;
}
开发者ID:BackupTheBerlios,项目名称:nirvana-svn,代码行数:10,代码来源:QPointArray.cpp


示例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();
    }
}
开发者ID:tieunun,项目名称:leidota,代码行数:53,代码来源:GameTeam.cpp


示例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() ); 
    } 
} 
开发者ID:Chaduke,项目名称:bah.mod,代码行数:14,代码来源:ogrlinearring.cpp


示例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();
}
开发者ID:josephzizys,项目名称:CM,代码行数:50,代码来源:TextEditor.cpp


示例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);
}
开发者ID:fluxer,项目名称:katie,代码行数:14,代码来源:qpolygon.cpp


示例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 );
    }
}
开发者ID:ksshannon,项目名称:gdal,代码行数:17,代码来源:ogrlinearring.cpp


示例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);
}
开发者ID:josephzizys,项目名称:CM,代码行数:31,代码来源:TextEditor.cpp


示例13: getQtPoint

void GLEText::moveBy(QPointF offset)
{
	pointHash.clear();
	// Moves relative to storedPointHash
	QPointF start = getQtPoint(ReferencePoint, true);
	setPoint(ReferencePoint, start + offset);
}
开发者ID:pnkfelix,项目名称:glx-gle,代码行数:7,代码来源:text.cpp


示例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);
		}
	}
}
开发者ID:geoffxiao,项目名称:CS-172-Projects,代码行数:25,代码来源:Sudoku.cpp


示例15: setPoint

void TextBuffer::startMatching(int pos1, int pos2)
{
  setPoint(pos1);
  setColour(TextEditor::caretColourId, Colours::red);
  matchpos=pos2;
  startTimer(1000);
}
开发者ID:josephzizys,项目名称:CM,代码行数:7,代码来源:TextEditor.cpp


示例16: setPoint

//-----------------------------------------------
void AflSpriteWnd::move(FLOAT fX,FLOAT fY)
{
	FLOAT fWindowX = -m_fClickPointX+fX + m_fClickPointBaseX;
	FLOAT fWindowY = -m_fClickPointY+fY + m_fClickPointBaseY;
	setPoint(fWindowX,fWindowY);
	onWindowMove(fWindowX,fWindowY);
}
开发者ID:mofon001,项目名称:AflLib,代码行数:8,代码来源:aflCustomTool.cpp


示例17: getQtPoint

void GLEDrawingObject::linearTransformPt(int pt, const GLELinearEquation& ex, const GLELinearEquation& ey, bool update)
{
	QPointF p = getQtPoint(pt, true);
	p.setX(ex.apply(p.x()));
	p.setY(ey.apply(p.y()));
	setPoint(pt, p, update);
}
开发者ID:pnkfelix,项目名称:glx-gle,代码行数:7,代码来源:drawingobject.cpp


示例18: setPoint

//Move each point by velocity * dt
void Convex::move(sf::Time* dt)
{
	for (int i = 0; i < getPointCount(); i++)
	{
		setPoint(i, getPoint(i) + _velocity * dt->asSeconds());
	}
}
开发者ID:Kintra,项目名称:PhysicsMiniProject,代码行数:8,代码来源:convex.cpp


示例19: newPos

/**
 * Moves the point or line if active.
 */
void AssociationLine::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
    UMLScene* scene = m_associationWidget->umlScene();

    QPointF oldPos = event->scenePos();
    QPointF newPos(
        scene->snappedX(oldPos.x()),
        scene->snappedY(oldPos.y())
    );

    // Prevent the moving vertex from disappearing underneath a widget
    // (else there's no way to get it back.)
    UMLWidget *onW = scene->widgetAt(newPos);
    if (onW && onW->baseType() != WidgetBase::wt_Box) {  // boxes are transparent
        const qreal pX = newPos.x();
        const qreal pY = newPos.y();
        const qreal wX = onW->x();
        const qreal wY = onW->y();
        const qreal wWidth = onW->width();
        const qreal wHeight = onW->height();
        if (pX > wX && pX < wX + wWidth) {
            const qreal midX = wX + wWidth / 2.0;
            if (pX <= midX)
                newPos.setX(wX);
            else
                newPos.setX(wX + wWidth);
        }
        if (pY > wY && pY < wY + wHeight) {
            const qreal midY = wY + wHeight / 2.0;
            if (pY <= midY)
                newPos.setY(wY);
            else
                newPos.setY(wY + wHeight);
        }
    }

    if (m_activePointIndex != -1) {
        // Move a single point (snap behaviour)
        setPoint(m_activePointIndex, newPos);
    }
    else if (m_activeSegmentIndex != -1 && !isEndSegmentIndex(m_activeSegmentIndex)) {
        // Move a segment (between two points, snap behaviour not implemented)
        QPointF delta = event->scenePos() - event->lastScenePos();
        setPoint(m_activeSegmentIndex, m_points[m_activeSegmentIndex] + delta);
        setPoint(m_activeSegmentIndex + 1, m_points[m_activeSegmentIndex + 1] + delta);
    }
}
开发者ID:behlingc,项目名称:umbrello-behlingc,代码行数:50,代码来源:associationline.cpp


示例20: initCamera

void initCamera(struct Camera *camera) {
    camera->x = 40;
    camera->y = 20;
    camera->z = -40;
    camera->direction = 0;
    camera->yPoint = 0;
    setPoint(camera);
}
开发者ID:imella,项目名称:perihelion,代码行数:8,代码来源:camera.c



注:本文中的setPoint函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ setPointer函数代码示例发布时间:2022-05-30
下一篇:
C++ setPixel函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap