Archived

This topic is now archived and is closed to further replies.

n4gix

TrafficRadar / TCAS for XML version 2.0. Beta testers?

Recommended Posts

Hi all of you, reworked my traffic radar for XML to accomodate a lot of suggestions and requests. If no one has any additions I'll upload it it on Monday.In the complete package all files will be together, I had to split it up.

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

I fixed a number of compiler warnings in an earlier version related to using deprecated string functions. So the original one I have now compiles without warnings.If I get a chance to do the same to this version on VS (if it needs it), I'll send it to you if you want.I am still amazed that you figured all this out, and there was not really an Arne there for you to ask questions!

Share this post


Link to post
Share on other sites

Ah, yes I forgot. My primay compiler is still VC++ 6.0, but with Visual C++ 2005 you'll get a lot of warnings, since the string handling syntax changed. I didn't think about making source code that is compatible to both compiler versions at the same time. BTW how can you eliminate the warning to "strcpy" in ConvertPropertyToString()? OK the whole method is not really necessary, but that's not the point.

Share this post


Link to post
Share on other sites

I'll look into that as I reach it. I guess I'll chronical here what I do on VS 2005 to get this to compile without warnings.So for the first installment:Well after creating an empty project and adding existing source and header files to it the first problem run into in an attempted build is:Compiling...TrafficRadarXML.cppc:documents and settingspatrickmy documentsvisual studio 2005projectsgauge projectstrafficradarxml2GdiPlusRadar.h(26) : warning C4005: 'UNICODE' : macro redefinition command-line arguments : see previous definition of 'UNICODE'GdiPlusRadar.cppc:documents and settingspatrickmy documentsvisual studio 2005projectsgauge projectstrafficradarxml2GdiPlusRadar.h(26) : warning C4005: 'UNICODE' : macro redefinition command-line arguments : see previous definition of 'UNICODE'Within GdiPlusRadar.h I do this:#pragma once#include #include // Definition of ULONG_PTR unsigned int#include using namespace Gdiplus;#include "..incfs9gauges.h" // Available for all projects#include "TrafficData.h"(vs.)/*#include "fs9gauges.h"#include "TrafficData.h"#ifndef SAFE_DELETE #define SAFE_DELETE(classp) if((classp)) delete (classp); (classp) =NULL#endif//SAFE_DELETE#ifndef ULONG_PTR #define ULONG_PTR unsigned int#endif#define UNICODE//Check also://http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdicpp/GDIPlus/GDIPlusreference.asp#include using namespace Gdiplus;*/as it is cleaner, an elimninates redefinition problem.------Use:#pragma once(vs.)#ifndef GDIPLUSRADAR_H#define GDIPLUSRADAR_H// Code here#enddef // GDIPLUSRADAR_H

Share this post


Link to post
Share on other sites

//------------------------------------------------------------------// Compiler warning://------------------------------------------------------------------GdiPlusRadar.cpp.GdiPlusRadar.cpp(30) : warning C4996: 'sprintf' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestdio.h(345) : see declaration of 'sprintf' Message: 'This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'//------------------------------------------------------------------// Solution//------------------------------------------------------------------/* Existing code - line 30sprintf(m_tooltip,"ID: %s ALT: %dft GS: %.0fkt TRK: %.0f

Share this post


Link to post
Share on other sites

//------------------------------------------------------------------// Compiler warning://------------------------------------------------------------------.GdiPlusRadar.cpp(77) : warning C4996: 'swprintf' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludeswprintf.inl(85) : see declaration of 'swprintf' Message: 'swprintf has been changed to conform with the ISO C standard, adding an extra character count parameter. To use traditional Microsoft swprintf, set _CRT_NON_CONFORMING_SWPRINTFS.'.GdiPlusRadar.cpp(78) : warning C4996: 'swprintf' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludeswprintf.inl(85) : see declaration of 'swprintf' Message: 'swprintf has been changed to conform with the ISO C standard, adding an extra character count parameter. To use traditional Microsoft swprintf, set _CRT_NON_CONFORMING_SWPRINTFS.'//------------------------------------------------------------------// Solution://------------------------------------------------------------------ swprintf(altstring,L"%+03d",ROUND(pai_data->dlt_alt/100)); swprintf(idstring,L"%S",pai_data->atc_id);change to: swprintf_s(altstring, sizeof(altstring),L"%+03d",ROUND(pai_data->dlt_alt/100)); swprintf_s(idstring, sizeof(idstring),L"%S",pai_data->atc_id);Patrick

