home *** CD-ROM | disk | FTP | other *** search
/ The Houseplan Collection / HRCD2005.ISO / data1.cab / Zusatz / 3DS / DATA2.Z / TerrainDemo.frm < prev    next >
Text File  |  1999-05-27  |  4KB  |  145 lines

  1. VERSION 5.00
  2. Begin VB.Form TerrainDemo 
  3.    Caption         =   "Terrains"
  4.    ClientHeight    =   4245
  5.    ClientLeft      =   60
  6.    ClientTop       =   345
  7.    ClientWidth     =   5490
  8.    LinkTopic       =   "Form1"
  9.    ScaleHeight     =   4245
  10.    ScaleWidth      =   5490
  11.    StartUpPosition =   3  'Windows Default
  12.    Begin VB.ListBox Koordinaten 
  13.       Height          =   2595
  14.       Left            =   120
  15.       TabIndex        =   5
  16.       Top             =   1560
  17.       Width           =   5175
  18.    End
  19.    Begin VB.ComboBox Bereiche 
  20.       Height          =   315
  21.       Left            =   1680
  22.       Style           =   2  'Dropdown List
  23.       TabIndex        =   3
  24.       Top             =   600
  25.       Width           =   3735
  26.    End
  27.    Begin VB.ComboBox Grundstuecke 
  28.       Height          =   315
  29.       Left            =   1680
  30.       Style           =   2  'Dropdown List
  31.       TabIndex        =   1
  32.       Top             =   120
  33.       Width           =   3735
  34.    End
  35.    Begin VB.Label Label3 
  36.       Caption         =   "Koordinaten:"
  37.       Height          =   255
  38.       Left            =   120
  39.       TabIndex        =   4
  40.       Top             =   1200
  41.       Width           =   5295
  42.    End
  43.    Begin VB.Label Label2 
  44.       Caption         =   "Bereich:"
  45.       Height          =   255
  46.       Left            =   120
  47.       TabIndex        =   2
  48.       Top             =   600
  49.       Width           =   1215
  50.    End
  51.    Begin VB.Label Label1 
  52.       Caption         =   "Grundstⁿck:"
  53.       Height          =   255
  54.       Left            =   120
  55.       TabIndex        =   0
  56.       Top             =   120
  57.       Width           =   1215
  58.    End
  59. End
  60. Attribute VB_Name = "TerrainDemo"
  61. Attribute VB_GlobalNameSpace = False
  62. Attribute VB_Creatable = False
  63. Attribute VB_PredeclaredId = True
  64. Attribute VB_Exposed = False
  65. Option Explicit
  66.  
  67. Dim WithEvents exe As ArCon.ArCon
  68. Attribute exe.VB_VarHelpID = -1
  69.  
  70. ' Alles initialisieren
  71. Private Sub Form_Load()
  72.     Set exe = New ArCon.ArCon
  73.     exe.StartMe hWnd, ""
  74.     ListTerrains
  75. End Sub
  76.  
  77. ' Das Programm wird beendet - Verbindung zu ArCon abbauen
  78. Private Sub Form_Unload(Cancel As Integer)
  79.     exe.EndMe
  80.     Set exe = Nothing
  81. End Sub
  82.     
  83. ' Liste alle Grundstⁿcke, merke den Listenindex des Grundstⁿckes, auf dem
  84. ' das aktuelle GebΣude steht
  85. Private Sub ListTerrains()
  86.     Grundstuecke.Clear
  87.     Bereiche.Clear
  88.     Koordinaten.Clear
  89.     
  90.     If exe.Mode = AC_NoMode Then Exit Sub
  91.     
  92.     Dim t As ArCon.Terrain, b As ArCon.Building, curBuilding As ArCon.Building
  93.     Dim i As Long, cur As Long
  94.     i = 1
  95.     cur = -1
  96.     Set curBuilding = exe.CurrentBuilding
  97.     For Each t In exe.Terrains
  98.         If t.Type = AC_TerrainEstate Then
  99.             Grundstuecke.AddItem t.Name
  100.             Grundstuecke.ItemData(Grundstuecke.NewIndex) = i
  101.             If cur < 0 Then
  102.                 For Each b In t.Buildings
  103.                     If b Is curBuilding Then
  104.                         cur = Grundstuecke.NewIndex
  105.                     End If
  106.                 Next
  107.             End If
  108.         End If
  109.         i = i + 1
  110.     Next
  111.     
  112.     Grundstuecke.ListIndex = cur
  113. End Sub
  114.  
  115. ' Das gewΣhlte Grundstⁿck hat gewechselt - alle Bereiche des Grundstⁿcks
  116. ' auflisten
  117. Private Sub Grundstuecke_Click()
  118.     Dim t As ArCon.Terrain, b As ArCon.Terrain, i As Long
  119.     Set t = exe.Terrains(Grundstuecke.ItemData(Grundstuecke.ListIndex))
  120.     Bereiche.Clear
  121.     Koordinaten.Clear
  122.     i = 1
  123.     For Each b In t.Terrains
  124.         Bereiche.AddItem b.Name
  125.         Bereiche.ItemData(Bereiche.NewIndex) = i
  126.         i = i + 1
  127.     Next
  128.     If i > 1 Then
  129.         Bereiche.ListIndex = 0
  130.     End If
  131. End Sub
  132.  
  133. Private Sub Bereiche_Click()
  134.     Dim t As ArCon.Terrain, b As ArCon.Terrain, p As Point2D
  135.     Set t = exe.Terrains(Grundstuecke.ItemData(Grundstuecke.ListIndex))
  136.     Set b = t.Terrains(Bereiche.ItemData(Bereiche.ListIndex))
  137.     
  138.     Koordinaten.Clear
  139.     For Each p In b.GetPolygon
  140.         Koordinaten.AddItem "(" & p.x & "/" & p.y & ")"
  141.     Next
  142. End Sub
  143.  
  144.  
  145.