Dim pMxDoc As IMxDocument Set pMxDoc = ThisDocument Dim pMap As IMap Set pMap = pMxDoc.FocusMap Dim pLayout As IPageLayout Set pLayout = pMxDoc.PageLayout Dim pActiveView As IActiveView Set pActiveView = pMap 'Query for selecting points in zipcode point layer Dim strQuery As String strQuery = "ZIP" & " = " & value 'Set pLayer to PMBC point Layer Dim pLayer As IFeatureSelection Set pLayer = pMap.Layer(0) 'Selects points in Selected Zip and turns them Blue Dim pFilter As IQueryFilter Set pFilter = New QueryFilter pFilter.WhereClause = strQuery pLayer.SelectFeatures pFilter, esriSelectionResultNew, False Dim pBlueColor As IRgbColor Set pBlueColor = New RgbColor pBlueColor.RGB = RGB(0, 112, 225) Set pLayer.SelectionColor = pBlueColor 'Sets zoom level to selected features of PMBC points Dim pLayer3 As IFeatureLayer Set pLayer3 = pMap.Layer(0) Set pFSel = pLayer3 Dim pSelSet As ISelectionSet Set pSelSet = pFSel.SelectionSet Dim pEnumGeom As IEnumGeometry Dim pEnumGeomBind As IEnumGeometryBind Set pEnumGeom = New EnumFeatureGeometry Set pEnumGeomBind = pEnumGeom pEnumGeomBind.BindGeometrySource Nothing, pSelSet Dim pGeomFactory As IGeometryFactory Set pGeomFactory = New GeometryEnvironment Dim pGeom As IGeometry Set pGeom = pGeomFactory.CreateGeometryFromEnumerator(pEnumGeom) 'Makes an envelope for selected features to determine proper page layout orientation Dim pEnvelope As IEnvelope If pFSel.SelectionSet.Count = 1 Then Set pEnvelope = pGeom.Envelope pEnvelope.XMax = pEnvelope.XMax + 500 pEnvelope.XMin = pEnvelope.XMin - 500 pEnvelope.YMax = pEnvelope.YMax + 500 pEnvelope.YMin = pEnvelope.YMin - 500 Else Set pEnvelope = pGeom.Envelope pEnvelope.Expand 1.05, 1.05, True End If Set pMxDoc.ActiveView = pMap pMxDoc.ActiveView.Extent = pEnvelope 'Determine the envelope ratio (for setting layout) Dim intEnvelopeHeight As Integer intEnvelopeHeight = pEnvelope.YMax - pEnvelope.YMin Dim intEnvelopeWidth As Integer intEnvelopeWidth = pEnvelope.XMax - pEnvelope.XMin If intEnvelopeHeight > intEnvelopeWidth Then strLayoutType = "Portrait" ElseIf intEnvelopeHeight < intEnvelopeWidth Then strLayoutType = "Landscape" Else strLayoutType = "Portrait" End If
Los miembros registrados pueden publicar, seguir actualizaciones y más. ¿Nuevo aquí? Regístrate gratis.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.