GRASS GIS 7 Programmer's Manual  7.7.svn(2018)-r73577
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
temporal.h
Go to the documentation of this file.
1 #ifndef GRASS_TEMPORAL_H
2 #define GRASS_TEMPORAL_H
3 
4 #include <grass/datetime.h>
5 #include <grass/gis.h>
6 #include <grass/dbmi.h>
7 
8 
9 #define TGISDB_DEFAULT_DRIVER "sqlite"
10 /* Default path in the current location */
11 #define TGISDB_DEFAULT_SQLITE_PATH "tgis/sqlite.db"
12 
13 
14 int tgis_set_connection(dbConnection * connection);
15 int tgis_get_connection(dbConnection * connection);
16 const char *tgis_get_default_driver_name(void);
18 char *tgis_get_driver_name(void);
19 char *tgis_get_database_name(void);
20 char *tgis_get_mapset_driver_name(const char*);
21 char *tgis_get_mapset_database_name(const char*);
23 
24 
25 /* ALL CODE BELOW THIS COMMENT
26  * IS A PROTOTYPICAL DEFINITION OF THE
27  * FUTURE TEMPORAL GIS C-LIBRARY INTERFACE
28  * AND NOT YET IMPLEMENTED
29  */
30 
31 #define TGIS_TYPE_MAP 0
32 #define TGIS_TYPE_STDS 1
33 
34 #define TGIS_RASTER_MAP 1
35 #define TGIS_RASTER3D_MAP 2
36 #define TGIS_VECTOR_MAP 3
37 #define TGIS_STRDS 4
38 #define TGIS_STR3DS 5
39 #define TGIS_STVDS 6
40 
41 #define TGIS_ABSOLUTE_TIME 0
42 #define TGIS_RELATIVE_TIME 1
43 
44 /*! A simple structure to organize time stamped maps*/
45 typedef struct _tgisMap {
46  char *name;
47  char *mapset;
48  struct TimeStamp ts;
49 } tgisMap;
50 
51 /*!
52  \brief List of tgisMap struct's
53 
54  This structure is used to store lists of time stamped maps
55  using the tgisMap structure internally.
56 */
57 typedef struct _tgisMapList
58 {
59  /*!
60  \brief Array of tgisMap struct's
61  */
63  /*!
64  \brief Number of tgisMap struct's in the list
65  */
66  int n_values;
67  /*!
68  \brief Allocated space for tgisMap struct's
69  */
71 } tgisMapList;
72 
73 /* map_list.c */
77 /*! Insert a new map to the map list */
78 void tgis_map_list_insert(tgisMapList *list, char *name, char*mapset, struct TimeStamp *ts);
79 /*! Add a new map to the map list */
81 
82 /*!Spatio temporal extent as double values
83 
84  The spatio temporal extent contains only double values.
85 
86  The unit of start and end time is seconds in case the time is absolute.
87  Reference is Jan. 1. 1900 00:00:00 +00:00 UTC
88 
89  If no end time is present, because its a time instance, then has_end must be 0.
90 
91  */
92 typedef struct _tgisExtent
93 {
94  double start; /*Start time as double value*/
95  double end; /*End time as double value*/
96  char has_end; /*Set to 1 if the end time exists, 0 otherwise*/
97  double north;
98  double south;
99  double east;
100  double west;
101  double top;
102  double bottom;
103 } tgisExtent;
104 
105 /* Forward declaration */
106 struct _tgisDataset;
107 
108 /*!
109  \brief List of tgisDatasets struct's
110 
111  This structure is used to store lists of dataset (space time datasets or time stamped maps)
112  using the tgisDataset structure internally.
113 */
114 typedef struct _tgisDatasetList
115 {
116  /*!
117  \brief Array of tgisDataset structs
118  */
120  /*!
121  \brief Number of tgisDataset structs in the list
122  */
123  int n_values;
124  /*!
125  \brief Allocated space for tgisDataset structs
126  */
129 
130 /*! A dataset structure to organize time stamped maps and space time datasets
131  and their spatio-temporal topological relations.
132  */
133 typedef struct _tgisDataset {
134  char *name; /* The name of this dataset */
135  char *mapset; /* The mapset of this dataset */
136  char *creator; /* The creator of this dataset */
137  DateTime creation_time; /* The creation time of this dataset */
138  char temporal_type; /* The temporal type of this dataset: TGIS_ABSOLUTE_TIME,
139  TGIS_RELATIVE_TIME */
140  struct TimeStamp ts; /* The timestamp of this dataset */
141  tgisExtent extent; /* This is the spatio-temporal extent represented as double values */
142 
143  void *metadata; /* A pointer to the dataset specific metadata (not used yet) */
144 
145  char dataset_type; /* The type of the dataset: TGIS_RASTER_MAP, TGIS_RASTER3D_MAP,
146  TGIS_VECTOR_MAP, TGIS_STRDS, TGIS_STR3DS, TGIS_STVDS */
147  char is_stds; /* Represent this struct a space time dataset? 1 True, 0 False */
148 
151 
152  /* Temporal topology relations */
164 
165  /* Spatial topology relations */
173 
174 } tgisDataset;
175 
176 
177 /* dataset_list.c */
181 /*! Insert a new dataset to the dataset list */
182 void tgis_dataset_list_insert(tgisDatasetList *list, char *name, char *mapset, char *creator,
184  struct TimeStamp *ts, tgisExtent *extent, void *metadata,
185  char dataset_type, char is_stds);
186 /*! Add a new dataset to the dataset list */
188 
189 /* topology.c */
190 /*! Build the temporal or spatio-temporal topology of the provided dataset list */
191 int tgis_build_topology(tgisDatasetList *A, char spatial);
192 
193 /*! Build the temporal or spatio-temporal topology between the two dataset list */
194 int tgis_build_topology2(tgisDatasetList *A, tgisDatasetList *B, char spatial);
195 
196 /*
197  * INTERFACE TO THE TEMPORAL PYTHON FRAMEWORK
198  */
199 
200 /* create.c */
201 /*! Create the new space time dataset */
202 int tgis_create_stds(char *stds_name, char stds_type, char temporal_type, char *title,
203  char *description, char *semantic_type, char *aggregation_type);
204 
205 /*! Modify the metadata of an existing space time dataset */
206 int tgis_modify_stds(char *stds_name, char stds_type, char *title,
207  char *description, char *semantic_type, char *aggregation_type);
208 
209 /* remove.c */
210 /*! Remove a space time dataset and optionally all of its maps */
211 int tgis_remove_stds(char *stds_name, char stds_type, char remove_maps);
212 
213 /* update.c */
214 int tgis_update_stds(char *stds_name, char stds_type);
215 
216 /* register.c */
217 /*! Register a map in the temporal database and optionally in a space time dataset */
218 int tgis_register_map(tgisMap *map, char map_type, char *stds_name);
219 
220 /*! Unregister a map from the temporal database or optionally from a space time dataset */
221 int tgis_unregister_map(tgisMap *map, char map_type, char *stds_name);
222 
223 /*! Register maps in the temporal database and optionally in a space time dataset */
224 int tgis_register_maps(tgisMapList *list, char map_type, char *stds_name);
225 
226 /*! Unregister maps from the temporal database or optionally from a space time dataset */
227 int tgis_unregister_maps(tgisMapList *list, char map_type, char *stds_name);
228 
229 /*! Get all maps that are registered in a space time dataset */
230 tgisDatasetList *tgis_get_registered_maps(char *stds_name, char *mapset,
231  char stds_type, char *order,
232  char *where);
233 
234 /* stds.c */
235 /*! Get all stds from the temporal database */
236 tgisDatasetList *tgis_get_registered_stds(char *stds_name, char *mapset,
237  char stds_type, char temporal_type,
238  char *order, char *where);
239 
240 /*! Get the information about a specific space time dataset from the temporal database */
241 tgisDataset *tgis_get_stds_info(char *stds_name, char *mapset, char stds_type);
242 
243 #endif
struct _tgisExtent tgisExtent
tgisDatasetList finished
Definition: temporal.h:163
void tgis_free_dataset_list(tgisDatasetList *list)
char dataset_type
Definition: temporal.h:145
tgisDatasetList starts
Definition: temporal.h:160
tgisDatasetList covered
Definition: temporal.h:168
void tgis_free_map_list(tgisMapList *list)
Free allocated memory of an integer list.
Definition: map_list.c:28
tgisDatasetList finishes
Definition: temporal.h:162
char has_end
Definition: temporal.h:96
char * tgis_get_default_database_name(void)
Get default TGIS database name for the sqlite connection.
const char * tgis_get_default_driver_name(void)
Get default TGIS driver name.
tgisMapList * tgis_new_map_list()
Return a new integer list.
Definition: map_list.c:53
int tgis_build_topology(tgisDatasetList *A, char spatial)
tgisDataset * tgis_get_stds_info(char *stds_name, char *mapset, char stds_type)
tgisDatasetList overlapped
Definition: temporal.h:157
char * mapset
Definition: temporal.h:135
tgisDatasetList meet
Definition: temporal.h:172
tgisDatasetList in
Definition: temporal.h:170
double bottom
Definition: temporal.h:102
double start
Definition: temporal.h:94
int tgis_register_maps(tgisMapList *list, char map_type, char *stds_name)
char * creator
Definition: temporal.h:136
tgisMap ** values
Array of tgisMap struct&#39;s.
Definition: temporal.h:62
tgisDatasetList contain
Definition: temporal.h:171
char * tgis_get_mapset_database_name(const char *)
Get TGIS database name.
struct _tgisDataset tgisDataset
tgisDatasetList started
Definition: temporal.h:161
char * mapset
Definition: temporal.h:47
int tgis_set_default_connection(void)
Sets up TGIS database connection settings using GRASS default.
int tgis_modify_stds(char *stds_name, char stds_type, char *title, char *description, char *semantic_type, char *aggregation_type)
tgisDatasetList * tgis_get_registered_maps(char *stds_name, char *mapset, char stds_type, char *order, char *where)
int tgis_set_connection(dbConnection *connection)
Set Temporal GIS DB connection settings.
char * tgis_get_database_name(void)
Get TGIS database name.
tgisDatasetList equal
Definition: temporal.h:153
double north
Definition: temporal.h:97
double end
Definition: temporal.h:95
struct _tgisDataset ** values
Array of tgisDataset structs.
Definition: temporal.h:119
tgisDatasetList contains
Definition: temporal.h:159
tgisDatasetList * tgis_get_registered_stds(char *stds_name, char *mapset, char stds_type, char temporal_type, char *order, char *where)
void tgis_init_dataset_list(tgisDatasetList *list)
struct _tgisMap tgisMap
char * tgis_get_driver_name(void)
Get TGIS driver name.
List of tgisDatasets struct&#39;s.
Definition: temporal.h:114
tgisDatasetList equivalent
Definition: temporal.h:166
int alloc_values
Allocated space for tgisMap struct&#39;s.
Definition: temporal.h:70
int tgis_register_map(tgisMap *map, char map_type, char *stds_name)
double west
Definition: temporal.h:100
struct TimeStamp ts
Definition: temporal.h:140
int n_values
Number of tgisMap struct&#39;s in the list.
Definition: temporal.h:66
char is_stds
Definition: temporal.h:147
List of tgisMap struct&#39;s.
Definition: temporal.h:57
double top
Definition: temporal.h:101
void tgis_init_map_list(tgisMapList *list)
Init a tgisMapList and free allocated memory.
Definition: map_list.c:67
int tgis_unregister_map(tgisMap *map, char map_type, char *stds_name)
double south
Definition: temporal.h:98
char temporal_type
Definition: temporal.h:138
tgisDatasetList during
Definition: temporal.h:158
int tgis_update_stds(char *stds_name, char stds_type)
int alloc_values
Allocated space for tgisDataset structs.
Definition: temporal.h:127
struct _tgisDatasetList tgisDatasetList
List of tgisDatasets struct&#39;s.
double east
Definition: temporal.h:99
tgisDatasetList precedes
Definition: temporal.h:155
int tgis_remove_stds(char *stds_name, char stds_type, char remove_maps)
char * name
Definition: temporal.h:46
void tgis_dataset_list_add(tgisDataset *dataset)
int tgis_unregister_maps(tgisMapList *list, char map_type, char *stds_name)
tgisDatasetList overlaps
Definition: temporal.h:156
char * name
Definition: temporal.h:134
void * metadata
Definition: temporal.h:143
Definition: manage.h:4
void tgis_map_list_add(tgisMapList *list, tgisMap *map)
Add a map to tgisMapList.
Definition: map_list.c:100
struct _tgisDataset * prev
Definition: temporal.h:150
int tgis_build_topology2(tgisDatasetList *A, tgisDatasetList *B, char spatial)
int order(int i_x, int i_y, int yNum)
Definition: InterpSpline.c:54
struct _tgisDataset * next
Definition: temporal.h:149
Definition: gis.h:565
tgisDatasetList * tgis_new_dataset_list()
void tgis_dataset_list_insert(tgisDatasetList *list, char *name, char *mapset, char *creator, DateTime *creation_time, char temporal_type, struct TimeStamp *ts, tgisExtent *extent, void *metadata, char dataset_type, char is_stds)
tgisDatasetList cover
Definition: temporal.h:167
Definition: ogsf.h:232
const char * name
Definition: named_colr.c:7
int tgis_create_stds(char *stds_name, char stds_type, char temporal_type, char *title, char *description, char *semantic_type, char *aggregation_type)
tgisDatasetList follows
Definition: temporal.h:154
void tgis_map_list_insert(tgisMapList *list, char *name, char *mapset, struct TimeStamp *ts)
Insert map information into tgisMapList.
Definition: map_list.c:130
int tgis_get_connection(dbConnection *connection)
Get Temporal GIS DB connection settings.
tgisDatasetList overlap
Definition: temporal.h:169
tgisExtent extent
Definition: temporal.h:141
int n_values
Number of tgisDataset structs in the list.
Definition: temporal.h:123
struct _tgisMapList tgisMapList
List of tgisMap struct&#39;s.
struct TimeStamp ts
Definition: temporal.h:48
DateTime creation_time
Definition: temporal.h:137
char * tgis_get_mapset_driver_name(const char *)
Get TGIS driver name from a specific mapset.