|
From: <jb...@us...> - 2013-12-11 02:56:44
|
Revision: 12844
http://sourceforge.net/p/plplot/code/12844
Author: jbauck
Date: 2013-12-11 02:56:40 +0000 (Wed, 11 Dec 2013)
Log Message:
-----------
Add the ability to reset arrow style for vector plots to the Ada bindings. Update Ada examples 22 accordingly.
Modified Paths:
--------------
trunk/bindings/ada/plplot.adb
trunk/bindings/ada/plplot.ads
trunk/bindings/ada/plplot_auxiliary.ads
trunk/bindings/ada/plplot_thin.ads
trunk/bindings/ada/plplot_traditional.adb
trunk/bindings/ada/plplot_traditional.ads
trunk/examples/ada/x22a.adb
trunk/examples/ada/xthick22a.adb
trunk/include/plplot.h
Modified: trunk/bindings/ada/plplot.adb
===================================================================
--- trunk/bindings/ada/plplot.adb 2013-12-11 01:50:02 UTC (rev 12843)
+++ trunk/bindings/ada/plplot.adb 2013-12-11 02:56:40 UTC (rev 12844)
@@ -1177,8 +1177,44 @@
end if;
plsvect(X_Vertices, Y_Vertices, X_Vertices'length, fill);
end Set_Arrow_Style_For_Vector_Plots;
+
+
+ -- Set the default style for the arrow used by plvect to plot vectors.
+ -- plsvect (for setting default)
+ procedure Set_Arrow_Style_For_Vector_Plots
+ (X_Vertices, Y_Vertices : PLPointer;
+ Fill_Arrow : Boolean) is
+ fill : PLBOOL;
+ begin
+ if Fill_Arrow then
+ fill := PLtrue;
+ else
+ fill := PLfalse;
+ end if;
+ PLplot_Thin.plsvectdefault(X_Vertices, Y_Vertices, 0, fill);
+ end Set_Arrow_Style_For_Vector_Plots;
+
+
+ -- Simple method to set the default style for the arrow used by plvect to plot vectors.
+ -- This is not part of the C API and is Ada-specific.
+ -- plsvect (alternate for setting default)
+ procedure plsvect is -- We'll keep the "traditional" named version here.
+ begin
+ plsvectdefault(System.Null_Address, System.Null_Address, 0, PLfalse);
+ end plsvect;
+
+
+ -- Another simple method to set the default style for the arrow used by plvect to plot vectors.
+ -- This is not part of the C API and is Ada-specific.
+ -- plsvect (alternate for setting default)
+ procedure Reset_Vector_Arrow_Style is
+ begin
+ plsvectdefault(System.Null_Address, System.Null_Address, 0, PLfalse);
+ end Reset_Vector_Arrow_Style;
+
+
-- This functions similarly to plbox() except that the origin of the axes
-- is placed at the user-specified point (x0, y0).
-- plaxes
Modified: trunk/bindings/ada/plplot.ads
===================================================================
--- trunk/bindings/ada/plplot.ads 2013-12-11 01:50:02 UTC (rev 12843)
+++ trunk/bindings/ada/plplot.ads 2013-12-11 02:56:40 UTC (rev 12844)
@@ -831,8 +831,25 @@
procedure Set_Arrow_Style_For_Vector_Plots
(X_Vertices, Y_Vertices : Real_Vector;
Fill_Arrow : Boolean);
-
+
+ -- Set the default style for the arrow used by plvect to plot vectors.
+ -- plsvect (for setting default)
+ procedure Set_Arrow_Style_For_Vector_Plots
+ (X_Vertices, Y_Vertices : PLPointer;
+ Fill_Arrow : Boolean);
+
+
+ -- Simple method to set the default style for the arrow used by plvect to plot vectors.
+ -- plsvect (alternate for setting default)
+ procedure plsvect;
+
+
+ -- Another simple method to set the default style for the arrow used by plvect to plot vectors.
+ -- plsvect (alternate for setting default)
+ procedure Reset_Vector_Arrow_Style;
+
+
-- This functions similarly to plbox() except that the origin of the axes
-- is placed at the user-specified point (x0, y0).
-- plaxes
Modified: trunk/bindings/ada/plplot_auxiliary.ads
===================================================================
--- trunk/bindings/ada/plplot_auxiliary.ads 2013-12-11 01:50:02 UTC (rev 12843)
+++ trunk/bindings/ada/plplot_auxiliary.ads 2013-12-11 02:56:40 UTC (rev 12844)
@@ -29,7 +29,7 @@
Ada.Strings.Bounded,
Ada.Strings.Unbounded;
--- with Ada.Numerics.Long_Real_Arrays;
+ with Ada.Numerics.Long_Real_Arrays;
package PLplot_Auxiliary is
@@ -39,8 +39,8 @@
-- Declarations for Ada 95 and Ada 2005 when it is desired to _not_ invoke
-- the numerical capability of Annex G.3.
- type Real_Vector is array (Integer range <>) of Long_Float;
- type Real_Matrix is array (Integer range <>, Integer range <>) of Long_Float;
+-- type Real_Vector is array (Integer range <>) of Long_Float;
+-- type Real_Matrix is array (Integer range <>, Integer range <>) of Long_Float;
-- Declarations when using Ada 2005 and it is desired to invoke the numerics
@@ -50,8 +50,8 @@
-- Using Annex G.3 requires linking to BLAS and LAPACK libraries or the
-- PLplot build process will fail when attempting to link the Ada examples
-- e.g. x01a.adb.
--- subtype Real_Vector is Ada.Numerics.Long_Real_Arrays.Real_Vector;
--- subtype Real_Matrix is Ada.Numerics.Long_Real_Arrays.Real_Matrix;
+ subtype Real_Vector is Ada.Numerics.Long_Real_Arrays.Real_Vector;
+ subtype Real_Matrix is Ada.Numerics.Long_Real_Arrays.Real_Matrix;
----------------------------------------------------------------------------
-- Implementation note: The easy ability to switch to Ada 2005 Annex G.3
Modified: trunk/bindings/ada/plplot_thin.ads
===================================================================
--- trunk/bindings/ada/plplot_thin.ads 2013-12-11 01:50:02 UTC (rev 12843)
+++ trunk/bindings/ada/plplot_thin.ads 2013-12-11 02:56:40 UTC (rev 12844)
@@ -532,11 +532,23 @@
pragma Import(C, plvect, "c_plvect");
+ -- Set arrow style for vector plots.
+
procedure
plsvect(arrowx : PL_Float_Array; arrowy : PL_Float_Array; npts : PLINT; fill : PLINT);
pragma Import(C, plsvect, "c_plsvect");
+
+
+-- Ada hack to accomodate the C API that allows this call in C
+-- plsvect( NULL, NULL, 0, 0 );
+-- to reset the arrow style to a default value.
+
+procedure
+plsvectdefault(arrowx : PLPointer; arrowy : PLPointer; npts : PLINT; fill : PLINT);
+pragma Import(C, plsvectdefault, "c_plsvect");
+
-- This functions similarly to plbox() except that the origin of the axes
-- is placed at the user-specified point (x0, y0).
Modified: trunk/bindings/ada/plplot_traditional.adb
===================================================================
--- trunk/bindings/ada/plplot_traditional.adb 2013-12-11 01:50:02 UTC (rev 12843)
+++ trunk/bindings/ada/plplot_traditional.adb 2013-12-11 02:56:40 UTC (rev 12844)
@@ -1153,7 +1153,8 @@
Transformation_Procedure_Pointer : Transformation_Procedure_Pointer_Type;
Transformation_Data_Pointer : PLpointer) is
begin
- PLplot_Thin.plvect(Matrix_To_Pointers(u), Matrix_To_Pointers(v), u'Length(1), u'Length(2), Scale, Transformation_Procedure_Pointer, Transformation_Data_Pointer);
+ PLplot_Thin.plvect(Matrix_To_Pointers(u), Matrix_To_Pointers(v), u'Length(1), u'Length(2),
+ Scale, Transformation_Procedure_Pointer, Transformation_Data_Pointer);
end plvect;
@@ -1172,8 +1173,41 @@
end if;
PLplot_Thin.plsvect(X_Vertices, Y_Vertices, X_Vertices'length, fill);
end plsvect;
+
+
+ -- Set the default style for the arrow used by plvect to plot vectors.
+ procedure plsvect
+ (X_Vertices, Y_Vertices : PLPointer;
+ Fill_Arrow : Boolean) is
+ fill : PLBOOL;
+ begin
+ if Fill_Arrow then
+ fill := PLtrue;
+ else
+ fill := PLfalse;
+ end if;
+ PLplot_Thin.plsvectdefault(X_Vertices, Y_Vertices, 0, fill);
+ end plsvect;
+
+
+ -- Simple method to set the default style for the arrow used by plvect to plot vectors.
+ -- This is not part of the C API and is Ada-specific.
+ procedure plsvect is
+ begin
+ PLplot_Thin.plsvectdefault(System.Null_Address, System.Null_Address, 0, PLfalse);
+ end plsvect;
+
+
+ -- Another simple method to set the default style for the arrow used by plvect to plot vectors.
+ -- This is not part of the C API and is Ada-specific.
+ procedure Reset_Vector_Arrow_Style is
+ begin
+ PLplot_Thin.plsvectdefault(System.Null_Address, System.Null_Address, 0, PLfalse);
+ end Reset_Vector_Arrow_Style;
+
+
-- This functions similarly to plbox() except that the origin of the axes
-- is placed at the user-specified point (x0, y0).
procedure plaxes
Modified: trunk/bindings/ada/plplot_traditional.ads
===================================================================
--- trunk/bindings/ada/plplot_traditional.ads 2013-12-11 01:50:02 UTC (rev 12843)
+++ trunk/bindings/ada/plplot_traditional.ads 2013-12-11 02:56:40 UTC (rev 12844)
@@ -823,8 +823,24 @@
procedure plsvect
(X_Vertices, Y_Vertices : Real_Vector;
Fill_Arrow : Boolean);
-
+
+ -- Set the default style for the arrow used by plvect to plot vectors.
+ procedure plsvect
+ (X_Vertices, Y_Vertices : PLPointer;
+ Fill_Arrow : Boolean);
+
+
+ -- Simple method to set the default style for the arrow used by plvect to plot vectors.
+ -- This is not part of the C API and is Ada-specific.
+ procedure plsvect;
+
+
+ -- Another simple method to set the default style for the arrow used by plvect to plot vectors.
+ -- This is not part of the C API and is Ada-specific.
+ procedure Reset_Vector_Arrow_Style;
+
+
-- This functions similarly to plbox() except that the origin of the axes
-- is placed at the user-specified point (x0, y0).
procedure plaxes
Modified: trunk/examples/ada/x22a.adb
===================================================================
--- trunk/examples/ada/x22a.adb 2013-12-11 01:50:02 UTC (rev 12843)
+++ trunk/examples/ada/x22a.adb 2013-12-11 02:56:40 UTC (rev 12844)
@@ -255,6 +255,16 @@
plsvect(arrow2_x, arrow2_y, True);
constriction(2);
+ -- Reset arrow style to the default by passing two NULL arrays.
+ -- This line uses the awkward method of the C API to reset the default arrow style.
+ plsvect(System.Null_Address, System.Null_Address, False);
+
+ -- This method of resetting the default arrow style is a little more Ada-friendly...
+ -- plsvect;
+
+ -- ... as is this one which is identical but for name.
+ -- Reset_Vector_Arrow_Style;
+
potential;
plend;
Modified: trunk/examples/ada/xthick22a.adb
===================================================================
--- trunk/examples/ada/xthick22a.adb 2013-12-11 01:50:02 UTC (rev 12843)
+++ trunk/examples/ada/xthick22a.adb 2013-12-11 02:56:40 UTC (rev 12844)
@@ -255,6 +255,16 @@
Set_Arrow_Style_For_Vector_Plots(arrow2_x, arrow2_y, True);
constriction(2);
+ -- Reset arrow style to the default by passing two NULL arrays.
+ -- This line uses the awkward method of the C API to reset the default arrow style.
+ Set_Arrow_Style_For_Vector_Plots(System.Null_Address, System.Null_Address, False);
+
+ -- This method of resetting the default arrow style is a little more Ada-friendly...
+ -- plsvect;
+
+ -- ... as is this one which is identical but for name.
+ -- Reset_Vector_Arrow_Style;
+
potential;
End_PLplot;
Modified: trunk/include/plplot.h
===================================================================
--- trunk/include/plplot.h 2013-12-11 01:50:02 UTC (rev 12843)
+++ trunk/include/plplot.h 2013-12-11 02:56:40 UTC (rev 12844)
@@ -1886,6 +1886,7 @@
PLINT opt, const PLFLT *clevel, PLINT nlevel,
PLINT ixstart, PLINT ixn, const PLINT *indexymin, const PLINT * indexymax );
+// Set arrow style for vector plots.
PLDLLIMPEXP void
c_plsvect( const PLFLT *arrowx, const PLFLT *arrowy, PLINT npts, PLBOOL fill );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|