Archive for January, 2010 downtime

January 12, 2010 Comments off

Just a note to let everyone know that there will be some expected downtime on my web site as my hosting provider migrates to a new platform. The expected outage will occur from c. 1 PM GMT on the 13 January 2010 till c. 1 AM GMT on the 14 January.

Happy Coding,

Categories: Web Site Updates

COSMCtrl v1.02

January 10, 2010 Comments off

Just to let everyone know that v1.02 of COSMCtrl has been released. Updates for this version include:

  • Fixed a bug in the display of the polar regions at low zoom settings.
  • You can now scroll horizontally continuously around all longitudes.
  • Fixed an issue where the scale would report a distance of 0 meters at zoom level 0.
  • Improved the overall responsiveness of the control by ensuring that the download thread returns quickly from any blocking calls when the code needs to terminate the download thread. The trick which the code uses is to share the Wininet session handle between the download thread and the main thread and when it comes time to kill the download thread the session handle is closed via InternetCloseHandle in the main thread. This causes any derived Wininet handles which the download thread has created from this session handle to become invalid and causes any blocking call on these handles to return with an error. This change also means that I do not need to completely re-architect the code to use asynchronous Wininet calls. Having taken a look at how asynchronous Wininet works I’m real glad about this.
  • Fixed an issue in DownloadThread() where the code would attempt to download a tile with an invalid Y value. This resulted in spurious TRACE messages in debug builds.
  • Fixed a bug where the OnPaint method was not using the values returned from GetDrawScrollRose(), GetDrawZoomBar() & GetDrawScaleBar().
  • As a really nice to have, the Zoom Bar is now drawn using transparency, just like on the main OpenStreetMap web site. As you may know GDI does not really handle transparency well, so I found it hard to find a good example on how to achieve this. Most of the examples I found were based on using a pre-existing image with an alpha channel already provided. My COSMCtrl code does not require any pre-rendered bitmaps and I wanted to keep the code this way. I did not also want to throw away all the GDI code and replace it with GDI+ code just for this one effect. For those interested in how the code works, it uses ATL::CImage to generate a 32 bit ARGB DIB section bitmap and select that into a memory device context. Then I use standard GDI calls as before to render most of the parts of the zoom bar, then I directly access the bits of the DIB section via CImage::GetBits and CImage::GetPitch and modify the transparency of specific pixels to achieve the effect I want. At this point you also need to do the calculations to ensure the RGB components of the pixel are premultiplied by the alpha value as this is what is required. Then I use CDC::AlphaBlend to blend the just created zoom bar pixels onto the map data which has already been rendered to the device context. I was worried about the performance of this code as I need to iterate across all the pixels of the DIB section to achieve this effect, but some profiling on my main dev machine showed that it added very little overhead to the total rendering time. All of this code is in COSMCtrl::DrawZoomBar and hopefully you may find this code of interest for your own projects which want to do runtime alpha blending. Finally if you do not want a transparent zoom bar, you can disable this effect using SetUseTransparencyForZoomBar(FALSE).
  • You can now optionally draw rectangles around each rendered tile via SetDrawTileOutlines(TRUE).
  • The sample app now ships with a VC 2008 solution and project instead of VC 2005.
  • The sample app now uses separate cache directories for the different tile providers. In addition the cache directory is now located at " "CSIDL_LOCAL_APPDATA"\OSMCtrlApp\"Provider" "
  • The client area is now invalidated when you change tile provider.
  • The sample app now can display a tile properties dialog when you right mouse click on the map. This dialog uses SysLink controls and as such will only show up if you build a Unicode version of the app. As such the binary included in the download is now the Static Unicode Release build. This tile properties dialog shows the following tile attributes: Provider, URL to download from, local cache path, the physical dimensions of the tile in vertically and horizontally, The center position of the tile, the tile Coordinates and the Rerender and status URLs if any. Please note that the vertical distance is the actual great arc distance from the top left of the tile to the bottom left, while the horizontal distance is the great arc distance from the bottom left of the tile to the bottom right of the tile. It is important to emphasize this as at lower zoom levels the scale of the map becomes different depending on where you are located in the tile.
  • Updated the sample app icon to use the standard OpenStreetMap logo.
Categories: Web Site Updates

Windows Live Blog SPAM

January 3, 2010 Comments off

Just a note to let everyone know that due to all the Blog SPAM which has been appearing on my blog, that as of today, I have disabled comments to my blog. I’m sorry to have to do this, but the amount of SPAM being put on my blog plus the relative lack of control which Windows Live seems to be able to deploy to prevent this problem has forced my hand on this decision.

Going forward I may look at migrating my blog to a more mature server environment which puts more onus on SPAM control. I’ve heard good things about WordPress but have not looked into it in any detail. I would be interested in peoples feedback and their experience using the various platforms out there. Being free would be a bonus also. What ever path I decide to move to going forward it will probably need to provide some mechanism to import my existing Windows Live blog entries if possible so that the change over can be as smooth as possible. Again your advice and experience would be appreciated.

For those who need to contact me to give me feedback about any of my blog entries or if you have questions in general about any of the source code I release, please feel free to drop by my web site at where you can send me a comment directly via the Ask PJ link or just use my standard email address as provided on the home page.

Happy Coding,

Categories: Programming