阅读:1187回复:0
[原创]急呀:关联表的相关问题:?????
<H2>急呀:关联表的相关问题:?????</H2>
<DIV><FONT face="Verdana "><FONT size=2>关联表的相关问题:</FONT></FONT><BR><FONT face="Verdana "><FONT size=2></FONT></FONT><BR><FONT face="Verdana "><FONT size=2>在同一个oracle服务下,我连了一个SDE点层,一个oracle表Table,形成了一个 IDisplayRelationshipClass ,也应该是一个表,也可以看成是一个图层,进行渲染,标注,查询等操作。</FONT></FONT><BR><FONT face="Verdana "><FONT size=2> 问题1 :是不是可以象编辑SDE一样,直接编辑关联表,就可以同时将信息存到SDE点层里和oracle表中。oracle表如何进行保存我想输入的数据,不用insert的方式。而用feature.store的方式可以吗 ?怎么实现。</FONT></FONT><BR><FONT face="Verdana "><FONT size=2>问题2:我用程序创建了关联表,可以显示标注,但是第一次过滤标注就不显示了,?如何解决。下面付代码:</FONT></FONT><BR><FONT face="Verdana "><FONT size=2> 1。创建关联表的代码:</FONT></FONT><BR><FONT face="Verdana "><FONT size=2> Dim pMap As IMap<BR> pMap = AxMapControl1.Map<BR> ' 设置要进行join的图层<BR> Dim pFeatLayer As IFeatureLayer</FONT></FONT><BR><BR><FONT face="Verdana "><FONT size=2> Dim ppplayer As IGeoFeatureLayer</FONT></FONT><BR><BR><FONT face="Verdana "><FONT size=2> Dim pFCLayer As IFeatureClass</FONT></FONT><BR><BR><FONT face="Verdana "><FONT size=2> If pMap.LayerCount = 0 Then<BR> MsgBox("没有图层可进行join操作")<BR> Exit Sub<BR> End If<BR> pFeatLayer = pMap.Layer(0)</FONT></FONT><BR><BR><FONT face="Verdana "><FONT size=2> ppplayer = pMap.Layer(0)<BR> pFCLayer = ppplayer.FeatureClass 'pFeatLayer.FeatureClass<BR> ' 获取数据库和外接表<BR> Dim pWSFact As IWorkspaceFactory<BR> Dim pFeatWS As IFeatureWorkspace</FONT></FONT><BR><BR><FONT face="Verdana "><FONT size=2> pWSFact = New OLEDBWorkspaceFactory</FONT></FONT><BR><BR><FONT face="Verdana "><FONT size=2> '<BR> Dim pPropertySet As IPropertySet<BR> pPropertySet = New PropertySet<BR> Debug.Print(Date.Now)<BR> '后面为oledb连接数据库的CONNECTSTRING<BR> pPropertySet.SetProperty("CONNECTSTRING", "Provider=oraoledb.oracle;Data Source=ora9;User Id=pdgis;Password=pdgis")</FONT></FONT><BR><BR><FONT face="Verdana "><FONT size=2> '<add name="StData.My.MySettings.ConnectionString" c</FONT></FONT><BR><BR><FONT face="Verdana "><FONT size=2> '<add key="Oracle" value="Data Source=ora9;Persist Security Info=True;User ID=pdgis;Password=pdgis" /></FONT></FONT><BR><BR><FONT face="Verdana "><FONT size=2><BR> pFeatWS = pWSFact.Open(pPropertySet, 0)<BR> Dim pGDBTable As ITable<BR> pGDBTable = pFeatWS.OpenTable("geo_graph") 'tablename为要关联的表明"forward""backward"<BR> 'pGDBTable.<BR> Debug.Print(Date.Now)<BR><BR> Dim pMemRelFact As IMemoryRelationshipClassFactory<BR> Dim pRelClass As IRelationshipClass<BR> 'pRelClass = New r<BR> pMemRelFact = New MemoryRelationshipClassFactory<BR> pRelClass = pMemRelFact.Open("joinTest", pFCLayer, "OBJECTID", pGDBTable, "objectid_1", "forwards", "backwards", esriRelCardinality.esriRelCardinalityOneToOne)<BR> 'pRelClass.<BR> '进行join<BR> Dim pDispRC As IDisplayRelationshipClass<BR> pDispRC = pFeatLayer<BR> pDispRC.DisplayRelationshipClass(pRelClass, esriJoinType.esriLeftOuterJoin)<BR> g_pDpyRC = pDispRC<BR><BR><BR>2. 显示标注的代码:<BR><BR><BR>Dim pGeoLayer As IGeoFeatureLayer<BR> pGeoLayer = g_pDpyRC<BR><BR> Dim pAnnoLayerPropsColl As IAnnotateLayerPropertiesCollection<BR> pAnnoLayerPropsColl = pGeoLayer.AnnotationProperties<BR><BR> pAnnoLayerPropsColl.Clear()<BR> Dim pannolayerprops As IAnnotateLayerProperties<BR> Dim pPosition As ILineLabelPosition<BR> Dim pPlacement As ILineLabelPlacementPriorities<BR> Dim pBasic As IBasicOverposterLayerProperties<BR> Dim pLabelEngine As ILabelEngineLayerProperties<BR><BR><BR> Dim pTextSyl As ITextSymbol<BR><BR> pTextSyl = New TextSymbol<BR> Dim pFont As New stdole.StdFont<BR> pFont.Size = 20<BR> pTextSyl.Font = pFont<BR><BR> pPosition = New LineLabelPosition<BR> pPosition.Parallel = False<BR> pPosition.Perpendicular = True<BR><BR> pPlacement = New LineLabelPlacementPriorities<BR> pBasic = New BasicOverposterLayerProperties<BR><BR> pBasic.FeatureType = esriBasicOverposterFeatureType.esriOverposterPoint<BR> pBasic.LineLabelPlacementPriorities = pPlacement<BR> pBasic.LineLabelPosition = pPosition<BR><BR> pLabelEngine = New LabelEngineLayerProperties<BR> pLabelEngine.Symbol = pTextSyl<BR> pLabelEngine.BasicOverposterLayerProperties = pBasic<BR><BR> pLabelEngine.Expression = "[GEOTYPE]"<BR><BR> pannolayerprops = pLabelEngine<BR><BR> pAnnoLayerPropsColl.Add(pannolayerprops)<BR><BR> pGeoLayer.DisplayAnnotation = True<BR><BR> Dim pActive As IActiveView<BR> pActive = Me.AxMapControl1.Map<BR> pActive.Refresh()<BR><BR>3. 过滤的代码:<BR><BR><BR> Dim pTable As IGeoFeatureLayer<BR> pTable = g_pDpyRC<BR><BR> Dim pDFl As IFeatureLayerDefinition<BR><BR> pDFl = pTable<BR> pDFl.Definiti<BR><BR> Dim pActive As IActiveView<BR> pActive = Me.AxMapControl1.Map<BR> pActive.PartialRefresh(esriViewDrawPhase.esriViewBackground + esriViewDrawPhase.esriViewGraphics, Nothing, pActive.Extent)<BR></FONT></FONT></DIV> |
|