From: <ai...@us...> - 2010-07-22 17:38:53
|
Revision: 11097 http://plplot.svn.sourceforge.net/plplot/?rev=11097&view=rev Author: airwin Date: 2010-07-22 17:38:46 +0000 (Thu, 22 Jul 2010) Log Message: ----------- Previous commit by Jerry removed all configurable items from Ada bindings source files so that the configure of those source files got turned into a copy. Strip out this configure=copy for the Ada bindings source files (but not the examples) and adjust the Ada examples build accordingly for the changed directory for the source. N.B. the result passes the "make test_diff_psc" test, but other tests (e.g., installed examples tests) have not been done yet. Furthermore, the equivalent stripping out of the configure=copy step in the Ada examples has not been done yet. Modified Paths: -------------- trunk/bindings/ada/CMakeLists.txt trunk/examples/ada/CMakeLists.txt Added Paths: ----------- trunk/bindings/ada/plplot.adb trunk/bindings/ada/plplot.ads trunk/bindings/ada/plplot_auxiliary.adb trunk/bindings/ada/plplot_auxiliary.ads trunk/bindings/ada/plplot_thin.adb trunk/bindings/ada/plplot_thin.ads trunk/bindings/ada/plplot_traditional.adb trunk/bindings/ada/plplot_traditional.ads Removed Paths: ------------- trunk/bindings/ada/plplot.adb.cmake trunk/bindings/ada/plplot.ads.cmake trunk/bindings/ada/plplot_auxiliary.adb.cmake trunk/bindings/ada/plplot_auxiliary.ads.cmake trunk/bindings/ada/plplot_thin.adb.cmake trunk/bindings/ada/plplot_thin.ads.cmake trunk/bindings/ada/plplot_traditional.adb.cmake trunk/bindings/ada/plplot_traditional.ads.cmake Modified: trunk/bindings/ada/CMakeLists.txt =================================================================== --- trunk/bindings/ada/CMakeLists.txt 2010-07-22 11:06:33 UTC (rev 11096) +++ trunk/bindings/ada/CMakeLists.txt 2010-07-22 17:38:46 UTC (rev 11097) @@ -49,12 +49,8 @@ set(plplotada${LIB_TAG}_LIB_SRCS) foreach(SOURCE_FILE ${SOURCE_LIST}) - configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_FILE}.cmake - ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_FILE} - ) list(APPEND plplotada${LIB_TAG}_LIB_SRCS - ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_FILE} + ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_FILE} ) endforeach(SOURCE_FILE ${SOURCE_LIST}) Copied: trunk/bindings/ada/plplot.adb (from rev 11096, trunk/bindings/ada/plplot.adb.cmake) =================================================================== --- trunk/bindings/ada/plplot.adb (rev 0) +++ trunk/bindings/ada/plplot.adb 2010-07-22 17:38:46 UTC (rev 11097) @@ -0,0 +1,3369 @@ +-- $Id$ + +-- Thick Ada binding to PLplot + +-- Copyright (C) 2006-2007 Jerry Bauck + +-- This file is part of PLplot. + +-- PLplot is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Library Public License as published +-- by the Free Software Foundation; either version 2 of the License, or +-- (at your option) any later version. + +-- PLplot is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU Library General Public License for more details. + +-- You should have received a copy of the GNU Library General Public License +-- along with PLplot; if not, write to the Free Software +-- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +with + PLplot_Thin, + PLplot_Auxiliary, + Ada.Text_IO, + Ada.Numerics.Long_Elementary_Functions, + Ada.Strings.Unbounded, + Ada.Unchecked_Conversion, + Ada.Strings.Maps, + Ada.Command_Line, + System, + System.Address_To_Access_Conversions, + Interfaces.C.Pointers, + Interfaces.C; +use + PLplot_Thin, + PLplot_Auxiliary, + Ada.Text_IO, + Ada.Numerics.Long_Elementary_Functions, + Ada.Strings.Unbounded, + Interfaces.C; + + + +package body PLplot is + +-------------------------------------------------------------------------------- +-- High-Level subroutines for thick binding -- +-------------------------------------------------------------------------------- + + -- When asked to draw white lines on black background, do it. + -- This is the default. + procedure Draw_On_Black is + begin + Set_One_Color_Map_0(Black, 0, 0 , 0); + Set_One_Color_Map_0(White, 255, 255, 255); + end Draw_On_Black; + + + -- When asked to draw black lines on white background, reverse black and white. + -- This might look better on anti-aliased displays. + -- fix this Darken some colors which have low contrast on white background, e.g. Yellow. + -- fix this Make a version that draws on white and converts _all_ colors to black for publications. + -- fix this Make this so that it works on Color Map 1 because as of now, it does + -- not change the background color for e.g. surface plots. See also Draw_On_Black. + procedure Draw_On_White is + begin + Set_One_Color_Map_0(Black, 255, 255, 255); + Set_One_Color_Map_0(White, 0, 0, 0); + end Draw_On_White; + + + -- Set default pen width. Docs don't say, so I'll make it 1. + -- I could make this depend on the type of outut device used. + Default_Pen_Width : constant Integer := 1; + procedure Set_Default_Pen_Width is + begin + Set_Pen_Width(Default_Pen_Width); + end Set_Default_Pen_Width; + + + -- Plotter for up to five x-y pairs and settable axis style, plot + -- line colors, widths, and styles, justification, zoom, and labels. + -- Can be used directly or as part of a "simple" plotter + -- such as those that follow or which are made by the user. + procedure Multiplot_Pairs + (x1 : Real_Vector := Dont_Plot_This; + y1 : Real_Vector := Dont_Plot_This; + x2 : Real_Vector := Dont_Plot_This; + y2 : Real_Vector := Dont_Plot_This; + x3 : Real_Vector := Dont_Plot_This; + y3 : Real_Vector := Dont_Plot_This; + x4 : Real_Vector := Dont_Plot_This; + y4 : Real_Vector := Dont_Plot_This; + x5 : Real_Vector := Dont_Plot_This; + y5 : Real_Vector := Dont_Plot_This; + X_Labels : Label_String_Array_Type := Default_Label_String_Array; + Y_Labels : Label_String_Array_Type := Default_Label_String_Array; + Title_Labels : Label_String_Array_Type := Default_Label_String_Array; + Axis_Style : Axis_Style_Type := Linear_Box_Plus; + Colors : Color_Array_Type := Default_Color_Array; + Line_Widths : Line_Width_Array_Type := Default_Line_Width_Array; + Line_Styles : Line_Style_Array_Type := Default_Line_Style_Array; + Justification : Justification_Type := Not_Justified; + x_Min_Zoom : Long_Float := Long_Float'small; + x_Max_Zoom : Long_Float := Long_Float'large; + y_Min_Zoom : Long_Float := Long_Float'small; + y_Max_Zoom : Long_Float := Long_Float'large) is + + x_Min, y_Min : Long_Float := Long_Float'large; + x_Max, y_Max : Long_Float := Long_Float'small; + + begin + -- Set or find x_Min. + if x_Min_Zoom /= Long_Float'small then -- zoom + x_Min := x_Min_Zoom; + else -- Auto-scale x_Min. + if x1'length /= 1 then + x_Min := Long_Float'min(x_Min, Vector_Min(x1)); + end if; + if x2'length /= 1 then + x_Min := Long_Float'min(x_Min, Vector_Min(x2)); + end if; + if x3'length /= 1 then + x_Min := Long_Float'min(x_Min, Vector_Min(x3)); + end if; + if x4'length /= 1 then + x_Min := Long_Float'min(x_Min, Vector_Min(x4)); + end if; + if x5'length /= 1 then + x_Min := Long_Float'min(x_Min, Vector_Min(x5)); + end if; + end if; -- Set or find x_Min. + + -- Set or find x_Max. + if x_Max_Zoom /= Long_Float'large then -- zoom + x_Max := x_Max_Zoom; + else -- Auto-scale x_Max. + if x1'length /= 1 then + x_Max := Long_Float'max(x_Max, Vector_Max(x1)); + end if; + if x2'length /= 1 then + x_Max := Long_Float'max(x_Max, Vector_Max(x2)); + end if; + if x3'length /= 1 then + x_Max := Long_Float'max(x_Max, Vector_Max(x3)); + end if; + if x4'length /= 1 then + x_Max := Long_Float'max(x_Max, Vector_Max(x4)); + end if; + if x5'length /= 1 then + x_Max := Long_Float'max(x_Max, Vector_Max(x5)); + end if; + end if; -- Set or find x_Max. + + -- Set or find y_Min. + if y_Min_Zoom /= Long_Float'small then -- zoom + y_Min := y_Min_Zoom; + else -- Auto-scale y_Min. + if y1'length /= 1 then + y_Min := Long_Float'min(y_Min, Vector_Min(y1)); + end if; + if y2'length /= 1 then + y_Min := Long_Float'min(y_Min, Vector_Min(y2)); + end if; + if y3'length /= 1 then + y_Min := Long_Float'min(y_Min, Vector_Min(y3)); + end if; + if y4'length /= 1 then + y_Min := Long_Float'min(y_Min, Vector_Min(y4)); + end if; + if y5'length /= 1 then + y_Min := Long_Float'min(y_Min, Vector_Min(y5)); + end if; + end if; -- Set or find y_Min. + + -- Set or find y_Max. + if y_Max_Zoom /= Long_Float'large then -- zoom + y_Max := y_Max_Zoom; + else -- Auto-scale y_Max. + if y1'length /= 1 then + y_Max := Long_Float'max(y_Max, Vector_Max(y1)); + end if; + if y2'length /= 1 then + y_Max := Long_Float'max(y_Max, Vector_Max(y2)); + end if; + if y3'length /= 1 then + y_Max := Long_Float'max(y_Max, Vector_Max(y3)); + end if; + if y4'length /= 1 then + y_Max := Long_Float'max(y_Max, Vector_Max(y4)); + end if; + if y5'length /= 1 then + y_Max := Long_Float'max(y_Max, Vector_Max(y5)); + end if; + end if; -- Set or find x_Max. + + + -- Set environment and its color. + Set_Pen_Color(White); +-- Set_Environment_Clear_Subpage(x_Min, x_Max, y_Min, y_Max, Justification, Axis_Style); + Set_Environment(x_Min, x_Max, y_Min, y_Max, Justification, Axis_Style); + + if x1'length /= 1 and y1'length /= 1 then + Write_Labels(To_String(X_Labels(1)), To_String(Y_Labels(1)), To_String(Title_Labels(1))); + Set_Pen_Color(Colors(1)); + Select_Line_Style(Line_Styles(1)); + Draw_Curve(x1, y1); +--Draw_Hershey_Symbol(x1, y1, 850); +--Draw_Points(x1, y1, 17); -- 17 is "Hershey bullet, same as 850 when using Draw_Hershey. + end if; + + if x2'length /= 1 and y2'length /= 1 then + Write_Labels(To_String(X_Labels(2)), To_String(Y_Labels(2)), To_String(Title_Labels(2))); + Set_Pen_Color(Colors(2)); + Select_Line_Style(Line_Styles(2)); + Draw_Curve(x2, y2); + end if; + + if x3'length /= 1 and y3'length /= 1 then + Write_Labels(To_String(X_Labels(3)), To_String(Y_Labels(3)), To_String(Title_Labels(3))); + Set_Pen_Color(Colors(3)); + Select_Line_Style(Line_Styles(3)); + Draw_Curve(x3, y3); + end if; + + if x4'length /= 1 and y4'length /= 1 then + Write_Labels(To_String(X_Labels(4)), To_String(Y_Labels(4)), To_String(Title_Labels(4))); + Set_Pen_Color(Colors(4)); + Select_Line_Style(Line_Styles(4)); + Draw_Curve(x4, y4); + end if; + + if x5'length /= 1 and y5'length /= 1 then + Write_Labels(To_String(X_Labels(5)), To_String(Y_Labels(5)), To_String(Title_Labels(5))); + Set_Pen_Color(Colors(5)); + Select_Line_Style(Line_Styles(5)); + Draw_Curve(x5, y5); + end if; + + Set_Pen_Color(White); + Set_Default_Pen_Width; + Select_Line_Style(1); --solid + end Multiplot_Pairs; + + +--------- Simple plotters requiring minimal arguments ----- + + + -- Simple plotter for single x array and multiple y arrays + procedure Simple_Plot + (x : Real_Vector; + y1 : Real_Vector := Dont_Plot_This; + y2 : Real_Vector := Dont_Plot_This; + y3 : Real_Vector := Dont_Plot_This; + y4 : Real_Vector := Dont_Plot_This; + y5 : Real_Vector := Dont_Plot_This; + X_Label : String := To_String(Default_Label_String); + Y_Label : String := To_String(Default_Label_String); + Title_Label : String := To_String(Default_Label_String)) is + + X_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; + Y_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; + Title_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; + + begin + X_Label_String_Array(1) := TUB(X_Label); -- First slot only; others not used. + Y_Label_String_Array(1) := TUB(Y_Label); -- First slot only; others not used. + Title_Label_String_Array(1) := TUB(Title_Label); -- First slot only; others not used. + + Multiplot_Pairs(x, y1, x, y2, x, y3, x, y4, x, y5, + X_Labels => X_Label_String_Array, + Y_Labels => Y_Label_String_Array, + Title_Labels => Title_Label_String_Array, + Axis_Style => Linear_Major_Grid); + end Simple_Plot; + + + -- Simple log x plotter for single x array and multiple y arrays + -- fix this: Automatically skip zero-valued abscissa; place marker at the + -- left-hand side of the plot at the ordinate of the deleted point. + procedure Simple_Plot_Log_X + (x : Real_Vector; + y1 : Real_Vector := Dont_Plot_This; + y2 : Real_Vector := Dont_Plot_This; + y3 : Real_Vector := Dont_Plot_This; + y4 : Real_Vector := Dont_Plot_This; + y5 : Real_Vector := Dont_Plot_This; + X_Label : String := To_String(Default_Label_String); + Y_Label : String := To_String(Default_Label_String); + Title_Label : String := To_String(Default_Label_String); + Log_Base : Long_Float := 10.0) is -- Should this default to e? + + X_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; + Y_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; + Title_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; + + x_Log : Real_Vector(x'range); + + begin + X_Label_String_Array(1) := TUB(X_Label); -- First slot only; others not used. + Y_Label_String_Array(1) := TUB(Y_Label); -- First slot only; others not used. + Title_Label_String_Array(1) := TUB(Title_Label); -- First slot only; others not used. + + for i in x_Log'range loop + x_Log(i) := Log(x(i), Log_Base); + end loop; + Multiplot_Pairs(x_Log, y1, x_Log, y2, x_Log, y3, x_Log, y4, x_Log, y5, + X_Labels => X_Label_String_Array, + Y_Labels => Y_Label_String_Array, + Title_Labels => Title_Label_String_Array, + Axis_Style => Log_X_Minor_Grid); + end Simple_Plot_Log_X; + + + -- Simple log y plotter for multiple x arrays and single y array + -- fix this: Automatically skip zero-valued ordinate; place marker at the + -- bottom of the plot at the abscissa of the deleted point. + procedure Simple_Plot_Log_Y + (x1 : Real_Vector := Dont_Plot_This; + y : Real_Vector := Dont_Plot_This; -- Beware of argument order. + x2 : Real_Vector := Dont_Plot_This; + x3 : Real_Vector := Dont_Plot_This; + x4 : Real_Vector := Dont_Plot_This; + x5 : Real_Vector := Dont_Plot_This; + X_Label : String := To_String(Default_Label_String); + Y_Label : String := To_String(Default_Label_String); + Title_Label : String := To_String(Default_Label_String); + Log_Base : Long_Float := 10.0) is -- Should this default to e? + + X_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; + Y_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; + Title_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; + + y_Log : Real_Vector(y'range); + + begin + X_Label_String_Array(1) := TUB(X_Label); -- First slot only; others not used. + Y_Label_String_Array(1) := TUB(Y_Label); -- First slot only; others not used. + Title_Label_String_Array(1) := TUB(Title_Label); -- First slot only; others not used. + + for i in y_Log'range loop + y_Log(i) := Log(y(i), Log_Base); + end loop; + Multiplot_Pairs(x1, y_Log, x2, y_Log, x3, y_Log, x4, y_Log, x5, y_Log, + X_Labels => X_Label_String_Array, + Y_Labels => Y_Label_String_Array, + Title_Labels => Title_Label_String_Array, + Axis_Style => Log_Y_Minor_Grid); + end Simple_Plot_Log_Y; + + + -- Simple log x - log y plotter + procedure Simple_Plot_Log_XY + (x, y : Real_Vector; + X_Label : String := To_String(Default_Label_String); + Y_Label : String := To_String(Default_Label_String); + Title_Label : String := To_String(Default_Label_String); + x_Log_Base, y_Log_Base : Long_Float := 10.0) is -- Should this default to e? + + X_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; + Y_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; + Title_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; + + x_Log : Real_Vector(x'range); + y_Log : Real_Vector(y'range); + begin + X_Label_String_Array(1) := TUB(X_Label); -- First slot only; others not used. + Y_Label_String_Array(1) := TUB(Y_Label); -- First slot only; others not used. + Title_Label_String_Array(1) := TUB(Title_Label); -- First slot only; others not used. + + for i in x_Log'range loop + x_Log(i) := Log(x(i), x_Log_Base); + y_Log(i) := Log(y(i), y_Log_Base); + end loop; + Multiplot_Pairs(x_Log, y_Log, + X_Labels => X_Label_String_Array, + Y_Labels => Y_Label_String_Array, + Title_Labels => Title_Label_String_Array, + Axis_Style => Log_XY_Minor_Grid); + end Simple_Plot_Log_XY; + + + -- Simple plotter for multiple x-y arrays specified pairwise. + procedure Simple_Plot_Pairs + (x1 : Real_Vector := Dont_Plot_This; + y1 : Real_Vector := Dont_Plot_This; + x2 : Real_Vector := Dont_Plot_This; + y2 : Real_Vector := Dont_Plot_This; + x3 : Real_Vector := Dont_Plot_This; + y3 : Real_Vector := Dont_Plot_This; + x4 : Real_Vector := Dont_Plot_This; + y4 : Real_Vector := Dont_Plot_This; + x5 : Real_Vector := Dont_Plot_This; + y5 : Real_Vector := Dont_Plot_This; + X_Label : String := To_String(Default_Label_String); + Y_Label : String := To_String(Default_Label_String); + Title_Label : String := To_String(Default_Label_String)) is + + X_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; + Y_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; + Title_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; + begin + X_Label_String_Array(1) := TUB(X_Label); -- First slot only; others not used. + Y_Label_String_Array(1) := TUB(Y_Label); -- First slot only; others not used. + Title_Label_String_Array(1) := TUB(Title_Label); -- First slot only; others not used. + + Multiplot_Pairs(x1, y1, x2, y2, x3, y3, x4, y4, x5, y5, + X_Labels => X_Label_String_Array, + Y_Labels => Y_Label_String_Array, + Title_Labels => Title_Label_String_Array, + Axis_Style => Linear_Major_Grid); + end Simple_Plot_Pairs; + + +--------- Plotter requiring somewhat more arguments ------ + + -- Single plotter with flexible attributes + -- Similar to Multiplot_Pairs except single trace and no attribute arrays. + procedure Single_Plot + (x, y : Real_Vector; + X_Label : String := To_String(Default_Label_String); + Y_Label : String := To_String(Default_Label_String); + Title_Label : String := To_String(Default_Label_String); + Axis_Style : Axis_Style_Type := Linear_Major_Grid; + Color : Plot_Color_Type := Red; + Line_Width : Integer := 1; + Line_Style : Line_Style_Type := 1; + Justification : Justification_Type := Not_Justified; + x_Min_Zoom : Long_Float := Long_Float'small; + x_Max_Zoom : Long_Float := Long_Float'large; + y_Min_Zoom : Long_Float := Long_Float'small; + y_Max_Zoom : Long_Float := Long_Float'large) is + + X_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; + Y_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; + Title_Label_String_Array : Label_String_Array_Type := Default_Label_String_Array; + Color_Array : Color_Array_Type := Default_Color_Array; + Line_Width_Array : Line_Width_Array_Type := Default_Line_Width_Array; + Line_Style_Array : Line_Style_Array_Type := Default_Line_Style_Array; + + begin + X_Label_String_Array(1) := TUB(X_Label); -- First slot only; others not used. + Y_Label_String_Array(1) := TUB(Y_Label); -- First slot only; others not used. + Title_Label_String_Array(1) := TUB(Title_Label); -- First slot only; others not used. + Color_Array(1) := Color; + Line_Width_Array(1) := Line_Width; -- First slot only; others not used. + Line_Style_Array(1) := Line_Style; -- First slot only; others not used. + + -- Process arrays if log plot is indicated. + -- The declare blocks save memory and time for non-log plots. + + -- Log x. + if Axis_Style in Log_X_Box_Plus..Log_X_Minor_Grid then + declare + x_Log : Real_Vector(x'range); + begin + for i in x_Log'range loop + x_Log(i) := Log(x(i), 10.0); + end loop; + + Multiplot_Pairs( + x_Log, y, + X_Labels => X_Label_String_Array, + Y_Labels => Y_Label_String_Array, + Title_Labels => Title_Label_String_Array, + Axis_Style => Axis_Style, + Colors => Color_Array, + Line_Widths => Line_Width_Array, + Line_Styles => Line_Style_Array, + Justification => Justification, + x_Min_Zoom => x_Min_Zoom, + x_Max_Zoom => x_Max_Zoom, + y_Min_Zoom => y_Min_Zoom, + y_Max_Zoom => y_Max_Zoom); + end; -- declare + end if; -- log x + + -- Log y + if Axis_Style in Log_Y_Box_Plus..Log_Y_Minor_Grid then + declare + y_Log : Real_Vector(y'range); + begin + for i in y_Log'range loop + y_Log(i) := Log(y(i), 10.0); + end loop; + Multiplot_Pairs( + x, y_Log, + X_Labels => X_Label_String_Array, + Y_Labels => Y_Label_String_Array, + Title_Labels => Title_Label_String_Array, + Axis_Style => Axis_Style, + Colors => Color_Array, + Line_Widths => Line_Width_Array, + Line_Styles => Line_Style_Array, + Justification => Justification, + x_Min_Zoom => x_Min_Zoom, + x_Max_Zoom => x_Max_Zoom, + y_Min_Zoom => y_Min_Zoom, + y_Max_Zoom => y_Max_Zoom); + end; -- declare + end if; -- log y + + -- Log x and log y + if Axis_Style in Log_XY_Box_Plus..Log_XY_Minor_Grid then + declare + x_Log : Real_Vector(x'range); + y_Log : Real_Vector(y'range); + begin + for i in x_Log'range loop + x_Log(i) := Log(x(i), 10.0); + y_Log(i) := Log(y(i), 10.0); + end loop; + Multiplot_Pairs( + x_Log, y_Log, + X_Labels => X_Label_String_Array, + Y_Labels => Y_Label_String_Array, + Title_Labels => Title_Label_String_Array, + Axis_Style => Axis_Style, + Colors => Color_Array, + Line_Widths => Line_Width_Array, + Line_Styles => Line_Style_Array, + Justification => Justification, + x_Min_Zoom => x_Min_Zoom, + x_Max_Zoom => x_Max_Zoom, + y_Min_Zoom => y_Min_Zoom, + y_Max_Zoom => y_Max_Zoom); + end; -- declare + end if; -- log x and log y + + -- Linear plot is indicated. + if Axis_Style in No_Box..Linear_Minor_Grid then + Multiplot_Pairs( + x, y, + X_Labels => X_Label_String_Array, + Y_Labels => Y_Label_String_Array, + Title_Labels => Title_Label_String_Array, + Axis_Style => Axis_Style, + Colors => Color_Array, + Line_Widths => Line_Width_Array, + Line_Styles => Line_Style_Array, + Justification => Justification, + x_Min_Zoom => x_Min_Zoom, + x_Max_Zoom => x_Max_Zoom, + y_Min_Zoom => y_Min_Zoom, + y_Max_Zoom => y_Max_Zoom); + end if; -- Linear plot + end Single_Plot; + + +--------- Simple Contour Plotter ------ + + procedure Simple_Contour + (z : Real_Matrix; + Number_Levels : Integer := 10; + X_Label : String := To_String(Default_Label_String); + Y_Label : String := To_String(Default_Label_String); + Title_Label : String := To_String(Default_Label_String)) is + + Contour_Levels : Real_Vector (0 .. Number_Levels); + + begin + -- Fill the contour vector with some levels. + Calculate_Contour_Levels(Contour_Levels, Matrix_Min(z), Matrix_Max(z)); + + Advance_To_Subpage(Next_Subpage); + Set_Viewport_Normalized(0.1, 0.9, 0.1, 0.9); + Set_Viewport_World(1.0, 35.0, 1.0, 46.0); -- fix +------- Set_Viewport_World(Long_Float(z'First(1)), Long_Float(z'Last(1)), Long_Float(z'First(2)), Long_Float(z'Last(2))); -- fix + Set_Pen_Color(White); + Box_Around_Viewport("bcnst", 0.0, 0, "bcnstv", 0.0, 0); + Set_Pen_Color(White); + Write_Labels(X_Label, Y_Label, Title_Label); + Set_Pen_Color(White); + Set_Contour_Label_Parameters(0.008, 0.6, 0.1, True); + Contour_Plot(z, z'First(1), z'Last(1), z'First(2), z'Last(2), + Contour_Levels, PLplot_Thin.pltr0'access, System.Null_Address); + end Simple_Contour; + + +--------- Simple 3D Mesh Plotter ------ + + procedure Simple_Mesh_3D + (x, y : Real_Vector; -- data definition points + z : Real_Matrix; -- z(x, y) = z(x(i), y(j)) + x_Min : Long_Float := 0.0; -- user coordinate limits + x_Max : Long_Float := 0.0; -- If x_Min = x_Max = 0.0 then plot + y_Min : Long_Float := 0.0; -- x-limits are found automatically. + y_Max : Long_Float := 0.0; -- Ditto y_Min and y_Max. + Altitude : Long_Float := 30.0; -- viewing elevation angle in degrees + Azimuth : Long_Float := 30.0; -- viewing azimuth in degrees + X_Label : String := "x"; + Y_Label : String := "y"; + Z_Label : String := "z") is + + x_Min_Local, x_Max_Local, y_Min_Local, y_Max_Local : Long_Float; + + begin + -- Set min and max for x and y if they are not the defaults. + if x_Min = 0.0 and x_Max = 0.0 then -- override + x_Min_Local := Vector_Min(x); + x_Max_Local := Vector_Max(x); + else + x_Min_Local := x_Min; + x_Max_Local := x_Max; + end if; + + if y_Min = 0.0 and y_Max = 0.0 then -- override + y_Min_Local := Vector_Min(y); + y_Max_Local := Vector_Max(y); + else + y_Min_Local := y_Min; + y_Max_Local := y_Max; + end if; + + Quick_Set_Color_Map_1(Blue_Green_Red); -- no way to restore after doing this + Advance_To_Subpage(Next_Subpage); + Set_Pen_Color(White); + Set_Viewport_Normalized(0.0, 1.0, 0.0, 1.0); + Set_Viewport_World(-0.9, 0.9, -0.8, 1.5); + Set_Up_3D(1.0, 1.0, 1.0, x_Min_Local, x_Max_Local, y_Min_Local, y_Max_Local, + Matrix_Min(z), Matrix_Max(z), Altitude, Azimuth); -- plw3d + Box_Around_Viewport_3D("bnstu", X_Label, 0.0, 0, + "bnstu", Y_Label, 0.0, 0, + "bcdmnstuv", Z_Label, 0.0, 0); -- plbox3 + Mesh_3D(x, y, z, Lines_Parallel_To_X_And_Y + Magnitude_Color); -- plmesh + end Simple_Mesh_3D; + + +--------- Simple 3D Surface Plotter ------ + + procedure Simple_Surface_3D + (x, y : Real_Vector; -- data definition points + z : Real_Matrix; -- z(x, y) = z(x(i), y(j)) + x_Min : Long_Float := 0.0; -- user coordinate limits + x_Max : Long_Float := 0.0; -- If x_Min = x_Max = 0.0 then plot + y_Min : Long_Float := 0.0; -- x-limits are found automatically. + y_Max : Long_Float := 0.0; -- Ditto y_Min and y_Max. + Altitude : Long_Float := 30.0; -- viewing elevation angle in degrees + Azimuth : Long_Float := 30.0; -- viewing azimuth in degrees + X_Label : String := "x"; + Y_Label : String := "y"; + Z_Label : String := "z") is + + x_Min_Local, x_Max_Local, y_Min_Local, y_Max_Local : Long_Float; + Contour_Levels_Dummy : Real_Vector(0..1) := (others => 0.0); + + begin + -- Set min and max for x and y if they are not the defaults. + if x_Min = 0.0 and x_Max = 0.0 then -- override + x_Min_Local := Vector_Min(x); + x_Max_Local := Vector_Max(x); + else + x_Min_Local := x_Min; + x_Max_Local := x_Max; + end if; + + if y_Min = 0.0 and y_Max = 0.0 then -- override + y_Min_Local := Vector_Min(y); + y_Max_Local := Vector_Max(y); + else + y_Min_Local := y_Min; + y_Max_Local := y_Max; + end if; + + Quick_Set_Color_Map_1(Blue_Green_Red); -- no way to restore after doing this + Advance_To_Subpage(Next_Subpage); + Set_Pen_Color(White); + Set_Viewport_Normalized(0.0, 1.0, 0.0, 1.0); + Set_Viewport_World(-0.9, 0.9, -0.8, 1.5); + Set_Up_3D(1.0, 1.0, 1.0, x_Min_Local, x_Max_Local, y_Min_Local, y_Max_Local, + Matrix_Min(z), Matrix_Max(z), Altitude, Azimuth); -- plw3d + Box_Around_Viewport_3D("bnstu", X_Label, 0.0, 0, + "bnstu", Y_Label, 0.0, 0, + "bcdmnstuv", Z_Label, 0.0, 0); -- plbox3 + Mesh_3D(x, y, z, Lines_Parallel_To_X_And_Y + Magnitude_Color); -- plmesh + Shaded_Surface_3D(x, y, z, Magnitude_Color, Contour_Levels_Dummy); + end Simple_Surface_3D; + + + +--------- Simple color table manipulatons ----- + + -- Things for manipulating color map 0 -- + + -- Make a snapshot of color map 0 for possible later full or partial restoration. + -- This is automatically called at package initialization with results stored + -- in Default_Red_Components, Default_Green_Components, Default_Blue_Components. + procedure Make_Snapshot_Of_Color_Map_0 + (Reds, Greens, Blues : out Integer_Array_1D) is + begin + for i in Reds'range loop + Get_Color_RGB(i, Reds(i), Greens(i), Blues(i)); + end loop; + end Make_Snapshot_Of_Color_Map_0; + + + -- Restore an arbitray snapshot of color map 0. + procedure Restore_Snapshot_Of_Color_Map_0 + (Reds, Greens, Blues : Integer_Array_1D) is + begin + Set_Color_Map_0(Reds, Greens, Blues); + end Restore_Snapshot_Of_Color_Map_0; + + + -- Restore the default colors of color map 0 taken as a snapshot at initialization. + procedure Restore_Default_Snapshot_Of_Color_Map_0 is + begin + Set_Number_Of_Colors_Map_0(Number_Of_Default_Colors); + Set_Color_Map_0(Default_Red_Components, Default_Green_Components, Default_Blue_Components); + end Restore_Default_Snapshot_Of_Color_Map_0; + + + -- Functions which correspond to the default colors of color map 0. Calling + -- one of these (1) resets the corresponding slot in color map 0 to its + -- default value, and (2) returns the correct integer value for the default + -- color specified. Thus, using Set_Pen_Color(Reset_Red) instead of + -- Set_Pen_Color(Red) guarantees that the color will be set to Red even if + -- there have been prior manipulations of color 1. + + function Reset_Black return Integer is + begin + Set_One_Color_Map_0(0, Default_Red_Components(0), Default_Green_Components(0), Default_Blue_Components(0)); + return 0; + end Reset_Black; + + function Reset_Red return Integer is + begin + Set_One_Color_Map_0(1, Default_Red_Components(1), Default_Green_Components(1), Default_Blue_Components(1)); + return 1; + end Reset_Red; + + function Reset_Yellow return Integer is + begin + Set_One_Color_Map_0(2, Default_Red_Components(2), Default_Green_Components(2), Default_Blue_Components(2)); + return 2; + end Reset_Yellow; + + function Reset_Green return Integer is + begin + Set_One_Color_Map_0(3, Default_Red_Components(3), Default_Green_Components(3), Default_Blue_Components(3)); + return 3; + end Reset_Green; + + function Reset_Aquamarine return Integer is + begin + Set_One_Color_Map_0(4, Default_Red_Components(4), Default_Green_Components(4), Default_Blue_Components(4)); + return 4; + end Reset_Aquamarine; + + function Reset_Pink return Integer is + begin + Set_One_Color_Map_0(5, Default_Red_Components(5), Default_Green_Components(5), Default_Blue_Components(5)); + return 5; + end Reset_Pink; + + function Reset_Wheat return Integer is + begin + Set_One_Color_Map_0(6, Default_Red_Components(6), Default_Green_Components(6), Default_Blue_Components(6)); + return 6; + end Reset_Wheat; + + function Reset_Grey return Integer is + begin + Set_One_Color_Map_0(7, Default_Red_Components(7), Default_Green_Components(7), Default_Blue_Components(7)); + return 7; + end Reset_Grey; + + function Reset_Brown return Integer is + begin + Set_One_Color_Map_0(8, Default_Red_Components(8), Default_Green_Components(8), Default_Blue_Components(8)); + return 8; + end Reset_Brown; + + function Reset_Blue return Integer is + begin + Set_One_Color_Map_0(9, Default_Red_Components(9), Default_Green_Components(9), Default_Blue_Components(9)); + return 9; + end Reset_Blue; + + function Reset_BlueViolet return Integer is + begin + Set_One_Color_Map_0(10, Default_Red_Components(10), Default_Green_Components(10), Default_Blue_Components(10)); + return 10; + end Reset_BlueViolet; + + function Reset_Cyan return Integer is + begin + Set_One_Color_Map_0(11, Default_Red_Components(11), Default_Green_Components(11), Default_Blue_Components(11)); + return 11; + end Reset_Cyan; + + function Reset_Turquoise return Integer is + begin + Set_One_Color_Map_0(12, Default_Red_Components(12), Default_Green_Components(12), Default_Blue_Components(12)); + return 12; + end Reset_Turquoise; + + function Reset_Magenta return Integer is + begin + Set_One_Color_Map_0(13, Default_Red_Components(13), Default_Green_Components(13), Default_Blue_Components(13)); + return 13; + end Reset_Magenta; + + function Reset_Salmon return Integer is + begin + Set_One_Color_Map_0(14, Default_Red_Components(14), Default_Green_Components(14), Default_Blue_Components(14)); + return 14; + end Reset_Salmon; + + function Reset_White return Integer is + begin + Set_One_Color_Map_0(15, Default_Red_Components(15), Default_Green_Components(15), Default_Blue_Components(15)); + return 15; + end Reset_White; + + + -- Things for manipulating color map 1 -- + + -- Quick application of pre-fabricated color schemes to color map 1. + procedure Quick_Set_Color_Map_1(Color_Theme : Color_Themes_For_Map_1_Type) is + + Controls_3 : Real_Vector (0..2); -- 3 control points + Controls_4 : Real_Vector (0..3); -- 4 control points + Red_3, Green_3, Blue_3 : Real_Vector (0..2); -- define 3 + Red_4, Green_4, Blue_4 : Real_Vector (0..3); -- define 4 + Hue_3, Lightness_3, Saturation_3 : Real_Vector (0..2); -- define 3 + Hue_4, Lightness_4, Saturation_4 : Real_Vector (0..3); -- define 4 + Reverse_Hue_3 : Boolean_Array_1D (0..2); + Reverse_Hue_4 : Boolean_Array_1D (0..3); + begin + Set_Number_Of_Colors_In_Color_Map_1(256); + + Controls_3(0) := 0.0; + Controls_3(1) := 0.5; + Controls_3(2) := 1.0; + + Controls_4(0) := 0.0; + Controls_4(1) := 0.5; -- allow a "bend" at the mid-point + Controls_4(2) := 0.5; -- allow a "bend" at the mid-point + Controls_4(3) := 1.0; + + -- Initialize everything, even unused stuff. + Red_3(0) := 0.0; + Red_3(1) := 0.0; + Red_3(2) := 0.0; + Green_3(0) := 0.0; + Green_3(1) := 0.0; + Green_3(2) := 0.0; + Blue_3(0) := 0.0; + Blue_3(1) := 0.0; + Blue_3(2) := 0.0; + + Red_4(0) := 0.0; + Red_4(1) := 0.0; + Red_4(2) := 0.0; + Red_4(3) := 0.0; + Green_4(0) := 0.0; + Green_4(1) := 0.0; + Green_4(2) := 0.0; + Green_4(3) := 0.0; + Blue_4(0) := 0.0; + Blue_4(1) := 0.0; + Blue_4(2) := 0.0; + Blue_4(3) := 0.0; + + Hue_3(0) := 0.0; + Hue_3(1) := 0.0; + Hue_3(2) := 0.0; + Lightness_3(0) := 0.0; + Lightness_3(1) := 0.0; + Lightness_3(2) := 0.0; + Saturation_3(0) := 0.0; + Saturation_3(1) := 0.0; + Saturation_3(2) := 0.0; + + Hue_4(0) := 0.0; + Hue_4(1) := 0.0; + Hue_4(2) := 0.0; + Hue_4(3) := 0.0; + Lightness_4(0) := 0.0; + Lightness_4(1) := 0.0; + Lightness_4(2) := 0.0; + Lightness_4(3) := 0.0; + Saturation_4(0) := 0.0; + Saturation_4(1) := 0.0; + Saturation_4(2) := 0.0; + Saturation_4(3) := 0.0; + + case Color_Theme is + when Gray => + begin + Hue_3(0) := 0.0; + Hue_3(1) := 0.0; + Hue_3(2) := 0.0; + Lightness_3(0) := 0.0; + Lightness_3(1) := 0.5; + Lightness_3(2) := 1.0; + Saturation_3(0) := 0.0; + Saturation_3(1) := 0.0; + Saturation_3(2) := 0.0; + Reverse_Hue_3(0) := False; + Reverse_Hue_3(1) := False; + Reverse_Hue_3(2) := False; + Set_Color_Map_1_Piecewise(HLS, Controls_3, Hue_3, Lightness_3, Saturation_3, Reverse_Hue_3); + end; + when Blue_Green_Red => -- This appears to be the PLplot default color theme. + begin + Blue_3(0) := 1.0; + Blue_3(1) := 0.0; + Blue_3(2) := 0.0; + Green_3(0) := 0.0; + Green_3(1) := 1.0; + Green_3(2) := 0.0; + Red_3(0) := 0.0; + Red_3(1) := 0.0; + Red_3(2) := 1.0; + Reverse_Hue_3(0) := False; + Reverse_Hue_3(1) := False; + Reverse_Hue_3(2) := False; + Set_Color_Map_1_Piecewise(RGB, Controls_3, Red_3, Green_3, Blue_3, Reverse_Hue_3); + end; + when Red_Green_Blue => + begin + Blue_3(0) := 0.0; + Blue_3(1) := 0.0; + Blue_3(2) := 1.0; + Green_3(0) := 0.0; + Green_3(1) := 1.0; + Green_3(2) := 0.0; + Red_3(0) := 1.0; + Red_3(1) := 0.0; + Red_3(2) := 0.0; + Reverse_Hue_3(0) := False; + Reverse_Hue_3(1) := False; + Reverse_Hue_3(2) := False; + Set_Color_Map_1_Piecewise(RGB, Controls_3, Red_3, Green_3, Blue_3, Reverse_Hue_3); + end; + when Red_Cyan_Blue => + begin + Hue_3(0) := 360.0; + Hue_3(1) := 300.0; + Hue_3(2) := 240.0; + Saturation_3(0) := 1.0; + Saturation_3(1) := 1.0; + Saturation_3(2) := 1.0; + Lightness_3(0) := 0.5; + Lightness_3(1) := 0.5; + Lightness_3(2) := 0.5; + Reverse_Hue_3(0) := False; + Reverse_Hue_3(1) := False; + Reverse_Hue_3(2) := False; + Set_Color_Map_1_Piecewise(HLS, Controls_3, Hue_3, Lightness_3, Saturation_3, Reverse_Hue_3); + end; + when Blue_Black_Red => + begin + Hue_4(0) := 240.0; -- Blue + Hue_4(1) := 240.0; -- Blue + Hue_4(2) := 0.0; -- Red + Hue_4(3) := 0.0; -- Red + Saturation_4(0) := 1.0; + Saturation_4(1) := 1.0; + Saturation_4(2) := 1.0; + Saturation_4(3) := 1.0; + Lightness_4(0) := 0.5; -- Apparently different from Brightness + Lightness_4(1) := 0.0; + Lightness_4(2) := 0.0; + Lightness_4(3) := 0.5; + Reverse_Hue_4(0) := False; + Reverse_Hue_4(1) := False; + Reverse_Hue_4(2) := False; + Reverse_Hue_4(3) := False; + Set_Color_Map_1_Piecewise(HLS, Controls_4, Hue_4, Lightness_4, Saturation_4, Reverse_Hue_4); + end; + when Red_Blue_Green => + begin + Hue_3(0) := 360.0; -- red + Hue_3(1) := 210.0; -- blue + Hue_3(2) := 120.0; -- green + Lightness_3(0) := 0.5; + Lightness_3(1) := 0.5; + Lightness_3(2) := 0.5; + Saturation_3(0) := 1.0; + Saturation_3(1) := 1.0; + Saturation_3(2) := 1.0; + Reverse_Hue_3(0) := False; + Reverse_Hue_3(1) := False; + Reverse_Hue_3(2) := False; + Set_Color_Map_1_Piecewise(HLS, Controls_3, Hue_3, Lightness_3, Saturation_3, Reverse_Hue_3); + end; + when Red_Yellow => + begin + Hue_3(0) := 0.0; -- red + Hue_3(1) := 30.0; -- orange + Hue_3(2) := 60.0; -- yellow + Lightness_3(0) := 0.5; + Lightness_3(1) := 0.5; + Lightness_3(2) := 0.5; + Saturation_3(0) := 1.0; + Saturation_3(1) := 1.0; + Saturation_3(2) := 1.0; + Reverse_Hue_3(0) := False; + Reverse_Hue_3(1) := False; + Reverse_Hue_3(2) := False; + Set_Color_Map_1_Piecewise(HLS, Controls_3, Hue_3, Lightness_3, Saturation_3, Reverse_Hue_3); + end; + end case; + end Quick_Set_Color_Map_1; + + +-------------------------------------------------------------------------------- +-- Auxiliary things -- +-------------------------------------------------------------------------------- + + -- This is a mask function for Shade_Regions (aka plshades) et al that always + -- returns 1 so that all points are plotted. Can be used as a template + -- for other user-written mask functions. This behaves the same as + -- when passing null for the second argument in Shade_Regions. + function Mask_Function_No_Mask(x, y : Long_Float) return Integer is + begin + return 1; + end Mask_Function_No_Mask; + + + -- Given an array to hold contour levels and function minimum and maximum, + -- fill it and return. Useful for contour and shade plots. + procedure Calculate_Contour_Levels + (Contour_Levels : in out Real_Vector; + z_Min, z_Max : Long_Float) is + + step : Long_Float; + ii : Integer; + begin + step := (z_Max - z_Min) / Long_Float(Contour_Levels'Last - Contour_Levels'First); + for i in Contour_Levels'range loop + ii := i - Contour_Levels'First; -- reference back to 0. + Contour_Levels(i) := z_Min + step * Long_Float(ii); + end loop; + end Calculate_Contour_Levels; + + +-------------------------------------------------------------------------------- +-- Re-define PLplot procedures using Ada style. -- +-------------------------------------------------------------------------------- + +-- These correspond to the section in plot.h called "Function Prototypes". + + -- set the format of the contour labels + -- pl_setcontlabelformat + procedure Set_Contour_Label_Format + (Limit_Exponent : Integer := 4; + Significant_Digits : Integer := 2) is + begin + pl_setcontlabelformat(Limit_Exponent, Significant_Digits); + end Set_Contour_Label_Format; + + + -- set offset and spacing of contour labels + -- pl_setcontlabelparam + procedure Set_Contour_Label_Parameters + (Label_Offset : Long_Float := 0.006; -- Units are ??? + Label_Font_Height : Long_Float := 0.3; -- Units are ??? + Label_Spacing : Long_Float := 0.1; -- Units are??? + Labels_Active : Boolean := False) is + + active : Integer; + + begin + if Labels_Active then + active := 1; + else + active := 0; + end if; + pl_setcontlabelparam(Label_Offset, Label_Font_Height, Label_Spacing, active); + end Set_Contour_Label_Parameters; + + + -- Advance to subpage "page", or to the next one if "page" = 0. + -- pladv + procedure Advance_To_Subpage(Page : Natural) is + begin + pladv(Page); + end Advance_To_Subpage; + + + -- Plot an arc. + -- plarc + procedure Draw_Arc + (x, y, a, b, angle1, angle2 : Long_Float; + fill : Boolean) is + + fill_arc : PLBOOL; + + begin + if fill then + fill_arc := PLtrue; + else + fill_arc := PLfalse; + end if; + plarc(x, y, a, b, angle1, angle2, fill_arc); + end Draw_Arc; + + + -- Draw a 2D vector plot. + -- plvect + procedure Vector_Plot + (u, v : Real_Matrix; + Scale : Long_Float; + Transformation_Procedure_Pointer : Transformation_Procedure_Pointer_Type; + Transformation_Data_Pointer : PLpointer) is + begin + plvect(Matrix_To_Pointers(u), Matrix_To_Pointers(v), u'Length(1), u'Length(2), Scale, Transformation_Procedure_Pointer, Transformation_Data_Pointer); + end Vector_Plot; + + + -- Set the style for the arrow used by plvect to plot vectors. + -- plsvect + procedure Set_Arrow_Style_For_Vector_Plots + (X_Vertices, Y_Vertices : Real_Vector; -- Should be range -0.5..0.5 + Fill_Arrow : Boolean) is + + fill : PLBOOL; + + begin + if Fill_Arrow then + fill := PLtrue; + else + fill := PLfalse; + end if; + plsvect(X_Vertices, Y_Vertices, X_Vertices'length, fill); + end Set_Arrow_Style_For_Vector_Plots; + + + -- This functions similarly to plbox() except that the origin of the axes + -- is placed at the user-specified point (x0, y0). + -- plaxes + procedure Box_Around_Viewport_With_Origin + (X_Origin, Y_Origin : Long_Float; + X_Option_String : String; + X_Major_Tick_Interval : Long_Float; + X_Number_Of_Subintervals : Natural; + Y_Option_String : String; + Y_Major_Tick_Interval : Long_Float; + Y_Number_Of_Subintervals : Natural) is + begin + plaxes + (X_Origin, Y_Origin, + To_C(X_Option_String, True), X_Major_Tick_Interval, X_Number_Of_Subintervals, + To_C(Y_Option_String, True), Y_Major_Tick_Interval, Y_Number_Of_Subintervals); + end Box_Around_Viewport_With_Origin; + + + -- Plot a histogram using x to store data values and y to store frequencies + -- plbin + procedure Histogram_Binned + (Bin_Values : Real_Vector; -- "x" + Bin_Counts : Real_Vector; -- "y" + Options : Integer) is -- Options are not defined in plplot.h. + begin + plbin(Bin_Values'length, Bin_Values, Bin_Counts, Options); + end Histogram_Binned; + + + -- Calculate broken-down time from continuous time for current stream. + -- plbtime + procedure Broken_Down_From_Continuous_Time + (year, month, day, hour, min : out Integer; + sec : out Long_Float; + ctime : Long_Float) is + begin + plbtime(year, month, day, hour, min, sec, ctime); + end Broken_Down_From_Continuous_Time; + + + -- Start new page. Should only be used with pleop(). + -- plbop + procedure Begin_New_Page is + begin + plbop; + end Begin_New_Page; + + + -- This draws a box around the current viewport. + -- plbox + procedure Box_Around_Viewport + (X_Option_String : String; + X_Major_Tick_Interval : Long_Float; + X_Number_Of_Subintervals : Natural := 0; + Y_Option_String : String; + Y_Major_Tick_Interval : Long_Float; + Y_Number_Of_Subintervals : Natural := 0) is + begin + plbox + (To_C(X_Option_String, True), X_Major_Tick_Interval, X_Number_Of_Subintervals, + To_C(Y_Option_String, True), Y_Major_Tick_Interval, Y_Number_Of_Subintervals); + end Box_Around_Viewport; + + + -- This is the 3-d analogue of plbox(). + -- plbox3 + procedure Box_Around_Viewport_3D + (X_Option_String : String; + X_Label : String := To_String(Default_Label_String); + X_Major_Tick_Interval : Long_Float := 0.0; + X_Number_Of_Subintervals : Natural := 0; + + Y_Option_String : String; + Y_Label : String := To_String(Default_Label_String); + Y_Major_Tick_Interval : Long_Float := 0.0; + Y_Number_Of_Subintervals : Natural := 0; + + Z_Option_String : String; + Z_Label : String := To_String(Default_Label_String); + Z_Major_Tick_Interval : Long_Float := 0.0; + Z_Number_Of_Subintervals : Natural := 0) is + begin + plbox3 + (To_C(X_Option_String, True), To_C(X_Label, True), X_Major_Tick_Interval, X_Number_Of_Subintervals, + To_C(Y_Option_String, True), To_C(Y_Label, True), Y_Major_Tick_Interval, Y_Number_Of_Subintervals, + To_C(Z_Option_String, True), To_C(Z_Label, True), Z_Major_Tick_Interval, Z_Number_Of_Subintervals); + end Box_Around_Viewport_3D; + + + -- Calculate world coordinates and subpage from relative device coordinates. + -- plcalc_world + procedure World_From_Relative_Coordinates + (x_Relative, y_Relative : Long_Float_0_1_Type; + x_World, y_World : out Long_Float; + Last_Window_Index : out Integer) is + begin + plcalc_world(x_Relative, y_Relative, x_World, y_World, Last_Window_Index); + end World_From_Relative_Coordinates; + + + -- Clear current subpage. + -- plclear + procedure Clear_Current_Subpage is + begin + plclear; + end Clear_Current_Subpage; + + + -- Set color, map 0. Argument is integer between 0 and 15. + -- plcol0 + procedure Set_Pen_Color(A_Color : Plot_Color_Type) is + begin + plcol0(A_Color); + end Set_Pen_Color; + + + -- Set color, map 1. Argument is a float between 0. and 1. + -- plcol1 + procedure Set_Color_Map_1(Color : Long_Float_0_1_Type) is + begin + plcol1(Color); + end Set_Color_Map_1; + + + -- Configure transformation between continuous and broken-down time (and + -- vice versa) for current stream. + -- plconfigtime + procedure Configure_Time_Transformation + (skale, offset1, offset2 : Long_Float; + ccontrol : Integer; + ifbtime_offset : Boolean; + year, month, day, hour, min : Integer; + sec : Long_Float) is + + ifbtime_offset_As_Integer : Integer; + begin + if ifbtime_offset then + ifbtime_offset_As_Integer := 1; + else + ifbtime_offset_As_Integer := 0; + end if; + plconfigtime(skale, offset1, offset2, ccontrol, + ifbtime_offset_As_Integer, year, month, day, hour, min, sec); + end Configure_Time_Transformation; + + + -- Draws a contour plot from data in f(nx,ny). Is just a front-end to + -- plfcont, with a particular choice for f2eval and f2eval_data. + + -- plcont (universal version using System.Address to the transformation data) + procedure Contour_Plot + (z : Real_Matrix; + x_Min_Index, x_Max_Index : Integer; + y_Min_Index, y_Max_Index : Integer; + Contour_Levels : Real_Vector; + Transformation_Procedure_Pointer : Transformation_Procedure_Pointer_Type; + Transformation_Data_Pointer : PLpointer) is + begin + plcont(Matrix_To_Pointers(z), z'Length(1), z'Length(2), + x_Min_Index, x_Max_Index, y_Min_Index, y_Max_Index, Contour_Levels, + Contour_Levels'Length, Transformation_Procedure_Pointer, + Transformation_Data_Pointer); + end Contour_Plot; + + + -- The procedure plfcont is not documented and is not part of the API. + -- However, it is a very useful capability to have available. + -- I have tried to implement it as I think was intended but this may be incorrect. + -- It appears as though the intent is to pass the arbitrarily organized + -- data (pointed to by Irregular_Data_Pointer) as a (single) pointer to a + -- 2D C-style array. Thus, for examaple, it is not possible to pass the data + -- as triples. + -- For further conversion insight, see plcont, above. + + -- Draws a contour plot using the function evaluator f2eval and data stored + -- by way of the f2eval_data pointer. This allows arbitrary organizations + -- of 2d array data to be used. + + -- plfcont + procedure Contour_Plot_Irregular_Data + (Function_Evaluator_Pointer : Function_Evaluator_Pointer_Type; + Irregular_Data : Real_Matrix; + x_Min_Index, x_Max_Index : Integer; + y_Min_Index, y_Max_Index : Integer; + Contour_Levels : Real_Vector; + Transformation_Procedure_Pointer : Transformation_Procedure_Pointer_Type; + Transformation_Data : Transformation_Data_Type) is + + -- This is a good place to change from the convenient form of passing + -- the transformation data (a record) to the form required by the PLplot + -- API (a pointer); same for the irregularly spaced data matrix. + Transformation_Data_Address : PLpointer; + Irregular_Data_Address : PLpointer; + begin + Transformation_Data_Address := Transformation_Data'Address; + Irregular_Data_Address := Irregular_Data'Address; + + plfcont(Function_Evaluator_Pointer, Irregular_Data_Address, + Irregular_Data'Length(1), Irregular_Data'Length(2), + x_Min_Index, x_Max_Index, y_Min_Index, y_Max_Index, + Contour_Levels, Contour_Levels'Length, + Transformation_Procedure_Pointer, Transformation_Data_Address); + end Contour_Plot_Irregular_Data; + + + -- Copies state parameters from the reference stream to the current stream. + -- plcpstrm + procedure Copy_State_Parameters + (Stream_ID : Integer; + Do_Not_Copy_Device_Coordinates : Boolean) is + + PL_Do_Not_Copy_Device_Coordinates : PLBOOL; + + begin + if Do_Not_Copy_Device_Coordinates then + PL_Do_Not_Copy_Device_Coordinates := PLtrue; + else + PL_Do_Not_Copy_Device_Coordinates := PLfalse; + end if; + plcpstrm(Stream_ID, PL_Do_Not_Copy_Device_Coordinates); + end Copy_State_Parameters; + + + -- Calculate continuous time from broken-down time for current stream. + -- plctime + procedure Continuous_From_Broken_Down_Time + (year, month, day, hour, min : Integer; + sec : Long_Float; + ctime : out Long_Float) is + begin + plctime(year, month, day, hour, min, sec, ctime); + end Continuous_From_Broken_Down_Time; + + + -- fix this + -- Converts input values from relative device coordinates to relative plot + -- coordinates. + -- pldid2pc + procedure pldid2pc_Placeholder is + begin + Put_Line("Not implemented due to lack of documentation."); + end pldid2pc_Placeholder; + + + -- fix this + -- Converts input values from relative plot coordinates to relative + -- device coordinates. + -- pldip2dc + procedure pldip2dc_Placeholder is + begin + Put_Line("Not implemented due to lack of documentation."); + end pldip2dc_Placeholder; + + + -- En... [truncated message content] |