Пример #1
0
bool CGarminTyp::decode(QDataStream& in, QMap<quint32, polygon_property>& polygons, QMap<quint32, polyline_property>& polylines, QList<quint32>& drawOrder, QMap<quint32, point_property>& points)
{

    if(!parseHeader(in))
    {
        return false;
    }

    if(!parseDrawOrder(in, drawOrder))
    {
        return false;
    }

    if(!parsePolygon(in, polygons))
    {
        return false;
    }

    if(!parsePolyline(in, polylines))
    {
        return false;
    }

    if(!parsePoint(in, points))
    {
        return false;
    }

    return true;
}
Пример #2
0
	void parseEnities() 
	{
		GROUP_BEGIN();
		switch(group.code)
		{
		case(0):
			if("POLYLINE" == group.type){
				m_rootNode->newChild();
				parsePolyline();
			}else if("ENDSEC" == group.type){
				finished = true;
			}
			break;
		}
		GROUP_END();
	}
Пример #3
0
XFigParser::XFigParser( QIODevice* device )
  : m_Document(0)
  , m_XFigStreamLineReader( device )
{
    if( (device == 0) || (m_XFigStreamLineReader.hasError()) )
        return;

    const QTextCodec* codec = QTextCodec::codecForName("ISO 8859-1");
    m_TextDecoder = codec->makeDecoder();

    // setup
    if (! parseHeader())
        return;

    XFigPage* page = new XFigPage;

    while (! m_XFigStreamLineReader.readNextObjectLine()) {
        const int objectCode = m_XFigStreamLineReader.objectCode();
        const QString objectComment = m_XFigStreamLineReader.comment();

        if (objectCode == XFig3_2ColorObjectId) {
            parseColorObject();
        } else if ((XFig3_2EllipseObjectId<=objectCode) && (objectCode<=XFig3_2CompoundObjectId)) {
            XFigAbstractObject* object =
                (objectCode == XFig3_2EllipseObjectId) ?  parseEllipse() :
                (objectCode == XFig3_2PolylineObjectId) ? parsePolyline() :
                (objectCode == XFig3_2SplineObjectId) ?   parseSpline() :
                (objectCode == XFig3_2TextObjectId) ?     parseText() :
                (objectCode == XFig3_2ArcObjectId) ?      parseArc() :
                /*else XFig3_2CompoundObjectId)*/         parseCompoundObject();
            if (object != 0) {
                object->setComment(objectComment);
                page->addObject(object);
            }
        } else {
            // should not occur
            qWarning() << "unknown object type:" << objectCode;
        }
    }

    m_Document->addPage( page );
}