Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix trace renderer #21

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions src/core/mesh/qgsmeshtracerenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ void QgsMeshStreamField::updateSize( const QgsRenderContext &renderContext )


QgsRectangle fieldInterestZoneInDeviceCoordinates = QgsMeshLayerUtils::boundingBoxToScreenRectangle( deviceMapToPixel, interestZoneExtent );
mFieldTopLeftInDeviceCoordinates = QPoint( int( fieldInterestZoneInDeviceCoordinates.xMinimum() ), int( fieldInterestZoneInDeviceCoordinates.yMaximum() ) );
mFieldTopLeftInDeviceCoordinates = QPoint( int( fieldInterestZoneInDeviceCoordinates.xMinimum() ), int( fieldInterestZoneInDeviceCoordinates.yMinimum() ) );
int fieldWidthInDeviceCoordinate = int( fieldInterestZoneInDeviceCoordinates.width() );
int fieldHeightInDeviceCoordinate = int ( fieldInterestZoneInDeviceCoordinates.height() );

Expand All @@ -318,10 +318,9 @@ void QgsMeshStreamField::updateSize( const QgsRenderContext &renderContext )
mFieldSize.setHeight( fieldHeight );
}


double mapUnitPerFieldPixel;
if ( interestZoneExtent.width() > 0 )
mapUnitPerFieldPixel = interestZoneExtent.width() / fieldWidthInDeviceCoordinate * mFieldResolution;
mapUnitPerFieldPixel = deviceMapToPixel.mapUnitsPerPixel() * mFieldResolution * mFieldSize.width() / ( fieldWidthInDeviceCoordinate / mFieldResolution ) ;
else
mapUnitPerFieldPixel = 1e-8;

Expand Down Expand Up @@ -364,9 +363,7 @@ bool QgsMeshStreamField::isValid() const

void QgsMeshStreamField::addTrace( QgsPointXY startPoint )
{
QPoint sp;
sp = mMapToFieldPixel.transform( startPoint ).toQPointF().toPoint();
addTrace( sp );
addTrace( mMapToFieldPixel.transform( startPoint ).toQPointF().toPoint() );
}


Expand Down Expand Up @@ -463,7 +460,7 @@ void QgsMeshStreamField::addTrace( QPoint startPixel )
/* nondimensional value : Vu=2 when the particle need dt=1 to go through a pixel with the mMagMax magnitude
* The nondimensional size of the side of a pixel is 2
*/
vector = vector.rotateBy( mMapToFieldPixel.mapRotation() * M_DEG2RAD );
vector = vector.rotateBy( -mMapToFieldPixel.mapRotation() * M_DEG2RAD );
QgsVector vu = vector / mMaximumMagnitude * 2;
data.magnitude = vector.length();

Expand Down