mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-07 00:15:48 -04:00
Yet more fixes for bugs in the X11 zoom clipping code. Hopefully all sorted
now. Still need to optimise the code a bit. git-svn-id: http://svn.osgeo.org/qgis/trunk@3136 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
72eb589963
commit
e75d32ed0d
@ -69,8 +69,8 @@ bool QgsClipper::trimLine(QgsPoint& from, QgsPoint& to)
|
||||
QgsPoint trimmedTo = to, trimmedFrom = from;
|
||||
|
||||
// Check for the need to trim first
|
||||
if (from.x() < minX || from.x() > maxX || to.x() < minX || to.x() > maxX ||
|
||||
from.y() < minY || from.y() > maxY || to.y() < minY || to.y() > maxY)
|
||||
if (std::abs(from.x()) > maxX || std::abs(to.x()) > maxX ||
|
||||
std::abs(from.y()) > maxY || std::abs(to.y()) > maxY)
|
||||
{
|
||||
// Check the top boundary
|
||||
double r_n = (from.y() - minY) * (maxX - minX);
|
||||
@ -213,19 +213,25 @@ bool QgsClipper::trimLine(QgsPoint& from, QgsPoint& to)
|
||||
}
|
||||
}
|
||||
}
|
||||
// If the line hasn't been trimmed yet, it is entirely outside the
|
||||
// boundary, so tell the calling code.
|
||||
if (!toDone && !fromDone)
|
||||
|
||||
// Done something, so leave.
|
||||
if (toDone || fromDone)
|
||||
{
|
||||
to = trimmedTo;
|
||||
from = trimmedFrom;
|
||||
return true;
|
||||
}
|
||||
|
||||
// If the line hasn't been trimmed yet, it is entirely outside the
|
||||
// boundary, so tell the calling code.
|
||||
if (!toDone && !fromDone)
|
||||
return false;
|
||||
|
||||
// Shouldn't get here
|
||||
std::cerr << "XXXXXXXXXXXXXXXXXXXXXXXXXXX\n";
|
||||
}
|
||||
|
||||
to = trimmedTo;
|
||||
from = trimmedFrom;
|
||||
|
||||
// The line is inside the boundary. Needs to be drawn.
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2270,16 +2270,16 @@ void QgsVectorLayer::drawFeature(QPainter* p, QgsFeature* fet, QgsMapToPixel * t
|
||||
{
|
||||
//reproject the point to the map coordinate system
|
||||
try
|
||||
{
|
||||
myProjectedPoint=mCoordinateTransform->transform(pt);
|
||||
}
|
||||
catch (QgsCsException &e)
|
||||
{
|
||||
qDebug( "Transform error caught in %s line %d:\n%s",
|
||||
__FILE__, __LINE__, e.what());
|
||||
}
|
||||
{
|
||||
myProjectedPoint=mCoordinateTransform->transform(pt);
|
||||
}
|
||||
catch (QgsCsException &e)
|
||||
{
|
||||
qDebug( "Transform error caught in %s line %d:\n%s",
|
||||
__FILE__, __LINE__, e.what());
|
||||
}
|
||||
// transform from projected coordinate system to pixel position
|
||||
// on map canvas
|
||||
// on map canvas
|
||||
theMapToPixelTransform->transform(&myProjectedPoint);
|
||||
}
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user