Konuyu Oyla:
  • Derecelendirme: 0/5 - 0 oy
  • 1
  • 2
  • 3
  • 4
  • 5
Mapview mark rotate sorunu
#1
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;
Muharrem ARSLAN
WWW
Cevapla
#2
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);
Begin : = end / 2;
Cevapla
#3
Dediğiniz gibi Rotation özelliğinden hemen önce kullandım fakat halen rotation özelliği değişmiyor.

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
Muharrem ARSLAN
WWW
Cevapla
#4
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.
Begin : = end / 2;
Cevapla
#5
Denedim, sonuç değişmedi fakat marker'ın olması gereken yerden sağ tarafa saptı.
Muharrem ARSLAN
WWW
Cevapla
#6
Flat özelliğini aşağıdaki şekilde set edebilirsiniz.
MyMarker.Appearance := TMarkerAppearance.Flat;
Begin : = end / 2;
Cevapla
#7
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.
Muharrem ARSLAN
WWW
Cevapla
#8
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.
Begin : = end / 2;
Cevapla
#9
(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.
Muharrem ARSLAN
WWW
Cevapla
#10
@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.
Muharrem ARSLAN
WWW
Cevapla


Konu ile Alakalı Benzer Konular
Konular Yazar Yorumlar Okunma Son Yorum
  Webbrowser Sorunu [ÇÖZÜLDÜ] codder71 7 418 10-02-2026, Saat: 17:04
Son Yorum: codder71
  Orange UI nin 2.3 Free versiyonu Dil Sorunu ? ovural 0 267 12-11-2025, Saat: 16:53
Son Yorum: ovural
  IOS Uygulama Yayınlama Sorunu emrahozten 2 714 11-06-2025, Saat: 21:00
Son Yorum: hakan_cng
  Boyutlandırma Sorunu Coban 6 1.406 28-03-2025, Saat: 11:51
Son Yorum: Coban
  Tam ekran sorunu Altıner 31 5.477 25-01-2025, Saat: 16:29
Son Yorum: mrmarman



Konuyu Okuyanlar: