Imported Upstream version 1.5
[routino] / src / types.h
index 852122f..c8af825 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************
- $Header: /home/amb/routino/src/RCS/types.h,v 1.40 2010/05/27 17:25:23 amb Exp $
+ $Header: /home/amb/routino/src/RCS/types.h,v 1.48 2010/09/17 17:43:41 amb Exp $
 
  Type definitions
 
 
 /* Constants and macros for handling them */
 
+/*+ An undefined node index. +*/
+#define NO_NODE        (~(index_t)0)
 
-/*+ The latitude and longitude conversion factor from floating point (radians) to integer. +*/
-#define LAT_LONG_SCALE (1024*65536)
+/*+ An undefined segment index. +*/
+#define NO_SEGMENT     (~(index_t)0)
 
-/*+ The latitude and longitude integer range within each bin. +*/
-#define LAT_LONG_BIN   65536
+/*+ An undefined way index. +*/
+#define NO_WAY         (~(index_t)0)
 
 
-/*+ A flag to mark a node as a super-node. +*/
-#define NODE_SUPER     ((index_t)0x80000000)
+/*+ The lowest number allowed for a fake node. +*/
+#define NODE_FAKE      ((index_t)0xffff0000)
 
-/*+ A segment index excluding the super-node flag. +*/
-#define SEGMENT(xxx)   (index_t)((xxx)&(~NODE_SUPER))
+/*+ The lowest number allowed for a fake segment. +*/
+#define SEGMENT_FAKE   ((index_t)0xffff0000)
 
 
-/*+ An undefined node index. +*/
-#define NO_NODE        (~(index_t)0)
+/*+ The latitude and longitude conversion factor from floating point (radians) to integer. +*/
+#define LAT_LONG_SCALE (1024*65536)
 
-/*+ An undefined segment index. +*/
-#define NO_SEGMENT     (~(index_t)0)
+/*+ The latitude and longitude integer range within each bin. +*/
+#define LAT_LONG_BIN   65536
 
-/*+ An undefined way index. +*/
-#define NO_WAY         (~(index_t)0)
+/*+ A flag to mark a node as a super-node. +*/
+#define NODE_SUPER     ((uint16_t)0x8000)
 
 
 /*+ A flag to mark a segment as one-way from node1 to node2. +*/
 #define SEGMENT_NORMAL ((distance_t)0x10000000)
 
 /*+ The real distance ignoring the ONEWAY_* and SEGMENT_* flags. +*/
-#define DISTANCE(xx)   ((distance_t)(xx)&(~(ONEWAY_1TO2|ONEWAY_2TO1|SEGMENT_SUPER|SEGMENT_NORMAL)))
+#define DISTANCE(xx)   ((distance_t)((xx)&(~(ONEWAY_1TO2|ONEWAY_2TO1|SEGMENT_SUPER|SEGMENT_NORMAL))))
 
 /*+ The distance flags selecting only the ONEWAY_* and SEGMENT_* flags. +*/
-#define DISTFLAG(xx)   ((distance_t)(xx)&(ONEWAY_1TO2|ONEWAY_2TO1|SEGMENT_SUPER|SEGMENT_NORMAL))
+#define DISTFLAG(xx)   ((distance_t)((xx)&(ONEWAY_1TO2|ONEWAY_2TO1|SEGMENT_SUPER|SEGMENT_NORMAL)))
 
 
 /*+ A very large almost infinite distance. +*/
@@ -178,8 +180,9 @@ typedef enum _Highway
   Way_Cycleway    =10,
   Way_Path        =11,
   Way_Steps       =12,
+  Way_Ferry       =13,
 
-  Way_Count       =13,       /* One more than the number of highway types. */
+  Way_Count       =14,       /* One more than the number of highway types. */
 
   Way_OneWay      =32,
   Way_Roundabout  =64
@@ -211,13 +214,15 @@ typedef enum _Transport
 
 
 /*+ The allowed traffic on a way. +*/
-typedef uint16_t wayallow_t;
+typedef uint16_t allow_t;
 
 #define ALLOWED(xx)  (1<<((xx)-1))
 
 /*+ The different allowed traffic on a way. +*/
 typedef enum _Allowed
  {
+  Allow_None       = 0,
+
   Allow_Foot       = ALLOWED(Transport_Foot      ),
   Allow_Horse      = ALLOWED(Transport_Horse     ),
   Allow_Wheelchair = ALLOWED(Transport_Wheelchair),
@@ -237,14 +242,16 @@ typedef enum _Allowed
 /*+ The individual properties of a highway. +*/
 typedef enum _Property
  {
-  Property_None      = 0,
+  Property_None         = 0,
 
-  Property_Paved     = 1,
-  Property_Multilane = 2,
-  Property_Bridge    = 3,
-  Property_Tunnel    = 4,
+  Property_Paved        = 1,
+  Property_Multilane    = 2,
+  Property_Bridge       = 3,
+  Property_Tunnel       = 4,
+  Property_FootRoute    = 5,
+  Property_BicycleRoute = 6,
 
-  Property_Count     = 5       /* One more than the number of property types. */
+  Property_Count        = 7       /* One more than the number of property types. */
  }
  Property;
 
@@ -257,12 +264,16 @@ typedef uint8_t wayprop_t;
 /*+ The different properties of a way. +*/
 typedef enum _Properties
  {
-  Properties_Paved     = PROPERTIES(Property_Paved),
-  Properties_Multilane = PROPERTIES(Property_Multilane),
-  Properties_Bridge    = PROPERTIES(Property_Bridge),
-  Properties_Tunnel    = PROPERTIES(Property_Tunnel),
+  Properties_None         = 0,
+
+  Properties_Paved        = PROPERTIES(Property_Paved),
+  Properties_Multilane    = PROPERTIES(Property_Multilane),
+  Properties_Bridge       = PROPERTIES(Property_Bridge),
+  Properties_Tunnel       = PROPERTIES(Property_Tunnel),
+  Properties_FootRoute    = PROPERTIES(Property_FootRoute),
+  Properties_BicycleRoute = PROPERTIES(Property_BicycleRoute),
 
-  Properties_ALL       = 255
+  Properties_ALL          = 255
  }
  Properties;
 
@@ -339,7 +350,7 @@ const char *HighwayName(Highway highway);
 const char *TransportName(Transport transport);
 const char *PropertyName(Property property);
 
-const char *AllowedNameList(wayallow_t allowed);
+const char *AllowedNameList(allow_t allowed);
 const char *PropertiesNameList(wayprop_t properties);
 
 const char *HighwayList(void);