ArcGIS网络分析最短路径分析源代码(VB6.0)计算机二级考试

文章作者 100test 发表时间 2009:06:15 09:03:42
来源 100Test.Com百考试题网


  编辑特别推荐:

  全国计算机等级考试(等考)指定教材

  全国计算机等级考试学习视频

  全国计算机等级考试网上辅导招生

  全国计算机等级考试时间及科目预告

  百考试题教育全国计算机等级考试在线测试平台

  全国计算机等级考试资料下载

  全国计算机等级考试论坛

  计算机等级考试四级应用题解析汇总

  2009年下半年全国计算机二级考试报名时间从6月1日起已经开始报名。详情点击:2009年下半年全国计算机等级考试各地报名点汇总。2009年下半年全国计算机二级考试时间是2009年9月19日至23日。更多优质资料尽在百考试题论坛 百考试题在线题库

  1
  2 Copyright 1995-2005 ESRI
  3
  4 All rights reserved under the copyright laws of the United States.
  5
  6 You may freely redistribute and use this sample code, with or without modification.
  7
   8 Disclaimer: THE SAMPLE CODE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
  9 WARRANTIES, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  10 FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ESRI OR
  11 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
  12 OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  13 SUBSTITUTE GOODS OR SERVICES. LOSS OF USE, DATA, OR PROFITS. OR BUSINESS
  14 INTERRUPTION) SUSTAINED BY YOU OR A THIRD PARTY, HOWEVER CAUSED AND ON ANY
  15 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ARISING IN ANY
  16 WAY OUT OF THE USE OF THIS SAMPLE CODE, EVEN IF ADVISED OF THE POSSIBILITY OF
  17 SUCH DAMAGE.
  18
  19 For additional information contact: Environmental Systems Research Institute, Inc.
  20
  21 Attn: Contracts Dept.
  22
  23 380 New York Street
  24
  25 Redlands, California, U.S.A. 92373
  26
  27 Email: [email protected]
  28
  29Option Explicit
  30
  31 vb version of the PathFinder object
  32
  33 本地变量
  34Private m_ipGeometricNetwork As esriGeoDatabase.IGeometricNetwork
  35Private m_ipMap As esriCarto.IMap
  36Private m_ipPoints As esriGeometry.IPointCollection
  37Private m_ipPointToEID As esriNetworkAnalysis.IPointToEID
  38 返回结果变量
  39Private m_dblPathCost As Double
  40Private m_ipEnumNetEID_Junctions As esriGeoDatabase.IEnumNetEID
  41Private m_ipEnumNetEID_Edges As esriGeoDatabase.IEnumNetEID
  42Private m_ipPolyline As esriGeometry.IPolyline
  43
  44
  45 Optionally set the Map (e.g. the current map in ArcMap),
  46 otherwise a default map will be made (for IPointToEID).
  47
  48Public Property Set Map(Map As esriCarto.IMap)
  49  Set m_ipMap = Map
  50End Property
  51
  52Public Property Get Map() As esriCarto.IMap
  53  Set Map = m_ipMap
  54End Property
  55
  56 Either OpenAccessNetwork or OpenFeatureDatasetNetwork
  57 needs to be called.
  58
  59Public Sub OpenAccessNetwork(AccessFileName As String, FeatureDatasetName As String)
  60
  61  Dim ipWorkspaceFactory As esriGeoDatabase.IWorkspaceFactory
  62  Dim ipWorkspace As esriGeoDatabase.IWorkspace
  63  Dim ipFeatureWorkspace As esriGeoDatabase.IFeatureWorkspace
  64  Dim ipFeatureDataset As esriGeoDatabase.IFeatureDataset
  65
  66  After this Sub exits, well have an INetwork interface
  67  and an IMap interface initialized for the network well be using.
  68
  69  close down the last one if opened
  70  CloseWorkspace
  71
  72  open the mdb
  73  Set ipWorkspaceFactory = New esriDataSourcesGDB.AccessWorkspaceFactory
  74  Set ipWorkspace = ipWorkspaceFactory.OpenFromFile(AccessFileName, 0)
  75
  76  get the FeatureWorkspace
  77  Set ipFeatureWorkspace = ipWorkspace
  78
  79  open the FeatureDataset
  80  Set ipFeatureDataset = ipFeatureWorkspace.OpenFeatureDataset(FeatureDatasetName)
  81
  82  initialize Network and Map (m_ipNetwork, m_ipMap)
  83  If Not InitializeNetworkAndMap(ipFeatureDataset) Then Err.Raise 0, "OpenAccessNetwork", "Error initializing Network and Map"
  84
  85End Sub
  86
  87Public Sub OpenFeatureDatasetNetwork(FeatureDataset As esriGeoDatabase.IFeatureDataset)
  88  close down the last one if opened
  89  CloseWorkspace
  90 
  91  we assume that the caller has passed a valid FeatureDataset
  92
  93  initialize Network and Map (m_ipNetwork, m_ipMap)
  94  If Not InitializeNetworkAndMap(FeatureDataset) Then Err.Raise 0, "OpenFeatureDatasetNetwork", "Error initializing Network and Map"
  95
  96End Sub
  97
  98 The collection of points to travel through must be set.
  99
  100Public Property Set StopPoints(Points As esriGeometry.IPointCollection)
  101  Set m_ipPoints = Points
  102End Property
  103

相关文章


2009年4月全国计算机等级二级VB分章节考试要点(13)计算机二级考试
2009年4月全国计算机等级二级VB分章节考试要点(12)计算机二级考试
ArcGIS网络分析最短路径分析源代码(VB6.0)计算机二级考试
菜鸟的第一次破解之VB程序计算机二级考试
API入门系列之那‘烦人’的Windows数据类型计算机二级考试
澳大利亚华人论坛
考好网
日本华人论坛
华人移民留学论坛
英国华人论坛