Example #1
0
PdfPage::PdfPage( PdfObject* pObject, const std::deque<PdfObject*> & rListOfParents )
    : PdfElement( "Page", pObject ), PdfCanvas()
{
    m_pResources = m_pObject->GetIndirectKey( "Resources" );
    if( !m_pResources ) 
    {
        // Resources might be inherited
        std::deque<PdfObject*>::const_reverse_iterator it = rListOfParents.rbegin();

        while( it != rListOfParents.rend() && !m_pResources )
        {
            m_pResources = (*it)->GetIndirectKey( "Resources" );
            ++it;
        }
    }

    PdfObject* pContents = m_pObject->GetIndirectKey( "Contents" );
    if (pContents)
        m_pContents = new PdfContents( pContents );
    else
    {
        // TODO: handle absent contents
        m_pContents = NULL;
    }
}
Example #2
0
void setDegu::displayShowTrajectory(QPainter &painter, std::deque< point2D<int> > &trajectory) {
    int i, size;
    if( (size = trajectory.size()) == 0 )
        return;

    int x1, y1, x2, y2;
    std::deque< point2D<int> >::reverse_iterator points = trajectory.rbegin();

    //Show first point
    x1 = (int) (*points).x;
    y1 = (int) (*points).y;

    //Oldest white
    painter.setPen(QColor(255,255,255,255)); //white
    painter.drawEllipse(x1 - 1, y1 - 1, 3, 3);

    //Draw next points and lines connecting them
    painter.setPen(QColor(0,0,255,255)); //blue

    for(i=1, points++; i<size ; i++, points++) {
        x2 = x1;
        y2 = y1;

        x1 = (int) (*points).x;
        y1 = (int) (*points).y;

        painter.drawLine(x1, y1, x2, y2);
        painter.drawEllipse(x1 - 1, y1 - 1, 3, 3);
    }

}
void MultipolygonProcessor::insertCoordinates(const std::deque<GeoCoordinate>& source, std::vector<GeoCoordinate>& destination, bool isOuter) const
{
    bool isClockwise = utymap::utils::isClockwise(source);
    if ((isOuter && isClockwise) || (!isOuter && !isClockwise))
        destination.insert(destination.end(), source.begin(), source.end());
    else
        destination.insert(destination.end(), source.rbegin(), source.rend());
}
	void deleteTrailingZeros()
	{
		auto reverse_it = std::find_if(
        pos_vec.rbegin(), 
        pos_vec.rend(), 
        [](int i) {return i != 0;} );

		pos_vec.erase(reverse_it.base(),pos_vec.end());
	};
void MultipolygonProcessor::insertCoordinates(const std::deque<GeoCoordinate> &source,
                                              std::vector<GeoCoordinate> &destination,
                                              bool isOuter) {
  // NOTE we need to remove the last coordinate in area
  std::size_t offset = source[0]==source[source.size() - 1] ? 1 : 0;

  bool isClockwise = utymap::utils::isClockwise(source);
  if ((isOuter && !isClockwise) || (!isOuter && isClockwise))
    destination.insert(destination.end(), source.begin(), source.end() - offset);
  else
    destination.insert(destination.end(), source.rbegin() + offset, source.rend());
}
Example #6
0
void sdl_handler::join_same(sdl_handler* parent)
{
	if(has_joined_) {
		leave(); // should not be in multiple event contexts
	}

	for(std::deque<context>::reverse_iterator i = event_contexts.rbegin(); i != event_contexts.rend(); ++i) {
		handler_list& handlers = (*i).handlers;
		if (std::find(handlers.begin(), handlers.end(), parent) != handlers.end()) {
			join(*i);
			return;
		}
	}

	join(event_contexts.back());
}
Example #7
0
void sdl_handler::leave()
{
	sdl_handler_vector members = handler_members();
	if(!members.empty()) {
		for(sdl_handler_vector::iterator i = members.begin(); i != members.end(); ++i) {
			(*i)->leave();
		}
	} else {
		assert(event_contexts.empty() == false);
	}
	for(std::deque<context>::reverse_iterator i = event_contexts.rbegin(); i != event_contexts.rend(); ++i) {
		if(i->remove_handler(this)) {
			break;
		}
	}
	has_joined_ = false;
}
void f_deque() {
  std::deque<int> C;
  std::deque<int>::iterator DequeI1 = C.begin();
  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when declaring iterators
  // CHECK-FIXES: auto DequeI1 = C.begin();

  std::deque<int>::reverse_iterator DequeI2 = C.rbegin();
  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when declaring iterators
  // CHECK-FIXES: auto DequeI2 = C.rbegin();

  const std::deque<int> D;
  std::deque<int>::const_iterator DequeI3 = D.begin();
  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when declaring iterators
  // CHECK-FIXES: auto DequeI3 = D.begin();

  std::deque<int>::const_reverse_iterator DequeI4 = D.rbegin();
  // CHECK-MESSAGES: :[[@LINE-1]]:3: warning: use auto when declaring iterators
  // CHECK-FIXES: auto DequeI4 = D.rbegin();
}