Composant Delphi / Google Maps / OpenStreetMap / Leaflet  / Mappilary / Native Maps 100% Delphi 0% WebBrowser 0% Javascript

EarthView

you are here :TECMap

EarthView type TECMapEarthView property lets you manage 3D Google Earth display or cesium

Google Earth is available only with the api Google

25

The suite TECMap offers independent component TECCesiumMap to manage your views 3D, this component is also integrated with EarthView to replace Google Earth.

The integration of Cesium in EarthView is partial, the logo class=pos=Textealign=ismap=macro=src=CESIUM-LOGO.PNG indicates compatibility with Cesium

It is recommended to use directly the Cesium property which gives full access to the Component Manager Cesium.

3

TECMapEarthView

It gives access to the following methods and properties

property Cesium;
Access to the TECCesiumMap component that allows you maximum control over the Cesium engine
property UseCesium;
Choice of the Cesium engine to handle 3D
procedure Clear;

Clears data

data are erased only in the 3D view, they are always available in the standard 2D view

16
procedure EnableLayer(const sLayer:string;const bShow:boolean)

Enable/disable layer

You can choose amongst

  • LAYER_BORDERS
  • LAYER_BUILDINGS
  • LAYER_BUILDINGS_LOW_RESOLUTION
  • LAYER_BUILDINGS_LOW_RESOLUTION.
  • LAYER_ROADS
  • LAYER_TERRAIN
  • LAYER_TREES

Under Cesium only LAYER_TERRAIN is functional

17

LAYER_TERRAIN is enabled by default

// Delphi map component ECMap

// active LAYER_BUILDINGS and LAYER_TREES
map.EarthView.EnableLayer('LAYER_BUILDINGS',true);
map.EarthView.EnableLayer('LAYER_TREES',true);

procedure Camera(const dLatitude,dLongitude:double)
Positioning the camera in dLatitude, dLongitude and displays the view in accordance with the properties Altitude,Roll, Tilt and Heading
procedure LookAt(const dLatitude,dLongitude:double)
Viewing point in dLatitude, dLongitude and displays the view in accordance with the properties Altitude,Range, Tilt and Heading
function getGroundAltitude(const dLatitude,dLongitude:double):double;
Returns the height of the point located in dLatitude, dLongitude
procedure LoadKml(const UrlKmlKmz:string);

Loading a remote Kml/Kmz file (for Cesium only Kml)

UrlKmlKmz URL of the file to import

The data is added , made a Clear front if you want a total replacement

50
procedure PlacemarkCamera(const id:integer)
Position the camera on the index id mark and displays the view in agreement with the properties Altitude,Roll, Tilt and Heading
procedure PlacemarkLookAt(const id:integer)
Viewing the index id mark and displays the view in agreement with the properties Altitude,Range, Tilt and Heading
procedure setPlacemarkLatLngAlt(const id:integer;const Lat,Lng,Alt:double);
Positioning the index id mark in Latitude, Longitude and Altitude
procedure getPlacemarkLatLngAlt(const id:integer;var Lat,Lng,Alt:double);
Get the latitude, longitude and altitude of the index id mark
procedure FromXYToLatLngAlt (const iX, iY: double; var dLatitude, dLongitude, altitude: double)
Gives the latitude, longitude and altitude of the point X, Y (pixels)
property Altitude : double

Read/write property to determine its altitude

property MouseAltitude : double
Read property indicates the altitude of the point under the mouse cursor
property AltitudeMode: TAltitudeMode

Read/write property to fix how is calculated the altitude

You have the choice between

  • amAbsolute
  • amRelativeToGround
  • amClampToGround
  • amRelativeToSea
  • amClampToSea
property FlyToSpeed : double

Property read/write to set the speed, from 0 to 5.0

Use 6.0 for an immediate teleportage

51
property Loaded : boolean
Property read-only to determine if the plugin has been loaded
property Latitude : double
Read/write property to determine the latitude
property Longitude : double
Read/write property to determine longitude
property Heading : double
Read/write property to determine the direction from the North (from 0 ° to 360 °)
property Tilt : double
Read/write property to determine the angle of the view (from 0 ° to 90 ° for LookAt and 0 ° to 180 ° for Camera)
property Range : double
Read/write property to determine the distance to the observed point (not used by Camera)
property Ready : boolean
Property read-only to determine the moment when the plugin has finished its screen rendering, corresponds to the event OnEarthViewFrameEnd
property Visible : boolean
Read/write to toggle the 3D view property
property Atmosphere : boolean
Read/write property to show or not the atmosphere
property Grid : boolean
Read/write property to display the lines of latitude and longitude on the globe
property MouseNavigationEnabled : boolean
Read/write property to turn the mouse-move

property NavigationControlVisibility : TNavigationControlVisibility

Read/write for display or non-property controls, you have the choice between ncvShow,ncvHide and ncvAuto

// Delphi map component ECMap

map.EarthView.NavigationControlVisibility := nvcAuto;

property StatusBar : boolean
Read/write property to display the information bar
property ScaleLegend : boolean
Read/write property to display scale
property Sun : boolean
Read/write property to display the Sun
property OverviewMap : boolean
Read/write to display a mini property world map
property TerrainExaggeration : double
Property read/write which is a factor of increase in altitude from 1.0 to 3.0
property ToKml : string;

Property read/write which allows import/export Kml format

TECMap has the toKml function to export almost all of the overlays in Kml format

// Delphi map component ECMap

// import overlays (markers, rectangles, circles,...routes)
map.EarthView.toKml := map.toKml;

property ToTxt : string;
Property read/write which gives access to the properties in a text format.

Google Earth under the given Kml are not taken into account

18
property PlaceMark[const index:integer]: string

Property read/write that determines the content of the index id mark

The string is in Kml format, such

<Placemark>
<name>Placemark from KML string</name>
<Point>
<coordinates>-122.448425,37.802907,0</coordinates>
</Point>
</Placemark>
property PlacemarkCount : integer
Returns the number of marks
property Models : TECMapEarthModels

List of TECMapEarthModel type models

A pattern is defined by the Kml tag <Model>
property CesiumModels : TECCesiumShapeModelList

List of 3D models of type TECCesiumShapeModel

property StreamPercent : integer
Property reading that indicates the percentage of the frame load
property ApiVersion : string
Returns the version of the api Google Earth
property PluginVersion
Returns the version number of the 3D plugin

To make changes to the Altitude, Heading, Range, Roll and Tilt properties visible you need to trigger a call to LookAt or Camera

19

TECMapEarthModels

This class has methods and properties

procedure LoadKml(const filename:string);
load a KML / KMZ defining a 3D model, triggers the event OnEarthViewUpdateModels

// Delphi map component ECMap

// load 3d model
map.EarthView.models.LoadKml('http://earth-api-samples.googlecode.com/svn/trunk/demos/drive-simulator/smart.kmz');


If templates are present in the KML loaded by TECMapEarthView.ToKml or TECMapEarthView.LoadKml they will also be available in the Models list

52
function IndexOf(const idModel:string):integer;
Returns the index of the model that we pass the ID

This is the ID property of the tag Model

53
procedure Delete(const index:integer);
Removes the index model
function Count:integer;
Returns the number of 3D model
procedure Clear;
Clears all the 3D models
property Model[Index:integer]:TECMapEarthModel

Table for access types, the default property so you can access it directly by map.EarthView.Models[index] instead of map.EarthView.Models.Model[index]

TECMapEarthModel

Class manages a 3D model, it have methods and properties

procedure setLatLngAlt(const Lat,Lng,Alt:double);
Position the model in latitude, longitude, altitude
procedure LookAt;
Watch model
property Id : string ;

Property read that gives the identifier of model

This is the ID property of the tag Model

54
property Index : integer
Index model in the list Models
property Latitude : double
Property read / write to determine latitude
property Longitude : double
Property read / write for determining longitude
property Heading : double
Property read / write to determine the orientation with respect to North (0 ° to 360 °)
property Tilt : double
Property read / write for determining the angle of view (0 ° to 90 °)
property Range : double
Property read / write to determine the distance to the observed point)
property Roll : double
Property read / write to determine the rotation model
property Altitude : double
Property read / write to determine the height of the model

Guided tour

Google Earth allows you to play tours ( see la documentation de google earth api )

EarthView offers you the possibility to manage in a simple way.

property Tour : string

Read/write property to load a tour

  • You can load a kml/kmz file from the internet or locally
  • You can also pass a string containing the kml data


// load kml tour

map.EarthView.Tour := 'http://www.my.com/mytour.kml';
map.EarthView.Tour := 'c:\mytour.kml';
map.EarthView.Tour := '<?xml version="1.0" encoding="UTF-8"?>...<gx:Tour>...';

The OnLoadTour event is raised when the tour is loaded and available

55
procedure PlayTour;

Start the tour

The OnEndTour event is raised when the tour is over

56
procedure PauseTour;
Paused the tour
procedure ResetTour;
Positions the tour initially, waiting to be played
procedure ExitTour;
Exit tour
property CurrentTimeTour : integer;
read/write property that gives/fixed the position of the tour in time (in seconds)
property Duration : integer
read property that gives the time of the tour in seconds
property StateTour : TEarthStateTour
read property that gives the status of the tour ( stNone,stPlay,stPause,stEnd )

Events



In addition to the events below you also have access to OnMapClick, OnMapDblClick, OnMouseMove, OnOverlayMouseDown, OnOverlayMouseUp et OnOverlayMouseOut

57

property OnEarthViewInit : TNotifyEvent;
Fired when the plugin is loaded, this happens when you switch to true TECMapEarthView.Visible
property OnEarthViewShow : TNotifyEvent;
Fired when when you switch to true TECMapEarthView.Visible
property OnEarthViewChange : TNotifyEvent;
Triggered when the view changes
property OnEarthViewFrameEnd : TNotifyEvent;
Triggered when 3D rendering is done, this is a good place to move 3D models for smooth animation
property OnEarthViewUpdateModels: TNotifyEvent;
Triggered by the addition of a model
property OnEarthViewUpdatePlacemarks : TNotifyEvent;
Triggered by the addition of a Placemark
property OnEarthViewClickPlacemark(sender: TObject;const index:integer;const KmlString:string)

Triggered by a click on a Placemark

index is the index of the mark in the list Placemark

KmlString the content of the mark in KML, gender

<Placemark>
<name>Placemark from KML string</name>
<Point>
<coordinates>-122.448425,37.802907,0</coordinates>
</Point>
</Placemark>

Demonstrations

Demo3D shows you how to move a particular 3D model by following a specific route.
Fig. 51 EarthView in Demo3D
Fig. 51 EarthView in Demo3D

DemoOverlay the program shows you how to transfer data to a 3D view



Fig. 52 DemoOverlay
Fig. 52 DemoOverlay
Fig. 53 Import KML overlays
Fig. 53 Import KML overlays
go to page
© 2016 ESCOT-SEP Christophe - Made width Help&Web - RSS - Google+