! Sanity check that geometry and family are compatible; note they may not be set (GMT_NOTSET) hence the use of signed ints */
| 2894 | |
| 2895 | /*! Sanity check that geometry and family are compatible; note they may not be set (GMT_NOTSET) hence the use of signed ints */ |
| 2896 | GMT_LOCAL bool gmtapi_validate_geometry (struct GMTAPI_CTRL *API, int family, int geometry) { |
| 2897 | bool problem = false; |
| 2898 | gmt_M_unused(API); |
| 2899 | if (geometry == GMT_NOTSET || family == GMT_NOTSET) return false; /* No errors if nothing to check yet */ |
| 2900 | switch (family) { |
| 2901 | case GMT_IS_DATASET: if (!(geometry == GMT_IS_NONE || geometry == GMT_IS_TEXT || (geometry & GMT_IS_PLP))) problem = true; break; /* Datasets can hold many things... */ |
| 2902 | case GMT_IS_GRID: if (geometry != GMT_IS_SURFACE) problem = true; break; /* Only surface is valid */ |
| 2903 | case GMT_IS_IMAGE: if (geometry != GMT_IS_SURFACE) problem = true; break; /* Only surface is valid */ |
| 2904 | case GMT_IS_PALETTE: if (geometry != GMT_IS_NONE) problem = true; break; /* Only text is valid */ |
| 2905 | case GMT_IS_POSTSCRIPT: if (geometry != GMT_IS_NONE) problem = true; break; /* Only text is valid */ |
| 2906 | case GMT_IS_CUBE: if (geometry != GMT_IS_VOLUME) problem = true; break; /* Only volume is valid */ |
| 2907 | case GMT_IS_VECTOR: if ((geometry & GMT_IS_PLP) == 0) problem = true; break; /* Must be one of those three */ |
| 2908 | case GMT_IS_MATRIX: if (geometry == GMT_IS_NONE) problem = true; break; /* Matrix can hold surfaces or DATASETs */ |
| 2909 | case GMT_IS_COORD: if (geometry != GMT_IS_NONE) problem = true; break; /* Only text is valid */ |
| 2910 | } |
| 2911 | return (problem); |
| 2912 | } |
| 2913 | |
| 2914 | /*! . */ |
| 2915 | GMT_LOCAL int gmtapi_decode_id (const char *filename) { |
no outgoing calls
no test coverage detected