当前位置: 首页>>代码示例>>C++>>正文


C++ CLine类代码示例

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


在下文中一共展示了CLine类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DBG

Text_sPtr TextParser::parseContent(const char* data, const unsigned int& len)
{
    DBG() << "\n---------------Text---------------------------" << ENDL;

    CColumn column = char2Bin<C_COLUMN_BYTES * BIT_PER_BYTE>( data );
    unsigned int offset = C_LINE_BYTES;

    CLine line = char2Bin<C_LINE_BYTES * BIT_PER_BYTE>( &data[offset] );
    offset += C_COLUMN_BYTES;

    unsigned int textLength = len - offset;

    Text_sPtr text( new ContentProcess<std::string> );
    text->pos.x = column.to_uint();
    text->pos.y = line.to_uint();
    text->content.insert(0, &data[offset], textLength);
    text->pos.len_x = text->content.size();
    text->size = C_LINE_BYTES + C_COLUMN_BYTES + text->pos.len_x;

    INFO() << "line: " << text->pos.y << ENDL;
    INFO() << "column: " << text->pos.x << ENDL;
    INFO() << "text: " << text->content << ENDL;

    return text;
}
开发者ID:mariodonick,项目名称:CAVLOD,代码行数:25,代码来源:ContentParser.cpp

示例2: GetDocument

void CMy010_SDIView::OnDraw(CDC* pDC)
{
	CMy010_SDIDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	if (!pDoc)
		return;

	// TODO: add draw code for native data here

	// Get the number of lines in the document
	int liCount = pDoc->GetLineCount();

	// Are there any lines in the document?
	if (liCount)
	{
		int liPos;
		CLine *lptLine;

		// Loop through the lines in the document
		for (liPos = 0; liPos < liCount; liPos++)
		{
			// Get the from and to point for each line
			lptLine = pDoc->GetLine(liPos);
			// Draw the line
			lptLine->Draw(pDC);
		}
	}
}
开发者ID:SulfredLee,项目名称:learn_mfc_21,代码行数:28,代码来源:010_SDIView.cpp

示例3: dc

void CMy010_SDIView::OnMouseMove(UINT nFlags, CPoint point)
{
	// TODO: Add your message handler code here and/or call default

	// Check to see if the left mouse button is down
	if ((nFlags & MK_LBUTTON) == MK_LBUTTON)
	{
		// Have we captured the mouse?
		if (GetCapture() == this)
		{
			// Get the Device Context
			CClientDC dc(this);

			// Add the line to the document
			CLine *pLine = GetDocument()->AddLine(m_ptPrevPos, point);

			// Draw the current stretch of line
			pLine->Draw(&dc);

			// Save the current point as the previous point
			m_ptPrevPos = point;
		}
	}
	CView::OnMouseMove(nFlags, point);
}
开发者ID:SulfredLee,项目名称:learn_mfc_21,代码行数:25,代码来源:010_SDIView.cpp

示例4: GetLineByIndex

	void CPlot::AddNewPoint( float x,float y,int nLineIndex )
	{
		CLine* nLinePtr = GetLineByIndex(nLineIndex);
		nLinePtr->AddPoint(x,y);
		m_axisX.SetAxisRange(x-100.0f,x);
		// 几率X轴的范围
		m_originXLwLmt = x-100.0f;
		m_originXUpLmt = x;	
		// 自动调整纵坐标轴的范围
		if (m_bAdjustable)
		{	
			// 调整Y轴
			float newLowerLmt = m_axisY.GetRangeLowerLimit();
			float newUpperLmt = m_axisY.GetRangeUpperLimit();
			if (y>newUpperLmt)
			{
				newUpperLmt = y;
			}
			if(y<newLowerLmt){
				newLowerLmt = y;
			}
			m_axisY.SetAxisRange(newLowerLmt,newUpperLmt);
			// 几率原始Y轴范围
			m_originYLwLmt = newLowerLmt;
			m_originYUpLmt = newUpperLmt;	
		}
	}
开发者ID:Daice,项目名称:bmd101,代码行数:27,代码来源:Plot.cpp

示例5: Equals

bool CLine::Equals(const CLine & other, unsigned int level) const
{
	if (level == 0)
		return other.GetHash() == GetHash();
	else if(level == 1)
		return other.GetAnchorHash() == GetAnchorHash();
	return Distance(other) < level;
}
开发者ID:GordonSmith,项目名称:eclide,代码行数:8,代码来源:TextCompare.cpp

示例6: AppendTable

void AppendTable(CLineVector & lineVector, const CTable & table, CLine::TYPE type)
{
	for (size_t i = 1; i < table.size() - 1; ++i)
	{
		CLine line = table[i];
		line.SetType(type);
		lineVector.push_back(line);
	}
}
开发者ID:GordonSmith,项目名称:eclide,代码行数:9,代码来源:TextCompare.cpp

示例7: tr

void CLineEditor::addCLine()
{
    QString txt = QInputDialog::getText(this, tr("New CLine"), tr("Insert a CLine : \"C: server port user pass\"\nExample : \"C: server.org 12000 c9nypo abc123\""));

    if(txt != "")
    {
        CLine cline = CLineFileParser::parseCLine(txt);
        if(!cline.getServer().isEmpty())
            model->addCline(cline);
    }
}
开发者ID:damianorenfer,项目名称:CLineEditor,代码行数:11,代码来源:clineeditor.cpp

示例8: sqrt

void CParticleEngine::NewBulletTracer(int x1, int y1, int x2, int y2, float intensity)
{
	int orderedTracerLength = sqrt((x2 - x1)*(x2 - x1) + (y2 - y1) * (y2 - y1));
	int createdTracerLength = 0;
	bool firstLine = true;
	float gradient = (float)(y2 - y1) / (float)(x2 - x1);
	float lineSegmentLength = standardLineSegmentLength * intensity;
	int loopNumber = 0;

	//create a bunch of lines with decreasing color and alpha intensity 
	while (createdTracerLength < orderedTracerLength)
	{
		float angle = atan2(y2 - y1, x2 - x1);
		float cosAngle = cos(angle);
		float sinAngle = sin(angle);
		CLine * line = new CLine();
		
		if (firstLine)
		{
			firstLine = false;
			line->x1 = x1;
			line->y1 = y1;
		}
		else
		{
			//take first point coordinates from last line's second point coordinates
			line->x1 = lineVector.at(lineVector.size() - 1)->x2 + cosAngle/abs(cosAngle);
			line->y1 = lineVector.at(lineVector.size() - 1)->y2 + sinAngle/abs(sinAngle);

		}
		 
		if (createdTracerLength + lineSegmentLength > orderedTracerLength) //last line is shorter
		{
			lineSegmentLength = orderedTracerLength - createdTracerLength;
		}
		/*x = old_x + length * cos(alpha);
		y = old_y + length * sin(alpha);*/

		//calculate x2 and y2
		
		line->x2 = line->x1 + lineSegmentLength * cosAngle;
		line->y2 = line->y1 + lineSegmentLength * sinAngle;
		
		createdTracerLength += lineSegmentLength;

		//set color values according to intensity
		line->SetRGB(255, 255, 255 - (intensity*150.0f) + loopNumber * (8.0f / intensity));
		line->SetAlpha(160 + (intensity*50.0f) - (loopNumber * (5.0f / intensity)));
		line->SetAlphaLossPerMs(1.3f - intensity * 2);
		loopNumber++;
		lineVector.push_back(line);
	}
}
开发者ID:scaepz,项目名称:Shapist,代码行数:53,代码来源:ParticleEngine.cpp

示例9: AppendBlankLines

