当前位置: 首页>>代码示例>>C++>>正文


C++ TMap::Dispose方法代码示例

本文整理汇总了C++中TMap::Dispose方法的典型用法代码示例。如果您正苦于以下问题:C++ TMap::Dispose方法的具体用法?C++ TMap::Dispose怎么用?C++ TMap::Dispose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TMap的用法示例。


在下文中一共展示了TMap::Dispose方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: AddMapsDialog2

OSErr AddMapsDialog2()
{
	char 		path[256], nameStr [256], shortFileName[256], tempStr[256];
	OSErr		err = noErr;
	long 		n;
	Point 		where = CenteredDialogUpLeft(M38b);
	TVectorMap	*vMap;
	TOSSMMap 	*oMap;
	Map3D 		*gMap;
	GridMap_c *gridMap = 0;
	OSType 	typeList[] = { 'NULL', 'NULL', 'NULL', 'NULL' };
	MySFReply 	reply;
	WorldRect	theRect = emptyWorldRect;
	short 		gridType;
	Boolean		isESI = false;
	float arrowDepth = 0;

#if TARGET_API_MAC_CARBON
		mysfpgetfile(&where, "", -1, typeList,
				   (MyDlgHookUPP)0, &reply, M38b, MakeModalFilterUPP(STDFilter));
		if (!reply.good) return USERCANCEL;
		strcpy(path, reply.fullPath);
		strcpy(tempStr,path);
		SplitPathFile(tempStr,shortFileName);
#else
	sfpgetfile(&where, "",
			   (FileFilterUPP)0,
			   -1, typeList,
			   (DlgHookUPP)0,
			   &reply, M38b,
			   (ModalFilterUPP)MakeUPP((ProcPtr)STDFilter, uppModalFilterProcInfo));
	if (!reply.good) return USERCANCEL;

	my_p2cstr(reply.fName);
	#ifdef MAC
		GetFullPath(reply.vRefNum, 0, (char *)reply.fName, path);
		strcpy(shortFileName,(char*) reply.fName);
	#else
		strcpy(path, reply.fName);
		strcpy(tempStr,path);
		SplitPathFile(tempStr,shortFileName);
	#endif
#endif	
	if (IsVectorMap (path, &isESI))
	{
		if (isESI) {printNote("File is ESI segments not map polygons");err=-1; return err;}
		strcpy (nameStr, "Vector Map: ");
		strcat (nameStr, shortFileName);
	
		vMap = (TVectorMap*) new TVectorMap (nameStr, theRect);
		if (!vMap)
			{ TechError("AddMapsDialog()", "new TVectorMap()", 0); return -1; }

		if (err = vMap -> InitMap(path)) { delete vMap; return err; }
	
		if (err = model->AddMap(vMap, 0))
		{
			vMap -> Dispose ();
			delete vMap;
			err = -1;
		}
	}
	else if (IsGridMap (path))
	{
		strcpy (nameStr, "Grid Map: ");
		strcat (nameStr, shortFileName);

		oMap = new TOSSMMap(nameStr, voidWorldRect);
		if (!oMap)
			{ TechError("AddMapsDialog()", "new TOSSMMap()", 0); return -1; }
	
		if (err = ((TOSSMMap*) oMap) -> InitMap(path)) { delete oMap; return err; }
	
		if (err = model->AddMap(oMap, 0))
		{
			oMap -> Dispose ();
			delete oMap;
			err = -1;
		}
	}
	else if (IsPtCurFile (path))
	{
		TMap *newMap = 0;
		TCurrentMover *newMover = CreateAndInitCurrentsMover (model->uMap,false,path,"ptcurfile",&newMap);	// already have path
		
		if (newMover)
		{
			PtCurMover *ptCurMover = dynamic_cast<PtCurMover*>(newMover);
			err = ptCurMover -> SettingsDialog();
			if(err)	
			{ 
				newMover->Dispose(); delete newMover; newMover = 0;
				if (newMap) {newMap->Dispose(); delete newMap; newMap = 0;} 
			}
	
			if(newMover && !err)
			{
				Boolean timeFileChanged = false;
				if (!newMap) 
				{
//.........这里部分代码省略.........
开发者ID:NOAA-ORR-ERD,项目名称:PyGnome,代码行数:101,代码来源:SETTINGS.CPP

示例2: AddMapsDialog

OSErr AddMapsDialog()
{
	char 		path[256], nameStr [256], shortFileName[256], tempStr[256];
	OSErr		err = noErr;
	long 		n;
	Point 		where = CenteredDialogUpLeft(M38b);
	TVectorMap	*vMap;
	TOSSMMap 	*oMap;
	OSType 	typeList[] = { 'NULL', 'NULL', 'NULL', 'NULL' };
	MySFReply 	reply;
	WorldRect	theRect = emptyWorldRect;
	short 		gridType;
	Boolean		isESI = false;
	float arrowDepth = 0;

#if TARGET_API_MAC_CARBON
		mysfpgetfile(&where, "", -1, typeList,
				   (MyDlgHookUPP)0, &reply, M38b, MakeModalFilterUPP(STDFilter));
		if (!reply.good) return USERCANCEL;
		strcpy(path, reply.fullPath);
		strcpy(tempStr,path);
		SplitPathFile(tempStr,shortFileName);
#else
	sfpgetfile(&where, "",
			   (FileFilterUPP)0,
			   -1, typeList,
			   (DlgHookUPP)0,
			   &reply, M38b,
			   (ModalFilterUPP)MakeUPP((ProcPtr)STDFilter, uppModalFilterProcInfo));
	if (!reply.good) return USERCANCEL;

	my_p2cstr(reply.fName);
	#ifdef MAC
		GetFullPath(reply.vRefNum, 0, (char *)reply.fName, path);
		strcpy(shortFileName,(char*) reply.fName);
	#else
		strcpy(path, reply.fName);
		strcpy(tempStr,path);
		SplitPathFile(tempStr,shortFileName);
	#endif
#endif	
	if (IsVectorMap (path, &isESI))
	{
		if (isESI) {printNote("File is ESI segments not map polygons");err=-1; return err;}
		strcpy (nameStr, "Vector Map: ");
		strcat (nameStr, shortFileName);
	
		vMap = (TVectorMap*) new TVectorMap (nameStr, theRect);
		if (!vMap)
			{ TechError("AddMapsDialog()", "new TVectorMap()", 0); return -1; }

		if (err = vMap -> InitMap(path)) { delete vMap; return err; }
	
		if (err = model->AddMap(vMap, 0))
		{
			vMap -> Dispose ();
			delete vMap;
			err = -1;
		}
	}
	else if (IsGridMap (path))
	{
		strcpy (nameStr, "Grid Map: ");
		strcat (nameStr, shortFileName);

		oMap = new TOSSMMap(nameStr, voidWorldRect);
		if (!oMap)
			{ TechError("AddMapsDialog()", "new TOSSMMap()", 0); return -1; }
	
		if (err = ((TOSSMMap*) oMap) -> InitMap(path)) { delete oMap; return err; }
	
		if (err = model->AddMap(oMap, 0))
		{
			oMap -> Dispose ();
			delete oMap;
			err = -1;
		}
	}
	else if (IsPtCurFile (path))
	{
		TMap *newMap = 0;
		TCurrentMover *newMover = CreateAndInitCurrentsMover (model->uMap,false,path,"ptcurfile",&newMap);	// already have path
		
		if (newMover)
		{
			PtCurMover *ptCurMover = dynamic_cast<PtCurMover*>(newMover);
			err = ptCurMover -> SettingsDialog();
			if(err)	
			{ 
				newMover->Dispose(); delete newMover; newMover = 0;
				if (newMap) {newMap->Dispose(); delete newMap; newMap = 0;} 
			}
	
			if(newMover && !err)
			{
				Boolean timeFileChanged = false;
				if (!newMap) 
				{
					err = AddMoverToMap (model->uMap, timeFileChanged, newMover);
				}
//.........这里部分代码省略.........
开发者ID:NOAA-ORR-ERD,项目名称:PyGnome,代码行数:101,代码来源:SETTINGS.CPP


注:本文中的TMap::Dispose方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。