Skip to content

Instantly share code, notes, and snippets.

@tschoonj
Created July 9, 2015 17:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tschoonj/e01c72165fd2cb9a68c9 to your computer and use it in GitHub Desktop.
Save tschoonj/e01c72165fd2cb9a68c9 to your computer and use it in GitHub Desktop.
gdl patch to make it compatible with plplot 5.11.0
diff --git a/CMakeModules/FindPlplot.cmake b/CMakeModules/FindPlplot.cmake
index a503f8c..ad13e7a 100644
--- a/CMakeModules/FindPlplot.cmake
+++ b/CMakeModules/FindPlplot.cmake
@@ -9,8 +9,8 @@
#
-find_library(PLPLOT_LIBRARY NAMES plplotd)
-find_library(PLPLOTCXX_LIBRARY NAMES plplotcxxd)
+find_library(PLPLOT_LIBRARY NAMES plplot)
+find_library(PLPLOTCXX_LIBRARY NAMES plplotcxx)
set(PLPLOT_LIBRARIES ${PLPLOT_LIBRARY} ${PLPLOTCXX_LIBRARY})
find_path(PLPLOT_INCLUDE_DIR NAMES plplot/plplot.h)
include(FindPackageHandleStandardArgs)
diff --git a/src/plotting_contour.cpp b/src/plotting_contour.cpp
index df6a196..7c56f96 100644
--- a/src/plotting_contour.cpp
+++ b/src/plotting_contour.cpp
@@ -23,6 +23,10 @@
#define LABELOFFSET 0.003
#define LABELSPACING 0.1
+// sometime after 10/14 the tr0,tr1 moved from plstream:: to plcallback::
+#undef PLCALLBACK
+#define PLCALLBACK plcallback
+
namespace lib
{
@@ -363,11 +367,11 @@ namespace lib
DFloat *wx, *wy;
GetWFromPlotStructs( &wx, &wy );
- DDouble xStart, xEnd, yStart, yEnd;
- DataCoordLimits( sx, sy, wx, wy, &xStart, &xEnd, &yStart, &yEnd, true );
+ DDouble pxStart, pxEnd, pyStart, pyEnd;
+ DataCoordLimits( sx, sy, wx, wy, &pxStart, &pxEnd, &pyStart, &pyEnd, true );
actStream->vpor( wx[0], wx[1], wy[0], wy[1] );
- actStream->wind( xStart, xEnd, yStart, yEnd );
+ actStream->wind( pxStart, pxEnd, pyStart, pyEnd );
}
}
@@ -789,8 +793,8 @@ namespace lib
1, value,
static_cast<PLFLT>(( *thick )[i%thick->N_Elements()]),
0,0,0,0,
- (plstream::fill), (oneDim),
- (oneDim)?(plstream::tr1):(plstream::tr2), (oneDim)?(void *)&cgrid1:(void *)&cgrid2);
+ (PLCALLBACK::fill), (oneDim),
+ (oneDim)?(PLCALLBACK::tr1):(PLCALLBACK::tr2), (oneDim)?(void *)&cgrid1:(void *)&cgrid2);
}
actStream->psty(0);
// if (docolors) gdlSetGraphicsForegroundColorFromKw( e, actStream );
@@ -808,8 +812,8 @@ namespace lib
clevel[i], maxmax,
1,value,
0,0,0,0,0,
- plstream::fill, (oneDim), //Onedim is accelerator since rectangles are kept rectangles see plplot doc
- (oneDim)?(plstream::tr1):(plstream::tr2), (oneDim)?(void *)&cgrid1:(void *)&cgrid2);
+ PLCALLBACK::fill, (oneDim), //Onedim is accelerator since rectangles are kept rectangles see plplot doc
+ (oneDim)?(PLCALLBACK::tr1):(PLCALLBACK::tr2), (oneDim)?(void *)&cgrid1:(void *)&cgrid2);
}
} else { //every other case of fill
// note that plshades is not protected against 1 level (color formula is
@@ -818,8 +822,8 @@ namespace lib
if (nlevel>2 && !(docolors)) { //acceleration with shades when no c_colors are given. use continuous table1, decomposed or not.
//acceleration is most sensible when a (x,y) transform (rotate, stretch) is in place since plplot does not recompute the map.
actStream->shades( map, xEl, yEl, isLog?doIt:NULL, xStart, xEnd, yStart, yEnd,
- clevel, nlevel, 1, 0, 0, plstream::fill, (oneDim),
- (oneDim)?(plstream::tr1):(plstream::tr2),
+ clevel, nlevel, 1, 0, 0, PLCALLBACK::fill, (oneDim),
+ (oneDim)?(PLCALLBACK::tr1):(PLCALLBACK::tr2),
(oneDim)?(void *)&cgrid1:(void *)&cgrid2);
}
else { //fill with colors defined with c_colors or n<=2
@@ -832,8 +836,8 @@ namespace lib
clevel[i], maxmax,
1,value,
0,0,0,0,0,
- plstream::fill, (oneDim), //Onedim is accelerator since rectangles are kept rectangles see plplot doc
- (oneDim)?(plstream::tr1):(plstream::tr2), (oneDim)?(void *)&cgrid1:(void *)&cgrid2);
+ PLCALLBACK::fill, (oneDim), //Onedim is accelerator since rectangles are kept rectangles see plplot doc
+ (oneDim)?(PLCALLBACK::tr1):(PLCALLBACK::tr2), (oneDim)?(void *)&cgrid1:(void *)&cgrid2);
} else
printf(" Problem, sorry! plplot doesn't like to FILL with a single level!");
}
@@ -854,7 +858,7 @@ namespace lib
if (doT3d) { //no label in T3D , bug in plplot...
actStream->setcontlabelparam ( LABELOFFSET, (PLFLT) label_size, LABELSPACING, 0 );
actStream->cont ( map, xEl, yEl, 1, xEl, 1, yEl, &( clevel[i] ), 1,
- (oneDim)?(plstream::tr1):(plstream::tr2), (oneDim)?(void *)&cgrid1:(void *)&cgrid2);
+ (oneDim)?(PLCALLBACK::tr1):(PLCALLBACK::tr2), (oneDim)?(void *)&cgrid1:(void *)&cgrid2);
} else {
if (dolabels && i<labels->N_Elements())
{
@@ -862,16 +866,16 @@ namespace lib
//else (lables thicker than contours) impossible with plplot...
actStream->setcontlabelparam ( LABELOFFSET, (PLFLT) label_size, LABELSPACING, 0 );
actStream->cont ( map, xEl, yEl, 1, xEl, 1, yEl, &( clevel[i] ), 1,
- (oneDim)?(plstream::tr1):(plstream::tr2), (oneDim)?(void *)&cgrid1:(void *)&cgrid2); //thick contours, no label
+ (oneDim)?(PLCALLBACK::tr1):(PLCALLBACK::tr2), (oneDim)?(void *)&cgrid1:(void *)&cgrid2); //thick contours, no label
actStream->Thick(label_thick);
}
actStream->setcontlabelparam ( LABELOFFSET, (PLFLT) label_size, LABELSPACING*sqrt(label_size),(PLINT)(*labels)[i] );
actStream->cont ( map, xEl, yEl, 1, xEl, 1, yEl, &( clevel[i] ), 1,
- (oneDim)?(plstream::tr1):(plstream::tr2), (oneDim)?(void *)&cgrid1:(void *)&cgrid2);
+ (oneDim)?(PLCALLBACK::tr1):(PLCALLBACK::tr2), (oneDim)?(void *)&cgrid1:(void *)&cgrid2);
if (!dothick) gdlSetPenThickness(e, actStream);
} else {
actStream->cont ( map, xEl, yEl, 1, xEl, 1, yEl, &( clevel[i] ), 1,
- (oneDim)?(plstream::tr1):(plstream::tr2), (oneDim)?(void *)&cgrid1:(void *)&cgrid2);
+ (oneDim)?(PLCALLBACK::tr1):(PLCALLBACK::tr2), (oneDim)?(void *)&cgrid1:(void *)&cgrid2);
}
}
}
@@ -1021,3 +1025,4 @@ namespace lib
}
} // namespace
+#undef PLCALLBACK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment