MapInfo Pro

 View Only
  • 1.  printing scalebar

    Posted 12-07-2020 18:38
    Wonder if anyone can help.
    Since the latest updates into V19 I have a mapbasic tool that won't work correctly.
    It is for printing farm maps and it wont print the scalebar.
    Any help greatly appreciated.
    Some of the code is:
    'Set coordinates for layout
    SET COORDSYS LAYOUT UNITS "mm"
    SET PAPER UNITS "mm"
    CREATE FRAME
    INTO WINDOW LayID
    (Origin.x+1,Origin.y+1)(Extent.x-Legend-1,Extent.y-1)
    PEN (0,0,0)
    TITLE WINDOWINFO(Win2Id,WIN_INFO_NAME)

    'Get origin for Scale bar at top right corner of map
    SET COORDSYS EARTH PROJECTION 8,13,"m",gAMGZone,0,0.9996,500000,10000000
    SET MAP WINDOW Win2Id COORDSYS Earth PROJECTION 8,13,"m",147,0,0.9996,500000,10000000
    DELETE FROM WINDOWINFO(Win2Id,WIN_INFO_TABLE) 'Delete cosmetic layer
    SET STYLE PEN MAKEPEN(1,2,0)
    Size = (gPrtScale / 10)*.75
    ' Orig.x = MAPPERINFO(Win2Id,MAPPER_INFO_MAXX) - gPrtScale / 100 - Size
    ' Orig.y = MAPPERINFO(Win2Id,MAPPER_INFO_MAXY) - gPrtScale / 100
    Orig.x = MAPPERINFO(Win2Id,MAPPER_INFO_MINX) + gPrtScale / 100
    Orig.y = MAPPERINFO(Win2Id,MAPPER_INFO_MINY) + gPrtScale / 100

    'Draw base line then ticks for scale bar
    SET STYLE FONT MAKEFONT(FName,0,8,BLACK,-1)
    SET MAP WINDOW Win2Id LAYER 0 EDITABLE ON
    CREATE LINE INTO WINDOW Win2Id (Orig.x,Orig.y)(Orig.x+Size,Orig.y)
    FOR Pos# = 1 TO 5
    Pos.x = Orig.x + (Pos# - 1) * (Size / 4)
    Pos.y = Orig.y
    CREATE LINE INTO WINDOW Win2Id (Pos.x,Pos.y)(Pos.x,Pos.y+(Size/20))
    Pos.y = Pos.y + Size/10
    CREATE TEXT INTO WINDOW Win2Id STR$((Pos#-1)*(Size/4)) (Pos.x,Pos.y)(Pos.x+Size,Pos.y-(Size/20))
    NEXT
    CREATE TEXT INTO WINDOW Win2Id "Scale 1:"+STR$(gPrtScale)
    (Orig.x+Size/3,Orig.y-Size/30)(Pos.x+Size,Orig.y-(Size/10))

    ------------------------------
    Dale Thomas
    Tully Sugar Ltd
    Tully QLD
    ------------------------------


  • 2.  RE: printing scalebar

    Employee
    Posted 12-08-2020 08:36
    Hi

    I'm assuming your tool used to work in an older 32-bit version of MapInfo Pro, right?

    Already in v15, we started implementing a new layout window that would change the way you work with map window in your layout.

    The map window in a layout used to be "a representation of" a map window. In the new layout window, the map window IS a map window. Earlier the map window in the layout just reflected another map window open in MapInfo Pro, but with the new layout window the map window in the layout is the actual map window. So to change that map window, you need to modify the actual embedded map, not the one you choose to insert.

    You'll need to modify your application slightly to make it work in v2019.

    '** Copy the existing map window into an embedded map window in the layout
    CREATE FRAME

       INTO WINDOW LayID
       (Origin.x+1,Origin.y+1)(Extent.x-Legend-1,Extent.y-1)
       PEN (0,0,0)
       TITLE WINDOWINFO(Win2Id,WIN_INFO_NAME)

    '** Get the Window ID of the new map window in the layout:
    '** Get the ID of the newest window opened
    Win2Id = WindowID(0)

    You now also need to know that Win2Id refers to the map window in your layout, not the standalone map.

    ------------------------------
    Peter Horsbøll Møller
    Principal Presales Consultant | Distinguished Engineer
    Precisely | Trust in Data
    ------------------------------



  • 3.  RE: printing scalebar

    Posted 12-08-2020 09:27
    Thanks Peter you are always helpful I'll past that on to IT.
    Another question,  what is the mapbasic syntax for saving a table in a different projection?
    Trying to go from agd84 to mga2020, or even mga 94 zone 55. For multiple maps in map basic where table = currenttable. Or something...
    Thanks for your help! 
    Dale





  • 4.  RE: printing scalebar

    Employee
    Posted 12-09-2020 02:53
    Hi Dale

    Try opening the MapBasic window and then do it via Save Copy As.
    You should afterwards see the statement in the MapBasic window

    Should be something like:
    Commit Table MYTABLE As "D:\MyTableMGA2020.TAB" TYPE NATIVEX Charset "UTF-8" CoordSys Earth Projection 8, 1028, "m", 147, 0, 0.9996, 500000, 10000000 Bounds (-7745844.29605, 2035.05684549) (8745844.29605, 19997964.9432) Interactive

    I have saved it into a NativeX, the Extended MapInfo table, but you can also save it into the older Native format if you prefer.

    ------------------------------
    Peter Horsbøll Møller
    Principal Presales Consultant | Distinguished Engineer
    Precisely | Trust in Data
    ------------------------------