Friday, October 27, 2006

more arcobjects... try it.. create a button in ArcMap

OK... here are a few steps you follow in VB6 or if you want... even VB.NET.

Firstly when you start Visual Studio for a new project... choose to create a DLL... cause this is gonna be compiled as a DLL... not EXE okei !!!

Add this code:
Private m_pApp As esriFramework.IApplication

Private Sub ICommand_OnCreate(ByVal hook As Object)
If TypeOf hook Is esriArcMapUI.IMxApplication Then
Set m_pApp = hook
Set m_pMxDoc = m_pApp.Document

' Get the extension
Dim u As New esriSystem.UID
u.Value = "CmdToolbarExt.SampleExtension"
Set m_pExt = m_pApp.FindExtensionByCLSID(u)
End If
End Sub

Know what its doing?? Its to create a Command in ArcMap and reference its interface. This ICommand interface determines behaviour and properties for simple commands in ArcMap... like buttons or menus. This interface also controls command properties like caption, name, category and status bar message. So what is happening with the above code??

Its actually starting something... when the command in instantiated... or when ArcMap is launched... it provides a hook or a connection to the ArcMap application. Its also important to see what type of object is passed by the hook... in this case its to ArcMap (IMxApplication).

Next add this:
Private Property Get ICommand_Enabled() As Boolean
If m_pExt.State = esriESEnabled Then
ICommand_Enabled = True
Else
ICommand_Enabled = False
End If
End Property

This is kinda straightforward... its actually specifying when the command is gonna be enabled.

Now add this:
Private Sub ICommand_OnClick()
' Zoom to the full extent
Dim pActiveView As esriCarto.IActiveView
Set pActiveView = m_pMxDoc.ActiveView
pActiveView.Extent = pActiveView.FullExtent
pActiveView.Refresh
End Sub
Private Property Get ICommand_Caption() As String
ICommand_Caption = "SampleCommand (zoom to full extent)"
End Property
Private Property Get ICommand_Name() As String
ICommand_Name = "ExtendingArcObjects_SampleCommand"
End Property

This also is self explanatory... when the command is clicked... there is an action or method.... in this case... its zooming to full extent. The Caption and Name is set with the following codes right after. Simple huh??

Now... compile this as DLL and then add it into ArcMap Customize function and you already have a working command.

Easy or not??

Labels:

Tuesday, October 17, 2006

all talk, no solutions... all handshakes and smiles, no answers...


Its back... the scourge of South East Asia, the curse of deforestation, the sting of nature, the mourning of children... and OF COURSE the illogical excuses. THE HAZE IS HERE TO STAY.

It never went away... just a minor postponement… an annual mist of death, anguish, pandemic, illness and diseases that engulfs all the little fresh air we take into our lungs. The smaller our lungs... higher the effect... babies, todlers and children suffer the most.

Where are the skies, stars, clouds, sun or the moon?? Where are the bright tropical colours?? WE now live in a perpetual haze. No more children in playgrounds, no more picnics, no more swimming by the beach, no more laughter... all replaced… by worried whispers, sad glances and cries of pain.

Some of the satellite photos taken by NASA images… created by Jesse Allen, Earth Observatory, using data provided courtesy of the MODIS Rapid Response team. Image Acquired: October 04, 2006 to October 08, 2006


Labels:

Wednesday, October 04, 2006

certs and exams... recognition - Pt 2

OK so... where were we?? Oh yes... GIS certs.

Besides the ESRI Virtual Campus where you can learn the software... and get kinda certified... there are Instructor led courses in ESRI that serve the interest of various industries and cover the latest versions of ESRI software. Now... these courses are done by CERTIFIED ESRI Sofware Instructors... that means we need to sit for exams and pass before we get to train others. All ESRI technical staff in Malaysia sit for these exams periodically and need to pass... its part of the management decision.

I still remember getting scared when they mentioned exams... I HATE EXAMS. I was thinking... NOT AGAIN!!! Enough with STPM... that was the toughest exam any human can take on this planet... trust me. Those who went thru STPM cannot be considered humans... we are aliens. Anyway, as the exam date came closer we were told that its an open book exam and that gave me some relief. When I saw the actual exam questions... it then hit me... tricky objective questions and no straightforward answers... the passing rate is 85%. Sat for the exams... toiling thru each question and testing out the software same time.... that takes a lot of time. You need to work on each of the objective answers in that exam. Haiihhh... I HATE EXAMS.

Its been 5 years now in ESRI Malaysia and I have sat and passed the ArcGIS Desktop ArcInfo 1&2 for 8.x and 9.x ... also ArcSDE 8.x and ArcSDE Config and Tuning 9.x. So far I think this is a good certification to sit for and it really helped me understand better the ArcGIS technology. We are always learning new things...

Labels: