Recent

Author Topic: LazMapViewer - Lines between realpoints  (Read 2908 times)

Arctic_Eddie

  • Jr. Member
  • **
  • Posts: 91
Re: LazMapViewer - Lines between realpoints
« Reply #15 on: August 09, 2022, 07:24:59 pm »
I tried the same thing with the call to ADrawer.TextOut() and ended up in win32winapi.inc  at this function.
Code: Pascal  [Select][+][-]
  1. function TWin32WidgetSet.CreateRoundRectRgn(X1, Y1, X2, Y2, nWidthEllipse,
  2.   nHeightEllipse: Integer): HRGN;
  3. begin
  4.   Result := Windows.CreateRoundRectRgn(X1, Y1, X2, Y2, nWidthEllipse,
  5.     nHeightEllipse);
  6. end;
  7.  
This one is talking about drawing an ellipse when it should be dealing with text. The X1 and Y1 values are reasonable but the next two are huge. It looks like each procedure is aimed at what the other should be doing. This is getting a lot deeper than I want to go just to print ham radio call signs on a world map.

Arctic_Eddie

  • Jr. Member
  • **
  • Posts: 91
Re: LazMapViewer - Lines between realpoints
« Reply #16 on: August 09, 2022, 07:44:11 pm »
Your second demo runs fine. I don't see any difference between what you have and mine. There must be a system setting in my PC that is causing the problem. I compared my Form.Activate with yours and nothing obvious. Would you like me to post my Form.Activate and Form.Create procedures? Maybe you can spot something there.

wp

  • Hero Member
  • *****
  • Posts: 11853
Re: LazMapViewer - Lines between realpoints
« Reply #17 on: August 09, 2022, 07:52:01 pm »
Yes post them, but reading the sources usually is not very efficient without support by the compiler. If the project is not too big it would be better to provide the full project, i.e. all pas, lfm, the lpi and lpr files so that I can compile and test myself. Of course you should remove everything not needed from the project

Arctic_Eddie

  • Jr. Member
  • **
  • Posts: 91
Re: LazMapViewer - Lines between realpoints
« Reply #18 on: August 09, 2022, 08:04:03 pm »
The project is about 1700 lines. Here's the two procedures.
Code: Pascal  [Select][+][-]
  1. procedure TForm1.FormActivate(Sender: TObject);
  2. var
  3.    P: TRealPoint;
  4. begin
  5.      // Set up initial map
  6.  
  7.      P.Lon := 0;                 // Just north of the equator
  8.      P.Lat := 10;
  9.      WSPRMap.Center := P;
  10.      WSPRMap.Zoom := DEF_ZOOM;   // Nice starting view
  11.      WSPRMap.DoubleBuffered := true;
  12.      WSPRMap.Active := true;
  13. end;
  14.  

Code: Pascal  [Select][+][-]
  1. procedure TForm1.FormCreate(Sender: TObject);
  2. var
  3.      sw, sh, ft, fl  :Integer;
  4. begin
  5.      // 1366x768 but account for title bar height
  6.      PageControl1.ActivePage := MapTab;      // Put on first tab
  7.  
  8.      Form1.Caption := 'WSPR Propagation Mapping - V'
  9.                       + VERSION + ' --- ' + OpenFileName;
  10.  
  11.      // Set form to 1366x768 for laptop and centered on any larger screen
  12.      PixPerInch := Screen.PixelsPerInch;             // Pitch for this PC
  13.      sh := Screen.Height;                            // Screen height
  14.      sw := Screen.Width;                             // Screen width
  15.      ft := ( sh - MINSCRH - TITLEHEIGHT) div 2;      // Centered vertically
  16.      if ft < 0 then ft := 0;                         // Don't let it go neg
  17.      fl := ( sw - MINSCRW ) div 2;                   // Centered horizontally
  18.      if fl < 0 then fl := 0;                         // Don't let it go neg
  19.      Form1.Top    := ft;                             // Set top
  20.      Form1.Left   := fl;                             // Set left side
  21.      Form1.Height := MINSCRH - TITLEHEIGHT;          // Set minimum height
  22.      Form1.Width  := MINSCRW;                        // Set minimum width
  23.      Application.ProcessMessages;                    // Now do this
  24.  
  25.     {// Start full screen on any PC
  26.      Form1.Top    := 0;                              // Set top
  27.      Form1.Left   := 0;                              // Set left side
  28.      Form1.Height := Screen.Height - TITLEHEIGHT;    // Set to screen height
  29.      Form1.Width  := Screen.Width; }                 // Set to screen width
  30.  
  31.      // Intialize the time scale under map
  32.      InitWidth := TimeScaleImage.Width;              // Initial width of image
  33.      TimeScaleImageInit();
  34.      TimeStart := 0;
  35.      TimeEnd   := 24;
  36.  
  37.      // Load CallGrid names in config tab and set sizes
  38.      CallGridStringGrid.Cells[0,0] := 'Call';
  39.      CallGridStringGrid.Cells[0,1] := 'Grid';
  40.      CallGridStringGrid.Cells[1,0] := TxCall;        //MY_CALL;
  41.      CallGridStringGrid.Cells[1,1] := TxGrid;        //MY_GRID;
  42.      CallGridStringGrid.Height     := CallGridStringGrid.DefaultRowHeight
  43.                                        * CallGridStringGrid.RowCount
  44.                                        + 4;
  45.      CallGridStringGrid.Width      := CallGridStringGrid.ColCount
  46.                                        * CallGridStringGrid.DefaultColWidth
  47.                                        + 4;
  48.  
  49.      // Open users data, call, grid, TZ
  50.      ConfigOpen();
  51.  
  52.      // Initialize the station data window
  53.      StationImageInit();
  54.      StationDataDraw();
  55.      TimeScaleDraw( 0, 24 );
  56.  
  57.  
  58. end;
  59.  

