Delphi Can

Orjinalini görmek için tıklayınız: Mapview mark rotate sorunu
Şu anda (Arşiv) modunu görüntülemektesiniz. Orjinal Sürümü Görüntüle internal link
Sayfalar: 1 2
Merhaba,
Haritada basit bir şekilde  "TMapMarker" ekliyorum, Marker'ın rotate özelliği android de çalışıyor fakat ios kısmın da çalışmıyor.

Örnek Kod'u paylaştım. Manuel olarak 0, 45, 90 gibi değerler versem de ios kısmın da tepki yok.



var
MyMarker: TMapMarkerDescriptor;
Derece:integer;
begin
 MyMarker := TMapMarkerDescriptor.Create(Position, 'Here');
 MyMarker.Icon := ImageList2.Bitmap(TSizeF.Create(64, 64), 10);
 Derece:= derecehesapla();
 MyMarker.Rotation := Derece;

 MyMarker.Draggable := false;
 MyMarker.Visible := true;
 MyMarker.Title := baslik;
 MyMarker.Snippet := '(' + Position.Latitude.ToString + ' - ' +
   Position.Longitude.ToString + ')';
 Yer := MapView1.AddMarker(MyMarker);
 FMarkersboat.add(Yer);
end;
iOS tarafına baktığımızda; farklı olarak groundAnchor özelliğinin set edildiğini görüyoruz. 
Delphi tarafında groundAnchor özelliğine karşılık gelen property, sanırım TMapMarkerDescriptor record'unun Origin özelliğidir. 
Rotation özelliğinden hemen önce aşağıdaki bir bir atama yapın.
MyMarker.Origin := TPointF.Create(0.5, 0.5);
Dediğiniz gibi Rotation özelliğinden hemen önce kullandım fakat halen rotation özelliği değişmiyor.

Kod:
Marker perth = mMap.addMarker(new MarkerOptions()
                     .position(PERTH)
                     .flat(true));

flat değerini true yapınca sorun çözülmüş fakaat delphi tarafında flat karşılını bulamıyorum.
kaynak
FMX.Map.iOS unit'inde Origin değerinden 0.5 çıkarılıyor. 
Bunu deden yapıyor bilmiyorum.
Söz konusu Unit'teki ilgili kısım:
function TMapKitMapMarker.AnnotationView: MKAnnotationView;
var
 Pin: MKPinAnnotationView;
 Image: UIImage;
begin
 if FAnnotationView <> nil then
   Exit(FAnnotationView);

 if Descriptor.Icon <> nil then
 begin
   Result := TMKAnnotationView.Wrap(TMKAnnotationView.Alloc.initWithAnnotation((FAnnotation as ILocalObject).GetObjectID,
     nil));
   Image := BitmapToUIImage(Descriptor.Icon);
   Result.setImage(Image);
   Result.setUserInteractionEnabled(Descriptor.Draggable);
   Result.setDraggable(Descriptor.Draggable);
   Result.setCanShowCallout(True);
   Result.setCenterOffset(CGPointMake(Image.size.width * (Descriptor.Origin.X - 0.5),
     - Image.size.height * (Descriptor.Origin.Y - 0.5)));
 end
 else
 begin
   Pin := TMKPinAnnotationView.Wrap(TMKPinAnnotationView.Alloc.initWithAnnotation((FAnnotation as ILocalObject).GetObjectID,
     nil));
   Pin.setUserInteractionEnabled(Descriptor.Draggable);
   Pin.setCanShowCallout(True);
   Pin.setDraggable(Descriptor.Draggable);
   Pin.setUserInteractionEnabled(Descriptor.Draggable);
   Result := Pin;
 end;
 FAnnotationView := Result;
end;


0.5 çıkarıldığına göre siz bu değeri 1,1 olarak gönderin.
Denedim, sonuç değişmedi fakat marker'ın olması gereken yerden sağ tarafa saptı.
Flat özelliğini aşağıdaki şekilde set edebilirsiniz.
MyMarker.Appearance := TMarkerAppearance.Flat;
MyMarker.Appearance := TMarkerAppearance.Flat;

MyMarker.Appearance := TMarkerAppearance.Billboard;

bu şekilde ikisini de denedim, malesef sorun aynı.

Geçici çözüm olarak mapview'in Beraing özelliğini kullanacağım, GestureOptions'dan ise rotate özelliğini kaldıracağım.
Android, iOS ve her iki platformun base class'ındaki ortak atamalarına bakalım.
Android tarafında:
function TAndroidMapView.BuildMarkerOptions(const D: TMapMarkerDescriptor): JMarkerOptions;
begin
 Result := TJMarkerOptions.JavaClass.init.alpha(D.Opacity)
   .anchor(D.Origin.X, D.Origin.Y)
   .draggable(D.Draggable)
   .flat(D.Appearance = TMarkerAppearance.Flat)
   .position(CoordToLatLng(D.Position))
   .rotation(D.Rotation)
   .snippet(StringToJString(D.Snippet))
   .title(StringToJString(D.Title))
   .visible(D.Visible);
 if D.Icon <> nil then
   Result := Result.icon(CreateBitmapDescriptorFromBitmap(D.Icon));
end;

iOS Tarafında:
function TMapKitMapMarker.AnnotationView: MKAnnotationView;
var
 Pin: MKPinAnnotationView;
 Image: UIImage;
