Skip to content
Permalink
Browse files

[GRASS] optionally show virtual topo layers

  • Loading branch information
blazek committed Sep 24, 2015
1 parent c8785ec commit e655c2617aef1cc9aec43e6b6017d3ed7ae678d7
@@ -1174,7 +1174,7 @@ QStringList QgsGrass::vectorLayers( const QString& gisdbase, const QString& loca

// TODO: add option in GUI to set listTopoLayers
QSettings settings;
bool listTopoLayers = settings.value( "/GRASS/listTopoLayers", false ).toBool();
bool listTopoLayers = settings.value( "/GRASS/showTopoLayers", false ).toBool();
if ( listTopoLayers )
{
// add topology layers
@@ -465,7 +465,7 @@ bool QgsGrassFeatureIterator::fetchFeature( QgsFeature& feature )
mSource->mLayer->map()->unlockReadWrite();
return false; // No more features
}
if ( type == 0 ) // should not happen
if ( type == 0 && mSource->mLayerType != QgsGrassProvider::TOPO_NODE )
{
QgsDebugMsg( "unknown type" );
close();
@@ -507,6 +507,7 @@ bool QgsGrassFeatureIterator::fetchFeature( QgsFeature& feature )
}
else
{
feature.initAttributes( mSource->mFields.size() );
feature.setAttribute( 0, lid );
#if GRASS_VERSION_MAJOR < 7
if ( mSource->mLayerType == QgsGrassProvider::TOPO_POINT || mSource->mLayerType == QgsGrassProvider::TOPO_LINE )
@@ -518,7 +519,6 @@ bool QgsGrassFeatureIterator::fetchFeature( QgsFeature& feature )
feature.setAttribute( 1, QgsGrass::vectorTypeName( type ) );

int node1, node2;;
close();
Vect_get_line_nodes( mSource->map(), lid, &node1, &node2 );
feature.setAttribute( 2, node1 );
if ( mSource->mLayerType == QgsGrassProvider::TOPO_LINE )
@@ -76,6 +76,8 @@ QgsGrassOptions::QgsGrassOptions( QWidget *parent )

mImportExternalCheckBox->setChecked( settings.value( mImportSettingsPath + "/external", true ).toBool() );

mTopoLayersCheckBox->setChecked( settings.value( "/GRASS/showTopoLayers", false ).toBool() );

// Region
QPen regionPen = QgsGrass::regionPen();
mRegionColorButton->setContext( "gui" );
@@ -160,6 +162,8 @@ void QgsGrassOptions::saveOptions()

settings.setValue( mImportSettingsPath + "/external", mImportExternalCheckBox->isChecked() );

settings.setValue( "/GRASS/showTopoLayers", mTopoLayersCheckBox->isChecked() );

// Region
QPen regionPen = QgsGrass::regionPen();
regionPen.setColor( mRegionColorButton->color() );
@@ -149,7 +149,7 @@
<number>0</number>
</property>
<property name="currentIndex">
<number>0</number>
<number>2</number>
</property>
<widget class="QWidget" name="mGeneralPage">
<layout class="QVBoxLayout" name="verticalLayout_11">
@@ -246,8 +246,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>408</width>
<height>311</height>
<width>247</width>
<height>141</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
@@ -351,7 +351,7 @@
<height>329</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_28">
<layout class="QVBoxLayout" name="verticalLayout_13">
<item>
<widget class="QgsCollapsibleGroupBox" name="mImportGroupBox">
<property name="title">
@@ -402,6 +402,28 @@
</layout>
</widget>
</item>
<item>
<widget class="QgsCollapsibleGroupBox" name="mLayersBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Layers</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_12">
<item>
<widget class="QCheckBox" name="mTopoLayersCheckBox">
<property name="text">
<string>Show virtual topological layers</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
@@ -484,7 +484,7 @@ QVector<QgsDataItem*> QgsGrassMapsetItem::createChildren()
QString typeName = layerName.split( "_" ).value( 1 );
QString baseLayerName = layerName.split( "_" ).value( 0 );

if ( typeName == "point" )
if ( typeName == "point" || typeName == "node" )
layerType = QgsLayerItem::Point;
else if ( typeName == "line" )
layerType = QgsLayerItem::Line;

0 comments on commit e655c26

Please sign in to comment.
You can’t perform that action at this time.