www.skylinesoft.com Homepage
Forum Home Forum Home > SkylineGlobe Enterprise Products > TerraExplorer Pro for Developers
  New Posts New Posts RSS Feed: Flying to Extent
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Flying to Extent

 Post Reply Post Reply
Author
Message
azam View Drop Down
Visitor
Visitor
Avatar

Joined: September 21 2008
Location: Dubai
Online Status: Offline
Posts: 20
Post Options Post Options   Quote azam Quote  Post ReplyReply Direct Link To This Post Topic: Flying to Extent
    Posted: July 05 2010 at 2:41pm
Can some one please help me how to play with APIs to fly to an extent.

I have a feature in shape file whose extent i can get, but I dont know how to pass that Extent to Terra Explorer to fly to that extent.


TE basically have apis to fly to a location at certain height (or default viewing distance) but what if I have extent coordinates not the center point than how to fly to that extent.


Its urgent. I have TED v5.1.3 (f11)

Thanks
Azam
Back to Top
Eylon View Drop Down
Skyline Admin Group
Skyline Admin Group
Avatar

Joined: May 05 2003
Location: Israel
Online Status: Offline
Posts: 216
Post Options Post Options   Quote Eylon Quote  Post ReplyReply Direct Link To This Post Posted: July 07 2010 at 12:58pm
Here is a not perfect VB6 code sample that I think you got from support, but other forum users can enjoy:
 
Private Sub cmdFlyToExtent_Click()
Dim CenterX As Double
Dim CenterY As Double
Dim Distance As Double
Dim RectGeoHeight As Double
Dim RectGeoWidth As Double
Dim NormalWidth As Double
Dim NormalHeight As Double
'Dim ScreenX, ScreenY, ScreenW, ScreenH As Double
Dim FOV, FOVW, FOVH As Double
CenterX = CDbl(txtX1.Text) + ((CDbl(txtX2.Text) - CDbl(txtX1.Text)) / 2) ' The calculation can be done better, e.g. if the rectangle crosses 180 deg line etc.
CenterY = CDbl(txtY2.Text) + ((CDbl(txtY1.Text) - CDbl(txtY2.Text)) / 2) ' The calculation can be done better, e.g. if the rectangle crosses 180 deg line etc.
RectGeoWidth = CoordSys.GetDistance(CDbl(txtX1.Text), CDbl(txtY1.Text), CDbl(txtX2.Text), CDbl(txtY1.Text))  ' Calculates the width on the top line of the rectangle (should be max between top and botom)
RectGeoHeight = CoordSys.GetDistance(CDbl(txtX1.Text), CDbl(txtY1.Text), CDbl(txtX1.Text), CDbl(txtY2.Text))  ' Calculates the Height on the left line of the rectangle (Same as the right)
Render.GetRenderRect ScreenX, ScreenY, ScreenW, ScreenH
If (ScreenW > ScreenH) Then
    FOVW = Rad(Plane.FieldOfView)
    FOVH = Tan(Atn(FOVW / 2) * (ScreenH / ScreenW)) * 2
Else
    FOVH = Rad(Plane.FieldOfView)
    FOVW = Tan(Atn(FOVH / 2) * (ScreenW / ScreenH)) * 2
   
End If
If (RectGeoWidth = 0) Or (RectGeoHeight / RectGeoWidth > ScreenH / ScreenW) Then
    Distance = RectGeoHeight / 2 / Tan(FOVH / 2)
Else
    Distance = RectGeoWidth / 2 / Tan(FOVW / 2)
End If
'***Top View***
Plane.FlyTo CenterX, CenterY, 0#, Distance, 0#, -90#, "FlyToLocation"
'***For Angled View remove comment****
'***Dim Angle As Double
'***Angle = 30
'***Plane.FlyTo CenterX, CenterY, 0#, Distance / Cos(Rad(Angle)), 0#, -90# + Angle, "FlyToLocation"
'***For Angled View remove comment****
End Sub
 
Eylon
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down



This page was generated in 0.094 seconds.