Skip to content

Commit

Permalink
dxf export: add method to update model
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Dec 15, 2014
1 parent c37ffa5 commit ac10e69
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 17 deletions.
7 changes: 6 additions & 1 deletion src/app/qgsdxfexportdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void FieldSelectorDelegate::setEditorData( QWidget *editor, const QModelIndex &i
if ( !fcb )
return;

int idx = m->mAttributeIdx.value( vl, -1 );
int idx = m->attributeIndex( vl );
if ( vl->pendingFields().exists( idx ) )
fcb->setField( vl->pendingFields()[ idx ].name() );
}
Expand Down Expand Up @@ -127,6 +127,11 @@ QgsVectorLayer *QgsVectorLayerAndAttributeModel::vectorLayer( const QModelIndex
return dynamic_cast<QgsVectorLayer *>( QgsLayerTree::toLayer( n )->layer() );
}

int QgsVectorLayerAndAttributeModel::attributeIndex( const QgsVectorLayer *vl ) const
{
return mAttributeIdx.value( vl, -1 );
}

QVariant QgsVectorLayerAndAttributeModel::data( const QModelIndex& idx, int role ) const
{
if ( idx.column() == 0 )
Expand Down
5 changes: 2 additions & 3 deletions src/app/qgsdxfexportdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,15 @@ class QgsVectorLayerAndAttributeModel : public QgsLayerTreeModel
QList< QPair<QgsVectorLayer *, int> > layers() const;

QgsVectorLayer *vectorLayer( const QModelIndex &index ) const;
int attributeIndex( const QgsVectorLayer *vl ) const;

void applyVisibilityPreset( const QString &name );

private:
QHash<QgsVectorLayer *, int> mAttributeIdx;
QHash<const QgsVectorLayer *, int> mAttributeIdx;
QModelIndexList mCheckedIndexes;

void applyVisibility( QSet<QString> &visibleLayers, QgsLayerTreeNode *node );

friend FieldSelectorDelegate;
};


Expand Down
13 changes: 0 additions & 13 deletions src/core/dxf/qgsdxfexport.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,19 +139,6 @@ class CORE_EXPORT QgsDxfExport
void writeSymbolLayerLinetype( const QgsSymbolLayerV2* symbolLayer );
void writeLinetype( const QString& styleName, const QVector<qreal>& pattern, QgsSymbolV2::OutputUnit u );

#if 0
//AC1018
void writeHeaderAC1018( QTextStream& stream );
void writeTablesAC1018( QTextStream& stream );
void writeEntitiesAC1018( QTextStream& stream );
void writeEntitiesSymbolLevelsAC1018( QTextStream& stream, QgsVectorLayer* layer );
void writeSymbolLayerLinetypeAC1018( QTextStream& stream, const QgsSymbolLayerV2* symbolLayer );
void writeLinetypeAC1018( QTextStream& stream, const QString& styleName, const QVector<qreal>& pattern, QgsSymbolV2::OutputUnit u );
void writeVertexAC1018( QTextStream& stream, const QgsPoint& pt );
void writePolylineAC1018( QTextStream& stream, const QgsPolyline& line, const QString& layer, const QString& lineStyleName, QColor color,
double width = -1, bool polygon = false );
#endif

QgsRectangle dxfExtent() const;

void addFeature( const QgsSymbolV2RenderContext& ctx, const QString& layer, const QgsSymbolLayerV2* symbolLayer, const QgsSymbolV2* symbol );
Expand Down

0 comments on commit ac10e69

Please sign in to comment.