' Copyright 1995-2004 ESRI
' All rights reserved under the copyright laws of the United States.
' You may freely redistribute and use this sample code, with or without modification.
' Disclaimer: THE SAMPLE CODE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
' WARRANTIES, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
' FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ESRI OR
' CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
' OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
' SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
' INTERRUPTION) SUSTAINED BY YOU OR A THIRD PARTY, HOWEVER CAUSED AND ON ANY
' THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ARISING IN ANY
' WAY OUT OF THE USE OF THIS SAMPLE CODE, EVEN IF ADVISED OF THE POSSIBILITY OF
' SUCH DAMAGE.
' For additional information contact: Environmental Systems Research Institute, Inc.
' Attn: Contracts Dept.
' 380 New York Street
' Redlands, California, U.S.A. 92373
' Email: [email]removed@mail.ru[/email]
Option Explicit
Public Sub Init(pTin As ITin)
Dim pEnv As IEnvelope
Set pEnv = pTin.Extent
Dim pSurf As ISurface
Set pSurf = pTin
If (pSurf.IsVoidZ(pEnv.zmin)) Then
txtZ = "0.0"
Else
Dim sZ As String
sZ = Format((pEnv.zmax + pEnv.zmin) * 0.5, "###0.00")
txtZ = sZ
End If
End Sub
Private Sub cboHeightSource_Click()
txtZ.Enabled = (cboHeightSource.ItemData(cboHeightSource.ListIndex) = 4)
labHeight.Enabled = txtZ.Enabled
End Sub
Private Sub cboSFType_Click()
' If 'Replace' is chosen we must only provide constant height options.
If (cboSFType.ItemData(cboSFType.ListIndex) = esriTinHardReplace) And _
(cboHeightSource.ListCount > 1) Then
cboHeightSource.RemoveItem 0
cboHeightSource.ListIndex = 0
Else
If (cboHeightSource.ListCount = 3) Then ' if 'Replace' was gone add it back
cboHeightSource.AddItem "variable along surface", 0
cboHeightSource.ItemData(0) = 1
End If
End If
txtBufOffset.Enabled = (cboSFType.ItemData(cboSFType.ListIndex) = esriTinHardReplace)
labOffset.Enabled = txtBufOffset.Enabled
End Sub
Private Sub Form_Load()
' TODO - add other 'Soft' SFType options
cboSFType.AddItem "Replace"
cboSFType.ItemData(0) = esriTinHardReplace
cboSFType.AddItem "Erase"
cboSFType.ItemData(1) = esriTinHardErase
cboSFType.AddItem "Clip"
cboSFType.ItemData(2) = esriTinHardClip
cboSFType.AddItem "Hard line"
cboSFType.ItemData(3) = esriTinHardLine
cboSFType.AddItem "Soft line"
cboSFType.ItemData(4) = esriTinSoftLine
cboHeightSource.AddItem "variable along surface"
cboHeightSource.ItemData(0) = 1
cboHeightSource.AddItem "max z from surface"
cboHeightSource.ItemData(1) = 2
cboHeightSource.AddItem "min z from surface"
cboHeightSource.ItemData(2) = 3
cboHeightSource.AddItem "specified"
cboHeightSource.ItemData(3) = 4
cboSFType.ListIndex = 3
cboHeightSource.ListIndex = 3
txtBufOffset = "1"
win32Util.FloatWindow Me, True
End Sub
Public Function GetSFType() As esriTinSurfaceType
GetSFType = cboSFType.ItemData(cboSFType.ListIndex)
End Function
Public Function GetHeightSource() As Long
GetHeightSource = cboHeightSource.ItemData(cboHeightSource.ListIndex)
End Function
Public Function GetHeight() As Double
GetHeight = CDbl(txtZ)
End Function
Public Function GetBufOffset() As Double
GetBufOffset = CDbl(txtBufOffset)
End Function
Public Function DetectConflicts() As Boolean
DetectConflicts = (chkConflictDetect.Value = 1)
End Function