1 /******************************************************************************
2  * $Id: gnm_priv.h 4b4fd1f9a696b025228d6489fc94e964cfdaab19 2016-11-19 16:54:08Z Dmitry Baryshnikov $
3  *
4  * Project:  GDAL/OGR Geography Network support (Geographic Network Model)
5  * Purpose:  GNM private and internal declarations.
6  * Authors:  Mikhail Gusev (gusevmihs at gmail dot com)
7  *           Dmitry Baryshnikov, polimax@mail.ru
8  *
9  ******************************************************************************
10  * Copyright (c) 2014, Mikhail Gusev
11  * Copyright (c) 2014-2015, NextGIS <info@nextgis.com>
12  *
13  * Permission is hereby granted, free of charge, to any person obtaining a
14  * copy of this software and associated documentation files (the "Software"),
15  * to deal in the Software without restriction, including without limitation
16  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
17  * and/or sell copies of the Software, and to permit persons to whom the
18  * Software is furnished to do so, subject to the following conditions:
19  *
20  * The above copyright notice and this permission notice shall be included
21  * in all copies or substantial portions of the Software.
22  *
23  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29  * DEALINGS IN THE SOFTWARE.
30  ****************************************************************************/
31 
32 #ifndef GNM_PRIV
33 #define GNM_PRIV
34 
35 #include "gdal_priv.h"
36 
37 /* -------------------------------------------------------------------- */
38 /*              Common constants for internal use                       */
39 /* -------------------------------------------------------------------- */
40 
41 // General constants.
42 #define GNM_VERSION     "1.0"
43 #define GNM_VERSION_NUM 100 //major * 100 + minor
44 
45 // Obligatory system layers.
46 #define GNM_SYSLAYER_META       "_gnm_meta"
47 #define GNM_SYSLAYER_GRAPH      "_gnm_graph"
48 #define GNM_SYSLAYER_FEATURES   "_gnm_features"
49 
50 // System field names.
51 // FORMAT NOTE: Shapefile driver does not support field names more than 10
52 //              characters.
53 
54 #define GNM_SYSFIELD_PARAMNAME  "key"
55 #define GNM_SYSFIELD_PARAMVALUE "val"
56 #define GNM_SYSFIELD_SOURCE     "source"
57 #define GNM_SYSFIELD_TARGET     "target"
58 #define GNM_SYSFIELD_CONNECTOR  "connector"
59 #define GNM_SYSFIELD_COST       "cost"
60 #define GNM_SYSFIELD_INVCOST    "inv_cost"
61 #define GNM_SYSFIELD_DIRECTION  "direction"
62 #define GNM_SYSFIELD_GFID       "gnm_fid"
63 #define GNM_SYSFIELD_LAYERNAME  "ogrlayer"
64 #define GNM_SYSFIELD_BLOCKED    "blocked"
65 #define GNM_SYSFIELD_PATHNUM    "path_num"
66 #define GNM_SYSFIELD_TYPE       "ftype"
67 
68 // Rule strings key-words.
69 #define GNM_RULEKW_CONNECTS "CONNECTS"
70 #define GNM_RULEKW_WITH "WITH"
71 #define GNM_RULEKW_VIA "VIA"
72 #define GNM_RULEKW_ALLOW "ALLOW"
73 #define GNM_RULEKW_DENY "DENY"
74 #define GNM_RULEKW_ANY "ANY"
75 
76 #define GNM_BLOCK_NONE 0x0000  // no blocking (vertex or edge)
77 #define GNM_BLOCK_SRC  0x0001  // the source vertex is blocked
78 #define GNM_BLOCK_TGT  0x0002  // the target vertext is blocked
79 #define GNM_BLOCK_CONN 0x0004  // the connection edge is blocked
80 #define GNM_BLOCK_ALL GNM_BLOCK_SRC | GNM_BLOCK_TGT | GNM_BLOCK_CONN
81 
82 // Other string constants.
83 #define GNM_SRSFILENAME "_gnm_srs.prj"
84 
85 // Corespondent datatype for identificator
86 // (i.e. int -> OFTInteger -> GetFieldAsInteger and
87 //       GUIntBig -> OFTInteger64 -> GetFieldAsInteger64)
88 #define GNMGFIDInt OFTInteger64
89 #define GetFieldAsGNMGFID GetFieldAsInteger64
90 #define GNMGFIDFormat CPL_FRMT_GIB
91 
92 #endif // GNM_PRIV
93