-
Notifications
You must be signed in to change notification settings - Fork 367
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the testapi code to plot vectors (#3528)
* Add the testapi code * Fix resampling of readonly memory * Add a bash test for testapi_vector_plot.c Co-authored-by: Paul Wessel <[email protected]>
- Loading branch information
1 parent
2a1a680
commit 5b11244
Showing
7 changed files
with
80 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include "gmt.h" | ||
int main () { | ||
void *API = NULL; /* The API control structure */ | ||
struct GMT_VECTOR *V = NULL; /* Structure to hold input dataset as vectors */ | ||
char input[GMT_VF_LEN] = {""}; /* String to hold virtual input filename */ | ||
char args[128] = {""}; /* String to hold module command arguments */ | ||
|
||
uint64_t dim[4] = {2, 2, 1, 0}; | ||
double x[2] = {5.0, 5.0}; | ||
double y[2] = {3.0, 8.0}; | ||
|
||
/* Initialize the GMT session */ | ||
API = GMT_Create_Session ("test", 2U, GMT_SESSION_EXTERNAL, NULL); | ||
/* Create a dataset */ | ||
if ((V = GMT_Create_Data (API, GMT_IS_DATASET|GMT_VIA_VECTOR, GMT_IS_POINT, GMT_CONTAINER_ONLY, dim, NULL, NULL, 0, 0, NULL)) == NULL) return (EXIT_FAILURE); | ||
/**/ | ||
GMT_Put_Vector(API, V, 0, GMT_DOUBLE, x); | ||
GMT_Put_Vector(API, V, 1, GMT_DOUBLE, y); | ||
/* Associate our data table with a virtual file */ | ||
//GMT_Open_VirtualFile (API, GMT_IS_DATASET|GMT_VIA_VECTOR, GMT_IS_POINT, GMT_IN|GMT_IS_REFERENCE, V, input); | ||
GMT_Open_VirtualFile (API, GMT_IS_DATASET|GMT_VIA_VECTOR, GMT_IS_POINT, GMT_IN|GMT_IS_REFERENCE, V, input); | ||
/* Prepare the module arguments */ | ||
sprintf (args, "%s -JX10c -R0/10/0/10 -Baf -W1p,black+ve0.2c -P", input); | ||
/* Call the psxy module */ | ||
GMT_Call_Module (API, "psxy", GMT_MODULE_CMD, args); | ||
GMT_Close_VirtualFile (API, input); | ||
/* Destroy the GMT session */ | ||
if (GMT_Destroy_Session (API)) return EXIT_FAILURE; | ||
}; |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Test the C API for plotting lines with arrows | ||
# See https://github.com/GenericMappingTools/gmt/pull/3528 | ||
ps=apivectorplot.ps | ||
testapi_vector_plot > $ps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters