Showing with 29 additions and 12 deletions.
  1. +1 −1 python/plugins/fTools/tools/doPointsInPolygon.py
  2. +10 −4 src/core/raster/qgscolorrampshader.cpp
  3. +16 −7 src/core/raster/qgscolorrampshader.h
  4. +2 −0 src/providers/ogr/qgsogrprovider.cpp
2 changes: 1 addition & 1 deletion python/plugins/fTools/tools/doPointsInPolygon.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def compute(self, inPoly, inPts, inField, outPath, progressBar):
for i in pointList:
pointProvider.featureAtId( int( i ), inFeatB , True, allAttrs )
tmpGeom = QgsGeometry( inFeatB.geometry() )
if inGeom.contains(tmpGeom.asPoint()):
if inGeom.intersects(tmpGeom.asPoint()):
count = count + 1
outFeat.setAttributeMap(atMap)
outFeat.addAttribute(index, QVariant(count))
Expand Down
14 changes: 10 additions & 4 deletions src/core/raster/qgscolorrampshader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ bool QgsColorRampShader::discreteColor( double theValue, int* theReturnRedValue,
myColorRampItem = mColorRampItemList.value( mCurrentColorRampItemIndex );
myTinyDiff = qAbs( theValue - myColorRampItem.value );
//If the previous entry is less, then search closer to the top of the list (assumes mColorRampItemList is sorted)
if ( mCurrentColorRampItemIndex != 0 && theValue <= mColorRampItemList.at( mCurrentColorRampItemIndex - 1 ).value )
if ( mCurrentColorRampItemIndex != 0 &&
theValue <= mColorRampItemList.at( mCurrentColorRampItemIndex - 1 ).value )
{
mCurrentColorRampItemIndex--;
}
Expand Down Expand Up @@ -119,7 +120,9 @@ bool QgsColorRampShader::exactColor( double theValue, int* theReturnRedValue, in
return true;
}
//pixel value sits between ramp entries so bail
else if ( mCurrentColorRampItemIndex != myColorRampItemCount - 1 && theValue > myColorRampItem.value && theValue < mColorRampItemList.at( mCurrentColorRampItemIndex + 1 ).value )
else if ( mCurrentColorRampItemIndex != myColorRampItemCount - 1 &&
theValue > myColorRampItem.value && theValue < mColorRampItemList.at(
mCurrentColorRampItemIndex + 1 ).value )
{
return false;
}
Expand All @@ -138,7 +141,8 @@ bool QgsColorRampShader::exactColor( double theValue, int* theReturnRedValue, in
return false; // value not found
}

bool QgsColorRampShader::interpolatedColor( double theValue, int* theReturnRedValue, int* theReturnGreenValue, int* theReturnBlueValue )
bool QgsColorRampShader::interpolatedColor( double theValue, int*
theReturnRedValue, int* theReturnGreenValue, int* theReturnBlueValue )
{
int myColorRampItemCount = mColorRampItemList.count();
if ( myColorRampItemCount <= 0 )
Expand Down Expand Up @@ -275,7 +279,9 @@ bool QgsColorRampShader::shade( double theValue, int* theReturnRedValue, int* th
return discreteColor( theValue, theReturnRedValue, theReturnGreenValue, theReturnBlueValue );
}

bool QgsColorRampShader::shade( double theRedValue, double theGreenValue, double theBlueValue, int* theReturnRedValue, int* theReturnGreenValue, int* theReturnBlueValue )
bool QgsColorRampShader::shade( double theRedValue, double theGreenValue,
double theBlueValue, int* theReturnRedValue, int* theReturnGreenValue, int*
theReturnBlueValue )
{
*theReturnRedValue = 0;
*theReturnGreenValue = 0;
Expand Down
23 changes: 16 additions & 7 deletions src/core/raster/qgscolorrampshader.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,11 @@ class CORE_EXPORT QgsColorRampShader : public QgsRasterShaderFunction
int mCurrentColorRampItemIndex;

//TODO: Consider pulling this out as a separate class and internally storing as a QMap rather than a QList
/** This vector holds the information for classification based on values. Each item holds a value, a label and a color. The member mDiscreteClassification holds if one color is applied for all values between two class breaks (true) or if the item values are (linearly) interpolated for values between the item values (false)*/
/** This vector holds the information for classification based on values.
* Each item holds a value, a label and a color. The member
* mDiscreteClassification holds if one color is applied for all values
* between two class breaks (true) or if the item values are (linearly)
* interpolated for values between the item values (false)*/
QList<QgsColorRampShader::ColorRampItem> mColorRampItemList;

/** \brief The color ramp type */
Expand All @@ -105,18 +109,23 @@ class CORE_EXPORT QgsColorRampShader : public QgsRasterShaderFunction
/** \brief Cache of values that have already been looked up */
QMap<double, QColor> mColorCache;

/** Maximum size of the color cache. The color cache could eat a ton of memory if you have 32-bit data */
/** Maximum size of the color cache. The color cache could eat a ton of
* memory if you have 32-bit data */
int mMaximumColorCacheSize;



/** Gets the color for a pixel value from the classification vector mValueClassification. Assigns the color of the lower class for every pixel between two class breaks.*/
/** Gets the color for a pixel value from the classification vector
* mValueClassification. Assigns the color of the lower class for every
* pixel between two class breaks.*/
bool discreteColor( double, int*, int*, int* );

/** Gets the color for a pixel value from the classification vector mValueClassification. Assigns the color of the exact matching value in the color ramp item list */
/** Gets the color for a pixel value from the classification vector
* mValueClassification. Assigns the color of the exact matching value in
* the color ramp item list */
bool exactColor( double, int*, int*, int* );

/** Gets the color for a pixel value from the classification vector mValueClassification. Interpolates the color between two class breaks linearly.*/
/** Gets the color for a pixel value from the classification vector
* mValueClassification. Interpolates the color between two class breaks
* linearly.*/
bool interpolatedColor( double, int*, int*, int* );
};

Expand Down
2 changes: 2 additions & 0 deletions src/providers/ogr/qgsogrprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1856,6 +1856,8 @@ QgsCoordinateReferenceSystem QgsOgrProvider::crs()
}
}

CPLSetConfigOption( "GDAL_FIX_ESRI_WKT", "TOWGS84" ); // add towgs84 parameter

OGRSpatialReferenceH mySpatialRefSys = OGR_L_GetSpatialRef( ogrLayer );
if ( mySpatialRefSys )
{
Expand Down