示例#1
0
void QgsDxfExport::writeVertex( const QgsPoint& pt, const QString& layer )
{
  writeGroup( 0, "VERTEX" );
  writeGroup( 8, layer );
  writeGroup( 10, pt.x() );
  writeGroup( 20, pt.y() );
  writeGroup( 30, 0 );
}
示例#2
0
void QgsDxfExport::writeText( const QString& layer, const QString& text, const QgsPoint& pt, double size, double angle, int color )
{
  writeGroup( 0, "TEXT" );
  writeGroup( 8, layer );
  writeGroup( 62, color );
  writeGroup( 10, pt.x() );
  writeGroup( 20, pt.y() );
  writeGroup( 30, 0 );
  writeGroup( 40, size );
  writeGroup( 1, text );
  writeGroup( 50, angle );
  writeGroup( 7, "STANDARD" ); //so far only support for standard font
}
示例#3
0
void QgsDxfExport::writeLinestyle( const QString& styleName, const QVector<qreal>& pattern, QgsSymbolV2::OutputUnit u )
{
  double length = 0;
  QVector<qreal>::const_iterator dashIt = pattern.constBegin();
  for ( ; dashIt != pattern.constEnd(); ++dashIt )
  {
    length += ( *dashIt * mapUnitScaleFactor( mSymbologyScaleDenominator, u, mMapUnits ) );
  }

  writeGroup( 0, "LTYPE" );
  writeGroup( 2, styleName );
  writeGroup( 70, 64 );
  writeGroup( 3, "" );
  writeGroup( 72, 65 );
  writeGroup( 73, pattern.size() );
  writeGroup( 40, length );

  dashIt = pattern.constBegin();
  bool isSpace = false;
  for ( ; dashIt != pattern.constEnd(); ++dashIt )
  {
    //map units or mm?
    double segmentLength = ( isSpace ? -*dashIt : *dashIt );
    segmentLength *= mapUnitScaleFactor( mSymbologyScaleDenominator, u, mMapUnits );
    writeGroup( 49, segmentLength );
    isSpace = !isSpace;
  }
}
//
//  Convenience routine for writing Group nodes that aren't animated
//
void
FltExportVisitor::writeGroup(const osg::Group &group)
{
    int32   flags        = 0, loopCount = 0;
    float32 loopDuration = 0.0f, lastFrameDuration = 0.0f;

    writeGroup(group, flags, loopCount, loopDuration, lastFrameDuration);
}
示例#5
0
	void ImageExportSerializer::writeImage(pugi::xml_node _parent, DataPtr _data)
	{
		pugi::xml_node node = _parent.append_child("Resource");
		node.append_attribute("type").set_value("ResourceImageSet");
		node.append_attribute("name").set_value(_data->getPropertyValue("Name").c_str());

		for (Data::VectorData::const_iterator child = _data->getChilds().begin(); child != _data->getChilds().end(); child ++)
			writeGroup(node, (*child));
	}
示例#6
0
static void writeProp(OFile *fp, VObject *o)
{
    int isQuoted=0;
    if (NAME_OF(o)) {
        const struct PreDefProp *pi;
        VObjectIterator t;
        const char **fields_ = 0;
        pi = lookupPropInfo(NAME_OF(o));
        if (pi && ((pi->flags & PD_BEGIN) != 0)) {
            writeVObject_(fp,o);
            return;
            }
        if (isAPropertyOf(o,VCGroupingProp))
            writeGroup(fp,o);
        else
            appendsOFile(fp,NAME_OF(o));
        if (pi) fields_ = pi->fields;
        initPropIterator(&t,o);
        while (moreIteration(&t)) {
            const char *s;
            VObject *eachProp = nextVObject(&t);
            s = NAME_OF(eachProp);
            if (strcasecmp(VCGroupingProp,s) && !inList(fields_,s))
                writeAttrValue(fp,eachProp);
            if (strcasecmp(VCQPProp,s)==0 || strcasecmp(VCQuotedPrintableProp,s)==0)
                 isQuoted=1;
            }
        if (fields_) {
            int i = 0, n = 0;
            const char** fields = fields_;
            /* output prop as fields */
            appendcOFile(fp,':');
            while (*fields) {
                VObject *tl = isAPropertyOf(o,*fields);
                i++;
                if (tl) n = i;
                fields++;
                }
            fields = fields_;
            for (i=0;i<n;i++) {
                writeValue(fp,isAPropertyOf(o,*fields),0,isQuoted);
                fields++;
                if (i<(n-1)) appendcOFile(fp,';');
                }
            }
        }

    if (VALUE_TYPE(o)) {
        unsigned long size = 0;
        VObject *p = isAPropertyOf(o,VCDataSizeProp);
        if (p) size = LONG_VALUE_OF(p);
        appendcOFile(fp,':');
        writeValue(fp,o,size,isQuoted);
        }

    appendcOFile(fp,'\n');
}
//
//  Since OpenFlight doesn't have 'Sequence' records---just Group records that
//  may, optionally, be animated---this routine sets the animation-related
//  parameters for a Group record and simply forwards to writeGroup()
//
void
FltExportVisitor::writeSequence(const osg::Sequence &sequence)
{
    int32   flags        = 0, loopCount = 0;
    float32 loopDuration = 0.0f, lastFrameDuration = 0.0f;

    osg::Sequence::LoopMode mode;
    int                     firstChildDisplayed, lastChildDisplayed;

    sequence.getInterval(mode, firstChildDisplayed, lastChildDisplayed);

    if (firstChildDisplayed == 0)
    {
        flags |= FORWARD_ANIM;
    }

    else
    {
        flags &= ~FORWARD_ANIM;
    }

    if (mode == osg::Sequence::SWING)
    {
        flags |= SWING_ANIM;
    }

    else
    {
        flags &= ~SWING_ANIM;
    }

    // Do we loop infinitely, or only a certain number of times?
    float speedUp;
    int   numReps;
    sequence.getDuration(speedUp, numReps);

    if (numReps != -1)
    {
        loopCount = numReps;
    }

    else
    {
        loopCount = 0;  // == loop continuously
    }

    // Sum individual frame durations to get the total loopDuration
    for (unsigned int i = 0; i < sequence.getNumChildren(); ++i)
    {
        loopDuration += sequence.getTime(i);
    }

    lastFrameDuration = sequence.getLastFrameTime();

    writeGroup(sequence, flags, loopCount, loopDuration, lastFrameDuration);
}
void KdbxXmlWriter::writeRoot()
{
    Q_ASSERT(m_db->rootGroup());

    m_xml.writeStartElement("Root");

    writeGroup(m_db->rootGroup());
    writeDeletedObjects();

    m_xml.writeEndElement();
}
示例#9
0
void QgsDxfExport::writeCircle( const QString& layer, int color, const QgsPoint& pt, double radius )
{
  writeGroup( 0, "CIRCLE" );
  writeGroup( 8, layer );
  writeGroup( 62, color );
  writeGroup( 10, pt.x() );
  writeGroup( 20, pt.y() );
  writeGroup( 30, 0 );
  writeGroup( 40, radius );
}
示例#10
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 );
}
示例#11
0
void QgsDxfExport::writePoint( const QString& layer, int color, const QgsPoint& pt )
{
  writeGroup( 0, "POINT" );
  writeGroup( 8, layer );
  writeGroup( 62, color );
  writeGroup( 10, pt.x() );
  writeGroup( 20, pt.y() );
  writeGroup( 30, 0.0 );
}
示例#12
0
    void ConfigFile::save( const String& filename ) const
    {
        std::ofstream file;
        file.open( filename.c_str() );

        GroupMapType::const_iterator groupIter = _groups.begin();
        GroupMapType::const_iterator groupEnd = _groups.end();

        while( groupIter != groupEnd ){
            file << "[" << groupIter->first << "]" << std::endl;
            writeGroup( file, groupIter->second );
            groupIter++;

            file << std::endl;
        }

        file.close();
    }    
示例#13
0
void QgsDxfExport::writePolyline( const QgsPolyline& line, const QString& layer, const QString& lineStyleName, int color,
                                  double width, bool polygon )
{
  writeGroup( 0, "POLYLINE" );
  writeGroup( 8, layer );
  writeGroup( 6, lineStyleName );
  writeGroup( 62, color );
  writeGroup( 66, 1 );
  int type = polygon ? 1 : 0;
  writeGroup( 70, type );
  if ( width > 0 ) //width -1: use default width
  {
    writeGroup( 40, width );
    writeGroup( 41, width );
  }

  QgsPolyline::const_iterator lineIt = line.constBegin();
  for ( ; lineIt != line.constEnd(); ++lineIt )
  {
    writeVertex( *lineIt, layer );
  }

  writeGroup( 0, "SEQEND" );
}
示例#14
0
void KdbxXmlWriter::writeGroup(const Group* group)
{
    Q_ASSERT(!group->uuid().isNull());

    m_xml.writeStartElement("Group");

    writeUuid("UUID", group->uuid());
    writeString("Name", group->name());
    writeString("Notes", group->notes());
    writeNumber("IconID", group->iconNumber());

    if (!group->iconUuid().isNull()) {
        writeUuid("CustomIconUUID", group->iconUuid());
    }
    writeTimes(group->timeInfo());
    writeBool("IsExpanded", group->isExpanded());
    writeString("DefaultAutoTypeSequence", group->defaultAutoTypeSequence());

    writeTriState("EnableAutoType", group->autoTypeEnabled());

    writeTriState("EnableSearching", group->searchingEnabled());

    writeUuid("LastTopVisibleEntry", group->lastTopVisibleEntry());

    if (m_kdbxVersion >= KeePass2::FILE_VERSION_4) {
        writeCustomData(group->customData());
    }

    const QList<Entry*>& entryList = group->entries();
    for (const Entry* entry : entryList) {
        writeEntry(entry);
    }

    const QList<Group*>& children = group->children();
    for (const Group* child : children) {
        writeGroup(child);
    }

    m_xml.writeEndElement();
}
示例#15
0
void QgsDxfExport::writeDefaultLinestyles()
{
  double das = dashSize();
  double dos = dotSize();
  double dss = dashSeparatorSize();

  //continuous (Qt solid line)
  writeGroup( 0, "LTYPE" );
  writeGroup( 2, "CONTINUOUS" );
  writeGroup( 70, 64 );
  writeGroup( 3, "Defaultstyle" );
  writeGroup( 72, 65 );
  writeGroup( 73, 0 );
  writeGroup( 40, 0.0 );

  QVector<qreal> dashVector( 2 );
  dashVector[0] = das;
  dashVector[1] = dss;
  writeLinestyle( "DASH", dashVector, QgsSymbolV2::MapUnit );

  QVector<qreal> dotVector( 2 );
  dotVector[0] = dos;
  dotVector[1] = dss;
  writeLinestyle( "DOT", dotVector, QgsSymbolV2::MapUnit );

  QVector<qreal> dashDotVector( 4 );
  dashDotVector[0] = das;
  dashDotVector[1] = dss;
  dashDotVector[2] = dos;
  dashDotVector[3] = dss;
  writeLinestyle( "DASHDOT", dashDotVector, QgsSymbolV2::MapUnit );

  QVector<qreal> dashDotDotVector( 6 );
  dashDotDotVector[0] = das;
  dashDotDotVector[1] = dss;
  dashDotDotVector[2] = dos;
  dashDotDotVector[3] = dss;
  dashDotDotVector[4] = dos;
  dashDotDotVector[5] = dss;
  writeLinestyle( "DASHDOTDOT", dashDotDotVector, QgsSymbolV2::MapUnit );
}
示例#16
0
void QgsDxfExport::startSection()
{
  writeGroup( 0, "SECTION" );
}
示例#17
0
void QgsDxfExport::writeHeader()
{
  writeGroup( 999, "DXF created from QGIS" );
  startSection();
  writeGroup( 2, "HEADER" );

  //ACADVER
  writeGroup( 9, "$ACADVER" );
  writeGroup( 1, "AC1009" );

  QgsRectangle ext = dxfExtent();
  if ( !ext.isEmpty() )
  {
    //EXTMIN
    writeGroup( 9, "$EXTMIN" );
    writeGroup( 10, ext.xMinimum() );
    writeGroup( 20, ext.yMinimum() );
    writeGroup( 30, 0.0 );

    //EXTMAX
    writeGroup( 9, "$EXTMAX" );
    writeGroup( 10, ext.xMaximum() );
    writeGroup( 20, ext.yMaximum() );
    writeGroup( 30, 0.0 );
  }

  //LTSCALE
  writeGroup( 9, "$LTSCALE" );
  writeGroup( 40, 1.0 );

  //PDMODE
  writeGroup( 9, "$PDMODE" );
  writeGroup( 70, 33 );

  //PDSIZE
  writeGroup( 9, "$PDSIZE" );
  writeGroup( 40, 1 );

  //PSLTSCALE
  writeGroup( 9, "$PSLTSCALE" );
  writeGroup( 70, 0 );

  endSection();
}
示例#18
0
void QgsDxfExport::writeTables()
{
  startSection();
  writeGroup( 2, "TABLES" );

  //iterate through all layers and get symbol layer pointers
  QList< QPair<QgsSymbolLayerV2*, QgsSymbolV2*> > slList;
  if ( mSymbologyExport != NoSymbology )
  {
    slList = symbolLayers();
  }

  //LTYPE
  mLineStyles.clear();
  writeGroup( 0, "TABLE" );
  writeGroup( 2, "LTYPE" );
  writeGroup( 70, nLineTypes( slList ) + 5 );

  writeDefaultLinestyles();
  //add custom linestyles
  QList< QPair< QgsSymbolLayerV2*, QgsSymbolV2*> >::const_iterator slIt = slList.constBegin();
  for ( ; slIt != slList.constEnd(); ++slIt )
  {
    writeSymbolLayerLinestyle( slIt->first );
  }

  writeGroup( 0, "ENDTAB" );

  //LAYER
  writeGroup( 0, "TABLE" );
  writeGroup( 2, "LAYER" );
  writeGroup( 70, mLayers.count() );

  QList< QgsMapLayer* >::const_iterator layerIt = mLayers.constBegin();
  for ( ; layerIt != mLayers.constEnd(); ++layerIt )
  {
    if ( !layerIsScaleBasedVisible(( *layerIt ) ) )
    {
      continue;
    }

    writeGroup( 0, "LAYER" );
    QString layerName = *layerIt ? ( *layerIt )->name() : "";
    writeGroup( 2, dxfLayerName( layerName ) );
    writeGroup( 70, 64 );
    writeGroup( 62, 1 );
    writeGroup( 6, "CONTINUOUS" );
  }
  writeGroup( 0, "ENDTAB" );

  //STYLE
  writeGroup( 0, "TABLE" );
  writeGroup( 2, "STYLE" );
  writeGroup( 70, 1 );

  //provide only standard font for the moment
  writeGroup( 0, "STYLE" );
  writeGroup( 2, "STANDARD" );
  writeGroup( 70, 64 );
  writeGroup( 40, 0.0 );
  writeGroup( 41, 1.0 );
  writeGroup( 50, 0.0 );
  writeGroup( 71, 0 );
  writeGroup( 42, 5.0 );
  writeGroup( 3, "romans.shx" );
  writeGroup( 4, "" );

  writeGroup( 0, "ENDTAB" );

  endSection();
}
示例#19
0
void QgsDxfExport::writeSolid( const QString& layer, int color, const QgsPoint& pt1, const QgsPoint& pt2, const QgsPoint& pt3, const QgsPoint& pt4 )
{
  writeGroup( 0, "SOLID" );
  writeGroup( 8, layer );
  writeGroup( 62, color );
  writeGroup( 10, pt1.x() );
  writeGroup( 20, pt1.y() );
  writeGroup( 30, 0.0 );
  writeGroup( 11, pt2.x() );
  writeGroup( 21, pt2.y() );
  writeGroup( 31, 0.0 );
  writeGroup( 12, pt3.x() );
  writeGroup( 22, pt3.y() );
  writeGroup( 32, 0.0 );
  writeGroup( 13, pt4.x() );
  writeGroup( 23, pt4.y() );
  writeGroup( 33, 0.0 );
}
示例#20
0
void QgsDxfExport::writeBlocks()
{
  startSection();
  writeGroup( 2, "BLOCKS" );

  //iterate through all layers and get symbol layer pointers
  QList< QPair< QgsSymbolLayerV2*, QgsSymbolV2* > > slList;
  if ( mSymbologyExport != NoSymbology )
  {
    slList = symbolLayers();
  }

  QList< QPair< QgsSymbolLayerV2*, QgsSymbolV2* > >::const_iterator slIt = slList.constBegin();
  for ( ; slIt != slList.constEnd(); ++slIt )
  {
    QgsMarkerSymbolLayerV2* ml = dynamic_cast< QgsMarkerSymbolLayerV2*>( slIt->first );
    if ( ml )
    {
      //if point symbol layer and no data defined properties: write block
      QgsRenderContext ct;
      QgsSymbolV2RenderContext ctx( ct, QgsSymbolV2::MapUnit, slIt->second->alpha(), false, slIt->second->renderHints(), 0 );
      ml->startRender( ctx );

      //markers with data defined properties are inserted inline
      if ( hasDataDefinedProperties( ml, slIt->second ) )
      {
        continue;
        // ml->stopRender( ctx );
      }
      writeGroup( 0, "BLOCK" );
      writeGroup( 8, 0 );
      QString blockName = QString( "symbolLayer%1" ).arg( mBlockCounter++ );
      writeGroup( 2, blockName );
      writeGroup( 70, 64 );

      //x/y/z coordinates of reference point
      //todo: consider anchor point
      // double size = ml->size();
      // size *= mapUnitScaleFactor( mSymbologyScaleDenominator, ml->sizeUnit(), mMapUnits );
      writeGroup( 10, 0 );
      writeGroup( 20, 0 );
      writeGroup( 30, 0 );
      writeGroup( 3, blockName );

      ml->writeDxf( *this, mapUnitScaleFactor( mSymbologyScaleDenominator, ml->sizeUnit(), mMapUnits ), "0", &ctx, 0 ); //maplayer 0 -> block receives layer from INSERT statement

      writeGroup( 0, "ENDBLK" );
      writeGroup( 8, 0 );

      mPointSymbolBlocks.insert( ml, blockName );
      ml->stopRender( ctx );
    }
  }
  endSection();
}
示例#21
0
void QgsDxfExport::writeEntities()
{
  startSection();
  writeGroup( 2, "ENTITIES" );

  //label engine
  QgsDxfPalLabeling labelEngine( this, mExtent.isEmpty() ? dxfExtent() : mExtent, mSymbologyScaleDenominator, mMapUnits );
  QgsRenderContext& ctx = labelEngine.renderContext();

  //iterate through the maplayers
  QList< QgsMapLayer* >::iterator layerIt = mLayers.begin();
  for ( ; layerIt != mLayers.end(); ++layerIt )
  {
    QgsVectorLayer* vl = qobject_cast<QgsVectorLayer*>( *layerIt );
    if ( !vl || !layerIsScaleBasedVisible( vl ) )
    {
      continue;
    }

    QgsSymbolV2RenderContext sctx( ctx, QgsSymbolV2::MM , 1.0, false, 0, 0 );
    QgsFeatureRendererV2* renderer = vl->rendererV2();
    renderer->startRender( ctx, vl->pendingFields() );

    QStringList attributes = renderer->usedAttributes();

    bool labelLayer = ( labelEngine.prepareLayer( vl, attributes, ctx ) != 0 );

    if ( mSymbologyExport == QgsDxfExport::SymbolLayerSymbology && ( renderer->capabilities() & QgsFeatureRendererV2::SymbolLevels ) &&
         renderer->usingSymbolLevels() )
    {
      writeEntitiesSymbolLevels( vl );
      renderer->stopRender( ctx );
      continue;
    }

    QgsFeatureRequest freq = QgsFeatureRequest().setSubsetOfAttributes(
                               attributes, vl->pendingFields() );
    if ( !mExtent.isEmpty() )
    {
      freq.setFilterRect( mExtent );
    }
    QgsFeatureIterator featureIt = vl->getFeatures( freq );
    QgsFeature fet;
    while ( featureIt.nextFeature( fet ) )
    {
      sctx.setFeature( &fet );
      if ( mSymbologyExport == NoSymbology )
      {
        addFeature( sctx, dxfLayerName( vl->name() ), 0, 0 ); //no symbology at all
      }
      else
      {
        if ( !renderer )
        {
          continue;
        }
        QgsSymbolV2List symbolList = renderer->symbolsForFeature( fet );
        if ( symbolList.size() < 1 )
        {
          continue;
        }

        if ( mSymbologyExport == QgsDxfExport::SymbolLayerSymbology ) //symbol layer symbology, but layer does not use symbol levels
        {
          QgsSymbolV2List::iterator symbolIt = symbolList.begin();
          for ( ; symbolIt != symbolList.end(); ++symbolIt )
          {
            int nSymbolLayers = ( *symbolIt )->symbolLayerCount();
            for ( int i = 0; i < nSymbolLayers; ++i )
            {
              addFeature( sctx, dxfLayerName( vl->name() ), ( *symbolIt )->symbolLayer( i ), *symbolIt );
            }
          }
        }
        else
        {
          //take first symbollayer from first symbol
          QgsSymbolV2* s = symbolList.first();
          if ( !s || s->symbolLayerCount() < 1 )
          {
            continue;
          }
          addFeature( sctx, dxfLayerName( vl->name() ), s->symbolLayer( 0 ), s );
        }

        if ( labelLayer )
        {
          labelEngine.registerFeature( vl->id(), fet, ctx );
        }
      }
    }
    renderer->stopRender( ctx );
  }

  labelEngine.drawLabeling( ctx );
  endSection();
}
示例#22
0
void QgsDxfExport::writeEndFile()
{
  writeGroup( 0, "EOF" );
}
示例#23
0
void QgsDxfExport::writePoint( const QgsPoint& pt, const QString& layer, int color, const QgsFeature* f, const QgsSymbolLayerV2* symbolLayer, const QgsSymbolV2* symbol )
{
#if 0
  //debug: draw rectangle for debugging
  const QgsMarkerSymbolLayerV2* msl = dynamic_cast< const QgsMarkerSymbolLayerV2* >( symbolLayer );
  if ( msl )
  {
    double halfSize = msl->size() * mapUnitScaleFactor( mSymbologyScaleDenominator,
                      msl->sizeUnit(), mMapUnits ) / 2.0;
    writeGroup( 0, "SOLID" );
    writeGroup( 8, layer );
    writeGroup( 62, 1 );
    writeGroup( 10, pt.x() - halfSize );
    writeGroup( 20, pt.y() - halfSize );
    writeGroup( 30, 0.0 );
    writeGroup( 11, pt.x() + halfSize );
    writeGroup( 21, pt.y() - halfSize );
    writeGroup( 31, 0.0 );
    writeGroup( 12, pt.x() - halfSize );
    writeGroup( 22, pt.y() + halfSize );
    writeGroup( 32, 0.0 );
    writeGroup( 13, pt.x() + halfSize );
    writeGroup( 23, pt.y() + halfSize );
    writeGroup( 33, 0.0 );
  }
#endif //0

  //insert block or write point directly?
  QHash< const QgsSymbolLayerV2*, QString >::const_iterator blockIt = mPointSymbolBlocks.find( symbolLayer );
  if ( !symbolLayer || blockIt == mPointSymbolBlocks.constEnd() )
  {
    //write symbol directly here
    const QgsMarkerSymbolLayerV2* msl = dynamic_cast< const QgsMarkerSymbolLayerV2* >( symbolLayer );
    if ( symbolLayer && symbol )
    {
      QgsRenderContext ct;
      QgsSymbolV2RenderContext ctx( ct, QgsSymbolV2::MapUnit, symbol->alpha(), false, symbol->renderHints(), f );
      if ( symbolLayer->writeDxf( *this, mapUnitScaleFactor( mSymbologyScaleDenominator, msl->sizeUnit(), mMapUnits ), layer, &ctx, f, QPointF( pt.x(), pt.y() ) ) )
      {
        return;
      }
    }
    writePoint( layer, color, pt ); //write default point symbol
  }
  else
  {
    //insert block reference
    writeGroup( 0, "INSERT" );
    writeGroup( 8, layer );
    writeGroup( 2, blockIt.value() );
    writeGroup( 10, pt.x() );
    writeGroup( 20, pt.y() );
    writeGroup( 30, 0 );
  }
}
示例#24
0
static void writeProp(OFile *fp, VObject *o)
{
    if (NAME_OF(o)) {
	struct PreDefProp *pi;
	VObjectIterator t;
	const char **fields_ = 0;
	pi = lookupPropInfo(NAME_OF(o));
	if (pi && ((pi->flags & PD_BEGIN) != 0)) {
	    writeVObject_(fp,o);
	    return;
	    }
	if (isAPropertyOf(o,VCGroupingProp))
	    writeGroup(fp,o);
	else
	    appendsOFile(fp,NAME_OF(o));
	if (pi) fields_ = pi->fields;
	initPropIterator(&t,o);
	while (moreIteration(&t)) {
	    const char *s;
	    VObject *eachProp = nextVObject(&t);
	    s = NAME_OF(eachProp);
	    if (qstricmp(VCGroupingProp,s) && !inList(fields_,s))
		writeAttrValue(fp,eachProp);
	    }
	if (fields_) {
	    int i = 0, n = 0;
	    const char** fields = fields_;
	    /* output prop as fields */
	    bool printable = TRUE;
	    while (*fields && printable) {
		VObject *t = isAPropertyOf(o,*fields);
		if (includesUnprintable(t,TRUE))
		    printable = FALSE;
		fields++;
	    }
	    fields = fields_;
	    if (!printable)
		appendsOFileEncCs(fp);
	    appendcOFile(fp,':');
	    while (*fields) {
		VObject *t = isAPropertyOf(o,*fields);
		i++;
		if (t) n = i;
		fields++;
	    }
	    fields = fields_;
	    for (i=0;i<n;i++) {
		writeValue(fp,isAPropertyOf(o,*fields),0,TRUE);
		fields++;
		if (i<(n-1)) appendcOFile(fp,';');
	    }
	    }
	}


    if (VALUE_TYPE(o)) {
	    if ( includesUnprintable(o,FALSE) )
			appendsOFileEncCs(fp);
	unsigned long size = 0;
        VObject *p = isAPropertyOf(o,VCDataSizeProp);
	if (p) size = LONG_VALUE_OF(p);
	appendcOFile(fp,':');
	writeValue(fp,o,size,FALSE);
	}

    appendcOFile(fp,'\n');
}
示例#25
0
void QgsDxfExport::endSection()
{
  writeGroup( 0, "ENDSEC" );
}