Share this post


Link to post
Share on other sites

In similar fashion I updated all the other functions and finally this one in the constructor:.GdiPlusRadar.cpp(369) : warning C4996: 'wcscpy' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(250) : see declaration of 'wcscpy' Message: 'This function or variable may be unsafe. Consider using wcscpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.' wcscpy(m_symbolfont,FONT_TYPE);to: wcscpy_s(m_symbolfont, sizeof(m_symbolfont), FONT_TYPE);//---------------------------------------------------------Finally, for this file, we get a whole lot of warnings:.GdiPlusRadar.cpp(425) : warning C4267: 'argument' : conversion from 'size_t' to 'INT', possible loss of data.GdiPlusRadar.cpp(428) : warning C4267: 'argument' : conversion from 'size_t' to 'INT', possible loss of data.GdiPlusRadar.cpp(459) : warning C4267: 'argument' : conversion from 'size_t' to 'INT', possible loss of data.GdiPlusRadar.cpp(462) : warning C4267: 'argument' : conversion from 'size_t' to 'INT', possible loss of data.GdiPlusRadar.cpp(491) : warning C4267: 'argument' : conversion from 'size_t' to 'INT', possible loss of data.GdiPlusRadar.cpp(493) : warning C4267: 'argument' : conversion from 'size_t' to 'INT', possible loss of data.GdiPlusRadar.cpp(502) : warning C4267: 'argument' : conversion from 'size_t' to 'INT', possible loss of data.GdiPlusRadar.cpp(504) : warning C4267: 'argument' : conversion from 'size_t' to 'INT', possible loss of data.GdiPlusRadar.cpp(568) : warning C4267: 'argument' : conversion from 'size_t' to 'INT', possible loss of data.GdiPlusRadar.cpp(570) : warning C4267: 'argument' : conversion from 'size_t' to 'INT', possible loss of data.GdiPlusRadar.cpp(611) : warning C4267: 'argument' : conversion from 'size_t' to 'INT', possible loss of data.GdiPlusRadar.cpp(613) : warning C4267: 'argument' : conversion from 'size_t' to 'INT', possible loss of dataAs there appears to be no alternative, I just cast with (int), although probably should use the newer form, this is shorter. m_graphics->MeasureString(altstring, (int)wcslen(altstring), &font,PointF(x+m_symbol_factor*ABVSTR_OFFSET_X,y+m_symbol_factor*ABVSTR_OFFSET_Y),&stringFormat, &boundRect); Now this file compiles without error or warning.Hope this is helpful or interesting.Patrick

Share this post


Link to post
Share on other sites

In case you want the completed file, I've attached it.Patrick

Share this post


Link to post
Share on other sites

In TrafficData.cppTrafficData.cpp.TrafficData.cpp(55) : warning C4996: 'strncpy' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(156) : see declaration of 'strncpy' Message: 'This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.Change:strncpy(pai_data->atc_id, m_ptraffic_info->GetPlayerName(ai_id), MAX_CHARS_ATC_ID);to:strncpy_s(pai_data->atc_id, MAX_CHARS_ATC_ID, m_ptraffic_info->GetPlayerName(ai_id), MAX_CHARS_ATC_ID);and this file compiles without warnings.Patrick

Share this post


Link to post
Share on other sites

And in XMLCCallbacks.cpp we have the following warnings which can be fixed in similar fashion to ones I have already posted:XMLCCallbacks.cpp.XMLCCallbacks.cpp(361) : warning C4996: 'strncpy' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(156) : see declaration of 'strncpy' Message: 'This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'.XMLCCallbacks.cpp(443) : warning C4996: 'stricmp' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp' Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'.XMLCCallbacks.cpp(632) : warning C4996: 'sprintf' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestdio.h(345) : see declaration of 'sprintf' Message: 'This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'.XMLCCallbacks.cpp(672) : warning C4996: 'stricmp' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp' Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'.XMLCCallbacks.cpp(719) : warning C4996: 'stricmp' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp' Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'.XMLCCallbacks.cpp(746) : warning C4996: 'stricmp' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp' Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'.XMLCCallbacks.cpp(752) : warning C4996: 'stricmp' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp' Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'.XMLCCallbacks.cpp(759) : warning C4996: 'stricmp' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp' Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'.XMLCCallbacks.cpp(766) : warning C4996: 'stricmp' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp' Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'.XMLCCallbacks.cpp(773) : warning C4996: 'stricmp' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp' Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'.XMLCCallbacks.cpp(778) : warning C4996: 'stricmp' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp' Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'.XMLCCallbacks.cpp(783) : warning C4996: 'stricmp' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp' Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'.XMLCCallbacks.cpp(788) : warning C4996: 'stricmp' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp' Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'.XMLCCallbacks.cpp(793) : warning C4996: 'stricmp' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp' Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'.XMLCCallbacks.cpp(798) : warning C4996: 'stricmp' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp' Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'.XMLCCallbacks.cpp(803) : warning C4996: 'stricmp' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp' Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'.XMLCCallbacks.cpp(808) : warning C4996: 'stricmp' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp' Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'.XMLCCallbacks.cpp(813) : warning C4996: 'stricmp' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp' Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'.XMLCCallbacks.cpp(818) : warning C4996: 'stricmp' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(213) : see declaration of 'stricmp' Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _stricmp. See online help for details.'.XMLCCallbacks.cpp(835) : warning C4996: 'strcpy' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(73) : see declaration of 'strcpy' Message: 'This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'.XMLCCallbacks.cpp(838) : warning C4996: 'strcpy' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(73) : see declaration of 'strcpy' Message: 'This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'.XMLCCallbacks.cpp(841) : warning C4996: 'strcpy' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(73) : see declaration of 'strcpy' Message: 'This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'.XMLCCallbacks.cpp(844) : warning C4996: 'strcpy' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(73) : see declaration of 'strcpy' Message: 'This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'.XMLCCallbacks.cpp(847) : warning C4996: 'strcpy' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(73) : see declaration of 'strcpy' Message: 'This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'.XMLCCallbacks.cpp(850) : warning C4996: 'strcpy' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(73) : see declaration of 'strcpy' Message: 'This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'.XMLCCallbacks.cpp(853) : warning C4996: 'strcpy' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(73) : see declaration of 'strcpy' Message: 'This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'.XMLCCallbacks.cpp(856) : warning C4996: 'strcpy' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(73) : see declaration of 'strcpy' Message: 'This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'.XMLCCallbacks.cpp(859) : warning C4996: 'strcpy' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(73) : see declaration of 'strcpy' Message: 'This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'.XMLCCallbacks.cpp(862) : warning C4996: 'strcpy' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(73) : see declaration of 'strcpy' Message: 'This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'.XMLCCallbacks.cpp(865) : warning C4996: 'strcpy' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(73) : see declaration of 'strcpy' Message: 'This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'.XMLCCallbacks.cpp(868) : warning C4996: 'strcpy' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(73) : see declaration of 'strcpy' Message: 'This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'.XMLCCallbacks.cpp(871) : warning C4996: 'strcpy' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(73) : see declaration of 'strcpy' Message: 'This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'.XMLCCallbacks.cpp(874) : warning C4996: 'strcpy' was declared deprecated c:Program FilesMicrosoft Visual Studio 8VCincludestring.h(73) : see declaration of 'strcpy' Message: 'This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'Patrick

Share this post


Link to post
Share on other sites

Put it in the 737 & CRJs HSI works great and thanks to you. Only the weather radar left to do now!! LOL. Paul

Share this post


Link to post
Share on other sites

Thanks for this marvellous module, it opens up endless possibilities for me in the J35J project. I added a parameter to change between boresight and top-down radar, it works perfectly. Just one thing I cannot figure out: how to get the graphic elements permanently bright. Is this not possible with the combination XML and GDI+? Or am I missing something here?/Thomas

Share this post


Link to post
Share on other sites

OMG I forgot that one. Too much coffee I suppose. Or not enough. ;o) Thanks!

Share this post


Link to post
Share on other sites

I noticed that it is not easy to make version of the TrafficRadarXML.dll that compiles with ALL versions of Visual Studio, I designed it for 6.0. So the question is: if everybody uses the 2005 edition, I switch to it, so only one version is needed. We have to stick with Visual Studio anyway, BCC doesn't allow a certain call which is needed for the ITrafficInfo interface (static_cast to abstract class), and GCC doesn't like the abstract class definition in fs9gauges.h at all, if I recall that right. So the question is VC 2005 or 6.0? I can do both, but I want to support only one version.

Share this post


Link to post
Share on other sites