Arctic_Eddie

  • Jr. Member
  • **
  • Posts: 91
Re: LazMapViewer - Lines between realpoints
« Reply #19 on: August 09, 2022, 08:13:32 pm »
The whole project zipped is about 100MB as it contains a lot of cached maps and is in debug mode. I can put it on my friends one-drive page and you can get it from there. It will be the one with the highest suffix number.

wp

  • Hero Member
  • *****
  • Posts: 11853
Re: LazMapViewer - Lines between realpoints
« Reply #20 on: August 09, 2022, 09:44:40 pm »
Remove the cached maps and I don't the exe, ppu etc either

Arctic_Eddie

  • Jr. Member
  • **
  • Posts: 91
Re: LazMapViewer - Lines between realpoints
« Reply #21 on: August 09, 2022, 10:41:15 pm »
I stripped out the items you mentioned. The program is still complete and there is one spot file that can be opened. The problem routine is near the end of the source file and activated directly using the Test Button at the bottom-left. There are two breakpoints at the problem statements. The third is commented out, TextWidth. The link to my friends public page is below. Select the file on the left with the word "test" in it's name. It's quite small now. There are no cached maps.

I did the same F7 with your demo file and it goes to an entirely different place and looks appropriate. There are two folders in the project folder involving MvEngine. I'm not sure how they got there, or are necessary, and may be the problem.


https://onedrive.live.com/?authkey=%21AlDtDyEVpMSIPeQ&id=2C53252267529651%21123&cid=2C53252267529651

wp

  • Hero Member
  • *****
  • Posts: 11853
Re: LazMapViewer - Lines between realpoints
« Reply #22 on: August 09, 2022, 11:11:57 pm »
I could not load the map from VirtualEarth which is used by your MapView component, selected "OpenStreetMap Mapnik" instead.

After this fix (and the installation of BGRAControls) the project compiled, but the button click made it crash at the line "APoint.Name := 'Test'". APoint is a local variable of type TGpsPoint - this is a class and must be created! Adding "APoint.Name := TGpsPoint.CreateFrom(rpt)" before "Apoint.Name := 'Test'" solved this issue.

The next crash is at line "ADrawer.BrushStyle := ...". Again: ADrawer is a local variable and type TMvCustomDrawingEngine. This is another local variable which has no value. In fact it is the DrawingEngine of the MapViewer (something like a "generalized canvas") needed for drawing on the screen. Assigning "ADrawer := WSPRMap.DrawingEngine" solves the issue, and there is no more crash. The commented TextWidth now is correct too.

No text appears on the map, but I already told you that you cannot draw in a button's click event and will not repeat this again.


Arctic_Eddie

  • Jr. Member
  • **
  • Posts: 91
Re: LazMapViewer - Lines between realpoints
« Reply #23 on: August 10, 2022, 12:05:24 am »
Still having a problem. When I insert "APoint.Name := TGpsPoint.CreateFrom(rpt)", the error says "expected Ansi string". If I change the argument to 'test' then it says "expected TRealPoint". Could you post the corrected version of the routine so I see what you did?

Found it, the inserted line should be "APoint := TGpsPoint.CreateFrom(rpt)" without the ".name" part.

wp

  • Hero Member
  • *****
  • Posts: 11853
Re: LazMapViewer - Lines between realpoints
« Reply #24 on: August 10, 2022, 12:44:44 am »
Sorry, this happens when I edit the text already written...

Arctic_Eddie

  • Jr. Member
  • **
  • Posts: 91
Re: LazMapViewer - Lines between realpoints
« Reply #25 on: August 10, 2022, 01:02:04 am »
I'm going to implement the ideas in your two demos. That will solve my immediate problems.

Thanks again for all your help. I could not have sorted this out by myself.

 

TinyPortal © 2005-2018