Bonjour à tous,
Je coince avec mon code Mapbasic sur un truc surement tout bête mais dont je n'arrive pas à me sortir. J'ai écris un petit programme pour automatiser la création de carte. Mais lorsque je lui demande de zoomer sur l'emprise de total de mon objet (un tracé) il le rogne un peu en haut et en bas. Il y avoir un problème de dimensionnement ou je ne sais quoi....
Voici le code :
Merci à tous ! :)
Je coince avec mon code Mapbasic sur un truc surement tout bête mais dont je n'arrive pas à me sortir. J'ai écris un petit programme pour automatiser la création de carte. Mais lorsque je lui demande de zoomer sur l'emprise de total de mon objet (un tracé) il le rogne un peu en haut et en bas. Il y avoir un problème de dimensionnement ou je ne sais quoi....
Voici le code :
Code:
declare sub maindeclare sub ouvrir
declare sub ChoixLigne
dim i as integer
include "ICONS.DEF"
include "MAPBASIC.DEF"
Sub main Create Menu "Lignes_Scolaires_Grésivaudan" As "ouvrir_tables" Calling ouvrir,
"Lancer" Calling ChoixLigne
Alter Menu bar add "Lignes_Scolaires_Grésivaudan"
End Sub
Sub ouvrir
Close all interactive
Open Table "J:\01-APPLICATIONS METIERS\Carto\D01\10003782 Grésivaudan TC\Fichiers Mapinfo\Tables\Lignes et arrêts scolaires.TAB" Interactive
Open Table "J:\01-APPLICATIONS METIERS\Carto\D01\10003782 Grésivaudan TC\Fichiers Mapinfo\Tables\Elèves.TAB" Interactive
Open Table "J:\01-APPLICATIONS METIERS\Carto\D01\10003782 Grésivaudan TC\Fichiers Mapinfo\Tables\Etablissements Enseignement.TAB" Interactive
Open Table "Y:\TUILES\Skobler.TAB" Interactive
Map From Lignes_et_arrêts_scolaires
Add Map Auto Layer Elèves
Add Map Auto Layer Etablissements_Enseignement
Add Map Auto Layer Skobler
End Sub
sub ChoixLigne
dim Ligne_TC as string
for i=1 to 3
if i<1
then Ligne_TC="0"+str$(i)
else Ligne_TC=str$(i)
end if
Select* from Lignes_et_arrêts_scolaires where Id=Ligne_TC into Seg
Map from Seg, Elèves, Etablissements_Enseignement, Skobler
Set Map Window FrontWindow() zoom entire layer Seg
Set Map Layer Seg Display Global Global Line (3,2,65280) Global Symbol (32,65280,15)
Set Map Layer Seg Label With Arrêts_tracé
Set Map Layer Seg Label Font ("Arial",257,7,40960,16777215)Overlap On Offset 5 Auto On
Set Map Layer Etablissements_Enseignement Display Global Global Symbol (45,0,20)
Set Map Layer Etablissements_Enseignement Label Font ("Arial",257,9,0,16777215) Offset 5 Auto On
Shade Etablissements_Enseignement with Name values apply color "College Belledonne" Brush (2,16711680,16777215) Pen (1,2,0) ,"College du Gresivaudan" Brush (2,16728319,16777215) Pen (1,2,0) Symbol (35,16728319,24) ,"College Flavius Vaussenat" Brush (2,255,16777215) Pen (1,2,0) ,"College Icare" Brush (2,16776960,16777215) Pen (1,2,0) Symbol (35,16776960,24) ,"College Marcel Chene" Brush (2,16750640,16777215) Pen (1,2,0) Symbol (35,16750640,24) ,"College Pierre Aiguille" Brush (2,65535,16777215) Pen (1,2,0) ,"College Simone de Beauvoir" Brush (2,8388608,16777215) Pen (1,2,0) ,"Lycee General Technologique du Gresivaudan" Brush (2,65280,16777215) Pen (1,2,0) Symbol (35,65280,24) ,"Lycee Marie Reynoard" Brush (2,32768,16777215) Pen (1,2,0) Symbol (35,32768,24) ,"Lycee Pierre du Terrail" Brush (2,11030783,16777215) Pen (1,2,0) Symbol (35,11030783,24) default Brush (1,0,16777215) Pen (1,2,0)
Set Map Layer Elèves Display Global Global Symbol (34,0,8)
Shade Elèves with Dénomination_établissement values apply color "BELLEDONNE" Brush (2,16711680,16777215) Pen (1,2,0) ,"DU GRESIVAUDAN" Brush (2,65280,16777215) Pen (1,2,0) ,"FLAVIUS VAUSSENAT" Brush (2,255,16777215) Pen (1,2,0) ,"GRESIVAUDAN" Brush (2,16711935,16777215) Pen (1,2,0) ,"ICARE" Brush (2,16776960,16777215) Pen (1,2,0) ,"LA PIERRE AIGUILLE" Brush (2,65535,16777215) Pen (1,2,0) ,"MARCEL CHENE" Brush (2,16754768,16777215) Pen (1,2,0) Symbol (35,16754768,24) ,"MARIE REYNOARD" Brush (2,32768,16777215) Pen (1,2,0) ,"PIERRE DU TERRAIL" Brush (2,10502399,16777215) Pen (1,2,0) Symbol (35,10502399,24) ,"SIMONE DE BEAUVOIR" Brush (2,9446400,16777215) Pen (1,2,0) Symbol (35,9446400,24) default Brush (1,0,16777215) Pen (1,2,0)
Set Map Layer Skobler Display Global contrast 50 brightness 50 alpha 255 transparency off color 0 grayscale on
Layout
Position (0.927083,1.30208) Units "in"
Width 7.45833 Units "in" Height 3.83333 Units "in"
Dim uniqueStringName As String
uniqueStringName = "Set " + SessionInfo(1)
Set CoordSys Layout Units "cm"
Create Frame (0.071,0.076) (36.16,25.506)
Pen (1,2,3)
Brush (2,16777215,16777215)
Title "Seg"
FillFrame On
Set Window FrontWindow() Printer
Name "Microsoft XPS Document Writer" Orientation Landscape Copies 1
Papersize 12
Set Layout Ruler On Pagebreaks On Frame Contents On
Save Window frontwindow()
As "J:\01-APPLICATIONS METIERS\Carto\D01\10003782 Grésivaudan TC\Exports format image\Lignes scolaires\"+Ligne_TC+".png"
Type "PNG" Width 36.16 Units "cm" Height 25.506 Units "cm" Resolution 150
next
end sub