If you learned how to that in the MapBasic course, Mike, you did
pretty well! It's an interesting technique that shows another way
to update symbols for a map, and once you set up the Shade
statement, it might even be faster if the table referenced by the
global variable i_read is a big one. 

While there's room for some cosmetic and other code improvements,
I don't think you can make it faster by trying to get rid of that
Do loop, but there's little point in bothering anyway because it
should never loop through more than 255 records. By letting it do
so, you ARE creating a potential time waster at the least or a
hidden fatal error at the worst. I'm not sure what happens if you
feed Shade a Values clause with more the 255 items, but it's
probably not healthy for it.

What we've been talking about is a bit different and is about how
you would make a permanent change to the object column -- as fast
as possible. But your approach points out that if one's end
product really only needs to be map, there's another way to get
it done ...which might possibly be even faster!

- Bill Thoen

"Cummings, Mike" wrote:
> 
> I wrote this a couple of years ago, after attending the Map basic course.  It opens 
> a reference table(DOGwellsymbols.tab) of font codes and matches status codes to get 
> the right symbol for the status of oil and gas wells into a Thematic Map.  I figure 
> that you all are talking about doing something similar.  The limitation is 255 
> symbols, which in my case, hasn't been an issue (yet).  I am not quite sure how or 
> if I could convert this operation to a function or if the function would be 
> noticeably quicker.
> 
>  Definition Table
>   Type NATIVE Charset "WindowsLatin1"
>   Fields 4
>     Status_cod Char (4) Index 1 ;
>     Symbol Smallint ;
>     Font_name Char (35) ;
>     Description Char (70) ;
> 
> sub symbolthem
> Dim win_id, i_symbol, i_value_count As Integer
> dim s_value, s_code, s_font, s_shade, s_table as string
> dim a_font, a_code as alias
> 
>   '** Make sure the user didn't click in a Layout window.
>    win_id = FrontWindow()
>    If WindowInfo(win_id, WIN_INFO_TYPE) <> WIN_MAPPER Then
>     Note "This tool may only be used on a Map window."
>     Exit Sub
>    End If
> 
> open table "W:\datadbf\wellsymbols\DOGwellsymbols.tab" interactive
> a_font="dogwellsymbols.font_name"
> a_code="dogwellsymbols.status_cod"
> 
> fetch first from DOGwellsymbols
> i_symbol=dogwellsymbols.symbol
> s_code=chr$(34)+a_code+chr$(34)
> s_font=chr$(34)+a_font+chr$(34)
> i_value_count=1
> s_value=s_code+" symbol ("+i_symbol+" , 0, 12, "+s_font+",0 ,0 )"
> 
> fetch next from DOGwellsymbols
> do while not EOT(DOGwellsymbols)
> i_symbol=dogwellsymbols.symbol
> s_code=chr$(34)+a_code+chr$(34)
> s_font=chr$(34)+a_font+chr$(34)
> if s_code=chr$(34)+chr$(34)then goto skip
> end if
> i_value_count=i_value_count+1
> s_value=s_value+","+chr$(13)+s_code+" symbol ("+i_symbol+" , 0, 12, "+s_font+",0 ,0 
> )"
> skip:
> fetch next from DOGwellsymbols
> loop
> if i_value_count > 255 then
> note "Your have exceeded the number of symbols for a Thematic Map."
> end if
> close table "DOGwellsymbols"
> call file_list
> s_table=tableinfo(i_read,tab_info_name)
> s_shade="Shade "+s_table+" with STATUS_COD values "+s_value
> run command s_shade
> end sub

---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 11992

Reply via email to