Delphi World to Canvas map rendering
$30-250 USD
Paid on delivery
Hello!
I have a rather simple project for all the smart brains on here.
What I need is a translatable and zoomable implementation of a worldmap, with support for background texturing, written in Delphi. It should be very lightweight (not consume loads of CPU). It should have the ability to resize the map canvas if the window resizes.
I have data about entities (location, rotation, scale). I also have a background texture. Map center should by default base on own position, which gets passed to map also (see below). By default I mean that map should be rendered with this point in middle, unless user decides to translate the viewpoint. The should be able to render the background (the actual "map"), and place entities on this background. This should then be :
---Translatable---
-The user must be able to use the mouse to drag around the contents, while the entities remain at their positions (like google maps).
---Zoomable---
-The user must be able to zoom into the map (nearer to the map texture), while the entities behave mathematically correct (a.k.a change their position on canvas in accordance of zoom level). This also is pretty much what google maps does. Zoom should be as smooth as possible, with many zoom levels.
For development purposes, it's sufficient to draw squares of a color you choose for each added entity - this I will change later on.
Please write the code that does the World to Canvas coordinate conversion into a private method, so I can easily use this method to add new items for rendering later on.
The project should be written using the Graphics32 libary, as it is far faster then the native canvas implementation.
You can find this library here : [url removed, login to view]
As a summary, these methods should in some form be implemented :
[url removed, login to view](canvasWidth,canvasHeight); //Set the render canvas size. This will be called on form resize event.
[url removed, login to view](zoomLevel : integer); //This sets the zoom level. It should be as smooth as possible, with many zoom levels.
[url removed, login to view] (unknown parameters) //This method gets called if user translates ("drags" around map. You'll probably want to use the onMouseUp/Down events?)
[url removed, login to view] (x,y,z : single); //Location of self, map should base on this point. These coordinates are in the same coordinate system the entity ones are in (world coordinates).
[url removed, login to view](x,y,z, rotation, scale : single); //Adds an entity to the map. Rotation is number between 1-128, scale 1.0 - 10.0.
[url removed, login to view]( pic : TPicture); //This sets backround texture for map. Should be able to support all TPicture formats (JPEG, BMP, etc). backround can of course be larger then rendersize - map must cut it to fit the rendersize and zoomlevel then.
[url removed, login to view](); //Renders a bitmap of size (canvasWidth,canvasHeight) internally. This implements doublebuffering.
[url removed, login to view]( c : TCanvas); //Draws internally rendered image on this passed Canvas. The internal image was drawn by [url removed, login to view](); (see above).
As you can see, please use the OOP paradigm for this project.
If you can, please comment on the mathematical code - I tried this myself many times, but failed at synchronizing map texture and entity zoom levels. If you want to have my code as a reference, please say so.
If you have any more questions, please do not hesitate to contact me and ask! I will be online most of the time.
Cheers!
Project ID: #4690271