Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
optional line width and marker size
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5059 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rblazek committed Mar 18, 2006
1 parent 9d9cd71 commit dc20cde
Show file tree
Hide file tree
Showing 3 changed files with 309 additions and 74 deletions.
49 changes: 43 additions & 6 deletions src/plugins/grass/qgsgrassedit.cpp
Expand Up @@ -373,22 +373,33 @@ void QgsGrassEdit::init()
mSymbName[SYMB_NODE_2] = "Node (2 lines)";

// Restore symbology
QString spath = "/GRASS/edit/symb/";
QSettings settings("QuantumGIS", "qgis");

mLineWidth = settings.readNumEntry (
spath + "lineWidth", 1 );
mSize = settings.readNumEntry (
spath + "markerSize", 9 );
mLineWidthSpinBox->setValue(mLineWidth);
mMarkerSizeSpinBox->setValue(mSize);

for ( int i = 0; i < SYMB_COUNT; i++ ) {
bool ok;
QString sn;
sn.sprintf( "/GRASS/edit/symb/display/%d", i );
bool displ = settings.readBoolEntry (sn, true, &ok );
bool displ = settings.readBoolEntry (
spath + "display/" + QString::number(i),
true, &ok );
if ( ok ) {
mSymbDisplay[i] = displ;
}

sn.sprintf( "/GRASS/edit/symb/color/%d", i );
QString colorName = settings.readEntry (sn, "", &ok );
QString colorName = settings.readEntry (
spath + "color/" + QString::number(i),
"", &ok );
if ( ok ) {
QColor color( colorName );
mSymb[i].setColor( color );
}
mSymb[i].setWidth( mLineWidth );
}

// Set Symbology in dialog
Expand Down Expand Up @@ -458,7 +469,6 @@ void QgsGrassEdit::init()
connect( mAttributeTable, SIGNAL(valueChanged(int,int)), this, SLOT(columnTypeChanged(int,int)) );

// Set variables
mSize = 9;
mSelectedLine = 0;
mAttributes = 0;

Expand Down Expand Up @@ -729,6 +739,33 @@ void QgsGrassEdit::changeSymbology(Q3ListViewItem * item, const QPoint & pnt, in
}
}

void QgsGrassEdit::lineWidthChanged()
{
#ifdef QGISDEBUG
std::cerr << "QgsGrassEdit::lineWidthChanged()" << std::endl;
#endif
QSettings settings("QuantumGIS", "qgis");
mLineWidth = mLineWidthSpinBox->value();

for ( int i = 0; i < SYMB_COUNT; i++ ) {
mSymb[i].setWidth( mLineWidth );
}

QString spath = "/GRASS/edit/symb/";
settings.writeEntry ( spath + "lineWidth", mLineWidth );
}

void QgsGrassEdit::markerSizeChanged()
{
#ifdef QGISDEBUG
std::cerr << "QgsGrassEdit::markerSizeChanged()" << std::endl;
#endif
QSettings settings("QuantumGIS", "qgis");
mSize = mMarkerSizeSpinBox->value();
QString spath = "/GRASS/edit/symb/";
settings.writeEntry ( spath + "markerSize", mSize );
}

void QgsGrassEdit::restorePosition()
{
QSettings settings("QuantumGIS", "qgis");
Expand Down
12 changes: 12 additions & 0 deletions src/plugins/grass/qgsgrassedit.h
Expand Up @@ -190,6 +190,12 @@ public slots:

void changeSymbology( Q3ListViewItem * item, const QPoint & pnt, int col );

//! width/size changed
void lineWidthChanged();
void markerSizeChanged();
void on_mLineWidthSpinBox_valueChanged() { lineWidthChanged(); }
void on_mMarkerSizeSpinBox_valueChanged() { markerSizeChanged(); }

// The type of column was changed
void columnTypeChanged ( int row, int col );

Expand Down Expand Up @@ -323,6 +329,12 @@ public slots:
//! Symbology name
std::vector<QString> mSymbName;

//! Line width
int mLineWidth;

//! Marker size
int mMarkerSize;

/**
* Read line symbology from map
* @return symbology code
Expand Down

0 comments on commit dc20cde

Please sign in to comment.