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

GEODATA DAYS 2024

#1 Tue 27 May 2008 01:44

badr
Participant occasionnel
Date d'inscription: 3 Nov 2007
Messages: 40

Ajouter Projet Mxd

Slt tt le monde, j'ai réalisé une application DLL sous arcGis et j'ai des cartes en extension .mxd,je veux créer des commandes pour afficher ces cates. est ce qu'il y a quelqu'un qui posséde un code qui me sera utile ou qui pourra m'aider. merci

Hors ligne

 

#2 Tue 27 May 2008 08:10

Jeirhome
Membre
Lieu: Liverion
Date d'inscription: 22 Aug 2006
Messages: 4298
Site web

Re: Ajouter Projet Mxd

J'ai pas ArcGIS sous la main maiontenant, mais un "Application.OpenDocument(chemin_du_mxd)" devrait ouvrir la carte sans trop de soucis.


Jérôme Cuinet
L'avantage de la Chine, c'est que le soleil se couche plus tard !

Hors ligne

 

#3 Tue 27 May 2008 20:03

badr
Participant occasionnel
Date d'inscription: 3 Nov 2007
Messages: 40

Re: Ajouter Projet Mxd

ET comment dois je definir la variable Application

Hors ligne

 

#4 Tue 27 May 2008 20:25

Jeirhome
Membre
Lieu: Liverion
Date d'inscription: 22 Aug 2006
Messages: 4298
Site web

Re: Ajouter Projet Mxd

La variable Application est un pointeur VBA  vers l'application ArcGIS en cours. À exécuter  simplement dans la fenêtre VBA.

Si tu veux l'intégrer dans ton DLL, tu récupère le hook as IApplication donné dans ICommand.OnCreate cf l'aide.


Jérôme Cuinet
L'avantage de la Chine, c'est que le soleil se couche plus tard !

Hors ligne

 

#5 Tue 27 May 2008 23:08

badr
Participant occasionnel
Date d'inscription: 3 Nov 2007
Messages: 40

Re: Ajouter Projet Mxd

je veux l'integrer dans mon DLL, est vous pouvez m'expliquez autrement

Hors ligne

 

#6 Sun 01 June 2008 00:54

badr
Participant occasionnel
Date d'inscription: 3 Nov 2007
Messages: 40

Re: Ajouter Projet Mxd

ça ne marche pas avec application.open.... est ce qu'il ny a pas une autre méthode pour afficher un projet mxd

Hors ligne

 

#7 Sun 01 June 2008 23:29

badr
Participant occasionnel
Date d'inscription: 3 Nov 2007
Messages: 40

Re: Ajouter Projet Mxd

je vais m'expliquer autrement espérant que quelqu'un m'aidera: j'ai utilisé le code suivant dans mon DLL:

Private Sub ICommand_OnClick()

Dim pExtentStack As esriCarto.IExtentStack
  Set pExtentStack = m_pMxDoc.ActiveView.ExtentStack
   
     Select Case m_lSubType
  Case 1
  Application.OpenDocument "D:\sujet de fin d'etude\DONN2ES-SOUFIANE\cartes\decoupage2.mxd"
  Case 2
  Application.OpenDocument "D:\sujet de fin d'etude\DONN2ES-SOUFIANE\cartes\graph_TER.mxd"
  Case 3
  Application.OpenDocument "D:\sujet de fin d'etude\DONN2ES-SOUFIANE\cartes\enseignement.mxd"
   Case 4
  Application.OpenDocument "D:\sujet de fin d'etude\DONN2ES-SOUFIANE\cartes\enseignement.mxd"
  Case 5
  Application.OpenDocument "D:\sujet de fin d'etude\DONN2ES-SOUFIANE\cartes\enseignement.mxd"
  Case 6
  Application.OpenDocument "D:\sujet de fin d'etude\DONN2ES-SOUFIANE\cartes\enseignement.mxd"

End Select
End Sub


Private Sub ICommand_OnCreate(ByVal hook As Object)
  Set Application = hook
  Set m_pMxDoc = m_App.document

'Set m_Application = New Application
'Set m_Application = New Application
' Set m_Application = New Application
' Set m_Application = New Application
'Set m_Application = New Application
'Set m_Application = New Application

End Sub

je pense que c'est au niveau de Private Sub ICommand_OnCreate(ByVal hook As Object) qu'il me manque quelque chose.
svp j'en ai vraiment besoin

Hors ligne

 

#8 Mon 02 June 2008 12:41

Jeirhome
Membre
Lieu: Liverion
Date d'inscription: 22 Aug 2006
Messages: 4298
Site web

Re: Ajouter Projet Mxd

Si c'est vraiment tout ton code, il doit y avoir quelques soucis.

Rajoute au tout début du fichier : Option Explicit

Là tu devrais avoir des erreurs qui t'indiquent ce qui ne va pas. Notamment, si tu utilises une variable dans plusieurs fonctions, il faut la déclarer avant les fonctions, au niveau du module.


Jérôme Cuinet
L'avantage de la Chine, c'est que le soleil se couche plus tard !

Hors ligne

 

#9 Mon 02 June 2008 19:27

badr
Participant occasionnel
Date d'inscription: 3 Nov 2007
Messages: 40

Re: Ajouter Projet Mxd

voilà tout le code

Code:

Option Explicit
Dim m_App As IApplication

Implements ICommand
Implements ICommandSubType
Dim pMxDoc As IMxDocument
Dim pMap As IMap
Dim pWorkspaceFactory As IWorkspaceFactory
Dim pFeatureWorkspace As IFeatureWorkspace
Dim Application As Application
Dim pFeatureClass As IFeatureClass
' Specify the workspace and the feature
Private m_pMxDoc As IMxDocument
Private m_pExt As IExtensionConfig



Private m_pBitmap1 As IPictureDisp
Private m_pBitmap2 As IPictureDisp
Private m_pBitmap3 As IPictureDisp
Private m_pBitmap4 As IPictureDisp
Private m_pBitmap5 As IPictureDisp
Private m_pBitmap6 As IPictureDisp

Private m_lSubType As Long
 
Private Sub Class_Initialize()
  ' Load the button image from the resource file.
  Set m_pBitmap1 = LoadResPicture(101, vbResBitmap)
  Set m_pBitmap2 = LoadResPicture(101, vbResBitmap)
  Set m_pBitmap3 = LoadResPicture(101, vbResBitmap)
  Set m_pBitmap4 = LoadResPicture(101, vbResBitmap)
  Set m_pBitmap5 = LoadResPicture(101, vbResBitmap)
  Set m_pBitmap6 = LoadResPicture(101, vbResBitmap)
End Sub
Private Sub Class_Terminate()
  ' Clear member variables
  Set m_pBitmap1 = Nothing
  Set m_pBitmap2 = Nothing
  Set m_pBitmap3 = Nothing
  Set m_pBitmap4 = Nothing
  Set m_pBitmap5 = Nothing
  Set m_pBitmap6 = Nothing
  Set m_pMxDoc = Nothing
  Set m_pExt = Nothing
  Set m_App = Nothing
End Sub
Private Property Get ICommand_Bitmap() As esrisystem.OLE_HANDLE
  Select Case m_lSubType
  Case 1
    ICommand_Bitmap = m_pBitmap1
  Case 2
    ICommand_Bitmap = m_pBitmap2
  Case 3
    ICommand_Bitmap = m_pBitmap3
   Case 4
    ICommand_Bitmap = m_pBitmap4
  Case 5
    ICommand_Bitmap = m_pBitmap5
  Case 6
    ICommand_Bitmap = m_pBitmap6
  End Select
End Property
Private Property Get ICommand_Caption() As String
  Select Case m_lSubType
  Case 1
    ICommand_Caption = "&Découpage_administratif "
  Case 2
    ICommand_Caption = "&Evolution de l'electrification"
  Case 3
    ICommand_Caption = "&Répartition des écoles"
  Case 4
    ICommand_Caption = "&Projets"
  Case 5
    ICommand_Caption = "&Réseau routier"
  Case 6
    ICommand_Caption = "Santé"
  End Select
End Property
Private Property Get ICommand_Category() As String
  ICommand_Category = "TANGER Utiliti"
End Property
Private Property Get ICommand_Checked() As Boolean
  ICommand_Checked = False
End Property

Private Property Get ICommand_Enabled() As Boolean
  Dim pExtentStack As esriCarto.IExtentStack
  Set pExtentStack = m_pMxDoc.ActiveView.ExtentStack
    ICommand_Enabled = True
End Property

Private Property Get ICommand_HelpContextID() As Long

End Property

 Private Property Get ICommand_HelpFile() As String

End Property

 Private Property Get ICommand_Message() As String
  Select Case m_lSubType
  Case 1
    ICommand_Message = "Afficher la carte du Découpage_administratif"
  Case 2
    ICommand_Message = "Afficher la carte de l'évolution de l'electrification rurale"
  Case 3
    ICommand_Message = " afficher la carte de la répartition des écoles"
   Case 4
    ICommand_Message = "Afficher la carte des projets"
  Case 5
    ICommand_Message = "Afficher la carte du réseau routier"
  Case 6
    ICommand_Message = " afficher la carte de santé"

End Select
End Property


Private Property Get ICommand_Name() As String
    
Select Case m_lSubType
 
  Case 1
    ICommand_Name = "Découpage_administratif_carte"
  Case 2
    ICommand_Name = "evolution de l'electrification_carte"
  Case 3
    ICommand_Name = "Répartition des écoles_carte"
  Case 4
    ICommand_Name = "Projets_carte"
  Case 5
    ICommand_Name = "Réseau routier_carte"
  Case 6
    ICommand_Name = "Santé_carte"
  End Select
End Property
Private Sub ICommand_OnClick()

 Dim pExtentStack As esriCarto.IExtentStack
  Set pExtentStack = m_pMxDoc.ActiveView.ExtentStack
    
     Select Case m_lSubType
  Case 1
  Application.OpenDocument "D:\sujet de fin d'etude\DONN2ES-SOUFIANE\cartes\decoupage2.mxd"
  Case 2
  Application.OpenDocument "D:\sujet de fin d'etude\DONN2ES-SOUFIANE\cartes\graph_TER.mxd"
  Case 3
  Application.OpenDocument "D:\sujet de fin d'etude\DONN2ES-SOUFIANE\cartes\enseignement.mxd"
   Case 4
  Application.OpenDocument "D:\sujet de fin d'etude\DONN2ES-SOUFIANE\cartes\enseignement.mxd"
  Case 5
  Application.OpenDocument "D:\sujet de fin d'etude\DONN2ES-SOUFIANE\cartes\enseignement.mxd"
  Case 6
  Application.OpenDocument "D:\sujet de fin d'etude\DONN2ES-SOUFIANE\cartes\enseignement.mxd"

End Select
End Sub


Private Sub ICommand_OnCreate(ByVal hook As Object)
  Set Application = hook
  Set m_pMxDoc = m_App.document

'Set m_Application = New Application
'Set m_Application = New Application
' Set m_Application = New Application
' Set m_Application = New Application
 'Set m_Application = New Application
 'Set m_Application = New Application
 
End Sub
    
 Private Property Get ICommand_Tooltip() As String
  Select Case m_lSubType
  Case 1
    ICommand_Tooltip = "Afficher la carte du Découpage_administratif"
  Case 2
    ICommand_Tooltip = "Afficher la carte de l'évolution de l'electrification rurale"
  Case 3
    ICommand_Tooltip = " afficher la carte de la répartition des écoles"
   Case 4
    ICommand_Tooltip = "Afficher la carte des projets"
  Case 5
    ICommand_Tooltip = "Afficher la carte du réseau routier"
  Case 6
    ICommand_Tooltip = " afficher la carte de santé"

End Select
End Property
  
 Private Function ICommandSubType_GetCount() As Long
  ' Set how many commands are contained in the subtyped command.
  ICommandSubType_GetCount = 6
End Function

Private Sub ICommandSubType_SetSubType(ByVal SubType As Long)
  m_lSubType = SubType
End Sub

[EDIT MODERATION : Prière d'utiliser la balise code]

Hors ligne

 

#10 Mon 02 June 2008 19:38

Jeirhome
Membre
Lieu: Liverion
Date d'inscription: 22 Aug 2006
Messages: 4298
Site web

Re: Ajouter Projet Mxd

Jérôme C a écrit:

La variable Application est un pointeur VBA  vers l'application ArcGIS en cours. À exécuter  simplement dans la fenêtre VBA.

Si tu veux l'intégrer dans ton DLL, tu récupère le hook as IApplication donné dans ICommand.OnCreate cf l'aide.


Jérôme Cuinet
L'avantage de la Chine, c'est que le soleil se couche plus tard !

Hors ligne

 

#11 Mon 02 June 2008 19:48

badr
Participant occasionnel
Date d'inscription: 3 Nov 2007
Messages: 40

Re: Ajouter Projet Mxd

l'aide du VBA

Hors ligne

 

#12 Mon 02 June 2008 20:37

Jeirhome
Membre
Lieu: Liverion
Date d'inscription: 22 Aug 2006
Messages: 4298
Site web

Re: Ajouter Projet Mxd

Jérôme C a écrit:
Jérôme C a écrit:

La variable Application est un pointeur VBA  vers l'application ArcGIS en cours. À exécuter  simplement dans la fenêtre VBA.

Si tu veux l'intégrer dans ton DLL, tu récupère le hook as IApplication donné dans ICommand.OnCreate cf l'aide.


Jérôme Cuinet
L'avantage de la Chine, c'est que le soleil se couche plus tard !

Hors ligne

 

#13 Mon 02 June 2008 23:08

badr
Participant occasionnel
Date d'inscription: 3 Nov 2007
Messages: 40

Re: Ajouter Projet Mxd

comment puis je faire pour récupérer le hook

Hors ligne

 

#14 Mon 02 June 2008 23:13

Fred
#JeSuisCharlie
Lieu: Paris
Date d'inscription: 24 Jun 2005
Messages: 7679
Site web

Re: Ajouter Projet Mxd

Badr, je crois qu'un petit effort de lecture de documentation d'ESRI t'apporterai plus que tes questions ici ...
Allez encore un effort wink !


Fred


GeoRezo vous aide ==> Aidez GeoRezo !

Hors ligne

 

#15 Mon 02 June 2008 23:23

badr
Participant occasionnel
Date d'inscription: 3 Nov 2007
Messages: 40

Re: Ajouter Projet Mxd

je le sais mais vraiment je n'ai pas assez de temps devant moi

Hors ligne

 

#16 Tue 03 June 2008 09:09

Tnarbiv
Participant assidu
Lieu: Véretz
Date d'inscription: 5 Sep 2005
Messages: 392

Re: Ajouter Projet Mxd

Bonjour c'est de cette manière que tu vas récupérer l'application

Code:

Dim m_pApp As IApplication      'ArcMap application

Private Sub ICommand_OnCreate(ByVal hook As Object)
  ' The hook argument is a pointer to Application object.
  Set m_pApp = hook
End Sub

Dernière modification par Tnarbiv (Tue 03 June 2008 09:10)


Ayez le réflexe "Développement Durable": N'imprimez ce message que si nécessaire.

Hors ligne

 

#17 Tue 03 June 2008 15:12

badr
Participant occasionnel
Date d'inscription: 3 Nov 2007
Messages: 40

Re: Ajouter Projet Mxd

bonjour, merci pour ton aide, j'ai ajouté le code que tu m'as donné dans mon code mais j'ai les sous menu , qui doivent appeler les projets mxd, désactivés

Hors ligne

 

Pied de page des forums

Powered by FluxBB