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


C++ QValueVector::pop_back方法代码示例

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


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

示例1: reduceSpike

/**
 * Does spike-reduction on the given point-array's stack-top.
 *
 * Spikes are path segments of which one goes forward, and the sucessor
 * goes backward on the predecessor's segment:
 *
 * 2      0      1
 * x------x<-----x
 * (0 is stack-top in point-array)
 *
 * This will be reduced to
 * 1      0
 * x------x
 *
 * Preconditions:
 * - No other spikes exist in the whole point-array except at most
 *   one at the end
 * - No two succeeding points are ever equal
 * - For each two succeeding points either p1.x == p2.x or p1.y == p2.y holds
 *   true
 * - No such spike exists where 2 is situated between 0 and 1.
 *
 * Postcondition:
 * - No spikes exist in the whole point-array
 *
 * If no spike is found, the point-array is left unchanged.
 * @return \c true if an actual reduction was done
 */
inline static bool reduceSpike(QValueVector< QPoint > &pointArray)
{
    if(pointArray.size() < 3)
        return false;
    QValueVector< QPoint >::Iterator it = pointArray.end();
    QPoint p0 = *--it;
    QPoint p1 = *--it;
    QPoint p2 = *--it;

    bool elide = false;

    if((p0.x() == p1.x() && p1.x() == p2.x() && ((p1.y() < p0.y() && p0.y() < p2.y()) || (p2.y() < p0.y() && p0.y() < p1.y())
                                                || (p1.y() < p2.y() && p2.y() < p0.y()) || (p0.y() < p2.y() && p2.y() < p1.y())
                                                || (elide = p2.y() == p0.y() && p0.y() < p1.y()) || (elide = p1.y() < p0.y() && p0.y() == p2.y())))
       || (p0.y() == p1.y() && p1.y() == p2.y() && ((p1.x() < p0.x() && p0.x() < p2.x()) || (p2.x() < p0.x() && p0.x() < p1.x())
                                                   || (p1.x() < p2.x() && p2.x() < p0.x()) || (p0.x() < p2.x() && p2.x() < p1.x())
                                                   || (elide = p2.x() == p0.x() && p0.x() < p1.x()) || (elide = p1.x() < p0.x() && p0.x() == p2.x()))))
    {
        //     kdDebug(6040) << "spikered p2" << (elide ? " (elide)" : "") << ": " << p2 << " p1: " << p1 << " p0: " << p0 << endl;
        pointArray.pop_back();
        pointArray.pop_back();
        if(!elide)
            pointArray.push_back(p0);
        return true;
    }
    return false;
}
开发者ID:,项目名称:,代码行数:55,代码来源:

示例2: reduceSegmentSeparator

/**
 * Reduces segment separators.
 *
 * A segment separator separates a segment into two segments, thus causing
 * two adjacent segment with the same orientation.
 *
 * 2       1     0
 * x-------x---->x
 * (0 means stack-top)
 *
 * Here, 1 is a segment separator. As segment separators not only make
 * the line drawing algorithm inefficient, but also make the spike-reduction
 * fail, they must be eliminated:
 *
 * 1             0
 * x------------>x
 *
 * Preconditions:
 * - No other segment separators exist in the whole point-array except
 *   at most one at the end
 * - No two succeeding points are ever equal
 * - For each two succeeding points either p1.x == p2.x or p1.y == p2.y holds
 *   true
 * - No such spike exists where 2 is situated between 0 and 1.
 *
 * Postcondition:
 * - No segment separators exist in the whole point-array
 *
 * If no segment separator is found at the end of the point-array, it is
 * left unchanged.
 * @return \c true if a segment separator was actually reduced.
 */
inline static bool reduceSegmentSeparator(QValueVector< QPoint > &pointArray)
{
    if(pointArray.size() < 3)
        return false;
    QValueVector< QPoint >::Iterator it = pointArray.end();
    QPoint p0 = *--it;
    QPoint p1 = *--it;
    QPoint p2 = *--it;
    //     kdDebug(6040) << "checking p2: " << p2 << " p1: " << p1 << " p0: " << p0 << endl;

    if((p0.x() == p1.x() && p1.x() == p2.x() && ((p2.y() < p1.y() && p1.y() < p0.y()) || (p0.y() < p1.y() && p1.y() < p2.y())))
       || (p0.y() == p1.y() && p1.y() == p2.y() && ((p2.x() < p1.x() && p1.x() < p0.x()) || (p0.x() < p1.x() && p1.x() < p2.x()))))
    {
        //     kdDebug(6040) << "segred p2: " << p2 << " p1: " << p1 << " p0: " << p0 << endl;
        pointArray.pop_back();
        pointArray.pop_back();
        pointArray.push_back(p0);
        return true;
    }
    return false;
}
开发者ID:,项目名称:,代码行数:53,代码来源:

示例3: load

	void load( const QString& filename )
	{
		QFile file( filename );

		if ( !file.open( IO_ReadOnly ) )
		{
			Console::instance()->send( tr( "Unable to open %1!\n" ).arg( filename ) );
			return;
		}

		filenames.push_back( filename );

		QXmlInputSource input( &file );
		QXmlSimpleReader reader;
		reader.setFeature( "http://trolltech.com/xml/features/report-whitespace-only-CharData", false );

		reader.setContentHandler( this );
		reader.setErrorHandler( this );
		reader.parse( &input, false );

		filenames.pop_back();
	}
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:22,代码来源:definitions.cpp

示例4: endDocument

	bool endDocument()
	{
		levels.pop_back();
		locators.pop();
		return true;
	}
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:6,代码来源:definitions.cpp


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