begin
 if FAnnotationView <> nil then
   Exit(FAnnotationView);

 if Descriptor.Icon <> nil then
 begin
   Result := TMKAnnotationView.Wrap(TMKAnnotationView.Alloc.initWithAnnotation((FAnnotation as ILocalObject).GetObjectID,
     nil));
   Image := BitmapToUIImage(Descriptor.Icon);
   Result.setImage(Image);
   Result.setUserInteractionEnabled(Descriptor.Draggable);
   Result.setDraggable(Descriptor.Draggable);
   Result.setCanShowCallout(True);
   Result.setCenterOffset(CGPointMake(Image.size.width * (Descriptor.Origin.X - 0.5),
     - Image.size.height * (Descriptor.Origin.Y - 0.5)));
 end
 else
 begin
   Pin := TMKPinAnnotationView.Wrap(TMKPinAnnotationView.Alloc.initWithAnnotation((FAnnotation as ILocalObject).GetObjectID,
     nil));
   Pin.setUserInteractionEnabled(Descriptor.Draggable);
   Pin.setCanShowCallout(True);
   Pin.setDraggable(Descriptor.Draggable);
   Pin.setUserInteractionEnabled(Descriptor.Draggable);
   Result := Pin;
 end;
 FAnnotationView := Result;
end;

Map ortak sınıfında:
class function TMapMarkerDescriptor.Create(const Position: TMapCoordinate; const Title: string): TMapMarkerDescriptor;
begin
 Result.Position := Position;
 Result.Title := Title;
 Result.Opacity := 1;
 Result.Origin := TPointF.Create(0.5, 1);
 Result.Snippet := string.Empty;
 Result.Draggable := False;
 Result.Visible := True;
 Result.Appearance := TMarkerAppearance.Flat;
 Result.Rotation := 0;
 Result.Icon := nil;
end;

Yukarıdaki temel atamalara baktığımızda; marker yönünün Origin (anchor) ve Flat özellikleri ile ilgili olduğunu görüyoruz. Siz her ne kadar set etseniz de durum değişmediğine göre kodlarınızda bir sorun yok demektir. 
Embercadero comminity'e bu durumu bildirmekten başka çare görünmüyor.
(31-01-2022, Saat: 12:13)RAD Coder Adlı Kullanıcıdan Alıntı: [ -> ]Android, iOS ve her iki platformun base class'ındaki ortak atamalarına bakalım.
Android tarafında:
function TAndroidMapView.BuildMarkerOptions(const D: TMapMarkerDescriptor): JMarkerOptions;
begin
 Result := TJMarkerOptions.JavaClass.init.alpha(D.Opacity)
   .anchor(D.Origin.X, D.Origin.Y)
   .draggable(D.Draggable)
   .flat(D.Appearance = TMarkerAppearance.Flat)
   .position(CoordToLatLng(D.Position))
   .rotation(D.Rotation)
   .snippet(StringToJString(D.Snippet))
   .title(StringToJString(D.Title))
   .visible(D.Visible);
 if D.Icon <> nil then
   Result := Result.icon(CreateBitmapDescriptorFromBitmap(D.Icon));
end;

iOS Tarafında:
function TMapKitMapMarker.AnnotationView: MKAnnotationView;
var
 Pin: MKPinAnnotationView;
 Image: UIImage;
begin
 if FAnnotationView <> nil then
   Exit(FAnnotationView);

 if Descriptor.Icon <> nil then
 begin
   Result := TMKAnnotationView.Wrap(TMKAnnotationView.Alloc.initWithAnnotation((FAnnotation as ILocalObject).GetObjectID,
     nil));
   Image := BitmapToUIImage(Descriptor.Icon);
   Result.setImage(Image);
   Result.setUserInteractionEnabled(Descriptor.Draggable);
   Result.setDraggable(Descriptor.Draggable);
   Result.setCanShowCallout(True);
   Result.setCenterOffset(CGPointMake(Image.size.width * (Descriptor.Origin.X - 0.5),
     - Image.size.height * (Descriptor.Origin.Y - 0.5)));
 end
 else
 begin
   Pin := TMKPinAnnotationView.Wrap(TMKPinAnnotationView.Alloc.initWithAnnotation((FAnnotation as ILocalObject).GetObjectID,
     nil));
   Pin.setUserInteractionEnabled(Descriptor.Draggable);
   Pin.setCanShowCallout(True);
   Pin.setDraggable(Descriptor.Draggable);
   Pin.setUserInteractionEnabled(Descriptor.Draggable);
   Result := Pin;
 end;
 FAnnotationView := Result;
end;

Map ortak sınıfında:
class function TMapMarkerDescriptor.Create(const Position: TMapCoordinate; const Title: string): TMapMarkerDescriptor;
begin
 Result.Position := Position;
 Result.Title := Title;
 Result.Opacity := 1;
 Result.Origin := TPointF.Create(0.5, 1);
 Result.Snippet := string.Empty;
 Result.Draggable := False;
 Result.Visible := True;
 Result.Appearance := TMarkerAppearance.Flat;
 Result.Rotation := 0;
 Result.Icon := nil;
end;

Yukarıdaki temel atamalara baktığımızda; marker yönünün Origin (anchor) ve Flat özellikleri ile ilgili olduğunu görüyoruz. Siz her ne kadar set etseniz de durum değişmediğine göre kodlarınızda bir sorun yok demektir. 
Embercadero comminity'e bu durumu bildirmekten başka çare görünmüyor.

Evet hocam, bu durumu Embercadero comminity'e bildireceğim, teşekkür ederim yardımlarınız için.
@RAD Coder  hocam kullandığınız Delphi sürümu 11 ise test edip sonucu paylaşma şansınız var mı? Bu sorun belki 11 sürümünde düzeltilmiştir.
Sayfalar: 1 2