Esempio n. 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;
    }
}
Esempio n. 2
0
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());
}
Esempio n. 5
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());
}
Esempio n. 6
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;
}