How to detect when a map window has finished rendering?

30 views
Skip to first unread message

Nicholas G Lawrence

unread,
Jan 3, 2023, 10:22:43 PMJan 3
to mapi...@googlegroups.com

Hello all,

 

I want to write a mapbasic script that opens a table, opens a map window, zooms to the full extent and captures how many seconds it takes to render.

 

My issue is, that mapinfo goes onto the next step (which is capturing the elapsed seconds) whilst the map window is still rendering. So I do not capture the elapsed time properly.

 

Is there a way for mapbasic to detect when a map window has finished rendering?

 

Nick Lawrence
Senior Spatial Science Officer | Geospatial Technologies
Engineering & Technology | Transport and Main Roads

 

Floor 19 | 313 Adelaide Street | Brisbane City Qld 4000
GPO Box 1412 | Brisbane City Qld 4001
P: (07) 30667977
E: nicholas....@tmr.qld.gov.au
W:
www.tmr.qld.gov.au

 


WARNING: This email (including any attachments) may contain legally privileged, confidential or private information and may be protected by copyright. You may only use it if you are the person(s) it was intended to be sent to and if you use it in an authorised way. No one is allowed to use, review, alter, transmit, disclose, distribute, print or copy this email without appropriate authority.

If this email was not intended for you and was sent to you by mistake, please telephone or email me immediately, destroy any hard copies of this email and delete it and any copies of it from your computer system. Any right which the sender may have under copyright law, and any legal privilege and confidentiality attached to this email is not waived or destroyed by that mistake.

It is your responsibility to ensure that this email does not contain and is not affected by computer viruses, defects or interference by third parties or replication problems (including incompatibility with your computer system).

Opinions contained in this email do not necessarily reflect the opinions of the Department of Transport and Main Roads, or endorsed organisations utilising the same infrastructure.

Sergi Gàmiz Ribelles

unread,
Jan 4, 2023, 3:56:32 AMJan 4
to MapInfo-L
Hi Nick. Use the Timer() function twice, first at the beginning of the process you want measure its duration and second at the end. The difference of those timer() is the ellapsed time of the process.
Hope this help
SGR

El dia dimecres, 4 de gener de 2023 a les 4:22:43 UTC+1, Nick Lawrence va escriure:

Peter Horsbøll Møller

unread,
Jan 4, 2023, 4:10:42 AMJan 4
to mapi...@googlegroups.com

Hi Nick

 

There is a MapDraw event described in the MapInfo Pro Extensibility Reference help that can help you.

This event gets fired when a map starts getting redrawn, finishes getting redrawn and has its redraw cancelled.

 

I have sketched the process in the attached sample app.

However, it fails to register the events for some reason that I can’t figure out.

I have asked around internally but maybe one of you can figure out what I’m doing wrong

 

Cheers

Peter

 

Peter Horsbøll Møller
Principal Sales Engineer - Distinguished Engineer

 

From: 'Nicholas G Lawrence' via MapInfo-L <mapi...@googlegroups.com>
Sent: Wednesday, 4 January 2023 04.23
To: mapi...@googlegroups.com
Subject: [MI-L] How to detect when a map window has finished rendering?

 

This message originated Externally. Use proper judgement and caution with attachments, links, or responses.

 

--
--
You received this message because you are subscribed to the
Google Groups "MapInfo-L" group.To post a message to this group, send
email to mapi...@googlegroups.com
To unsubscribe from this group, go to:
http://groups.google.com/group/mapinfo-l/subscribe?hl=en
For more options, information and links to MapInfo resources (searching
archives, feature requests, to visit our Wiki, visit the Welcome page at
http://groups.google.com/group/mapinfo-l?hl=en

---
You received this message because you are subscribed to the Google Groups "MapInfo-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapinfo-l+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mapinfo-l/SY6P282MB381619E4A56FB63B95383AB1D3F59%40SY6P282MB3816.AUSP282.PROD.OUTLOOK.COM.

WinDrawTimeMapDraw.mb

Peter Horsbøll Møller

unread,
Jan 4, 2023, 1:44:29 PMJan 4
to mapi...@googlegroups.com

Hi again

 

I got some help making it work.

It can no show you the time spent rendering the map and it’s layers.

Do not that it will show a value for each layer

 

Peter

 

Peter Horsbøll Møller
Principal Sales Engineer - Distinguished Engineer

 

WinDrawTimeMapDraw.mb

Nicholas G Lawrence

unread,
Jan 5, 2023, 5:53:07 PMJan 5
to mapi...@googlegroups.com

HI SGR,

 

I did do the Timer() function twice in my original code.

The problem is that MapInfo runs the rendering of the map window in parallel, and the second Timer() is captured whilst the Map Window is still rendering.

 

I have figured out a solution though.

 

I use a Save Window command to save the window as an image file (to a temporary folder)

Then I run the Timer() command

Because the Save Window can only happen after the map window has complete rendering, this forces the Timer() to only run after the rendering is finished

--

--
You received this message because you are subscribed to the
Google Groups "MapInfo-L" group.To post a message to this group, send
email to mapi...@googlegroups.com
To unsubscribe from this group, go to:
http://groups.google.com/group/mapinfo-l/subscribe?hl=en
For more options, information and links to MapInfo resources (searching
archives, feature requests, to visit our Wiki, visit the Welcome page at
http://groups.google.com/group/mapinfo-l?hl=en

---
You received this message because you are subscribed to the Google Groups "MapInfo-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapinfo-l+...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages