Hi Nicky

Just a quick amendment to that code! It should of course read:

if (lfX1 - lfX2) < lfTolerance then
   lnResult = lnResult + 1
end if

with regard to my suggested solution, and not if greater than.

You could further optimise the ifs so that the least likely result causes the increment. Then the least likely result of all would end up as case 0. THis mean the most likely result would not run the code within the ifs.

Regards

Bob


----- Original Message ----- From: "Nicki Cozens" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, August 16, 2006 3:08 PM
Subject: [MI-L] Using do case...end case


Dear Listers

I have written some code with several nested if and elseif statements.
My code is running pretty slowly, probably as a result, and I would like
to do something to rectify this.  The only problem is that I'm not
really sure how to!  I believe that do case statements are more
efficient than ifs but I'm not really sure how to use them.

For example, is it possible to re-write:

If (ObjectnodeX(a_linelist(myline), 1,zz)) =
ObjectnodeX(a_intersecting_point, 1, 1) and
(ObjectnodeY(a_linelist(myline), 1,zz)) =
ObjectnodeY(a_intersecting_point, 1, 1)then

using a do case, or is there a better way to do this?

Similarly can I re-write the following statements:

If ((a_startx = a_x_1) and (a_starty = a_y_1)) or ((a_endx = a_x_1) and
(a_endy = a_y_1)) then
X1y1_flag = true
End If
If ((a_startx = a_x_2) and (a_starty = a_y_2)) or ((a_endx = a_x_2) and
(a_endy = a_y_2)) then
X2y2_flag = true
End If
If (a_x1y1_flag) and (a_x2y2_flag) then
DO SOMETHING
elseif ((a_x1y1_flag)= true) and ((a_x2y2_flag)=false) then
DO SOMETHING ELSE
elseif ((a_x2y2_flag)= true) and ((a_x1y1_flag)= false) then
DO SOMETHING ELSE
end if

using a do case?

Many thanks
Nicki Cozens

Data Management Officer
Highways Development Control
Leicestershire County Council

_______________________________________________________________________
Leicestershire County Council - rated a 'four-star' council by the Audit Commission
_______________________________________________________________________


This e-mail and any files transmitted with it are confidential. If you are not the intended recipient, any reading, printing, storage, disclosure, copying or any other action taken in respect of this e-mail is prohibited and may be unlawful. If you are not the intended recipient, please notify the sender immediately by using the reply function and then permanently delete what you have received.

Incoming and outgoing e-mail messages are routinely monitored for compliance with Leicestershire County Council's policy on the use of electronic communications. The contents of e-mails may have to be disclosed to a request under the Data Protection Act 1998 and the Freedom of Information Act 2000.

The views expressed by the author may not necessarily reflect the views or policies of the Leicestershire County Council.

Attachments to e-mail messages may contain viruses that may damage your system. Whilst Leicestershire County Council has taken every reasonable precaution to minimise this risk, we cannot accept any liability for any damage which you sustain as a result of these factors. You are advised to carry out your own virus checks before opening any attachment.



_______________________________________________
MapInfo-L mailing list
[email protected]
http://www.directionsmag.com/mailman/listinfo/mapinfo-l



_______________________________________________
MapInfo-L mailing list
[email protected]
http://www.directionsmag.com/mailman/listinfo/mapinfo-l

Reply via email to