Skip to content

Commit 90c30ed

Browse files
author
wonder
committedMar 8, 2007
Python bindings:
- recreate on changed .sip file - wrapped QgsColorTable git-svn-id: http://svn.osgeo.org/qgis/trunk@6776 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 41e63a9 commit 90c30ed

File tree

4 files changed

+76
-5
lines changed

4 files changed

+76
-5
lines changed
 

‎python/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ ADD_CUSTOM_TARGET (python ALL DEPENDS ${BINDINGS_CORE_LIB} ${BINDINGS_GUI_LIB})
2828
# don't run python before the libs are built
2929
ADD_DEPENDENCIES (python qgis_core qgis_gui)
3030

31+
FILE(GLOB CORE_SIP_FILES "${CMAKE_CURRENT_SOURCE_DIR}/core/*.sip")
32+
FILE(GLOB GUI_SIP_FILES "${CMAKE_CURRENT_SOURCE_DIR}/gui/*.sip")
3133

3234
# Step 1: during configuration
3335
# create file configure.py from configure.py.in
@@ -41,7 +43,9 @@ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/configure.py.in
4143
ADD_CUSTOM_COMMAND(OUTPUT ${BINDINGS_CORE_MAKEFILE} ${BINDINGS_GUI_MAKEFILE} PRE_BUILD
4244
COMMAND ${PYTHON_EXECUTABLE}
4345
ARGS ${CMAKE_CURRENT_BINARY_DIR}/configure.py
44-
DEPENDS ${QGIS_CORE_LIB} ${QGIS_GUI_LIB} ${CMAKE_CURRENT_BINARY_DIR}/configure.py)
46+
DEPENDS ${QGIS_CORE_LIB} ${QGIS_GUI_LIB}
47+
${CMAKE_CURRENT_BINARY_DIR}/configure.py
48+
${CORE_SIP_FILES} ${GUI_SIP_FILES})
4549

4650
# Step 3: run make in core and gui subdirs
4751
ADD_CUSTOM_COMMAND(OUTPUT ${BINDINGS_CORE_LIB} PRE_LINK

‎python/core/core.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
%Include qgis.sip
1111
%Include qgsapplication.sip
12-
// TODO: %Include qgscolortable.sip
12+
%Include qgscolortable.sip
1313
%Include qgscontexthelp.sip
1414
%Include qgscoordinatetransform.sip
1515
%Include qgsdataprovider.sip

‎python/core/qgscolortable.sip

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
2+
class QgsColorTable
3+
{
4+
%TypeHeaderCode
5+
#include <qgscolortable.h>
6+
%End
7+
8+
public:
9+
/**
10+
* \brief Constructor.
11+
* \param interp color table interpretation
12+
*/
13+
QgsColorTable ( int interp = Rgb );
14+
15+
/** \brief The destuctor. */
16+
~QgsColorTable();
17+
18+
/** \brief Color table interpretation. */
19+
// This is taken from GDAL, GPI_RGB is mapped to Rgba
20+
enum Interp {
21+
Gray = 0, // Use c1 as grayscale value.
22+
Rgb, // Use c1 as red, c2 as green, c3 as blue
23+
Rgba, // Use c1 as red, c2 as green, c3 as blue and c4 as alpha.
24+
Cmyk, // Use c1 as cyan, c2 as magenta, c3 as yellow and c4 as black.
25+
Hls // c1 hue, c2 lightness, c3 saturation; should be His ?
26+
};
27+
28+
/**
29+
* \brief Color table is defined
30+
* \return true if at least one rule is defined
31+
* \false no rule defined
32+
*/
33+
bool defined ( );
34+
35+
/** \brief Get color table interpretation */
36+
int interpretation ( );
37+
38+
/** \brief Add a discrete color */
39+
void add ( unsigned int index, unsigned char c1, unsigned char c2, unsigned char c3, unsigned char c4 = 0 );
40+
41+
/** \brief Add a ramp rule */
42+
void add ( double min, double max,
43+
unsigned char min_c1, unsigned char min_c2, unsigned char min_c3, unsigned char min_c4,
44+
unsigned char max_c1, unsigned char max_c2, unsigned char max_c3, unsigned char max_c4);
45+
46+
/** \brief Get color
47+
* \return true color was found
48+
* \return false color was no found
49+
*/
50+
bool color ( double value, int *c1, int *c2, int *c3 );
51+
52+
/** \brief Sort ramp rules */
53+
void sort ( );
54+
55+
/** \brief Print to stderr - for debuging */
56+
void print ( );
57+
58+
/** \brief Minimum value */
59+
double rmin();
60+
61+
/** \brief Maximum value */
62+
double rmax();
63+
64+
/** \brief Clear the color table */
65+
void clear();
66+
void gack();
67+
68+
};
69+

‎python/core/qgsrasterbandstats.sip

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,12 @@ class QgsRasterBandStats
3737
int elementCountInt;
3838
/** \brief Store the histogram for a given layer */
3939
typedef QVector<int> HistogramVector;
40-
// TODO: why SIP says its unsupported?
4140
//HistogramVector * histogramVector;
4241
/** \brief whteher histogram values are estimated or completely calculated */
4342
bool histogramEstimatedFlag;
4443
/** whehter histogram compuation should include out of range values */
4544
bool histogramOutOfRangeFlag;
4645
/** Color table */
47-
// TODO: not working
48-
//QgsColorTable colorTable;
46+
QgsColorTable colorTable;
4947
};
5048

0 commit comments

Comments
 (0)
Please sign in to comment.