Alternate Reality Map 3D Demo For Delphi XE5 Firemonkey On Android And IOS

Delphi XE5 Firemonkey Alternate Reality 3D Map DemoI put together this alternate reality 3D map demo using Delphi XE5 Firemonkey and tested it on Windows and Android (though I’m sure it probably works on IOS and OSX as well).

I started out with a TForm3D (so the Firemonkey 3D form) and added a TPlane to it. The plane has it’s RotationAngle.X set to 315 (which is -45 degrees) to get the tilt. I added a TTextureMaterialSource component and linked it to the TPlane before assigning a default image to it. I also added a TFloatAnimation to the TPlane, set it to change PropertyName RotationAngle.Z, Duration 10, StartFromCurrent, and StopValue 359. The FloatAnimation causes the plane object to rotate.

Next I added a TCone in the center of the screen, tilted it -45 degrees to match the TPlane, gave it a LightMaterialSource, and placed a TLight above the cone to give it some shading. I then added a TLayer3D into the scene and set it’s Projection to pjScreen and set it’s Align property to alContents. I placed a TLabel inside of the TLayer3D and set it’s Align to alMostBottom. you can use the TLayer3D to add whatever other interface controls you want on to this project.

I have also added a TIdHTTP component and linked in a TIdCompressionIntercept, TIdCompressorZLib, TIdCookieManager, and TIdSSLIOHandlerSocketOpenSSL (none of these besides TIdHTTP are necessary). I setup a function called LoadMapImage() which uses TIdHTTP in an anonymous thread to download a map from Google Maps static image service. You should get a Google Maps static API key to use the static service more than a few times.

Next up I added a TLocationSensor and a couple timers. Your GPS needs to be enabled on your mobile device for the location sensor to work. The first timer delays the start of the location sensor and the second timer only allows the location sensor to update the map every 5 seconds. At start up it loads a high zoom map of the United States as it waits for the location sensor to kick in and as a placeholder on Windows which has no location sensor. The map that gets loaded is passed through SaveBitmapWithEffect function which applies a TInvertEffect to the bitmap before assigning it to the TPlane texture.

That is pretty much all there is to it. It needs polish and you can continue to enhance it and use it for your own purposes.

Download the full project with source code for Delphi XE5 Firemonkey Alternate Reality Map 3D.

Have Delphi Firemonkey questions? Ask and get answers on StackOverflow.

Alternate Reality Map 3D Demo For Delphi XE5 Firemonkey On Android And IOS by Delphi XE5 XE6 XE7 XE8 10 Seattle Berlin Firemonkey, Delphi Android, Delphi IOS is licensed under a Creative Commons Attribution 4.0 International License.

2 Responses to Alternate Reality Map 3D Demo For Delphi XE5 Firemonkey On Android And IOS

  1. salvo says:

    Not work move the form on second monitor on OSX.

  2. nazuna says:

    My Delphi Xe10.1 is not worked.
    FMX.Sensors not found in Library.
    How to fix it?

Leave a Reply

Show Buttons
Hide Buttons
Read previous post:
Get System Directories Using TPath In Delphi XE5 Firemonkey On Android And IOS

Embarcadero has a page up which shows a map of all of the TPath functions in Delphi XE5 Firemonkey and...