Option Explicit

'Routine for adding a tree to the shapefile
Sub AddTree
	Application.StatusBar.Text = "Add Tree"
	Dim dblX, dblY, objToolButton, blnLyrExists
	Set objToolButton = ThisEvent.Object
	blnLyrExists = False
	Dim objLyr
	For Each objLyr in Map.Layers
		If StrComp (objLyr.Name, "NYC Trees", 1) = 0 Then
			blnLyrExists = True
			Exit For
		End If
	Next
	If Not blnLyrExists Then
		MsgBox "There is no NYC Trees layer in this map.", vbExclamation, "Layer not present"
		objToolButton.Click
		Exit Sub
	End If
	dblX = Map.PointerX
	dblY = Map.PointerY
	Dim objLayer
	Set objLayer = Map.Layers("NYC Trees")
	If objLayer.CanEdit Then
		objLayer.Editable = True
		Call Map.AddFeatureXY(dblX,dblY)
		objToolButton.Click
	End If
End Sub

'Routine for identifying a tree on the map
Sub IdentifyTree
	Application.StatusBar.Text = "Identify"
	Dim dblX, dblY, objToolButton, blnLyrExists
	Set objToolButton = ThisEvent.Object
	blnLyrExists = False
	Dim objLyr
	For Each objLyr in Map.Layers
		If StrComp (objLyr.Name, "NYC Trees", 1) = 0 Then
			blnLyrExists = True
			Exit For
		End If
	Next
	If Not blnLyrExists Then
		MsgBox "There is no NYC Trees Layer in this Map.", vbExclamation, "Layer not Present"
		objToolButton.Click
		Exit Sub
	End If
	dblX = Map.PointerX
	dblY = Map.PointerY
	Dim objLayer
	Set objLayer = Map.Layers("NYC Trees")
	objLayer.Identifiable = True
	Dim featureExists
	featureExists = Map.IdentifyXY(dblX,dblY)
	If featureExists Then
		Call Map.IdentifyXY(dblX,dblY)
	End If
End Sub

Sub SetScale
	Application.Map.Scale = 2000
End Sub