⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 garmintypes.cpp

📁 garmin 协议处理范例: 处理了 0183协议 处理了 gps的专有格式等
💻 CPP
📖 第 1 页 / 共 3 页
字号:
//
// GPSMapEdit
// (c) Konstantin Galichsky (kg@geopainting.com), 2002-2005
//
// The Garmin-specific type set.
//

# include "StdAfx.h"
# include "Resource.h"
# include "GarminTypes.h"
# include "GarminRound.h"
# include "Map.h"
# include "Types.h"
# include "TypesDraw.h"
# include "TypesPOIDraw.h"
//# include "fvector.h"
# include "Globals.h"

bool Garmin_IsCity (USHORT _ushType) {
	const USHORT ushType = _ushType & 0xFF00;
	return 0x0100 <= ushType && ushType <= 0x1100;
}

bool Garmin_IsCity (const rgn_t & _rgn) {
	return _rgn.IsPoint () && Garmin_IsCity (_rgn.ushType);
}

bool Garmin_HasAddress (USHORT _ushType) {
	const USHORT ushType = _ushType & 0xFF00;
	return (0x2900 <= ushType && ushType <= 0x3000) || ushType == 0x1200;
}

bool Garmin_HasAddress (const rgn_t & _rgn) {
	return _rgn.IsPoint () && Garmin_HasAddress (_rgn.ushType);
}

bool Garmin_IsHwExit (USHORT _ushType) {
	const USHORT ushType = _ushType & 0xFF00;
	return 0x2000 <= ushType && ushType <= 0x2700;
}

bool Garmin_IsHwExit (const rgn_t & _rgn) {
	return _rgn.IsPoint () && Garmin_IsHwExit (_rgn.ushType);
}

bool Garmin_IsHeight (const rgn_t & _rgn) {
	if (_rgn.IsPoint ()) {
		const USHORT ushType = _rgn.ushType & 0xFF00;
		return 0x6200 == ushType || ushType == 0x6300;
	} else if (_rgn.IsPolyline ()) {
		return 0x20 <= _rgn.ushType && _rgn.ushType <= 0x25;
	} else
		return false;
}

bool Garmin_IsBackground (USHORT _ushType) {
	return _ushType == 0x4b;
}

bool Garmin_IsBackground (const rgn_t & _rgn) {
	return Garmin_IsBackground (_rgn.ushType) && _rgn.Kind == rkPolygon;
}

bool Garmin_IsRoad (USHORT _ushType) {
	if (0x01 <= _ushType && _ushType <= 0x0C)
		return true;
	if (_ushType == 0x16)
		return true;
	return false;
}

bool Garmin_IsRoad (const rgn_t & _rgn) {
	return _rgn.IsPolyline () && Garmin_IsRoad (_rgn.ushType);
}

///////////////////////////////////////////////

struct POI_desc_t {
	BYTE btPointCode;
	BYTE btPOISubcodeMin;
	BYTE btPOISubcodeMax;

	char * strTypeName;

		// The icon for point/POI. NOTE: can't be NULL; use g_hcurUnknown for default.
	HCURSOR *      phCursor;

	label_desc_t * pLabelDesc;
};

static POI_desc_t g_POIs [] = {
	{0x01, 0x00, 0,    "Large city (over 10M)",          & g_hcurCityMega,   & g_BigCityLabel},
	{0x02, 0x00, 0,    "Large city (5-10M)",             & g_hcurCityMega,   & g_BigCityLabel},
	{0x03, 0x00, 0,    "Large city (2-5M)",              & g_hcurCityBig,    & g_BigCityLabel},
	{0x04, 0x00, 0,    "Large city (1-2M)",              & g_hcurCityMedium, & g_CityLabel},
	{0x05, 0x00, 0,    "Medium city (0.5-1M)",           & g_hcurCityMedium, & g_CityLabel},
	{0x06, 0x00, 0,    "Medium city (200-500K)",         & g_hcurCityMedium, & g_CityLabel},
	{0x07, 0x00, 0,    "Medium city (100-200K)",         & g_hcurCitySmall},
	{0x08, 0x00, 0,    "Small city (50-100K)",           & g_hcurCitySmall},
	{0x09, 0x00, 0,    "Small city (20-50K)",            & g_hcurCitySmall},
	{0x0a, 0x00, 0,    "Small city/town (10-20K)",       & g_hcurSettlement},
	{0x0b, 0x00, 0,    "Small city/town (5-10K)",        & g_hcurSettlement},
	{0x0c, 0x00, 0,    "Settlement (2-5K)",              & g_hcurSettlement},
	{0x0d, 0x00, 0,    "Settlement (1-2K)",              & g_hcurSettlement},
	{0x0e, 0x00, 0,    "Settlement (500-1K)",            & g_hcurNamedpoint},
	{0x0f, 0x00, 0,    "Settlement (200-500)",           & g_hcurNamedpoint},
	{0x10, 0x00, 0,    "Settlement (100-200)",           & g_hcurNamedpoint},
	{0x11, 0x00, 0,    "Settlement (less 100)",          & g_hcurNamedpoint},

	{0x12, 0x00, 0,    "Marina with facilities",         & g_hcurWarf},

	// appears in some MapDekode maps
//	{0x13, 0x00, 0,    "Settlement ???",                 & g_hcurNamedpoint},

	{0x14, 0x00, 0x3F, "Major country name",             & g_hcurRegion, & g_BigRegionLabel},
	{0x15, 0x00, 0x3F, "Minor country name",             & g_hcurRegion, & g_BigRegionLabel},

	{0x1c, 0x00, 0,    "Obstruction",                    & g_hcurObstruction},
	{0x1c, 0x01, 0,    "Wreck",                          & g_hcurWreckVisible},
	{0x1c, 0x02, 0,    "Submerged wreck, dangerous",     & g_hcurWreckDangerous},
	{0x1c, 0x03, 0,    "Submerged wreck, non-dangerous", & g_hcurWreckNonDangerous},
	{0x1c, 0x04, 0,    "Wreck, cleared by wire-drag",    & g_hcurWreckDrag},
	{0x1c, 0x05, 0,    "Obstr., visible at high water",  & g_hcurObstructionAwash},
	{0x1c, 0x06, 0,    "Obstruction, awash",             & g_hcurObstructionAwash},
	{0x1c, 0x07, 0,    "Obstruction, submerged",         & g_hcurObstruction},
	{0x1c, 0x08, 0,    "Obstr., cleared by wire-drag",   & g_hcurObstructionDrag},
	{0x1c, 0x09, 0,    "Rock, awash",                    & g_hcurReefAwash},
	{0x1c, 0x0a, 0,    "Rock, submerged at low water",   & g_hcurReef},
	{0x1c, 0x0b, 0,    "Sounding",                       & g_hcurSounding},

	{0x1d, 0x00, 0,    "Tide",                           & g_hcurWater},
	{0x1d, 0x01, 0,    "Tide prediction",                & g_hcurWater},
	// in Garmin MapSource BlueCharts
	{0x1d, 0x02, 0,    "Tide prediction",                & g_hcurWater},

	{0x1e, 0x00, 0x3f, "State/province/region name",     & g_hcurRegion, & g_RegionLabel},
	{0x1f, 0x00, 0x3f, "County/parish name",             & g_hcurRegion, & g_RegionLabel},

	{0x20, 0x00, 0x3f, "HW Exit",                        & g_hcurExit},
	{0x21, 0x00, 0x3f, "HW Exit with facilities",        & g_hcurExit},
	{0x21, 0x0F, 0,    "HW Exit (service)",              & g_hcurExit},
	{0x22, 0x00, 0x3f, "HW Exit (restroom)",             & g_hcurRestroom},
	{0x23, 0x00, 0x3f, "HW Exit (convenience store)",    & g_hcurExit},
	{0x24, 0x00, 0x3f, "HW Exit (weight station)",       & g_hcurWeight},
	{0x25, 0x00, 0x3f, "HW Exit (toll booth)",           & g_hcurToll},
	{0x26, 0x00, 0x3f, "HW Exit (information)",          & g_hcurInformation},
	{0x27, 0x00, 0x3f, "HW Exit",                        & g_hcurExit},

	{0x28, 0x00, 0x3f, "Label",                          & g_hcurRegion, & g_RegionLabel},

	{0x29, 0x00, 0x3f, "Uncategorized business",         & g_hcurLand},

	{0x2a, 0x00, 0,    "Dining",                         & g_hcurDining},
	{0x2a, 0x01, 0,    "Dining (American)",              & g_hcurDining},
	{0x2a, 0x02, 0,    "Dining (Asian)",                 & g_hcurDining},
	{0x2a, 0x03, 0,    "Dining (barbecue)",              & g_hcurDining},
	{0x2a, 0x04, 0,    "Dining (Chinese)",               & g_hcurDining},
	{0x2a, 0x05, 0,    "Dining (Deli/Bakery)",           & g_hcurDining},
	{0x2a, 0x06, 0,    "Dining (international)",         & g_hcurDining},
	{0x2a, 0x07, 0,    "Fast food",                      & g_hcurDining},
	{0x2a, 0x08, 0,    "Dining (Italian)",               & g_hcurDining},
	{0x2a, 0x09, 0,    "Dining (Mexican)",               & g_hcurDining},
	{0x2a, 0x0a, 0,    "Dining (pizza)",                 & g_hcurDining},
	{0x2a, 0x0b, 0,    "Dining (sea food)",              & g_hcurDining},
	{0x2a, 0x0c, 0,    "Dining (steak/grill)",           & g_hcurDining},
	{0x2a, 0x0d, 0,    "Dining (bagel/donut)",           & g_hcurDining},
	{0x2a, 0x0e, 0,    "Dining (cafe/diner)",            & g_hcurDining},
	{0x2a, 0x0f, 0,    "Dining (French)",                & g_hcurDining},
	{0x2a, 0x10, 0,    "Dining (German)",                & g_hcurDining},
	{0x2a, 0x11, 0,    "Dining (British Isles)",         & g_hcurDining},

	{0x2b, 0x00, 0,    "Lodging",                        & g_hcurHotel},
	{0x2b, 0x01, 0,    "Hotel/Motel",                    & g_hcurHotel},
	{0x2b, 0x02, 0,    "Bed&Breakfast inn",              & g_hcurHotel},
	{0x2b, 0x03, 0,    "Camping/RV-Park",                & g_hcurCamping},
	{0x2b, 0x04, 0,    "Resort",                         & g_hcurHotel},

	{0x2c, 0x00, 0,    "Attraction",                     & g_hcurCulture},
	{0x2c, 0x01, 0,    "Amusement/Theme park",           & g_hcurAmusementPark},
	{0x2c, 0x02, 0,    "Museum/History",                 & g_hcurMuseum},
	{0x2c, 0x03, 0,    "Library",                        & g_hcurLibrary},
	{0x2c, 0x04, 0,    "Landmark",                       & g_hcurScenic},
	{0x2c, 0x05, 0,    "School",                         & g_hcurSchool},
	{0x2c, 0x06, 0,    "Park/Garden",                    & g_hcurPark},
	{0x2c, 0x07, 0,    "Zoo/Aquarium",                   & g_hcurZoo},
	{0x2c, 0x08, 0,    "Arena/Track",                    & g_hcurSports},
	{0x2c, 0x09, 0,    "Hall/Auditorium",                & g_hcurCulture},
	{0x2c, 0x0a, 0,    "Winery",                         & g_hcurBar},
	{0x2c, 0x0b, 0,    "Place of worship",               & g_hcurChurch},
//	{0x2c, 0x0c, 0,    "Hot spring",                     & g_hcurCulture},

	{0x2d, 0x00, 0,    "Entertainment",                  & g_hcurLeasure},
	{0x2d, 0x01, 0,    "Live theatre",                   & g_hcurTheatre},
	{0x2d, 0x02, 0,    "Bar/Nightclub",                  & g_hcurBar},
	{0x2d, 0x03, 0,    "Cinema",                         & g_hcurCinema},
	{0x2d, 0x04, 0,    "Casino",                         & g_hcurCasino},
	{0x2d, 0x05, 0,    "Golf course",                    & g_hcurGolf},
	{0x2d, 0x06, 0,    "Skiing center/resort",           & g_hcurSkiing},
	{0x2d, 0x07, 0,    "Bowling center",                 & g_hcurBowling},
	{0x2d, 0x08, 0,    "Ice skating",                    & g_hcurIceSkate},
	{0x2d, 0x09, 0,    "Swimming pool",                  & g_hcurSwimming},
	{0x2d, 0x0a, 0,    "Sports/Fitness Center",          & g_hcurSports},
	{0x2d, 0x0b, 0,    "Public sport airport",           & g_hcurAirport},

	{0x2e, 0x00, 0,    "Shopping",                       & g_hcurShopping},
	{0x2e, 0x01, 0,    "Department store",               & g_hcurDepartmentStore},
	{0x2e, 0x02, 0,    "Grocery store",                  & g_hcurShopping},
	{0x2e, 0x03, 0,    "General merchandiser",           & g_hcurShopping},
	{0x2e, 0x04, 0,    "Shopping center",                & g_hcurShopping},
	{0x2e, 0x05, 0,    "Pharmacy",                       & g_hcurPharmacy},
	{0x2e, 0x06, 0,    "Convenience store",              & g_hcurShopping},
	{0x2e, 0x07, 0,    "Apparel",                        & g_hcurShopping},
	{0x2e, 0x08, 0,    "House and garden",               & g_hcurShopping},
	{0x2e, 0x09, 0,    "Home furnishing",                & g_hcurShopping},
	{0x2e, 0x0a, 0,    "Speciality retail",              & g_hcurShopping},
	{0x2e, 0x0b, 0,    "Computer/Software",              & g_hcurShopping},
//	{0x2e, 0x0c, 0,    "Others",                         & g_hcurShopping},

	{0x2f, 0x00, 0,    "Generic service",                & g_hcurService},
	{0x2f, 0x01, 0,    "Auto fuel",                      & g_hcurPetrol},
	{0x2f, 0x02, 0,    "Auto rental",                    & g_hcurAutoRental},
	{0x2f, 0x03, 0,    "Auto repair",                    & g_hcurAutoRepair},
	{0x2f, 0x04, 0,    "Air transportation",             & g_hcurAirport},
	{0x2f, 0x05, 0,    "Post office",                    & g_hcurPostOffice},
	{0x2f, 0x06, 0,    "Bank/ATM",                       & g_hcurBank},
	{0x2f, 0x07, 0,    "Dealer/Auto parts",              & g_hcurCarDealer},
	{0x2f, 0x08, 0,    "Ground transportation",          & g_hcurBusStation},
	{0x2f, 0x09, 0,    "Marina/Boat repair",             & g_hcurWarf},
	{0x2f, 0x0a, 0,    "Wrecker service",                & g_hcurAutoRepair},
	{0x2f, 0x0b, 0,    "Parking",                        & g_hcurParking},
	{0x2f, 0x0c, 0,    "Rest area/Tourist info",         & g_hcurRestroom},
	{0x2f, 0x0d, 0,    "Automobile club",                & g_hcurAutoClub},
	{0x2f, 0x0e, 0,    "Car wash",                       & g_hcurAutoWash},
	{0x2f, 0x0f, 0,    "Garmin dealer",                  & g_hcurShopping},
	{0x2f, 0x10, 0,    "Personal services",              & g_hcurService},
	{0x2f, 0x11, 0,    "Business service",               & g_hcurService},

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -