Exemplo n.º 1
0
static void writeLineComments(Key *key, FILE *fp)
{
	// TODO: this is really inefficient
	KeySet *metaKeys = elektraKeyGetMetaKeySet(key);
	Key *commentParent = keyNew("comment", KEY_META_NAME, KEY_END);
	KeySet *comments = elektraArrayGet(commentParent, metaKeys);
	keyDel(commentParent);

	ksRewind(comments);
	Key *current;
	while ((current = ksNext (comments)))
	{
		if (strcmp (keyName (current), "comment/#0"))
		{
			Key *spaceKey = keyDup (current);
			keyAddBaseName (spaceKey, "space");
			Key *startKey = keyDup (current);
			keyAddBaseName (startKey, "start");
			const char *spaces = getMetaValue (key, keyName (spaceKey));
			const char *start = getMetaValue (key, keyName (startKey));
			const char *comment = getMetaValue (key, keyName (current));
			keyDel (spaceKey);
			keyDel (startKey);
			writeComment (spaces, start, comment, fp);
			fprintf (fp, "\n");
		}
	}

	ksDel(metaKeys);
	ksDel(comments);
}
Exemplo n.º 2
0
void
Consumer::sendPrecedingComment(	Comment const& comment,
											Annotation const& annotation,
											MarkSet const& marks)
{
	writeComment(Comment(), comment, annotation, marks);
}
Exemplo n.º 3
0
void
Consumer::sendTrailingComment(Comment const& comment, bool variationIsEmpty)
{
	if (!comment.isEmpty())
	{
#ifndef ALLOW_EMPTY_VARS
		if (variationIsEmpty)
			putMove(m_move = Move::null());
#endif

		if (m_danglingEndMarker)
		{
			m_strm.put(token::End_Marker);
			m_danglingEndMarker--;
		}

		Byte flag = writeComment(comm::Post, comment);

		//M_ASSERT(flag);

		m_strm.put(token::Comment);
		m_data.put(flag);
		m_endOfRun = true;

		if (isMainline())
			m_lastCommentPos = plyCount() + 1;
	}
}
Exemplo n.º 4
0
static void writeMessage(QTextStream *t, const TranslatorMessage &msg, int indent,
                         const QString &languageCode)
{
    static int msgid = 1;
    if (msg.isPlural()) {
        writeIndent(t, indent);
        (*t) << "<group restype=\"" << restypePlurals << "\">\n";
        indent+=2;
        writeLineNumber(t, msg, indent);
        writeComment(t, msg, indent);

        QLocale::Language l;
        QLocale::Country c;
        MetaTranslator::languageAndCountry(languageCode, &l, &c);
        QStringList translns = MetaTranslator::normalizedTranslations(msg, l, c);
        for (int j = 0; j < qMax(1, translns.count()); ++j) {
            writeTransUnit(t, msg, msgid, indent, translns.at(j));
        }
        indent-=2;
        writeIndent(t, indent);
        (*t) << "</group>\n";
    } else {
        writeTransUnit(t, msg, msgid, indent);
    }
    ++msgid;
}
Exemplo n.º 5
0
void XMLSchemaWriter::writeAttributeDecl(UMLAttribute *attrib, QTextStream &XMLschema )
{

    QString documentation = attrib->getDoc();
    QString typeName = fixTypeName(attrib->getTypeName());
    bool isStatic = attrib->getStatic();
    QString initialValue = fixInitialStringDeclValue(attrib->getInitialValue(), typeName);

    if(!documentation.isEmpty())
        writeComment(documentation, XMLschema);

    XMLschema<<getIndent()<<"<"<<makeSchemaTag("attribute")
    <<" name=\""<<cleanName(attrib->getName())<<"\""
    <<" type=\""<<typeName<<"\"";

    // default value?
    if(!initialValue.isEmpty())
    {
        // IF its static, then we use "fixed", otherwise, we use "default" decl.
        // For the default decl, we _must_ use "optional" decl
        if(isStatic)
            XMLschema<<" use=\"required\" fixed=\""<<initialValue<<"\"";
        else
            XMLschema<<" use=\"optional\" default=\""<<initialValue<<"\"";
    }

    // finish decl
    XMLschema<<"/>"<<m_endl;

}
Exemplo n.º 6
0
bool
FltExportVisitor::complete( const osg::Node& node )
{
    // Always write final pop level
    writePop();
    // Done writing records, close the record data temp file.
    _recordsStr.close();

    // Write OpenFlight file front matter: header, vertex palette, etc.
    writeHeader( node.getName() );

    writeColorPalette();
    _materialPalette->write( _dos );
    _texturePalette->write( _dos );
    _lightSourcePalette->write( _dos );
    _vertexPalette->write( _dos );

    // Write Comment ancillary record and specify the _dos DataOutputStream.
    writeComment( node, &_dos );

    // Copy record data temp file into final OpenFlight file.
    // Yee-uck. TBD need better stream copy routine.
    char buf;
    std::ifstream recIn;
    recIn.open( _recordsTempName.c_str(), std::ios::in | std::ios::binary );
    while (!recIn.eof() )
    {
        recIn.read( &buf, 1 );
        if (recIn.good())
            _dos << buf;
    }
    recIn.close();

    return true;
}
Exemplo n.º 7
0
void
FltExportVisitor::apply( osg::LOD& lodNode )
{
    _firstNode = false;
    ScopedStatePushPop guard( this, lodNode.getStateSet() );

    // LOD center - same for all children
    osg::Vec3d center = lodNode.getCenter();

    // Iterate children of the LOD and write a separate LOD record for each,
    // with that child's individual switchIn and switchOut properties
    for ( size_t i = 0; i < lodNode.getNumChildren(); ++i )
    {
        osg::Node* lodChild = lodNode.getChild(i);

        // Switch-in/switch-out distances may vary per child
        double switchInDist = lodNode.getMaxRange(i);
        double switchOutDist = lodNode.getMinRange(i);

        writeLevelOfDetail( lodNode, center, switchInDist, switchOutDist);
        writeMatrix( lodNode.getUserData() );
        writeComment( lodNode );

        // Traverse each child of the LOD
        writePushTraverseWritePop( *lodChild );
    }

}
Exemplo n.º 8
0
bool
Consumer::sendMove(	Move const& move,
							Annotation const& annotation,
							MarkSet const& marks,
							Comment const& preComment,
							Comment const& comment)
{
	if (m_danglingPop)
	{
		m_position.pop();
		m_danglingPop = false;
	}
	else if (__builtin_expect(m_move, 1))
	{
		m_position.doMove(m_move);
	}

	if (!encodeMove(m_move = move))
		m_endOfRun = true;

	writeComment(preComment, comment, annotation, marks);

	if (!m_endOfRun)
		++m_runLength;

	return true;
}
Exemplo n.º 9
0
static void writeInlineComment(Key *key, FILE *fp)
{

	const char *spaces = getMetaValue(key, "comment/#0/space");
	const char *start = getMetaValue(key, "comment/#0/start");
	const char *comment = getMetaValue(key, "comment/#0");

	writeComment(spaces, start, comment, fp);
}
Exemplo n.º 10
0
void
FltExportVisitor::apply( osg::ProxyNode& node )
{
    _firstNode = false;
    ScopedStatePushPop guard( this, node.getStateSet() );

    writeExternalReference( node );
    writeMatrix( node.getUserData() );
    writeComment( node );
}
Exemplo n.º 11
0
			// Must define void operator() with no arguments
			void IXMLWriterTest::operator()()
			{
				writeXMLHeader();
				writeElement();
				writeComment();
				writeClosingTag();
				writeText();
				writeLineBreak();

				ASSERTM(mes.c_str(), mes.size() == 0);
			}
Exemplo n.º 12
0
void
FltExportVisitor::apply( osg::LightSource& node )
{
    _firstNode = false;
    ScopedStatePushPop guard( this, node.getStateSet() );

    writeLightSource( node );
    writeMatrix( node.getUserData() );
    writeComment( node );
    writePushTraverseWritePop( node );
}
Exemplo n.º 13
0
void XMLSchemaWriter::writeElementDecl( const QString &elementName, const QString &elementTypeName, QTextStream &XMLschema)
{
    if(forceDoc())
        writeComment(elementName+" is the root element, declared here.", XMLschema);

    XMLschema<<getIndent()<<"<"<<makeSchemaTag("element")
    <<" name=\""<<elementName<<"\""
    <<" type=\""<<makePackageTag(elementTypeName)<<"\""
    <<"/>"<<m_endl;

}
Exemplo n.º 14
0
void
FltExportVisitor::apply( osg::Group& node )
{
    ScopedStatePushPop guard( this, node.getStateSet() );

    if (_firstNode)
    {
        // On input, a FLT header creates a Group node.
        // On export, we always write a Header record, but then the first Node
        //   we export is the Group that was created from the original input Header.
        // On successive roundtrips, this results in increased redundant top-level Group nodes/records.
        // Avoid this by NOT outputting anything for a top-level Group node.
        _firstNode = false;
        traverse( node );
        return;
    }

    // A Group node could indicate one of many possible records.
    //   Header record -- Don't need to support this here. We always output a header.
    //   Group record -- HIGH
    //   Child of an LOD node -- HIGH Currently write out a Group record regardless.
    //   InstanceDefinition/InstanceReference -- MED --  multiparented Group is an instance
    //   Extension record -- MED
    //   Object record -- MED
    //   LightPointSystem record (if psgSim::MultiSwitch) -- LOW

    osgSim::MultiSwitch* multiSwitch = dynamic_cast<osgSim::MultiSwitch*>( &node );
    if (multiSwitch)
    {
        writeSwitch( multiSwitch );
    }

    else
    {
        osgSim::ObjectRecordData* ord =
            dynamic_cast< osgSim::ObjectRecordData* >( node.getUserData() );
        if (ord)
        {
            // This Group should write an Object Record.
            writeObject( node, ord );
        }
        else
        {
            // Handle other cases here.
            // For now, just output a Group record.
            writeGroup( node );
        }
    }

    writeMatrix( node.getUserData() );
    writeComment( node );
    writePushTraverseWritePop( node );
}
Exemplo n.º 15
0
void
Consumer::writeComment(	Comment const& preComment,
								Comment const& comment,
								Annotation const& annotation,
								MarkSet const& marks)
{
	if (!annotation.isEmpty())
	{
		for (unsigned i = 0; i < annotation.count(); ++i)
		{
			m_strm.put(token::Nag);
			m_strm.put(annotation[i]);
		}

		m_endOfRun = true;
	}

	if (!marks.isEmpty())
	{
		for (unsigned i = 0; i < marks.count(); ++i)
		{
			m_strm.put(token::Mark);
			marks[i].encode(m_data);
		}

		m_endOfRun = true;
	}

	Byte flag = writeComment(comm::Ante, preComment) | writeComment(comm::Post, comment);

	if (flag)
	{
		m_strm.put(token::Comment);
		m_data.put(flag);
		m_endOfRun = true;

		if (isMainline())
			m_lastCommentPos = plyCount() + 1;
	}
}
Exemplo n.º 16
0
bool Writer::writeMessage(const protocol::Message &msg)
{
	Q_ASSERT(m_file->isOpen());

	if(m_encoding == Encoding::Binary) {
		QVarLengthArray<char> buf(msg.length());
		const int len = msg.serialize(buf.data());
		Q_ASSERT(len == buf.length());
		if(m_file->write(buf.data(), len) != len)
			return false;

	} else {
		if(msg.type() == protocol::MSG_FILTERED) {
			// Special case: Filtered messages are
			// written as comments in the text format.
			const protocol::Filtered &fm = static_cast<const protocol::Filtered&>(msg);
			auto wrapped = fm.decodeWrapped();

			QString comment;
			if(wrapped.isNull()) {
				comment = QStringLiteral("FILTERED: undecodable message type #%1 of length %2")
					.arg(fm.wrappedType())
					.arg(fm.wrappedPayloadLength());

			} else {
				comment = QStringLiteral("FILTERED: ") + wrapped->toString();
			}

			return writeComment(comment);
		}

		QByteArray line = msg.toString().toUtf8();
		if(m_file->write(line) != line.length())
			return false;
		if(m_file->write("\n", 1) != 1)
			return false;

		// Write extra newlines after certain commands to give
		// the file some visual structure
		switch(msg.type()) {
		case protocol::MSG_UNDOPOINT:
			if(m_file->write("\n", 1) != 1)
				return false;
		default: break;
		}
	}

	return true;
}
Exemplo n.º 17
0
static void writeTransUnit(QTextStream *t, const TranslatorMessage &msg, int msgid,
                           int indent, const QString &translation = QString())
{
    static int plural = 0;
    static int prevMsgId = -1;
    writeIndent(t, indent);
    (*t) << "<trans-unit id=\"msg";
    QString strid;
    QByteArray transl;
    if (msg.isPlural()) {
        if (prevMsgId != msgid)
            plural = 0;
        strid = QString::fromAscii("%1[%2]").arg(msgid).arg(plural);
        ++plural;
        transl = translation.toUtf8();
    } else {
        strid = QString::fromAscii("%1").arg(msgid);
        plural = 0;
        transl = msg.translation().toUtf8();
    }
    prevMsgId = msgid;
    (*t) << strid << "\"";
    QString state;
    indent+=2;
    if (msg.type() == TranslatorMessage::Obsolete) {
        (*t) << " translate=\"no\"";
    } else {
        state = msg.type() == TranslatorMessage::Finished
            ? QLatin1String("final") : QLatin1String("new");
        state = QString::fromAscii(" state=\"%1\"").arg(state);
    }
    (*t) << ">\n";
    writeIndent(t, indent);
    (*t) << "<source xml:space=\"preserve\">" << evilBytes(msg.sourceText(), msg.utf8()) << "</source>\n";

    writeIndent(t, indent);
    (*t) << "<target xml:space=\"preserve\"" << state << ">" << evilBytes2(transl, msg.utf8()) << "</target>\n";
    // ### In XLIFF 1.1, name is marked as required, and it must be unique
    // This is questionable behaviour, and was brought up at the xliff-comments mailinglist.
    if (!msg.isPlural()) {
        writeLineNumber(t, msg, indent);
        writeComment(t, msg, indent);
    }
    indent-=2;
    writeIndent(t, indent);
    (*t) << "</trans-unit>\n";
}
Exemplo n.º 18
0
void
FltExportVisitor::apply( osg::Transform& node )
{
    _firstNode = false;
    ScopedStatePushPop guard( this, node.getStateSet() );

    osgSim::DOFTransform* dof = dynamic_cast<osgSim::DOFTransform*>( &node );

    if (dof)
    {
        writeDegreeOfFreedom( dof);
    }

    writeMatrix( node.getUserData() );
    writeComment( node );
    writePushTraverseWritePop( node );
}
Exemplo n.º 19
0
void XMLSchemaWriter::writeClassifier (UMLClassifier *c, QTextStream &XMLschema)
{

    // NO doing this 2 or more times.
    if(hasBeenWritten(c))
        return;

    XMLschema<<m_endl;

    // write documentation for class, if any, first
    if(forceDoc() || !c->getDoc().isEmpty())
        writeComment(c->getDoc(),XMLschema);

    if(c->getAbstract() || c->isInterface() )
        writeAbstractClassifier(c,XMLschema); // if its an interface or abstract class
    else
        writeConcreteClassifier(c,XMLschema);

}
static int write_header() {
	FILE *out = stil_out;
	if (out == 0) {
		return 1;
	}
	if (header_written == 1){
		return 0;
	}

	int i;
	int e;
	if ( (e = arrange_pins( jtag_pins_inorder, jtag_pins, jtag_pin_count )) != 0 ) {
		return e;	
	}
	if ( write_signals() ) {
		return 1;
	} else if ( write_signalGroups() ) {
		return 1;
	} 

	if ( fprintf (out, "Pattern {\n") < 0 ) {
		close_delete_file();
		return 1;
	}
	if ( fprintf (out, "\tW %s;\n", wft_name) < 0 ) {
		close_delete_file();
		return 1;
	}
	header_written = 1;
	//Write whatever comment there is before writing the first vector
	//After writing the header.
	char *comment = (char *) dequeue_linklist(&initial_comments);

	while (comment) {
		writeComment(comment);
		comment = dequeue_linklist(&initial_comments);
	}
	return 0;
}
Exemplo n.º 21
0
static void writeMessage(QTextStream &ts, const TranslatorMessage &msg, const QRegExp &drops, int indent)
{
    if (msg.isPlural()) {
        writeIndent(ts, indent);
        ts << "<group restype=\"" << restypePlurals << "\"";
        if (!msg.id().isEmpty())
            ts << " id=\"" << msg.id() << "\"";
        if (msg.type() == TranslatorMessage::Obsolete)
            ts << " translate=\"no\"";
        ts << ">\n";
        ++indent;
        writeLineNumber(ts, msg, indent);
        writeComment(ts, msg, drops, indent);

        writeTransUnits(ts, msg, drops, indent);
        --indent;
        writeIndent(ts, indent);
        ts << "</group>\n";
    } else {
        writeTransUnits(ts, msg, drops, indent);
    }
}
Exemplo n.º 22
0
void XMLSchemaWriter::writeAttributeGroupDecl (const QString &elementName, UMLAttributeList &attribs, QTextStream &XMLschema )
{

    if (attribs.count()> 0) {

        // write a little documentation
        writeComment("attributes for element "+elementName,XMLschema);

        // open attribute group
        XMLschema<<getIndent()<<"<"<<makeSchemaTag("attributeGroup")<<" name=\""<<elementName+"AttribGroupType"<<"\">"<<m_endl;

        m_indentLevel++;

        for( UMLAttribute *at=attribs.first(); at; at=attribs.next())
        {
            writeAttributeDecl(at,XMLschema);
        }

        m_indentLevel--;

        // close attrib group node
        XMLschema<<getIndent()<<"</"<<makeSchemaTag("attributeGroup")<<">"<<m_endl;
    }
}
Exemplo n.º 23
0
void
FltExportVisitor::handleDrawArrays( const osg::DrawArrays* da, const osg::Geometry& geom, const osg::Geode& geode )
{
    GLint first = da->getFirst();
    GLsizei count = da->getCount();
    GLenum mode = da->getMode();

    int n( 0 );
    bool useMesh( false );
    switch( mode )
    {
    case GL_TRIANGLE_STRIP:
    case GL_TRIANGLE_FAN:
    case GL_QUAD_STRIP:
        useMesh = true;
        break;
    case GL_POINTS:
        n = 1;
        break;
    case GL_LINES:
        n = 2;
        break;
    case GL_TRIANGLES:
        n = 3;
        break;
    case GL_QUADS:
        n = 4;
        break;
    case GL_LINE_STRIP:
    case GL_LINE_LOOP:
    case GL_POLYGON:
    default:
        n = count;
        break;
    }

    if (useMesh)
    {
        std::vector< unsigned int > indices;
        int jdx;
        for (jdx=0; jdx<count; jdx++)
            indices.push_back( first+jdx );
        writeMeshPrimitive( indices, mode );
    }
    else
    {
        const unsigned int max( first+count );
        while ((unsigned int)( first+n ) <= max)
        {
            writeFace( geode, geom, mode );

            writeMatrix( geode.getUserData() );
            writeComment( geode );
            writeMultitexture( geom );
            writePush();

            // Write vertex list records.
            int numVerts = writeVertexList( first, n );
            first += n;

            writeUVList( numVerts, geom );

            writePop();
        }
    }
}
Exemplo n.º 24
0
static void writeTransUnits(QTextStream &ts, const TranslatorMessage &msg, const QRegExp &drops, int indent)
{
    static int msgid;
    QString msgidstr = !msg.id().isEmpty() ? msg.id() : QString::fromAscii("_msg%1").arg(++msgid);

    QStringList translns = msg.translations();
    QHash<QString, QString>::const_iterator it;
    QString pluralStr;
    QStringList sources(msg.sourceText());
    if ((it = msg.extras().find(QString::fromLatin1("po-msgid_plural"))) != msg.extras().end())
        sources.append(*it);
    QStringList oldsources;
    if (!msg.oldSourceText().isEmpty())
        oldsources.append(msg.oldSourceText());
    if ((it = msg.extras().find(QString::fromLatin1("po-old_msgid_plural"))) != msg.extras().end()) {
        if (oldsources.isEmpty()) {
            if (sources.count() == 2)
                oldsources.append(QString());
            else
                pluralStr = QLatin1Char(' ') + QLatin1String(attribPlural) + QLatin1String("=\"yes\"");
        }
        oldsources.append(*it);
    }

    QStringList::const_iterator
        srcit = sources.begin(), srcend = sources.end(),
        oldsrcit = oldsources.begin(), oldsrcend = oldsources.end(),
        transit = translns.begin(), transend = translns.end();
    int plural = 0;
    QString source;
    while (srcit != srcend || oldsrcit != oldsrcend || transit != transend) {
        QByteArray attribs;
        QByteArray state;
        if (msg.type() == TranslatorMessage::Obsolete) {
            if (!msg.isPlural())
                attribs = " translate=\"no\"";
        } else if (msg.type() == TranslatorMessage::Finished) {
            attribs = " approved=\"yes\"";
        } else if (transit != transend && !transit->isEmpty()) {
            state = " state=\"needs-review-translation\"";
        }
        writeIndent(ts, indent);
        ts << "<trans-unit id=\"" << msgidstr;
        if (msg.isPlural())
            ts << "[" << plural++ << "]";
        ts << "\"" << attribs << ">\n";
        ++indent;

        writeIndent(ts, indent);
        if (srcit != srcend) {
            source = *srcit;
            ++srcit;
        } // else just repeat last element
        ts << "<source xml:space=\"preserve\">" << protect(source) << "</source>\n";

        bool puttrans = false;
        QString translation;
        if (transit != transend) {
            translation = *transit;
            translation.replace(QChar(Translator::BinaryVariantSeparator),
                                QChar(Translator::TextVariantSeparator));
            ++transit;
            puttrans = true;
        }
        do {
            if (oldsrcit != oldsrcend && !oldsrcit->isEmpty()) {
                writeIndent(ts, indent);
                ts << "<alt-trans>\n";
                ++indent;
                writeIndent(ts, indent);
                ts << "<source xml:space=\"preserve\"" << pluralStr << '>' << protect(*oldsrcit) << "</source>\n";
                if (!puttrans) {
                    writeIndent(ts, indent);
                    ts << "<target restype=\"" << restypeDummy << "\"/>\n";
                }
            }

            if (puttrans) {
                writeIndent(ts, indent);
                ts << "<target xml:space=\"preserve\"" << state << ">" << protect(translation) << "</target>\n";
            }

            if (oldsrcit != oldsrcend) {
                if (!oldsrcit->isEmpty()) {
                    --indent;
                    writeIndent(ts, indent);
                    ts << "</alt-trans>\n";
                }
                ++oldsrcit;
            }

            puttrans = false;
        } while (srcit == srcend && oldsrcit != oldsrcend);

        if (!msg.isPlural()) {
            writeLineNumber(ts, msg, indent);
            writeComment(ts, msg, drops, indent);
        }

        --indent;
        writeIndent(ts, indent);
        ts << "</trans-unit>\n";
    }
}
Exemplo n.º 25
0
/*! This function updates .ini file in two stages. It copies original .ini file
  into temporary one line by line, replacing/deleting/adding lines as necessary.
  Then it copies temporary file into original one and deletes temporary file.
*/
bool TEIniFile::update()
{
  close();
	if (!f.open(IO_ReadWrite)) return false;
  QString tempfn=f.name()+".tmp";
  QFile tempf(tempfn);
  if (!tempf.open(IO_ReadWrite | IO_Truncate)) return false;
  QTextStream tsorg;
  bool skipsec=false;

  tsorg.setEncoding(QTextStream::UnicodeUTF8);
  tsorg.setDevice(&f);
	ts.setDevice(&tempf); // writeXXX function hardwired to write into ts. So we set it appropriatedly.
	// prepare
  QMap<QString,bool> secProcd, valueProcd; // processedp flag's maps
  QMapIterator<QString,type_ValueList> it1;
  for(it1=SectionList.begin();it1!=SectionList.end();++it1)
  {
    secProcd[it1.key()]=false;
  }
	// scan form sections
	QString line, sec;
	type_Processing pr = P_NONE;	// nothing done yet
	type_ValueList ValueList;

	while (!((line = tsorg.readLine()).isNull())) {
		if ((pr == P_NONE) || (pr == P_SECTION)) {
			// trim line
			line = line.stripWhiteSpace();
			// skip if empty
			if (line.isEmpty())
      {
        writeBreak();
        continue;
      }
			// skip if comment
			if (line.startsWith("#"))
      {
        writeComment(line.mid(1));
        continue;
      }
			// check if section
			if (line.startsWith("[") && line.endsWith("]")) {
				if (pr == P_SECTION) {
					// update previous section
          // write new values
          type_ValueList::iterator it;
          type_ValueList & curSec=SectionList[sec];
          type_ValueList & curSecDef=SectionListDef[sec];
          for(it=curSec.begin();it!=curSec.end();++it)
          {
            if (!valueProcd[it.key()])
            { // this value was not processed yet, hence it's new or just default.
              if (curSecDef.find(it.key())==curSecDef.end() || curSecDef[it.key()]!=it.data()) // if it equals default value, skip it.
                ts << it.key() << "\t" << it.data() << "\n";
              valueProcd[it.key()]=true; // it is for completeness' sake, so it don't really necessary (yet?).
            }
          }
					secProcd[sec]=true;
				}
				// section found!
        valueProcd.clear(); // get ready for next section
				pr = P_SECTION;
				sec = line.mid(1, line.length()-2).stripWhiteSpace();
        writeSection(sec);
        skipsec=SectionList.find(sec)==SectionList.end() || secProcd[sec]==true; // Skip deleted or already processed section
        type_ValueList & curSec=SectionList[sec];
        type_ValueList::iterator it;
        for(it=curSec.begin();it!=curSec.end();++it)
        {
          valueProcd[it.key()]=false;
        }
				ValueList.clear();
				continue;
			}
			if (pr == P_SECTION) {
				// read name
        if (skipsec)
          continue;
				QString nam;
				int j = 0, l = (int)line.length();
				QChar c;
				while ( (j < l) && !((c = line.ref((uint)j)).isSpace()) ) {
					nam += c;
					j++;
				}
				// read value
        bool rawData=false;
        bool doubleQuotes=false;
				QString val;
				val = line.mid((uint)j).stripWhiteSpace();
				if (val == "data{") {
          rawData=true;
					// read raw data...
					val = "";
					while (!((line = ts.readLine()).isNull())) {
						if (line == "}data") {
							ValueList[nam] = val;
							break;
						}
						val += line + "\n";
					}
				} else {
					// test for ""
					if (val.startsWith("\"") && val.endsWith("\""))
          {
            doubleQuotes=true;
						val = val.mid(1, val.length()-2).stripWhiteSpace();
          }
					ValueList[nam] = val;
				}
        if (SectionList[sec].find(nam)!=SectionList[sec].end() && valueProcd[nam]==false)
        { // write modified value
          if (rawData)
            writeData(nam,SectionList[sec][nam]);
          else if (doubleQuotes)
            writeString(nam,SectionList[sec][nam]);
          else
            ts << nam << "\t" << SectionList[sec][nam] << "\n";
          valueProcd[nam]=true;
        }
			}
      else
        writeComment(line);
		}
	}

	if (pr == P_SECTION) {
		// update last section
    // write new values
    type_ValueList::iterator it;
    type_ValueList & curSec=SectionList[sec];
    type_ValueList & curSecDef=SectionListDef[sec];
    for(it=curSec.begin();it!=curSec.end();++it)
    {
      if (!valueProcd[it.key()])
      { // this value was not processed yet, hence it's new.
        if (curSecDef.find(it.key())==curSecDef.end() || curSecDef[it.key()]!=it.data())
          ts << it.key() << "\t" << it.data() << "\n";
        valueProcd[it.key()]=true; // it is for completeness' sake, so it don't really necessary (yet?).
      }
    }
		secProcd[sec]=true;
	}
  QMapIterator<QString,bool> it;
  for(it=secProcd.begin();it!=secProcd.end();++it)
  {
    QString sec=it.key();
    if (!it.data())
    {
      writeSection(sec);
      type_ValueList & curSec=SectionList[sec];
      type_ValueList & curSecDef=SectionListDef[sec];
      type_ValueList::iterator it1;
      for(it1=curSec.begin();it1!=curSec.end();++it1)
        if (curSecDef.find(it1.key())==curSecDef.end() || curSecDef[it1.key()]!=it1.data())
          ts << it1.key() << "\t" << it1.data() << "\n";
    }
  }
  tempf.flush();
  if (!tempf.reset())
    return false;
  f.close();
  if (!f.open(IO_WriteOnly | IO_Truncate))
    return false;
  const int N=64*1024;
  char * buf=new char[N];
  Q_LONG len;
  while(true)
  {
    len=tempf.readBlock(buf,N);
    if (len<=0)
      break;
    f.writeBlock(buf,(Q_ULONG)len);
  }
  delete [] buf;
  f.close();
  tempf.close();
  tempf.remove();
  ts.setDevice(&f);
	return len>=0;
}
void
FltExportVisitor::writeLightPoint(const osgSim::LightPointNode *lpn)
{
    enum Directionality
    {
        OMNIDIRECTIONAL = 0,
        UNIDIRECTIONAL  = 1,
        BIDIRECTIONAL   = 2
    };
    enum DisplayMode
    {
        RASTER = 0,
        CALLIG = 1,
        EITHER = 2
    };
    enum Modes
    {
        ENABLE  = 0,
        DISABLE = 1
    };
    enum Flags
    {
        NO_BACK_COLOR = 0x80000000u >> 1,
        CALLIGRAPHIC  = 0x80000000u >> 3,
        REFLECTIVE    = 0x80000000u >> 4,
        PERSPECTIVE   = 0x80000000u >> 8,
        FLASHING      = 0x80000000u >> 9,
        ROTATING      = 0x80000000u >> 10,
        ROTATE_CC     = 0x80000000u >> 11,
        VISIBLE_DAY   = 0x80000000u >> 15,
        VISIBLE_DUSK  = 0x80000000u >> 16,
        VISIBLE_NIGHT = 0x80000000u >> 17
    };
    int32 flags(NO_BACK_COLOR);

    if (lpn->getNumLightPoints() == 0)
        return;

    // In OSG, each LightPoint within a LightPointNode  can have different appearance
    // parameters, but in OpenFlight, a Light Point Record contains a list of homogeneous
    // vertices. To be correct, we'd have to look at all LightPoints in the LightPointNode
    // and spew out multiple FLT records for each group that shared common appearance
    // parameters. Instead, we cheat: We take the first LightPoint and use its appearance
    // parameters for all LightPoints in the LightPointNode.
    const osgSim::LightPoint &lp0 = lpn->getLightPoint(0);

    // No really good mapping between OSG and FLT light point animations.
    float32 animPeriod(0.f);
    float32 animEnabled(0.f);
    float32 animPhaseDelay(0.f);
    if (lp0._blinkSequence != NULL)
    {
        flags         |= FLASHING;
        animPeriod     = 4.f;
        animEnabled    = 2.f;
        animPhaseDelay = lp0._blinkSequence->getPhaseShift();
    }

    // Note that true bidirectional light points are currently unsupported (they are unavailable
    // in OSG, so we never write them out to FLT as BIDIRECTIONAL.
    int32                           directionality(OMNIDIRECTIONAL);
    float32                         horizLobe(360.f);
    float32                         vertLobe(360.f);
    float32                         lobeRoll(0.f);
    const osgSim::DirectionalSector *ds = dynamic_cast<osgSim::DirectionalSector*>(lp0._sector.get());
    if (ds)
    {
        directionality = UNIDIRECTIONAL;
        horizLobe      = osg::RadiansToDegrees(ds->getHorizLobeAngle());
        vertLobe       = osg::RadiansToDegrees(ds->getVertLobeAngle());
        lobeRoll       = osg::RadiansToDegrees(ds->getLobeRollAngle());
    }

    {
        // Braces req'd to invoke idHelper destructor (and potentially
        // write LongID record) before Push Record.

        const uint16 length(156);
        IdHelper     id(*this, lpn->getName());

        _records->writeInt16((int16) LIGHT_POINT_OP);
        _records->writeInt16(length);
        _records->writeID(id);
        _records->writeInt16(0);   // Surface material code
        _records->writeInt16(0);   // Feature ID
        _records->writeUInt32(~0u);   // OpenFlight erronously say -1, so will assume ~0u is OK.  Back color for bidirectional
        _records->writeInt32(EITHER);   // Display mode
        _records->writeFloat32(lp0._intensity);   // Intensity
        _records->writeFloat32(0.f);   // Back intensity TBD
        _records->writeFloat32(0.f);   // min defocus
        _records->writeFloat32(0.f);   // max defocus
        _records->writeInt32(DISABLE);   // Fading mode
        _records->writeInt32(DISABLE);   // Fog punch mode
        _records->writeInt32(DISABLE);   // Directional mode
        _records->writeInt32(0);   // Range mode
        _records->writeFloat32(lpn->getMinPixelSize());   // min pixel size
        _records->writeFloat32(lpn->getMaxPixelSize());   // max pixel size
        _records->writeFloat32(lp0._radius * 2.f);   // Actual size
        _records->writeFloat32(1.f);   // transparent falloff pixel size
        _records->writeFloat32(1.f);   // Transparent falloff exponent
        _records->writeFloat32(1.f);   // Transparent falloff scalar
        _records->writeFloat32(0.f);   // Transparent falloff clamp
        _records->writeFloat32(1.f);   // Fog scalar
        _records->writeFloat32(0.f);   // Reserved
        _records->writeFloat32(0.f);   // Size difference threshold
        _records->writeInt32(directionality);   // Directionality
        _records->writeFloat32(horizLobe);   // Horizontal lobe angle
        _records->writeFloat32(vertLobe);   // Vertical lobe angle
        _records->writeFloat32(lobeRoll);   // Lobe roll angle
        _records->writeFloat32(0.f);   // Directional falloff exponent
        _records->writeFloat32(0.f);   // Directional ambient intensity
        _records->writeFloat32(animPeriod);   // Animation period in seconds
        _records->writeFloat32(animPhaseDelay);   // Animation phase delay in seconds
        _records->writeFloat32(animEnabled);   // Animation enabled period in seconds
        _records->writeFloat32(1.f);   // Significance
        _records->writeInt32(0);   // Calligraphic draw order
        _records->writeInt32(flags);   // Flags
        _records->writeVec3f(osg::Vec3f(0.f, 0.f, 0.f));     // Axis of rotation
    }

    {
        osg::ref_ptr<osg::Vec3dArray> v = new osg::Vec3dArray(lpn->getNumLightPoints());
        osg::ref_ptr<osg::Vec4Array>  c = new osg::Vec4Array(lpn->getNumLightPoints());
        osg::ref_ptr<osg::Vec3Array>  n = new osg::Vec3Array(lpn->getNumLightPoints());
        osg::Vec3f                    normal(0.f, 0.f, 1.f);

        unsigned int idx;

        for (idx = 0; idx < lpn->getNumLightPoints(); idx++)
        {
            const osgSim::LightPoint &lp = lpn->getLightPoint(idx);
            (*v)[idx] = lp._position;
            (*c)[idx] = lp._color;

            const osgSim::DirectionalSector *ds = dynamic_cast<osgSim::DirectionalSector*>(lp._sector.get());
            if (ds)
                normal = ds->getDirection();

            (*n)[idx] = normal;
        }

        _vertexPalette->add((const osg::Array*)NULL, v.get(), c.get(), n.get(), NULL, true, true, false);
    }

    writeMatrix(lpn->getUserData());
    writeComment(*lpn);
    writePush();
    writeVertexList(0, lpn->getNumLightPoints());
    writePop();
}
Exemplo n.º 27
0
/**
 * Write the source code body file for this classifier.
 */
