MCPcopy Create free account
hub / github.com/GenericMappingTools/gmt / main

Function main

src/testapi_vector_plot.c:2–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1#include "gmt.h"
2int main () {
3 void *API = NULL; /* The API control structure */
4 struct GMT_VECTOR *V = NULL; /* Structure to hold input dataset as vectors */
5 char input[GMT_VF_LEN] = {""}; /* String to hold virtual input filename */
6 char args[128] = {""}; /* String to hold module command arguments */
7
8 uint64_t dim[4] = {2, 2, 1, 0};
9 double x[2] = {5.0, 5.0};
10 double y[2] = {3.0, 8.0};
11
12 /* Initialize the GMT session */
13 API = GMT_Create_Session ("test", 2U, GMT_SESSION_EXTERNAL, NULL);
14 /* Create a dataset */
15 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);
16 /**/
17 GMT_Put_Vector(API, V, 0, GMT_DOUBLE, x);
18 GMT_Put_Vector(API, V, 1, GMT_DOUBLE, y);
19 /* Associate our data table with a virtual file */
20 //GMT_Open_VirtualFile (API, GMT_IS_DATASET|GMT_VIA_VECTOR, GMT_IS_POINT, GMT_IN|GMT_IS_REFERENCE, V, input);
21 GMT_Open_VirtualFile (API, GMT_IS_DATASET|GMT_VIA_VECTOR, GMT_IS_POINT, GMT_IN|GMT_IS_REFERENCE, V, input);
22 /* Prepare the module arguments */
23 sprintf (args, "%s -JX10c -R0/10/0/10 -Baf -W1p,black+ve0.2c -P", input);
24 /* Call the psxy module */
25 GMT_Call_Module (API, "psxy", GMT_MODULE_CMD, args);
26 GMT_Close_VirtualFile (API, input);
27 /* Destroy the GMT session */
28 if (GMT_Destroy_Session (API)) return EXIT_FAILURE;
29};

Callers

nothing calls this directly

Calls 7

GMT_Create_SessionFunction · 0.85
GMT_Create_DataFunction · 0.85
GMT_Put_VectorFunction · 0.85
GMT_Open_VirtualFileFunction · 0.85
GMT_Call_ModuleFunction · 0.85
GMT_Close_VirtualFileFunction · 0.85
GMT_Destroy_SessionFunction · 0.85

Tested by

no test coverage detected