void AppendBlankLines(CLineVector & lineVector, const CTable & otherTable, CLine::TYPE type)
{
	for (size_t i = 1; i < otherTable.size() - 1; ++i)
	{
		CLine line;
		if (!IsDummyLine(line))
		{
			line.SetType(otherTable[i].GetType() == CLine::TYPE_MOVED ? CLine::TYPE_MATCH : type);
			lineVector.push_back(line);
		}
	}
}
开发者ID:GordonSmith,项目名称:eclide,代码行数:12,代码来源:TextCompare.cpp

示例10: Intersects

// =============================================================================
// CLine::Intersects
// Does the given line intersect this line
// Returns the intersection point in a parameter
// -----------------------------------------------------------------------------
bool CLine::Intersects(CLine other, CVector2f *intersectionPoint)
{
    bool theResult = false;
    
    // First check that the lines would intersect if they were infinitely long
    // Use the equation from
    // http://devmag.org.za/2009/04/13/basic-collision-detection-in-2d-part-1/
    float otherDY = other.GetEnd().y - other.GetStart().y;
    float otherDX = other.GetEnd().x - other.GetStart().x;
    float thisDY = mEnd.y - mStart.y;
    float thisDX = mEnd.x - mStart.x;
    
    float denominator = (otherDY * thisDX) - (otherDX * thisDY);
    
    // If this denominator is 0 then the lines are parallel, any other value
    // and the lines would intersect at some point if they were of infinite
    // length
    if (denominator != 0.0f)
    {
        // Find the intersection point and make sure it lies between the start
        // and end of each respective line
        float otherToThisStartY = mStart.y - other.GetStart().y;
        float otherToThisStartX = mStart.x - other.GetStart().x;
        
        float percentageAlongThis =     (
                                            (otherDX * otherToThisStartY)
                                            - (otherDY * otherToThisStartX)
                                        )
                                        / denominator;
        float percentageAlongOther =    (
                                            (thisDX * otherToThisStartY)
                                            - (thisDY * otherToThisStartX)
                                        )
                                        / denominator;
        
        if (percentageAlongThis >= 0.0f
            && percentageAlongThis <= 1.0f
            && percentageAlongOther >= 0.0f
            && percentageAlongOther <= 1.0f)
        {
            // This point lies on both lines so we have an intersection
            theResult = true;
            
            // Populate the intersectinoPoint parameter
            CVector2f offsetToEnd = mDirection * GetLength();
            *intersectionPoint = mStart + (percentageAlongThis * offsetToEnd);
        }
    }
    
    return theResult;
}
开发者ID:sizlo,项目名称:TimGameLib,代码行数:56,代码来源:CLine.cpp

示例11: GetDocument

void CMFCView::OnDraw(CDC* pDC)
{
	CMFCDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	CRect rect;
	GetClientRect(&rect);
	pDC->SetMapMode(MM_ANISOTROPIC);
	pDC->SetWindowExt(rect.Width(),rect.Height());
	pDC->SetViewportExt(rect.Width(),-rect.Height());
	pDC->SetViewportOrg(rect.Width()/2,rect.Height()/2);
	rect.OffsetRect(-rect.Width()/2,-rect.Height()/2);
	CLine c;
	c.Moveto(pDC,0,0);
	c.Lineto(pDC,500,500);
	// TODO: add draw code for native data here
}
开发者ID:lenomirei,项目名称:C-C-,代码行数:16,代码来源:MFCView.cpp

示例12: _AddPathPortion

void COptimizePath::_AddPathPortion(CLine& line, const A3DPOINT2& dest, const int newCount)
{
	int index;
	int old_count = 0;
	for (index = m_CurIndex +1; index < (int)m_Path.size(); index++)
	{
		old_count++;
		//clear  the old footprint
		int x, y;
		x = (int)m_Path[index].x;
		y = (int)m_Path[index].y;
		SetFootprint(x, y, 0);
		if (x == dest.x && y == dest.y)
		{
			break;
		}
	}

	assert(index < (int)m_Path.size() );

	//adjust the path space between current to dest,  have old_count, need newCount 
	if (old_count > newCount)
	{
		//erase 
		abase::vector<APointF>::iterator it1, it2;
		it1 = &m_Path[m_CurIndex+1];
		it2 = it1 + old_count - newCount;
		m_Path.erase(it1, it2);
	}
	else if (old_count < newCount)
	{
		//insert
		abase::vector<APointF>::iterator it1;
		it1 = &m_Path[m_CurIndex+1];
		m_Path.insert(it1, newCount - old_count, APointF());
	}
	
	//replace the old path portion
	index = m_CurIndex+1;
	while (line.GetCount() < newCount)
	{
		m_Path[index] = line.Next();
		index++;
	}

}
开发者ID:fengqk,项目名称:Art,代码行数:46,代码来源:OptimizePath.cpp

示例13: _LineTo

bool COptimizePath::_LineTo(CLine& line, APointF& to)
{

#define  LOCAL_STRICT_LINE
	A3DPOINT2 to_pt((int)to.x, (int)to.y);
	A3DPOINT2 cur_pt((int)line.GetFrom().x, (int)line.GetFrom().y);

	CMoveMap * pMoveMap = g_MoveAgentManager.GetMoveMap();
	assert(pMoveMap);

#ifdef LOCAL_STRICT_LINE
	A3DPOINT2  last_pt(cur_pt);

#endif
	while (cur_pt != to_pt )
	{
		
		APointF cur(line.Next());
		cur_pt.x = (int)cur.x;
		cur_pt.y = (int)cur.y;

		if (!pMoveMap->IsPosReachable(cur_pt))
		{
			return false;
		}

#ifdef LOCAL_STRICT_LINE
		if ((cur_pt.x != last_pt.x && cur_pt.y != last_pt.y) 
			&&(!pMoveMap->IsPosReachable(last_pt.x, cur_pt.y)
			  || !pMoveMap->IsPosReachable(cur_pt.x, last_pt.y)) )
		{
			return false;
		}
		last_pt = cur_pt;
#endif

	}
	
#undef  LOCAL_STRICT_LINE
	return true;
}
开发者ID:fengqk,项目名称:Art,代码行数:41,代码来源:OptimizePath.cpp

示例14: src

void CLineEditor::createCCcamFile()
{
    QFile src(remoteFileName + ".bak");
    QFile dst(remoteFileName);
    if(!src.open(QIODevice::ReadOnly | QIODevice::Text))
    {
        QMessageBox::critical(0,tr("Open fail"), tr("Failed to open : %1").arg(src.fileName()));
        return;
    }
    if(!dst.open(QIODevice::WriteOnly | QIODevice::Text))
    {
        QMessageBox::critical(0,tr("Open fail"), tr("Failed to open : %1").arg(dst.fileName()));
        return;
    }

    QTextStream out(&dst);

    while (!src.atEnd())
    {
        QString line = src.readLine().trimmed();
        CLine cline = CLineFileParser::parseCLine(line);

        if(cline.getServer().isEmpty() && line != CLINE_EDITOR_HEADER)
            out << line << "\n";
    }

    if(model->getClines().size() > 0)
        out << CLINE_EDITOR_HEADER << "\n";

    foreach (const CLine &cline, model->getClines())
        out << cline.toString() << "\n";


    src.close();
    dst.close();
}
开发者ID:damianorenfer,项目名称:CLineEditor,代码行数:36,代码来源:clineeditor.cpp

示例15: SetCharTypes

void SetCharTypes(CLine & line, const CLineVector & lineVector)
{
	int charPos = 0;
	for(CLineVector::const_iterator itr = lineVector.begin(); itr != lineVector.end(); ++itr)
	{
		switch(itr->GetType())
		{
		case CLine::TYPE_DELETED:
		case CLine::TYPE_SIMILAR:
		case CLine::TYPE_MOVED:
			line.SetCharType(charPos, CLine::TYPE_SIMILAR);
			break;
		}
		charPos++;
	}
}
开发者ID:GordonSmith,项目名称:eclide,代码行数:16,代码来源:TextCompare.cpp


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