Skip to content

Commit

Permalink
Polished (changed) how segment lengths appear in the (excellent) meas…
Browse files Browse the repository at this point in the history
…ure tool.

The current segment length is shown/updated in the list of segments. Area measurement
is not affected.


git-svn-id: http://svn.osgeo.org/qgis/branches/Release-0_8_0@6365 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
homann committed Jan 1, 2007
1 parent f3107f0 commit 280587d
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/gui/qgsmeasure.cpp
Expand Up @@ -45,6 +45,11 @@ QgsMeasure::QgsMeasure(bool measureArea, QgsMapCanvas *mc, Qt::WFlags f)

mTable->setLeftMargin(0); // hide row labels

// Set one cell row where to update current distance
// If measuring area, the table doesn't get shown
mTable->setNumRows(1);
mTable->setText(0, 0, QString::number(0, 'f',1));

mTable->horizontalHeader()->setLabel( 0, tr("Segments (in meters)") );
//mTable->horizontalHeader()->setLabel( 1, tr("Total") );
//mTable->horizontalHeader()->setLabel( 2, tr("Azimuth") );
Expand Down Expand Up @@ -121,7 +126,10 @@ QgsMeasure::~QgsMeasure()
void QgsMeasure::restart(void )
{
mPoints.resize(0);
mTable->setNumRows(0);
// Set one cell row where to update current distance
// If measuring area, the table doesn't get shown
mTable->setNumRows(1);
mTable->setText(0, 0, QString::number(0, 'f',1));
mTotal = 0.;

updateUi();
Expand Down Expand Up @@ -160,13 +168,14 @@ void QgsMeasure::addPoint(QgsPoint &point)
mTotal += d;
editTotal->setText(formatDistance(mTotal));

mTable->setNumRows ( mPoints.size()-1 );

int row = mPoints.size()-2;
mTable->setText(row, 0, QString::number(d, 'f',1));
//mTable->setText ( row, 1, QString::number(mTotal) );
mTable->setNumRows ( mPoints.size() );

mTable->ensureCellVisible(row,0);
mTable->setText(row + 1, 0, QString::number(0, 'f',1));
mTable->ensureCellVisible(row + 1,0);
}

mRubberBand->addPoint(point);
Expand Down Expand Up @@ -208,6 +217,7 @@ void QgsMeasure::mouseMove(QgsPoint &point)
QgsPoint p1 = tmpPoints[last], p2 = tmpPoints[last+1];

double d = mCalc->measureLine(p1,p2);
mTable->setText(last, 0, QString::number(d, 'f',1));
editTotal->setText(formatDistance(mTotal + d));
}
}
Expand Down

0 comments on commit 280587d

Please sign in to comment.