Archive
CPerformanceCounter v1.0
Just to let everyone know that v1.0 of CPerformanceCounter has been released. CPerformanceCounter is a freeware C++ class which encapsulates the performance counters API of Windows. The performance counter API on Windows is composed of the SDK calls "QueryPerformanceFrequency" and "QueryPerformanceCounter". These two methods provide a high frequency counter value (normally with a single digit Megahertz frequency), which is synchronized across CPU cores. This is the official way to implement high performance timers on Windows. Other approaches such as the Pentium assembly language instruction of "RDTSC" are available (wrapped by the CCPUTicker class of the author) but the frequency of this counter can change as the frequency of a CPU is changed based on technologies such as Intel SpeedStep. Also on modern CPUs different cores can be slowed down individually meaning that the value you get back can become inconsistent if your code is migrated from core to core as it runs. This simple class avoids these issues while still providing a simple and high speed API.
EnumSerialPorts v1.21
Just to let everyone know that v1.21 of EnumSerialPorts has been released. Updates for this version include:
- Updated copyright details.
- Code can now optionally use STL instead of MFC or ATL in the API. To use STL containers instead of MFC or ATL versions, please define CENUMERATESERIAL_USE_STL before you include enumser in your project. Please note that the code still internally uses ATL in the UsingWMI method, but the other functions do not. This means that the class should now be partly compilable on VC Express (2005, 2008 or 2010) as none of these have support for ATL or MFC. I do not personally have VC Express installed so people’s feedback on this would be appreciated. Thanks to Bill Adair for providing this update.
GPSCom v1.06 & IConnectionPointImplMT v1.02
Just to let everyone know that v1.06 of CGPSCom and v1.02 of IConnectionPointImplMT has been released. Updates for this version include:
- Updated copyright details.
- GPSCom now internally uses v1.27 of CSerialPort.
-
Updated the instructions on how to code the Fire_* methods to avoid a COM reference counting problem which could have resulted in memory leaks. Thanks to Peter Blanz for reporting this issue.
COSMCtrl v1.03
Just to let everyone know that v1.03 of COSMCtrl has been released. Updates for this version include:
- Updated the sample app to include copyright details in line with information at http://wiki.openstreetmap.org/wiki/Legal_FAQ#I_would_like_to_use_OpenStreetMap_maps._How_should_I_credit_you.3F. The copyright details are displayed in the about dialog and on the main map itself. For client applications which use COSMCtrl, you should review these details to make sure you are compliant with the OpenStreetMap licensing requirements.
- The zoom bar can now be shown using a standard Win32 slider control instead of custom draw code and this setting is now the default. To change this behaviour you can use SetDrawZoomBarAsSlider(FALSE)
- The setting to allow a zoom via double click has now been separated from the setting to allow a zoom via the wheel mouse.
- Sample app now shows the modified date of the tile in the Tile Properties dialog
- The sample app now allows a specific tile to be refreshed via the view context menu and the main application menu
- The scroll rose, zoom bar, and scale bar can all now be placed on the control in an arbitrary position. This is achieved via two additional parameters to SetDrawScrollRose, SetDrawZoomBar and SetDrawScaleBar. These parameters allow an anchor position on the map to be chosen for the control as well as an offset position.
- Fixed an issue where the download thread would get created if the cache directory was not specified.
- The class now supports markers, polylines, polygons and circles being overlaid on the map. In addition to just allowing static markers, polylines, polygons and circles to be added, the code now has comprehensive support for interactively editing, dragging, moving and deleted these items. The sample app has been extensively modified to demo these features.
- Re-implemented all GDI drawing code with GDI+. This provides much better support for features such as transparency etc and will make it easier to add more features to the code base going forward.
- The class now supports a full set of methods to calculate the distance between two points as well as calculate the end location from a start position given a certain distance and bearing. These methods implement C++ versions of Vincenty’s Direct and Inverse algorithms. These methods are required for calculation of the scale bar as well as supporting dragging polygons and polylines. The sample app now uses these features to show the distance and bearing for the first polyline or polygon which is selected in the status bar.
- The code to draw the scale bar has been re-factored to allow further detailed client customization.
- The various strings which are used by the class are now all stored in a string table. You need to ensure that all the string resources of ID "IDS_OSMCTRL*" and dialog resources of "IDD_OSMCTRL*" are included in your client application.
- Fixed a bug where the download thread would not be created if you changed the location of the map using the cursor keys
- The control now supports a Rectangular selection mode. When this mode is activated, you can select specific markers, polylines and polygons on the map and in conjunction with support for the "Delete" button you can interactively edit the items on the map
- Addition of a new comprehensive "Map Operations" dialog. This in conjunction with the rectangular selection mechanism allows you to delete specific tiles, download specific tiles (optionally skipping files which have already been downloaded) as well as support Mapnik re-render requests. This dialog uses a worker thread to remain responsive while these potentially lengthy operations are taking place. In addition this dialog provides feedback via a progress control and a static text notification area as the operation is taking place as well as cancelation support. This dialog on its own provides a good example on how to implement a responsive user interface while a lengthy operation is happening.
- The control now supports "decimation" of polylines and polygons. This feature adds new nodes between all the existing nodes of a polyline or polygon. This can prove useful where you have a feature where the curvature of the earth can cause distortion of the displayed object. By default this feature is provided for by double clicking on an editable polyline or polygon. Thanks to Dermot McNally for prompting this update
- The control now has support for drawing crosshairs at the center of the map.
- The control now supports a ZoomToBounds method. This method takes two positions which the method will ensure will be shown on the map at the highest possible zoom level. In conjunction with various new "GetBoundingRect*" methods you can now add your various items to the map and then zoom to those items. This avoids client code needing to explicitly handle zoom levels of center positions.
- The arrow keys now scroll by a small amount while the likes of PageUp / PageDown keys will scroll by a tile at a time.
Here’s a screen capture of the sample app in operation: