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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 GPS Maps Demo - Pins don't show when saved
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Andy_Bell

United Kingdom
37 Posts

Posted - Mar 22 2021 :  20:10:46  Show Profile  Reply
Hi

Using C++ Builder 2007, I've converted the GPS Map demo to C++ and all looks good - until I try to save the map.

The pins drawn during the ImageEnView1DrawBackBuffer event show on the map but are not present when I save the ImageEnView.

I've tried saving to TIF and to JPEG but it makes no difference.

The Delphi demo exhibits the same behavior...

Is there a way to get the pins to save?

Andy

Andy

xequte

38217 Posts

Posted - Mar 22 2021 :  21:42:15  Show Profile  Reply
Hi Andy

The pins in the demo are only drawn on the back buffer, so you would need to use code to burn them into the image if you wanted them to be visible when saved.

Here is one method that adds the locations as Pin shape layers, then saves the merged layer to a file:

const
  Pin_Width  = 40;
  Pin_Height = 40;
var
  i: integer;
  idx: integer;
  lat, lon: double;
  x, y: integer;
  fn: string;
begin
  // Prompt for a filename
  fn := ImageEnView1.IO.ExecuteSaveDialog();
  if fn = '' then
    exit;

  // Hide changes from view
  ImageEnView1.LockUpdate();
  try

    // Add pins as shape layers
    for i := 0 to ImageEnMView1.MultiSelectedImagesCount - 1 do
    begin
      idx := ImageEnMView1.MultiSelectedImages[i];
      lat := ImageEnMView1.MIO.Params[idx].EXIF_GPSLatitude;
      lon := ImageEnMView1.MIO.Params[idx].EXIF_GPSLongitude;
      x := map.LongitudeToBmpX(lon);
      y := map.LatitudeToBmpY(lat);

      ImageEnView1.LayersAdd( iesPinLeft, x, y - Pin_Height, Pin_Width, Pin_Height );
    end;

    // Save current image + layers to file
    ImageEnView1.LayersSaveMergedTo( fn );

    // Clean up
    ImageEnView1.LayersClear(False);

  finally
    // Reenable ImageEnView1
    ImageEnView1.UnlockUpdate();
  end;
end;


Nigel
Xequte Software
www.imageen.com
Go to Top of Page

Andy_Bell

United Kingdom
37 Posts

Posted - Mar 23 2021 :  04:50:32  Show Profile  Reply
Thank you!

Works perfectly

Andy

Andy
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: