Hi Wilfried,
PowerScript is a programming language used in
the development environment PowerBuilder from
Sybase (
http://www.sybase.com/products/devel...n/powerbuilder).
Rather than talking much about it let me show
my PowerScipt implementation of CalcPos:
Code:
public function integer uf_get_latlong4wp (oleobject aole_wp, ref decimal adc_lat, ref decimal adc_long);
// ======================================================================================
//
// adoptet from:
//
// http://www.mp2kmag.com/mappoint/discussion/viewtopic.asp?t=3291&highlight=calcpos
//
// ======================================================================================
integer li_ret
dec{10} ldc_dist, ldc_len
string ls_err
oleObject lole_loc
li_ret = c_map_ok
if li_ret = c_map_ok then
if isNull(this.idc_halfEarth) then
this.iole_northPole = this.iole_objt.getLocation( 90, 0, 1)
this.iole_southPole = this.iole_objt.getLocation(-90, 0, 1)
this.iole_santaCruz = this.iole_objt.getLocation( 0, -90, 1)
this.idc_halfEarth = this.iole_objt.distance(this.iole_northPole, this.iole_southPole);
this.idc_quarterEarth = this.idc_halfEarth / 2
end if
end if
if li_ret = c_map_ok then
lole_loc = aole_wp.location
adc_lat = 90.0 - 180.0 * this.iole_objt.distance(this.iole_northPole, lole_loc) / this.idc_halfEarth
ldc_dist = this.iole_objt.distance(this.iole_objt.getLocation(adc_lat, 0, 1), lole_loc)
ldc_len = (adc_lat / 180) * pi(1)
adc_long = 180.0 * acos((cos((ldc_dist * 2 * pi(1)) / (2 * this.idc_halfearth)) - sin(ldc_len) * sin(ldc_len)) / (cos(ldc_len) * cos(ldc_len))) / pi(1)
end if
return li_ret
Of course there are some declarations and initializations not shown here.
Kind regards
Chris Werner