ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Advice needed, Geomap slippymap

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
Patrick Quinn Posted - Sep 28 2016 : 07:42:56
Hi

I wish to have a Geomap display as in the example, but replacing the marker pin with an arrow pointing at the GPS position, with the arrow rotated by an angle set by EXIF_GPSImgDirection. This would show the direction the camera was pointing in when the photo was taken.

I assume that rotating the arrow image in the ImageEnView DrawBackBuffer event would be too slow?

Would the best way be to make an array of 360 rotated bitmaps, loaded into the form, and then load the appropriate bitmap in the DrawBackBuffer event, or can you recommend a better method?

Thanks

Patrick
3   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Oct 04 2016 : 02:57:12
Nice, one



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Patrick Quinn Posted - Oct 01 2016 : 17:53:32
Hi Nigel
I've experimented and found that drawing a 'pie slice' using the Canvas.Pie method works well, the angle of the slice indicating the EXIF_GPSImgDirection.I draw cross hairs and a circle to show the GPS position.



The code is all in the DrawBackBuffer event and is a lot faster than using the bitmap of the pin, so should not cause any problems.

procedure TfrmMain.ImageEnViewMapDrawBackBuffer(Sender: TObject);
var
  i, idx, x, y, x1, x2, x3, x4, y1, y2, y3, y4: Integer;
  dLat, dLong: Double;
  dPieAngle, dStartAngle, dStopAngle: Double;
const
  r = 30; //  radius of circle
  rPie = 29; // radius of pie
  ds = 2; // bevel offset
  PieSlice: Double = 30;  //  Angle of pie slice
begin
  with ImageEnViewMain.IO.Params do
    begin
      dLat := EXIF_GPSLatitude;
      dLong := EXIF_GPSLongitude;
      dPieAngle := EXIF_GPSImgDirection;
    end;
  x := map.LongitudeToBmpX(dLong);
  y := map.LatitudeToBmpY(dLat);

  with ImageEnViewMap.BackBuffer.Canvas do
    begin
      //  Circle and cross hairs
      Pen.Width := 1;
      Brush.Style := bsClear;
      //  Drew in white offset by ds pixels
      Pen.Color := clWhite;
      Ellipse(ds + x - r, ds + y - r, ds + x + r, ds + y + r);
      MoveTo(ds + x, ds + y - r - r);
      LineTo(ds + x, ds + y + r + r);
      MoveTo(ds + x - r - r, ds + y);
      LineTo(ds + x + r + r, ds + y );
      // Bevel effect, draw again in gray, no offset
      Pen.Color := clDkGray;
      Ellipse(x - r, y - r, x + r, y + r);
      MoveTo(x, y - r - r);
      LineTo(x, y + r + r);
      MoveTo(x - r - r, y);
      LineTo(x + r + r, y );

      // Draw the pie slice;
      with Brush do
        begin
          Style := bsClear;
          Color := clyellow;
        end;
      Pen.Color := clred;
    end;
  dPieAngle := 90 - dPieAngle;
  dStartAngle := dPieAngle - (PieSlice / 2);
  dStopAngle := dPieAngle + (PieSlice / 2);
  x1 := x - rPie;
  y1 := y - rPie;
  x2 := x + rPie;
  y2 := y + rPie;
  x3 := x + Round(rPie * Cos(DegToRad(dStartAngle)));
  y3 := y - Round(rPie * Sin(DegToRad(dStartAngle)));
  x4 := x + Round(rPie * Cos(DegToRad(dStopAngle)));
  y4 := y - Round(rPie * Sin(DegToRad(dStopAngle)));
  ImageEnViewMap.BackBuffer.Canvas.Pie(x1, y1, x2, y2, x3, y3, x4, y4);
end;
The code isn't optimised and could be cleaned up a bit but works ok.
Note that not all cameras record the image direction. My Panasonic Lumix TZ20 with built-in GPS does not, but my Marrex MX-G20M MKII Geotagger (which attaches to my Nikon D3200) does.

Patrick
xequte Posted - Sep 30 2016 : 02:19:19
Hi Patrick

Whether it would be too slow would depend on the complexity of your arrow graphic, the smoothing filter you use and the number of arrows on screen.

It is probably not too slow for a simple arrow, but you should do a test.

The other option is an array, but you could probably simplify it to 36 images, for example, as users are unlikely to notice <10 degree variances.

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com