<commit_before>//
// RoadMap.h
//
// Copyright (c) 2001-2006 Virtual Terrain Project
// Free for all uses, see license.txt for details.
//

#ifndef ROADMAPH
#define ROADMAPH

#include "DLG.h"

#define RMFVERSION_STRING "RMFFile2.0"
#define RMFVERSION_CURRENT 2.0
#define RMFVERSION_SUPPORTED 1.7	// oldest supported version

enum SurfaceType {
	SURFT_NONE,		// 0
	SURFT_GRAVEL,	// 1
	SURFT_TRAIL,	// 2
	SURFT_2TRACK,	// 3
	SURFT_DIRT,		// 4
	SURFT_PAVED,	// 5
	SURFT_RAILROAD,	// 6
	SURFT_STONE		// 7
};

//
// This enum describes how a single link meets a node.
//
enum IntersectionType {
	IT_NONE,	// uncontrolled
	IT_LIGHT,	// a traffic light
	IT_STOPSIGN,  // a stop sign
};

enum LightStatus {
	LT_INVALID,
	LT_RED,
	LT_YELLOW,
	LT_GREEN
};

// link flags
#define RF_SIDEWALK	0x0800
#define RF_PARKING	0x0400
#define RF_MARGIN	0x0200
#define RF_FORWARD	0x0080	// true if traffic flows from node 0 to 1
#define RF_REVERSE	0x0040	// true if traffic flows from node 1 to 0
// the following are for temporary, runtime use
#define RF_HIT		0x0001

// Typical, default values for widths, in meters
#define SIDEWALK_WIDTH		1.5f
#define CURB_HEIGHT			0.15f
#define MARGIN_WIDTH		1.6f
#define LANE_WIDTH			3.3f
#define PARKING_WIDTH		LANE_WIDTH

// Nodes and Links refer to each other, so use forward declarations
class TNode;
class TLink;

// Store the connectivity information for each place a link meets a node.
struct LinkConnect
{
	TLink *pLink;

	// True if the link starts at this node, false if it ends
	bool bStart;

	// intersection types of the link at this node.
	IntersectionType eIntersection;

	// light of the link at this node.
	LightStatus eLight;

	// angle of each link, not initialized till SortLinksByAngle is called
	float fLinkAngle;
};

/**
 * A Transporation Node is a place where 2 or more links meet.
 */
class TNode
{
public:
	TNode();
	virtual ~TNode();

	// comparison
	bool operator==(TNode &ref);

	//copies internal variables from given node.
	void Copy(TNode* node);

	TLink *GetLink(int n);
	int AddLink(TLink *pR, bool bStart);		// attaches a link to the node
	void DetachLink(TLink *pR, bool bStart);	// detaches the link from the node
	void DetermineLinkAngles();	// resulting angles > 0
	float GetLinkAngle(int iLinkNum);
	void SortLinksByAngle();	// sorts the internal links by angle.
	DPoint2 GetAdjacentLinkPoint2d(int iLinkNum);  //returns the 2nd point on the link from the node.

	int GetLinkNum(TLink *link, bool bStart);
	LinkConnect &GetLinkConnect(int iLinkNum) { return m_connect[iLinkNum]; }

	//sets intersection type for node.  returns false if link is invalid
	bool SetIntersectType(int linkNum, IntersectionType type);  //linkNum is internal index within the node
	IntersectionType GetIntersectType(int linkNum); //returns the intersection type of given link index (not ID)
	LightStatus GetLightStatus(int linkNum);		//returns the light status of given link index (not ID)
	bool SetLightStatus(int linkNum, LightStatus light); //sets the light status of given link index (not ID)

	bool HasLights();
	bool IsControlled();	// true if any stopsigns or stoplights

	//adjust the light relationship of the links at the node (if the intersection is has a signal light.)
	void AdjustForLights();

	DPoint2 m_p;	// utm coordinates of center
	int m_iLinks;	// number of links meeting here

	TNode *m_pNext;

	// only used for reading from DLG/RMF
	int FindLink(int linkID);	// returns internal number of link with given ID.  -1 if not found.
	int m_id;

protected:
	// Information about the links that connect to or from this node.
	std::vector<LinkConnect> m_connect;
<commit_msg>comment tweaks<commit_after>//
// RoadMap.h
//
// Copyright (c) 2001-2007 Virtual Terrain Project
// Free for all uses, see license.txt for details.
//

#ifndef ROADMAPH
#define ROADMAPH

#include "DLG.h"

#define RMFVERSION_STRING "RMFFile2.0"
#define RMFVERSION_CURRENT 2.0
#define RMFVERSION_SUPPORTED 1.7	// oldest supported version

enum SurfaceType {
	SURFT_NONE,		// 0
	SURFT_GRAVEL,	// 1
	SURFT_TRAIL,	// 2
	SURFT_2TRACK,	// 3
	SURFT_DIRT,		// 4
	SURFT_PAVED,	// 5
	SURFT_RAILROAD,	// 6
	SURFT_STONE		// 7
};

//
// This enum describes how a single link meets a node.
//
enum IntersectionType {
	IT_NONE,	// uncontrolled
	IT_LIGHT,	// a traffic light
	IT_STOPSIGN,  // a stop sign
};

enum LightStatus {
	LT_INVALID,
	LT_RED,
	LT_YELLOW,
	LT_GREEN
};

// link flags
#define RF_SIDEWALK	0x0800
#define RF_PARKING	0x0400
#define RF_MARGIN	0x0200
#define RF_FORWARD	0x0080	// true if traffic flows from node 0 to 1
#define RF_REVERSE	0x0040	// true if traffic flows from node 1 to 0
// the following are for temporary, runtime use
#define RF_HIT		0x0001

// Typical, default values for widths, in meters
#define SIDEWALK_WIDTH		1.5f
#define CURB_HEIGHT			0.15f
#define MARGIN_WIDTH		1.6f
#define LANE_WIDTH			3.3f
#define PARKING_WIDTH		LANE_WIDTH

// Nodes and Links refer to each other, so use forward declarations
class TNode;
class TLink;

// Store the connectivity information for each place a link meets a node.
struct LinkConnect
{
	TLink *pLink;

	// True if the link starts at this node, false if it ends
	bool bStart;

	// intersection types of the link at this node.
	IntersectionType eIntersection;

	// light of the link at this node.
	LightStatus eLight;

	// angle of each link, not initialized till SortLinksByAngle is called
	float fLinkAngle;
};

/**
 * A Transporation Node is a place where 2 or more links meet.
 */
class TNode
{
public:
	TNode();
	virtual ~TNode();

	// comparison
	bool operator==(TNode &ref);

	//copies internal variables from another node.
	void Copy(TNode* node);

	TLink *GetLink(int n);
	int AddLink(TLink *pR, bool bStart);		// attaches a link to the node
	void DetachLink(TLink *pR, bool bStart);	// detaches the link from the node
	void DetermineLinkAngles();	// resulting angles > 0
	float GetLinkAngle(int iLinkNum);
	void SortLinksByAngle();	// sorts the internal links by angle.
	DPoint2 GetAdjacentLinkPoint2d(int iLinkNum);  //returns the 2nd point on the link from the node.

	int GetLinkNum(TLink *link, bool bStart);
	LinkConnect &GetLinkConnect(int iLinkNum) { return m_connect[iLinkNum]; }

	//sets intersection type for node.  returns false if link is invalid
	bool SetIntersectType(int linkNum, IntersectionType type);  //linkNum is internal index within the node
	IntersectionType GetIntersectType(int linkNum); //returns the intersection type of given link index (not ID)
	LightStatus GetLightStatus(int linkNum);		//returns the light status of given link index (not ID)
	bool SetLightStatus(int linkNum, LightStatus light); //sets the light status of given link index (not ID)

	bool HasLights();
	bool IsControlled();	// true if any stopsigns or stoplights

	//adjust the light relationship of the links at the node (if the intersection is has a signal light.)
	void AdjustForLights();

	DPoint2 m_p;	// utm coordinates of center
	int m_iLinks;	// number of links meeting here

	TNode *m_pNext;

	// only used while reading from DLG/RMF/OSM
	int FindLink(int linkID);	// returns internal number of link with given ID.  -1 if not found.
	int m_id;

protected:
	// Information about the links that connect to or from this node.
	std::vector<LinkConnect> m_connect;

{'fraction_non_alphanumeric': 0.08419457075926691, 'fraction_numerical': 0.02011850626980846, 'mean_word_length': 3.803441429516876, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6314772', 'n_tokens_mistral': 2582, 'n_tokens_neox': 2435, 'n_words': 929}