我怎样才能在消防队获得听觉的pass子?
my delphi 2009 app has a basic translation system that uses GNUGetText. i had used some win API calls to prepare the fonts. i thought it was working correctly until recently when someone from Malta ...
我怎样才能在消防队获得听觉的pass子?
Here s a howto video: http://blogs.embarcadero.com/ao/2011/10/13/39171
Full source code: http://cc.embarcadero.com/item/28536
And a (short) article: http://edn.embarcadero.com/article/41715
And here s source code for a compass component.
Have not tried it yet, but it should work.
unit Compass;
{Based on Anders Ohlsson Firemonkey Compass example}
{$IFDEF FPC}
{$mode objfpc}{$H+}
{$modeswitch objectivec1}
{$ENDIF}
interface
uses
SysUtils, Classes, FMX_Types
{$IFDEF FPC}
, iPhoneAll
{$ENDIF}
;
type
TUpdateEvent = TNotifyEvent;
TiOSGPSCompass = class(TFmxObject)
private
FLatitude: Double;
FLongitude: Double;
FAltitude: Double;
FHeading: Double;
FOnUpdate: TUpdateEvent;
UpdateNeeded: Boolean;
protected
procedure SetLatitude(value: Double);
procedure SetLongitude(value: Double);
procedure SetAltitude(value: Double);
procedure SetHeading(value: Double);
procedure Update;
public
constructor Create(AOwner: Classes.TComponent); override;
destructor Destroy; override;
published
property Latitude: Double read FLatitude;
property Longitude: Double read FLongitude;
property Altitude: Double read FAltitude;
property Heading: Double read FHeading;
property OnUpdate: TUpdateEvent read FOnUpdate write FOnUpdate;
end;
var
MyGPSCompass: TiOSGPSCompass = nil;
procedure Register;
implementation
{$IFDEF FPC}
uses
CoreLocation;
{$ENDIF}
{$IFDEF FPC}
type
MyCLController = objcclass(NSObject)
locationManager : CLLocationManager;
procedure locationManager_didUpdateToLocation_fromLocation(manager: CLLocationManager; newLocation, oldLocation: CLLocation); message locationManager:didUpdateToLocation:fromLocation: ;
procedure locationManager_didUpdateHeading(manager: CLLocationManager; newHeading: CLHeading); message locationManager:didUpdateHeading: ;
end;
var
Controller : MyCLController;
{$ENDIF}
{$IFDEF FPC}
procedure MyCLController.locationManager_didUpdateToLocation_fromLocation(manager: CLLocationManager; newLocation, oldLocation: CLLocation);
begin
if Assigned(MyGPSCompass) then begin
MyGPSCompass.SetLatitude(newLocation.coordinate.latitude);
MyGPSCompass.SetLongitude(newLocation.coordinate.longitude);
MyGPSCompass.SetAltitude(newLocation.altitude);
MyGPSCompass.Update;
end;
end;
{$ENDIF}
{$IFDEF FPC}
procedure MyCLController.locationManager_didUpdateHeading(manager: CLLocationManager; newHeading: CLHeading);
begin
if Assigned(MyGPSCompass) then begin
MyGPSCompass.FCompassHeading:= newHeading.magneticheading;
MyGPSCompass.Update;
end;
end;
{$ENDIF}
constructor TiOSGPSCompass.Create(AOwner: TComponent);
begin
inherited;
{$IFDEF FPC}
Controller := MyCLController.alloc.init;
Controller.locationManager := CLLocationManager.alloc.init;
Controller.locationManager.setDelegate(Controller);
Controller.locationManager.setDesiredAccuracy(kCLLocationAccuracyBestForNavigation);
Controller.locationManager.startUpdatingLocation;
Controller.locationManager.startUpdatingHeading;
{$ENDIF}
MyGPSCompass:= Self;
end;
destructor TiOSGPSCompass.Destroy;
begin
{$IFDEF FPC}
Controller.locationManager.release;
Controller.release;
{$ENDIF}
inherited;
end;
procedure TiOSGPSCompass.SetLatitude(value: Double);
begin
if (FLatitude <> value) then begin
FLatitude:= value;
UpdateNeeded:= True;
end;
end;
procedure TiOSGPSCompass.SetLongitude(value: Double);
begin
if (FLongitude <> value) then begin
FLongitude:= value;
UpdateNeeded:= True;
end;
end;
procedure TiOSGPSCompass.SetAltitude(value: Double);
begin
if (FAltitude <> value) then begin
FAltitude:= value;
UpdateNeeded:= True;
end;
end;
procedure TiOSGPSCompass.SetHeading(value: Double);
begin
if (FHeading <> value) then begin
FHeading:= value;
UpdateNeeded:= True;
end;
end;
procedure TiOSGPSCompass.Update;
begin
if (UpdateNeeded and Assigned(OnUpdate)) then OnUpdate(Self);
UpdateNeeded:= False;
end;
procedure Register;
begin
RegisterComponents( iOS , [TiOSGPSCompass]);
end;
end.
my delphi 2009 app has a basic translation system that uses GNUGetText. i had used some win API calls to prepare the fonts. i thought it was working correctly until recently when someone from Malta ...
Ok, I m going nuts here. For the last (almost) four years, I ve been putting up with some extremely bad behavior from my Delphi 5 IDE. Problems include: Seemingly random errors in coride50.bpl ...
i would like to know if there are any solution to do this. Does anyone? The big picture: I want to access data over the web, using my delphi thin clients. But i´would like to keep my server/service ...
In Delphi, there is a function StrToInt() that converts a string to an integer value; there is also IntToStr(), which does the reverse. These functions doesn t appear to be part of Oxygene, and I can ...
What is the equivalent of SetLength using Oxygene? I m trying to size an integer array. var listIndexes: array of integer; begin setLength(listIndexes,5); // doesn t work end;
How can I monitor or visualize memory fragmentation of a delphi application?
I have consistently had IDE problems in Delphi/C++Builder for years, with every version. I usually just reboot, recompile, etc. and move on. However, I keep seeing others say that the IDE is rock ...
I was trying to speed up a certain routine in an application, and my profiler, AQTime, identified one method in particular as a bottleneck. The method has been with us for years, and is part of a "...