void CppWriter::writeSourceFile(UMLClassifier *c, QFile &file)
{
    // open stream for writing
    QTextStream cpp (&file);

    // set the starting indentation at zero
    m_indentLevel = 0;

    //try to find a heading file (license, coments, etc)
    QString str;
    str = getHeadingFile(".cpp");
    if (!str.isEmpty()) {
        str.replace(QRegExp("%filename%"), fileName_ + ".cpp");
        str.replace(QRegExp("%filepath%"), file.fileName());
        cpp << str << m_endl;
    }

    // IMPORT statements
    // Q: Why all utils? Isnt just List and Vector the only classes we are using?
    // Our import *should* also look at operations, and check that objects being
    // used arent in another package (and thus need to be explicitly imported here).
    cpp << "#include \"" << className_ << ".h\"" << m_endl;
    writeBlankLine(cpp);

    if (c->visibility() == Uml::Visibility::Implementation) {
        writeClassDecl(c, cpp);
    }

    // Start body of class

    // Constructors: anything we more we need to do here ?
    //
    if (!c->isInterface())
        writeConstructorMethods(c, cpp);

    // METHODS
    //

    // write comment for section IF needed
    QString indnt = indent();
    if (forceDoc() || c->hasAccessorMethods() || c->hasOperationMethods()) {
        writeComment(" ", indnt, cpp);
        writeComment("Methods", indnt, cpp);
        writeComment(" ", indnt, cpp);
        writeBlankLine(cpp);
        writeBlankLine(cpp);
    }

    // write comment for sub-section IF needed
    if (forceDoc() || c->hasAccessorMethods() ) {
        writeComment("Accessor methods", indnt, cpp);
        writeComment(" ", indnt, cpp);
        writeBlankLine(cpp);
    }

    // Accessor methods for attributes
    const bool bInlineAccessors = policyExt()->getAccessorsAreInline();
    if (!bInlineAccessors && c->hasAttributes()) {
        writeAttributeMethods(c->getAttributeListStatic(Uml::Visibility::Public), Uml::Visibility::Public, false, true, !bInlineAccessors, cpp);
        writeAttributeMethods(c->getAttributeList(Uml::Visibility::Public), Uml::Visibility::Public, false, false, !bInlineAccessors, cpp);
        writeAttributeMethods(c->getAttributeListStatic(Uml::Visibility::Protected), Uml::Visibility::Protected, false, true, !bInlineAccessors, cpp);
        writeAttributeMethods(c->getAttributeList(Uml::Visibility::Protected), Uml::Visibility::Protected, false, false, !bInlineAccessors, cpp);
        writeAttributeMethods(c->getAttributeListStatic(Uml::Visibility::Private), Uml::Visibility::Private, false, true, !bInlineAccessors, cpp);
        writeAttributeMethods(c->getAttributeList(Uml::Visibility::Private), Uml::Visibility::Private, false, false, !bInlineAccessors, cpp);
    }

    // accessor methods for associations

    // public
    writeAssociationMethods(c->getSpecificAssocs(Uml::at_Association), Uml::Visibility::Public, false,
                            !INLINE_ASSOCIATION_METHODS, true, c->id(), cpp);
    writeAssociationMethods(c->getUniAssociationToBeImplemented(), Uml::Visibility::Public, false,
                            !INLINE_ASSOCIATION_METHODS, true, c->id(), cpp);
    writeAssociationMethods(c->getAggregations(), Uml::Visibility::Public, false,
                            !INLINE_ASSOCIATION_METHODS, true, c->id(), cpp);
    writeAssociationMethods(c->getCompositions(), Uml::Visibility::Public, false,
                            !INLINE_ASSOCIATION_METHODS, true, c->id(), cpp);

    // protected
    writeAssociationMethods(c->getSpecificAssocs(Uml::at_Association), Uml::Visibility::Protected, false,
                            !INLINE_ASSOCIATION_METHODS, true, c->id(), cpp);
    writeAssociationMethods(c->getUniAssociationToBeImplemented(), Uml::Visibility::Protected, false,
                            !INLINE_ASSOCIATION_METHODS, true, c->id(), cpp);
    writeAssociationMethods(c->getAggregations(), Uml::Visibility::Protected, false,
                            !INLINE_ASSOCIATION_METHODS, true, c->id(), cpp);
    writeAssociationMethods(c->getCompositions(), Uml::Visibility::Protected, false,
                            !INLINE_ASSOCIATION_METHODS, true, c->id(), cpp);

    // private
    writeAssociationMethods(c->getSpecificAssocs(Uml::at_Association), Uml::Visibility::Private, false,
                            !INLINE_ASSOCIATION_METHODS, true, c->id(), cpp);
    writeAssociationMethods(c->getUniAssociationToBeImplemented(), Uml::Visibility::Private, false,
                            !INLINE_ASSOCIATION_METHODS, true, c->id(), cpp);
    writeAssociationMethods(c->getAggregations(), Uml::Visibility::Private, false,
                            !INLINE_ASSOCIATION_METHODS, true, c->id(), cpp);
    writeAssociationMethods(c->getCompositions(), Uml::Visibility::Private, false,
                            !INLINE_ASSOCIATION_METHODS, true, c->id(), cpp);
    writeBlankLine(cpp);

    // Other operation methods -- all other operations are now written
    //

    // write comment for sub-section IF needed
    if (forceDoc() || c->hasOperationMethods()) {
        writeComment("Other methods", indnt, cpp);
        writeComment(" ", indnt, cpp);
        writeBlankLine(cpp);
    }

    if (!policyExt()->getOperationsAreInline()) {
        writeOperations(c,false,Uml::Visibility::Public,cpp);
        writeOperations(c,false,Uml::Visibility::Protected,cpp);
        writeOperations(c,false,Uml::Visibility::Private,cpp);
    }

    // Yep, bringing up the back of the bus, our initialization method for attributes
    writeInitAttributeMethod(c, cpp);

    writeBlankLine(cpp);
}
Exemplo n.º 28
0
void
FltExportVisitor::handleDrawArrayLengths( const osg::DrawArrayLengths* dal, const osg::Geometry& geom, const osg::Geode& geode )
{
    GLint first = dal->getFirst();
    GLenum mode = dal->getMode();

    int n( 0 );
    bool useMesh( false );
    switch( mode )
    {
    case GL_TRIANGLE_STRIP:
    case GL_TRIANGLE_FAN:
    case GL_QUAD_STRIP:
        useMesh = true;
        break;
    case GL_POINTS:
        n = 1;
        break;
    case GL_LINES:
        n = 2;
        break;
    case GL_TRIANGLES:
        n = 3;
        break;
    case GL_QUADS:
        n = 4;
        break;
    case GL_LINE_STRIP:
    case GL_LINE_LOOP:
    case GL_POLYGON:
    default:
        break;
    }

    // Push and pop subfaces if polygon offset is on.
    SubfaceHelper subface( *this, getCurrentStateSet() );

    if (useMesh)
    {
        int idx( 0 );
        for( osg::DrawArrayLengths::const_iterator itr=dal->begin();
             itr!=dal->end(); itr++ )
        {
            std::vector< unsigned int > indices;
            int jdx;
            for (jdx=0; jdx<(*itr); idx++, jdx++)
                indices.push_back( idx );
            writeMeshPrimitive( indices, mode );
        }
    }
    else
    {
        // Hm. You wouldn't usually use DrawArrayLengths for non-strip/fan prims...
        for( osg::DrawArrayLengths::const_iterator itr=dal->begin();
             itr!=dal->end(); itr++ )
        {
            while (first+n <= *itr)
            {
                writeFace( geode, geom, mode );

                writeMatrix( geode.getUserData() );
                writeComment( geode );
                writeMultitexture( geom );
                writePush();

                // Write vertex list records.
                int numVerts;
                if (n == 0)
                {
                    numVerts = writeVertexList( first, *itr );
                    first += *itr;
                }
                else
                {
                    numVerts = writeVertexList( first, n );
                    first += n;
                }

                writeUVList( numVerts, geom );

                writePop();
            }

            first += *itr;
        }
    }
}
Exemplo n.º 29
0
void
FltExportVisitor::handleDrawElements( const osg::DrawElements* de, const osg::Geometry& geom, const osg::Geode& geode )
{
    GLenum mode = de->getMode();

    int n( 0 );
    bool useMesh( false );
    switch( mode )
    {
    case GL_TRIANGLE_STRIP:
    case GL_TRIANGLE_FAN:
    case GL_QUAD_STRIP:
        n = de->getNumIndices();
        useMesh = true;
        break;
    case GL_POINTS:
        n = 1;
        break;
    case GL_LINES:
        n = 2;
        break;
    case GL_TRIANGLES:
        n = 3;
        break;
    case GL_QUADS:
        n = 4;
        break;
    case GL_LINE_STRIP:
    case GL_LINE_LOOP:
    case GL_POLYGON:
    default:
        n = de->getNumIndices();
        break;
    }

    // Push and pop subfaces if polygon offset is on.
    SubfaceHelper subface( *this, getCurrentStateSet() );

    if (useMesh)
    {
        std::vector< unsigned int > indices;
        int idx;
        for (idx=0; idx<n; idx++)
            indices.push_back( de->index( idx ) );
        writeMeshPrimitive( indices, mode );
    }
    else
    {
        unsigned int first( 0 );
        while (first+n <= de->getNumIndices())
        {
            // Need:
            // * Geode for record name (but also need to handle
            //   multi Geometry objects and multi PrimitiveSet objects;
            //   all Face records can't have the same name).
            // * Mode
            writeFace( geode, geom, mode );

            writeMatrix( geode.getUserData() );
            writeComment( geode );
            writeMultitexture( geom );
            writePush();

            // Write vertex list records.
            std::vector<unsigned int> indices;
            int idx;
            for(idx=0; idx<n; idx++)
                indices.push_back( de->index( first+idx ) );
            int numVerts = writeVertexList( indices, n );
            first += n;

            writeUVList( numVerts, geom );

            writePop();
        }
    }
}
Exemplo n.º 30
0
// Billboards also go through this code. The Geode is passed
// to writeFace and writeMesh. If those methods successfully cast
// the Geode to a Billboard, then they set the template mode
// bit accordingly.
void
FltExportVisitor::apply( osg::Geode& node )
{
    _firstNode = false;
    ScopedStatePushPop guard( this, node.getStateSet() );

    unsigned int idx;
    for (idx=0; idx<node.getNumDrawables(); idx++)
    {
        osg::Geometry* geom = node.getDrawable( idx )->asGeometry();
        if (!geom)
        {
            std::string warning( "fltexp: Non-Geometry Drawable encountered. Ignoring." );
            osg::notify( osg::WARN ) << warning << std::endl;
            _fltOpt->getWriteResult().warn( warning );
            continue;
        }

        ScopedStatePushPop drawableGuard( this, geom->getStateSet() );

        // Push and pop subfaces if polygon offset is on.
        SubfaceHelper subface( *this, getCurrentStateSet() );

        if (atLeastOneFace( *geom ))
        {
            // If at least one record will be a Face record, then we
            //   need to write to the vertex palette.
            _vertexPalette->add( *geom );

            // Iterate over all PrimitiveSets and output Face records.
            unsigned int jdx;
            for (jdx=0; jdx < geom->getNumPrimitiveSets(); jdx++)
            {
                osg::PrimitiveSet* prim = geom->getPrimitiveSet( jdx );
                if ( isMesh( prim->getMode() ) )
                    continue;

                if (prim->getType() == osg::PrimitiveSet::DrawArraysPrimitiveType)
                    handleDrawArrays( dynamic_cast<osg::DrawArrays*>( prim ), *geom, node );
                else if (prim->getType() == osg::PrimitiveSet::DrawArrayLengthsPrimitiveType)
                    handleDrawArrayLengths( dynamic_cast<osg::DrawArrayLengths*>( prim ), *geom, node );
                else if ( (prim->getType() == osg::PrimitiveSet::DrawElementsUBytePrimitiveType) ||
                          (prim->getType() == osg::PrimitiveSet::DrawElementsUShortPrimitiveType) ||
                          (prim->getType() == osg::PrimitiveSet::DrawElementsUIntPrimitiveType) )
                    handleDrawElements( dynamic_cast<osg::DrawElements*>( prim ), *geom, node );
                else
                {
                    std::string warning( "fltexp: Unknown PrimitiveSet type." );
                    osg::notify( osg::WARN ) << warning << std::endl;
                    _fltOpt->getWriteResult().warn( warning );
                    return;
                }
            }
        }

        if (atLeastOneMesh( *geom ))
        {
            // If at least one Mesh record, write out preamble mesh records
            //   followed by a Mesh Primitive record per PrimitiveSet.
            writeMesh( node, *geom );

            writeMatrix( node.getUserData() );
            writeComment( node );
            writeMultitexture( *geom );
            writeLocalVertexPool( *geom );

            writePush();

            unsigned int jdx;
            for (jdx=0; jdx < geom->getNumPrimitiveSets(); jdx++)
            {
                osg::PrimitiveSet* prim = geom->getPrimitiveSet( jdx );
                if ( !isMesh( prim->getMode() ) )
                    continue;

                if (prim->getType() == osg::PrimitiveSet::DrawArraysPrimitiveType)
                    handleDrawArrays( dynamic_cast<osg::DrawArrays*>( prim ), *geom, node );
                else if (prim->getType() == osg::PrimitiveSet::DrawArrayLengthsPrimitiveType)
                    handleDrawArrayLengths( dynamic_cast<osg::DrawArrayLengths*>( prim ), *geom, node );
                else if ( (prim->getType() == osg::PrimitiveSet::DrawElementsUBytePrimitiveType) ||
                          (prim->getType() == osg::PrimitiveSet::DrawElementsUShortPrimitiveType) ||
                          (prim->getType() == osg::PrimitiveSet::DrawElementsUIntPrimitiveType) )
                    handleDrawElements( dynamic_cast<osg::DrawElements*>( prim ), *geom, node );
                else
                {
                    std::string warning( "fltexp: Unknown PrimitiveSet type." );
                    osg::notify( osg::WARN ) << warning << std::endl;
                    _fltOpt->getWriteResult().warn( warning );
                    return;
                }
            }

            writePop();
        }
    }

    // Would traverse here if this node could have children.
    //   traverse( (osg::Node&)node );
}