Nous utilisons des cookies pour vous garantir la meilleure expérience sur notre site. Si vous continuez à utiliser ce dernier, nous considèrerons que vous acceptez l'utilisation des cookies. J'ai compris ! ou En savoir plus !.
banniere

Le portail francophone de la géomatique


Toujours pas inscrit ? Mot de passe oublié ?
Nom d'utilisateur    Mot de passe              Toujours pas inscrit ?   Mot de passe oublié ?

Annonce

Rencontres QGIS 2025

L'appel à participation est ouvert jusqu'au 19 janvier 2025!

#1 Thu 22 October 2009 23:10

G.BAZIN
Participant occasionnel
Lieu: Marseille
Date d'inscription: 5 Sep 2005
Messages: 43

MapBasic 6.0: MBO au lieu de MBX...pouquoi ?

Bonjour à tous

J'ai un programme Mapbasic v 6.0 de mise en page automatique.

Je gère quelques 280 ou 600 planchesau format A0, écrit  il y a quelques (nombreuses) années. Cette automatisation de la mise en page me fait gagner un temps fou,et de plus elle m'évite beaucoup d'erreurs. Seulement, j'ai du apporter quelques améliorations mineures maisqui me faciliteraient à la fois, la vie (un peu feignant pour les uns ou sage pour les autres) et la gestion des modifications que je suis obligé de gérer (modifications voir plan ci dessous)... d'un document d'urbanisme qu'est le POS ou le PLU).

En fait sur mes planches apparaissent de façon automatique toutes les procédures de modification.
Ce qui me permet de savoir ou j'en suis et d'avoir rapidement un tour d'horizon des planches modifiées par telle ou telle procédure.

C'est un peu long mais il fallait que je rentre dans un certain détail.

J'en viens au fait.
Je suis confronté à un problème de compilation ce programme: il ne me fait qu'un MBO (et ne me trouve aucune erreur) alors que bien évidemment j'aimerais un MBX
J'ai lu qu'il doit me manquer le développement d'une procédure; oui voilà, mais laquelle, je ne sais plus, je suis complètement sec ou nul.

Je joins le programme
Si quelqu'un peut m'aider merci.

Code:

'****************************************************************************
'
' Program: MulMEP Multiple MiseEnPage
'
'
'****************************************************************************
'****************************************************************************
'
' Include files and Define statements.
'
'****************************************************************************
Include "MapBasic.def"
Include "STR_Lib.def"
Include "Auto_lib.def"
Include "MiStdLib.def"
Include "getscale.def"

type WorDefinition
  LayoutName as string
  LayoutPageSize   as string
  LayoutPrinter    as String
  LayoutTableRect  as string
  LayoutID         as string
  LayoutTitre1     as string
  LayoutTitre2     as string
  LayoutTitre3     as string
  LayoutTitre4     as string
  LayoutTitreLibre as integer
end type

Define ID_LB               100
Define ID_LBWOR            101
Define ID_LBRect           102
Define ID_LBSCALE          108
Define ID_LBPrinters       109
Define ID_TFILENAME        112

define  mcolor  5263440

global WorDefinitions()     as WorDefinition
global CarteWindowName      as string
global MiseEnPageWindowName as string
global ZOOMMEP              as float
global ZOOMMEPINIT          as float
global TableRect            as alias
global NbRect               as integer
global NbMiseEnPage         as integer
global StrAllTables         as string
global StrAllFields         as string
global StrAllPrinters       as string
global IDFirstLayout        as integer
'****************************************************************************
'
' Declare Global variables
'
'****************************************************************************
Global tbl_list    As String
Global tbl_listWOR As String
Global gCurMEP as String

Declare Sub Main
Declare Sub MainDialog
Declare Sub ListBoxHndlr
Declare Sub ListBoxRectHndlr
Declare Sub ListBoxMiseEnPageHndlr
Declare Sub ListBoxIdHndlr
Declare Sub EndPrg
''Declare Sub valuelist_handler
declare sub DeleteEnteteLayout
declare sub ModifyTextObjectLayout(byVal newval as string,byval x as float,byval y as float,byval prefix as string,byval suffix as string,byval align as integer)
declare sub CreateTextIntoLayout(LayoutName as string,byval x as float,byval y as float,byVal Sz as integer,byval Txt as string,IsItScale as integer) 
declare sub ZoomPlus
declare sub ZoomMoins
declare sub PrintLayout
declare sub PrintThisLayout
declare sub PrintAllLayout
declare sub ImgAllLayoutForOneID

declare sub ImgLayout
declare sub ImgAllLayout
declare sub ImgAllRectThisLayout

declare sub MAJZoom
Declare function GetWindowIDFromName(MWindowName as string) as integer
Declare function GetWindowNumFromName(MWindowName as string) as integer
declare function getCarteWindowNameFromLayout(MiseEnPageWindowName as string) as string
Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (lpBuffer As String,  nSize As integer) As integer
Declare Function GetTempPath         Lib "kernel32" Alias "GetTempPathA"         (nBufferLength As integer, lpBuffer As String) As integer
declare function GetWinDir() as string
declare function GetTempDir() as string
declare sub  getPrintersList() 
declare function getLayerIdFromTableName(byval WindowId as integer,byval Tablename as string) as integer
declare sub DropTableWhenever(byval Tablename as string)
declare sub FillStrAllfieldsVar(byval TableName as string)
declare sub FillTblList()
''declare function CalcMEPScale(byval MiseEnPageWindowNamePrm as string) as string
declare sub closeWindow()
declare sub UpdateListWor()
declare sub PrintAllRectThisLayout()
declare function IsTablePresentInMapWindow(byval tablename as string,byval MapWindowID as integer)  as integer

'****************************************************************************
' Sub procedure: closeWindow()
'
'****************************************************************************

sub CloseWindow()
  Dialog Preserve
end sub

'****************************************************************************
' Function: GetWinDir()
'
'****************************************************************************

function GetWinDir() as string
  dim MaxPath as integer
  dim MyString as string
  MaxPath=255
  MyString = Space$(MaxPath) 
  if   GetWindowsDirectory(MyString, MaxPath) 0 then
    GetWinDir = MyString
  else
    GetWinDir = ""
  end if
end function

'****************************************************************************
' Function: GetTempDir()
'
'****************************************************************************

function GetTempDir() as string
  dim MaxPath as integer
  dim MyString as string

  MaxPath=255
  MyString = Space$(MaxPath) 
  if GetTempPath(MaxPath,MyString)  0 then
    GetTempDir = MyString 
  else
    GetTempDir = ""
  end if
end function

'****************************************************************************
' Sub procedure: getPrinterList()
'
'****************************************************************************

sub getPrintersList() 
  dim str as string
  
  run program  ApplicationDirectory$() & "Allprinters.exe"
  StrAllPrinters  =""
  Open File "c:allprinters.txt"  For input  As #2
  Do While Not EOF(2)
    Line Input #2, str
    StrAllPrinters=StrAllPrinters & str &";"
  Loop 
  Close File #2
end sub 

'****************************************************************************
' Sub procedure: Main
'
'****************************************************************************
Sub Main

  call getPrintersList()
  
  ZOOMMEPINIT           =0.8
  
  gsAppDescription = "AgAM - POS-PLU"
  gsAppFilename    = "pos.mbx"

  Create Menu "POS-PLU" As
    "Mise en page"    Calling MainDialog,
    "(-",
    "&Remove ApplicationtCtrl+K/W^K" Calling EndPrg
      
  Alter Menu Bar Add "POS-PLU"

'  call MainDialog
End Sub

'****************************************************************************
' Sub procedure: UpdateListWor
'
'****************************************************************************
sub UpdateListWor()
  dim FirstLayout as logical
  dim i as integer
 
  tbl_listWOR = ""
  NbMiseEnPage=0
  FirstLayout= true
  For i = 1 to NumWindows() 
    If (WindowInfo(i,WIN_INFO_TYPE) = WIN_LAYOUT) Then
      NbMiseEnPage = NbMiseEnPage+1
      tbl_listWOR =tbl_listWOR + WindowInfo(i,WIN_INFO_NAME)+ ";"  
      if FirstLayout then
        IDFirstLayout =1
        FirstLayout =false
        MiseEnPageWindowName = WindowInfo(i,WIN_INFO_NAME)
        CarteWindowName = getCarteWindowNameFromLayout(MiseEnPageWindowName)
      end if
    end if
  next 

  redim WorDefinitions(NbMiseEnpage)
  if NbMiseEnPage=0 then
    Note "Aucune Mise en page trouvee, Arret"
    exit sub
  end if
end sub

'****************************************************************************
' Sub procedure: MainDialog
'
'****************************************************************************
Sub MainDialog
 Dim i As Integer
  Dim staticInit As String
  Dim j, iNumOpen as smallint
  dim ColZoomFound as integer
  dim IsItFirstTableWithZoom as integer
  dim FirstColName as string
 
        
  StrAllTables =""
  StrAllFields=""
  IsItFirstTableWithZoom =0
  Close Table Selection Interactive
  for i=1 to NumTables()
    ColZoomFound =0
    FirstColName=""
    onerror goto errh
    FirstColName=ColumnInfo(TableInfo(i,TAB_INFO_NAME),"COL1",COL_INFO_NAME)
    errh:
    For j = 1 to NumCols(TableInfo(i,TAB_INFO_NAME))      
      if ucase$(ColumnInfo(TableInfo(i,TAB_INFO_NAME),"COL" + Str$(j),COL_INFO_NAME))="ZOOM" and 
         TableInfo(i,TAB_INFO_NAME)"MEPSELECTED" and 
         TableInfo(i,TAB_INFO_NAME)"TMPMEP"      then
        ColZoomFound =1
      end if
    next 
    if ColZoomFound =1 then
      StrAllTables  = StrAllTables  + TableInfo(i,TAB_INFO_NAME) + ";"
      if IsItFirstTableWithZoom =0 then
        call FillStrAllfieldsVar(TableInfo(i,TAB_INFO_NAME))
        TableRect=TableInfo(i,TAB_INFO_NAME)
        IsItFirstTableWithZoom =1
        call FillTblList()
      end if
    end if
  Next

  call UpdateListWor()

  Dialog
    Title  gsAppDescription 
    Height 210
    Width  400

  Control StaticText Title "Mises en page présentes:" 
    Position 10, 16
  Control ListBox 
    Position 10, 27 Width 150 Height 55
    Title    tbl_listWOR 
    Value    IDFirstLayout 
    ID       ID_LBWOR
    Calling  ListBoxMiseEnPageHndlr

  Control StaticText Title "Imprimante:"      
    Position  10, 140 width 70
  Control popupmenu
    Position 10, 150 Width 110 Height 20
    Title    StrAllPrinters
    Value    1
    ID       ID_LBPrinters

  Control StaticText Title "Donnees presentes:" 
    Position 170, 5
  Control ListBox 
    Position 170, 15 Width 200 Height 60
    Title    tbl_list
    Value    0
    ID       ID_LB
    Calling  ListBoxHndlr

  Control Button 
    Position  170, 80     width     100
    Title     "PRN : Cette MEP / Cette ID"
    Calling   PrintLayout

  Control Button 
    Position  170, 95     width     100
    Title     "PRN : cette MEP/Tout ID"
    Calling   PrintAllRectThisLayout

  Control Button 
    Position  170, 110    width     100
    Title     "PRN : toutes les MeP/tout ID"
    Calling   PrintAllLayout

  Control Button 
    Position  170, 125    width     100
    Title     "INACTIF: tts les MeP/Cette ID"
    Calling   ImgAllLayoutForOneID
      'PrintAllLayoutForOneID

  Control Button 
    Position  270, 80     width     100
    Title     "IMG : Cette MEP / Cette ID"
    Calling   ImgLayout

  Control Button 
    Position  270, 95    width     100
    Title     "IMG : cette MEP/Tout ID"
    Calling   ImgAllRectThisLayout

  Control Button 
    Position  270, 110    width     100
    Title     "IMG : toutes les MeP/tout ID"
    Calling   ImgAllLayout

  Control Button 
    Position  270, 125    width     100
    Title     "IMG : toutes les MeP/Cette ID"
    Calling   ImgAllLayoutForOneID

  Control StaticText Title "Prefix Fichier:" 
    Position 170, 140 width 60
  Control EditText    
    Position 270, 140 width 115
    value  "c:"
    ID ID_TFILENAME

  'Control Button 
  '  Position  170, 190 
  '  width     150
  '  Title     "MaJ du Zoom et de l'echelle"
  '  Calling   MAJZoom

  Control OKButton
    Position 350, 190
    Width    40
    Title "OK"  

End Sub 

'****************************************************************************
'  Sub procedure : FillTblList
'
'****************************************************************************
sub FillTblList()
  tbl_list = ""
  NbRect=0
  select * From TableRect order by IDEN Into MySelection Noselect
  fetch First From  MySelection
  tbl_list=""
  Do Until EOT(MySelection)
    NbRect=NbRect+1 
    tbl_list = tbl_list + MySelection.IDEN + ";"
    Fetch Next From MySelection
  Loop
  close table MySelection
end sub

'****************************************************************************
' Sub procedure: DropTableWhenever
'
'****************************************************************************
sub DropTableWhenever(byval Tablename as string)
  dim i as integer

  for i=1 to NumTables()
    if ucase$(TableInfo(i,TAB_INFO_NAME))=ucase$(tablename) then
      run command "close table "& Tablename
      exit for
    end if
  next
  
end sub
'****************************************************************************
' Sub procedure: ListBoxMiseEnPageHndlr
'
'****************************************************************************
Sub ListBoxMiseEnPageHndlr
  dim index as integer
  index = ReadControlValue( ID_LBWOR )
  Call Extract( index, tbl_listwor, MiseEnPageWindowName )
  print "Mise En Page :" + MiseEnPageWindowName
  CarteWindowName = getCarteWindowNameFromLayout(MiseEnPageWindowName) 
  print "Carte : " + CarteWindowName
  call ListBoxHndlr
end sub
'****************************************************************************
' Sub procedure: FillStrAllfieldsVar
'
'****************************************************************************
sub FillStrAllfieldsVar(byval TableName as string)
  dim i        as integer 
  dim sCol     as alias
  dim sColName as string
  StrAllfields=""
  For i = 1 to NumCols(TableName)
    sCol   = Str$(ColumnInfo(TableName,"COL"+Str$(i),COL_INFO_NUM))               
    sColName  = ColumnInfo(TableName ,"COL" + Str$(i),COL_INFO_NAME)
    StrAllfields = StrAllfields + sColname + ";"
  next  
  StrAllfields = StrAllfields +"--AUCUN--;--TEXTE-LIBRE--;--ECHELLE--"
end sub
'****************************************************************************
' Sub procedure: ListBoxRectHndlr
'
'****************************************************************************
Sub ListBoxRectHndlr
  dim index as integer
  dim TableRectName as string
  dim mapstr as string

  Index = ReadControlValue( ID_LBRect )
  Call Extract( index, strAlltables, TableRectName)
  TableRect = TableRectName
  call FillStrAllfieldsVar(TableRectName ) 

  call ListBoxIDHndlr
  

  'rechercher les MEP contenant cette table
  '
end sub 

'****************************************************************************
' Sub procedure: ListBoxHndlr
'
'****************************************************************************
Sub ListBoxHndlr
  Dim index, tabletype  As SmallInt
  Dim i as integer
  Dim WindowCarteID as integer
  Dim CurMEP as object
  Dim p_MEP As PEN
  Dim MEPwidth as integer
  Dim MEPheight as integer
  Dim MEPMinX,MEPMaxX,MEPMinY,MEPMaxY,curx,cury as FLOAT
  Dim n,o as integer 
  Dim taillezoomarea as float
  Dim tmpcol as alias
  Dim titre1 as string
  Dim titre2 as string
  Dim titre3 as string
  Dim titre4 as string
  Dim titre1Echelle as integer
  Dim titre2Echelle as integer
  Dim titre3Echelle as integer
  Dim titre4Echelle as integer
  Dim IdRectAlias as alias
  Dim PrinterOrientation as integer
  Dim WindowMiseEnPageId as integer 
  Dim titre2Pos as float
  dim b_fillstyle As Brush
  dim sTxtLibre as string
  dim mapstr as string
  dim TmpId as integer
  dim FrameWidth as float
  dim x1 as float
  dim x2 as float
  dim xcenter as float
  dim desiredScale as float
  dim formatPapier as string
  dim TypePlanche as string

  'print "MEP" + MiseEnPageWindowName
  'print "MAP" + CarteWindowName
  index = ReadControlValue( ID_LB )
  Call Extract( index, tbl_list, gCurMEP )
  'print "MEP en cours:"+gCurMEP

  if gCurMEP="" then
    note "vous devez selectionner une table et un champ ID"
    exit sub
  end if

  
  'Cherche la fenetre CARTE
  WindowMiseEnPageId  = GetWindowIDFromName(MiseEnPageWindowName)  
  'if WindowCarteID =0 then
  '  note "Attention la fenetre carte a un nom trop long, servez vous de MAP WINDOW MANAGER, fin du programme"
  '  end program
  'end if  
  
  'Recherche de l'object Mise en page
  dim MEPObj as object
  dim t,layoutTempName as string 
  layoutTempName = WindowInfo(GetWindowIDFromName(MiseEnPageWindowName),WIN_INFO_TABLE)
  t="-" 
  select * from layoutTempName into TmpLayout
  fetch first from TmpLayout 
  Set CoordSys Layout Units "cm"
  Do Until EOT(TmpLayout)
    if objectInfo(TmpLayout.obj,OBJ_INFO_TYPE)=OBJ_TYPE_FRAME then
      if t="-" and objectInfo(TmpLayout.obj,OBJ_INFO_FRAMETITLE)  "" then 
         MEPObj =TmpLayout.obj
         'WindowCarteID = GetWindowIDFromName(CarteWindowName)
         TmpId = objectInfo(TmpLayout.obj,OBJ_INFO_FRAMEWIN) 
         ''''''''ici le test pour la carte avec la table selectionnee
         if IsTablePresentInMapWindow(TABLERECT ,TmpID)=1 then
           WindowCarteID =TmpID
           t="---"
         else
           note "la table des rectangles n existe pas dans la fenetre carte"
           exit sub
         end if 
      end if
    end if
    Fetch Next From TmpLayout
  Loop
  ''''''''''''''''''''''''''''''''''''''
  print "Carte ID : " + WindowCarteID

  set window WindowCarteID front
  set map redraw off
  set map XY Units "m"

  'reinitialise les MEP
  ''''i=0
  ''''IdFieldAlias = "MySelection." & IdField
  ''''select * From TableRect order by IdFieldAlias Into MySelection noselect
  ''''fetch First From  MySelection
  ''''Do Until EOT(MySelection)
  ''''  curMEP = MySelection.obj
  ''''  i=i+1
  ''''  p_MEP = MakePen(1,2,BLACK)
  ''''  alter Object CURMEP Info  OBJ_INFO_PEN,P_MEP
  ''''  update MySelection 
  ''''    set obj = CURMEP
  ''''    where rowid = i
  ''''  Fetch Next From MySelection
  ''''Loop
  ''''close table MySelection 
  
  select * From TableRect where str$(IDEN)=str$(gCurMEP) Into MEPSELECTED 
  ZOOMMEP  = MEPSELECTED.zoom
  if (ZOOMMEP+0) = 0 then
    ZOOMMEP= ZOOMMEPINIT
  end if
  curMEP   = MEPSELECTED.OBJ    

  Add Map Layer MEPSELECTED 
  Set Map Layer getLayerIdFromTableName(WindowCarteId,"MEPSELECTED") Editable On
  Set Map Layer getLayerIdFromTableName(WindowCarteId,"MEPSELECTED") Display Graphic Editable on Selectable On 
    Global Line (3,2,mcolor)
    Global Pen (8,2,mcolor)
    Global Brush(01,mcolor,mcolor)
    Global Symbol (35,12632256,12)
    Global Font ("Arial",0,9,0)
  set map layer getLayerIdFromTableName(WindowCarteId,"MEPSELECTED") XY Units "m" 
  set map layer getLayerIdFromTableName(WindowCarteId,"MEPSELECTED") display global
  set map center(centroidX(curMEP),centroidy(curMEP))

  'zone selected
  Set Map Layer getLayerIdFromTableName(WindowCarteId,"MEPSELECTED") 

  Set Map Zoom Entire Layer getLayerIdFromTableName(WindowCarteId,"MEPSELECTED")

  'set map zoom MapperInfo(WindowCarteID,MAPPER_INFO_ZOOM)*ZOOMMEP
  'note MapperInfo(WindowCarteID,MAPPER_INFO_ZOOM)*ZOOMMEP

  'note MiseEnPageWindowName
  'mise_en_page_A0_2000_A
  
  'note mid$(MiseEnPageWindowName,15,2)
  desiredScale =val(mid$(MiseEnPageWindowName,17,2))
  formatPapier = mid$(MiseEnPageWindowName,14,2)
  TypePlanche = right$(MiseEnPageWindowName,1)

  set distance units "m"    
  FrameWidth = ObjectGeography(MEPObj,OBJ_GEO_MAXX)  -  ObjectGeography(MEPObj,OBJ_GEO_MINX)
  x1 = MapperInfo(WindowCarteId,MAPPER_INFO_MINX )
  x2 = MapperInfo(WindowCarteId,MAPPER_INFO_MAXX)
    
  'print  (FrameWidth * desiredScale)
  'print "D1 "+ x1
  'print "D "+ MapperInfo(WindowCarteId,MAPPER_INFO_ZOOM)
  'print "##################################"
  'print "AAA "+MapperInfo(ObjectInfo(MEPObj, 4),1) / (ObjectGeography(MEPObj, 3) - ObjectGeography(MEPObj, 1))
  'print "B "+MapperInfo(ObjectInfo(MEPObj, 4),1) 

  set map window WindowCarteId zoom (FrameWidth * desiredScale) units "m"
  Set Map Layer getLayerIdFromTableName(WindowCarteId,"MEPSELECTED") Display Off
 
  
  Set Coordsys Window WindowCarteID 

  
  set map redraw on

  ' on repasse sur la mise en page
  set window WindowMiseEnPageId  front

  'call DeleteEnteteLayout 
  set paper units "cm"
  PrinterOrientation = WindowInfo(WindowMiseEnPageId,WIN_INFO_PRINTER_ORIENT    )

  if (formatPapier="A0") then
    call ModifyTextObjectLayout(MEPSELECTED.PLANCHE_SUP , 3.6, 4.8,"","",5)
    call ModifyTextObjectLayout(MEPSELECTED.PLANCHE_INF ,63.3,99.3,"","",5)

    if TypePlanche = "A" then
      call ModifyTextObjectLayout(MEPSELECTED.IDEN        ,28.1, 4.5,""," - A - (Consulter la planche B)",-1)
      call ModifyTextObjectLayout(MEPSELECTED.IDEN        ,70.8, 5.9,""," A",-1)
    end if
    if TypePlanche = "B" then
      call ModifyTextObjectLayout(MEPSELECTED.IDEN        ,28.1, 4.5,""," - B - (Consulter la planche A)",-1)
      call ModifyTextObjectLayout(MEPSELECTED.IDEN        ,70.8, 5.9,""," B",-1)
    end if
    call ModifyTextObjectLayout(MEPSELECTED.TXTLIBRE_1  , 3.1,  99.0,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.TXTLIBRE_2  , 3.1,  99.6,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.TXTLIBRE_3  , 3.1, 100.2,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.TXTLIBRE_4  , 3.1, 100.8,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.TXTLIBRE_5  , 3.1, 101.4,"","",-1)  
    call ModifyTextObjectLayout(MEPSELECTED.TXTLIBRE_6  , 3.1, 102.0,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.TXTLIBRE_7  , 3.1, 102.6,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.TXTLIBRE_8  , 3.1, 103.2,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.TXTLIBRE_9  , 3.1, 103.8,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.TXTLIBRE_10 , 3.1, 104.4,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.TXTLIBRE_11 , 3.1, 105.0,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.TXTLIBRE_12 , 3.1, 105.6,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.TXTLIBRE_13 , 3.1, 106.2,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.TXTLIBRE_14 , 3.1, 106.8,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.TXTLIBRE_15 , 3.1, 107.4,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.TXTLIBRE_16 , 3.1, 108.0,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.TXTLIBRE_17 , 3.1, 108.6,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.TXTLIBRE_18 , 3.1, 109.2,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.TXTLIBRE_19 , 3.1, 109.8,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.TXTLIBRE_20 , 3.1, 110.4,"","",-1)

    call ModifyTextObjectLayout(MEPSELECTED.ASTLIBRE_1  , 2.4,  99.0,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.ASTLIBRE_2  , 2.4,  99.6,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.ASTLIBRE_3  , 2.4, 100.2,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.ASTLIBRE_4  , 2.4, 100.8,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.ASTLIBRE_5  , 2.4, 101.4,"","",-1)  
    call ModifyTextObjectLayout(MEPSELECTED.ASTLIBRE_6  , 2.4, 102.0,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.ASTLIBRE_7  , 2.4, 102.6,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.ASTLIBRE_8  , 2.4, 103.2,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.ASTLIBRE_9  , 2.4, 103.8,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.ASTLIBRE_10 , 2.4, 104.4,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.ASTLIBRE_11 , 2.4, 105.0,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.ASTLIBRE_12 , 2.4, 105.6,"","",-1)  
    call ModifyTextObjectLayout(MEPSELECTED.ASTLIBRE_13 , 3.1, 106.2,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.ASTLIBRE_14 , 3.1, 106.8,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.ASTLIBRE_15 , 3.1, 107.4,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.ASTLIBRE_16 , 3.1, 108.0,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.ASTLIBRE_17 , 3.1, 108.6,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.ASTLIBRE_18 , 3.1, 109.2,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.ASTLIBRE_19 , 3.1, 109.8,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.ASTLIBRE_20 , 3.1, 110.4,"","",-1)
  end if

  if (formatPapier="A3") then
    call ModifyTextObjectLayout(MEPSELECTED.PLANCHE_SUP , 2.7, 0.9,"","",5)
    call ModifyTextObjectLayout(MEPSELECTED.PLANCHE_INF ,26.5,38.6,"","",5)

    if TypePlanche = "A" then
      call ModifyTextObjectLayout(MEPSELECTED.IDEN        ,13.3, 0.8,""," - A - (Consulter la planche B)",-1)
    end if
    if TypePlanche = "B" then
      call ModifyTextObjectLayout(MEPSELECTED.IDEN        ,13.3, 0.8,""," - B - (Consulter la planche A)",-1)
    end if
    call ModifyTextObjectLayout(MEPSELECTED.TXTLIBRE_1  , 2.7,38.4,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.TXTLIBRE_2  , 2.7,38.6,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.TXTLIBRE_3  , 2.7,38.9,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.TXTLIBRE_4  , 2.7,39.1,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.TXTLIBRE_5  , 2.7,39.4,"","",-1)  
    call ModifyTextObjectLayout(MEPSELECTED.TXTLIBRE_6  , 2.7,39.6,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.TXTLIBRE_7  , 2.7,39.9,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.TXTLIBRE_8  , 2.7,40.1,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.TXTLIBRE_9  , 2.7,40.3,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.TXTLIBRE_10, 2.7,40.6,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.TXTLIBRE_11, 2.7,40.9,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.TXTLIBRE_12, 2.7,41.1,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.TXTLIBRE_13 , 2.7,41.4,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.TXTLIBRE_14 , 2.7,41.6,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.TXTLIBRE_15 , 2.7,41.9,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.TXTLIBRE_16 , 2.7,42.1,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.TXTLIBRE_17 , 2.7,42.4,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.TXTLIBRE_18 , 2.7,42.6,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.TXTLIBRE_19 , 2.7,42.9,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.TXTLIBRE_20 , 2.7,43.1,"","",-1)

    call ModifyTextObjectLayout(MEPSELECTED.ASTLIBRE_1  , 2.3,38.4,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.ASTLIBRE_2  , 2.3,38.6,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.ASTLIBRE_3  , 2.3,38.9,"","",-1) 
    call ModifyTextObjectLayout(MEPSELECTED.ASTLIBRE_4  , 2.3,39.1,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.ASTLIBRE_5  , 2.3,39.4,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.ASTLIBRE_6  , 2.3,39.6,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.ASTLIBRE_7  , 2.3,39.9,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.ASTLIBRE_8  , 2.3,40.1,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.ASTLIBRE_9  , 2.3,40.3,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.ASTLIBRE_10 , 2.3,40.6,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.ASTLIBRE_11 , 2.3,40.9,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.ASTLIBRE_12 , 2.3,41.1,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.ASTLIBRE_13 , 2.3,41.4,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.ASTLIBRE_14 , 2.3,41.6,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.ASTLIBRE_15 , 2.3,41.9,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.ASTLIBRE_16 , 2.3,42.1,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.ASTLIBRE_17 , 2.3,42.4,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.ASTLIBRE_18 , 2.3,42.6,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.ASTLIBRE_19 , 2.3,42.9,"","",-1)
    call ModifyTextObjectLayout(MEPSELECTED.ASTLIBRE_20 , 2.3,43.1,"","",-1)

  end if

  select * from layoutTempName where false into TmpLayout

  'close table MEPSELECTED
End Sub 

'****************************************************************************
' Sub Function: IsTablePresentInMapWindow
'
'****************************************************************************
function IsTablePresentInMapWindow(byval tablename as string,byval MapWindowID as integer) as integer
  dim TmpReturn as integer
  dim i as integer
  TmpReturn =0
  for i=1 to MapperInfo(MapWindowID, MAPPER_INFO_LAYERS)
    ''''print ucase$(Tablename) + "####"+ ucase$(LayerInfo( MapWindowID,  i ,  LAYER_INFO_NAME ))
    if ucase$(Tablename)=ucase$(LayerInfo( MapWindowID,  i ,  LAYER_INFO_NAME )) then
      TmpReturn =1
    end if
  next
  IsTablePresentInMapWindow=TmpReturn 
end function

'****************************************************************************
' Sub Function: getLayerIdFromTableName
'
'****************************************************************************
function getLayerIdFromTableName(byval WindowId as integer,byval Tablename as string) as integer
  dim i as integer
  dim tmpresult as integer
  tmpresult =0
  for i=1 to MapperInfo(WindowId, MAPPER_INFO_LAYERS)
    if ucase$(Tablename)=ucase$(LayerInfo( WindowId ,  i ,  LAYER_INFO_NAME )) then
      tmpresult = i
    end if
  next
  getLayerIdFromTableName = tmpresult
end function

'****************************************************************************
' Sub procedure: DeleteEnteteLayout
'
'****************************************************************************
sub DeleteEnteteLayout
  dim i as integer
  dim layoutTempName as alias
  dim idlayout as integer

  idlayout = GetWindowIDFromName(MiseEnPageWindowName)  
  layoutTempName = WindowInfo(idlayout,WIN_INFO_TABLE)

  set window idlayout  front
  Set CoordSys Layout Units "cm"
  select * from layoutTempName into MySelection
  where centroidX(obj)>=0 and centroidX(obj)0 then
    if ((align - len(newval))/2) >0 then    
      txtspacer  = space$((align - len(newval))/2)
    end if
  end if
  idlayout = GetWindowIDFromName(MiseEnPageWindowName)  
  layoutTempName = WindowInfo(idlayout,WIN_INFO_TABLE)

  set window idlayout  front
  Set CoordSys Layout Units "cm"
  select * from layoutTempName into MySelection
  where ObjectGeography(obj,OBJ_GEO_MINX)>=x and objectgeography(obj,OBJ_GEO_MINX)

G.BAZIN
Tel : 04 88 91 92 74
email : g.bazin@texte-a-enlever.agam.org
email : gbazin05@texte-a-enlever.free.fr

Hors ligne

 

#2 Fri 23 October 2009 05:21

Bruno MELI
Participant occasionnel
Lieu: Le Tampon - Réunion
Date d'inscription: 7 Apr 2008
Messages: 46
Site web

Re: MapBasic 6.0: MBO au lieu de MBX...pouquoi ?

bonjour,

Je n'ai pas la solution mais après un petit coup d'oeil, je me demande si à la dernière ligne il ne manquerait pas un opérateur et une valeur ?

mais ça ne doit pas régler ton problème

BM

Hors ligne

 

#3 Fri 23 October 2009 08:33

Patrick PALMIER
Participant actif
Lieu: Lille
Date d'inscription: 18 Jan 2007
Messages: 97

Re: MapBasic 6.0: MBO au lieu de MBX...pouquoi ?

Bonjour,

Typiquement le MBO est généré soit quand il n'y a pas de procedure main ou quand une fonction ou subroutine est déclarée mais pas défini.

C'est notamment la manière de procéder quand le MB fait plus de 64Ko  (taille maxi enfin avec des anciennes versions de MapBasic)

Dans ce acs on fait plusieurs MB qui génèrent  des MBO (modules)
il faut alors les lier avec un fichier MBP pour générer le MBX

D'où deux possibilités, la procédure main étant définie
Une procédure déclarée n'est pas définie dans le MB
Le fichier MB dépasse les 64Ko, dans ce cas il faut le partager en plusieurs parties en déclarer certaines procédures dans un autre fichier

le fichier MBP se présente ainsi
[LINK]
    Application=v:\temp\reseaux.mbx
    Module=i:\palmier\mbx\work\reseaux.mbo
    Module=i:\palmier\mbx\work\reseauxb.mbo

Hors ligne

 

#4 Sat 24 October 2009 09:13

fredericfridi
Participant actif
Date d'inscription: 2 Feb 2008
Messages: 97

Re: MapBasic 6.0: MBO au lieu de MBX...pouquoi ?

Bonjour

Je n ai pas regardé en detail le programme car je suis novice,
mais ça m arrive lorque j ai declaré un sub que je n ai pas crée.

Hors ligne

 

Pied de page des forums

Powered by FluxBB