【文章內(nèi)容簡介】
Path(m_pPointCollection,m_sceneGraph)。 m_l++。 } else m_l=0。 } //畫運動點的 DrawTarget(m_pNext,m_sceneGraph)的實現(xiàn) void CMGis3DView:rawTarget(IPointPtr pRadarLocation, ISceneGraphPtr pScenGraph) { IGeometryPtr pGeometry。 pGeometry=pRadarLocation。 IElementPtr pElement(CLSID_MarkerElement)。 m_pElement=pElement。 m_pElementput_Geometry(pGeometry)。 IMarkerElementPtr pMarkerElement(m_pElement)。 //create RGB color IRgbColorPtr pRGB(CLSID_RgbColor)。 pRGBput_Red(220)。 pRGBput_Green(0)。 pRGBput_Blue(0)。 //以下為創(chuàng)建 3DMarker IMarker3DPlacementPtr pMarker3DPlacement。 IMarker3DSymbolPtr pMarker3DSymbol(CLSID_Marker3DSymbol)。 pMarker3DSymbolCreateFromFile(CComBSTR(_T (D:\\GisEx\\data\\3dmodel_texture\\multigen_models\\streetscene\\)))。 pMarker3DSymbolRestrictAccessToShape()。 IMarkerSymbolPtr pMarkerSymbol(CLSID_Marker3DSymbol)。 pMarkerSymbolput_Color(pRGB)。 pMarker3DPlacement=pMarker3DSymbol。 pMarker3DPlacementput_Depth(1)。 pMarker3DPlacementput_Units(esriMeters)。 pMarker3DPlacementput_Size(300)。 pMarker3DPlacementput_Color(pRGB)。 pMarkerSymbol=pMarker3DPlacement。 pMarkerElementput_Symbol(pMarkerSymbol)。 m_pTargetsPointsAddElement(m_pElement)。 m_pGcon3DAddElement(m_pElement)。 } //畫運動點的軌跡函數(shù)的實現(xiàn) void CMGis3DView:rawPath(IPointCollectionPtr pPointCollection, ISceneGraphPtr pSceneGraph) { double tx,ty,tz,tz2。 IGeometryPtr pGeoIn。 IGeometryPtr pGeoOut。 IPointPtr pS(CLSID_Point)。 IPointPtr pE(CLSID_Point)。 long c。 pSputref_SpatialReference(m_pSpRe)。 pEputref_SpatialReference(m_pSpRe)。 pSProject(m_pSpRe)。 pEProject(m_pSpRe)。 double zFactor。 m_sceneget_ExaggerationFactor(amp。zFactor)。 //從點集獲取兩點并給曲線 pPath m_pPointCollectionget_PointCount(amp。c)。 m_pPointCollectionget_Point(c1,amp。pS)。 m_pPointCollectionget_Point(c2,amp。pE)。 IPolycurvePtr pPath(CLSID_Polyline)。 pPathSmooth(2)。 pPathput_FromPoint(pS)。 pPathput_ToPoint(pE)。 pGeoIn=pPath。 //設(shè)置曲線參照 tin 表面輸出。 問題:本在定時器函數(shù)中設(shè)定了各點的 z 坐標,但z 坐標不起作用,為什么?請指點。 m_pSufInterpolateShape(pGeoIn,amp。pGeoOut)。//用于使軌跡在 tin 表面運動。 pGeoInputref_SpatialReference(m_pSpRe)。 pGeoInProject(m_pSpRe)。 IElementPtr pElement(CLSID_LineElement)。 pElementput_Geometry(pGeoOut)。 //以下設(shè)置線型 ILineElementPtr pLineElement(pElement)。 IRgbColorPtr pRGB(CLSID_RgbColor)。 pRGBput_Red(255)。 pRGBput_Green(128)。 pRGBput_Blue(128)。 ISimpleLine3DSymbolPtr pSLnSymbol(CLSID_SimpleLine3DSymbol)。 pSLnSymbolput_Style(esriS3DLSTube)。 ILineSymbolPtr pl(pSLnSymbol)。 plput_Color(pRGB)。 plput_Width(5)。 pLineElementput_Symbol(pl)。 m_pGcon3DAddElement((IElementPtr)pLineElement)。 m_sceneGraphRefreshViewers()。 } 1 刷新這樣效果最佳 esriViewGraphics, pElement, Nothing 2 你的飛行器沒必要每次增加、刪除,直接使用 UpdateElement 3 你的軌跡沒浮起來是沒對軌跡的所有點使用 IZAware 這個吧,或是你的 POINT 的 Z 沒值吧 謝謝指點 ,我在 scenecontrol 中沒發(fā)現(xiàn)有 PartialRefresh()啊 還有在 graphiccontainer3d 中沒發(fā) 現(xiàn)有 updateelement. IActiveView:artialRefresh uses its knowledge of the cache layout to invalidate as little as possible IGraphicsContainer Interface ...... UpdateElement The graphic element39。s properties have changed. IGraphicsContainer3D Interface 中沒發(fā)現(xiàn)有 UpdateElement 在 下有 PartialRefresh 這個函數(shù) 在 AxtocControl 中關(guān)聯(lián) AxSceneContro 時可以用 l AxSceneControl 中打印地圖 DrawToMetafile Method (esri3DAnalyst) Draws the contents of the viewer to a device. Syntax (hDC, resolutionFactor, left, top, right, bottom, bOffScreen ) 下面這種獲得 hdc 的辦法不知道對你是否有用 Image image = new Bitmap(800, 600)。 g = (image)。 tagRECT rect = new tagRECT()。 = = 0。 = 800。 = 600。 // 填充背景色 (白色 ) (, 0, 0, 800, 600)。 (().ToInt32(), 0, ref rect, null, null)。 ()。 就是用 DrawToMetafile (hDC, resolutionFactor, left, top, right, bottom, bOffScreen ) Print Active View Description: This sample demonstrates how to print a map programmatically. It will work from either Data View or Page Layout View. The PrintActiveView subroutine demonstrates the minimum steps necessary to output a correctly scaled page to the application39。s current printer. The PrintActiveView2() subroutine demonstrates how to reproduce the full functionality of ArcMap39。s print mand, including using a Win32 API device context functions to detect and pensate for the physical offset of the print device. Products: ArcView: VBA Platforms: Windows Minimum ArcGIS Release: How to use: [VBA] Paste this code into the Visual Basic editor and select Run Sub from the Run menu. Private Declare Function GetDeviceCaps Lib gdi32 (ByVal hDC As Long, ByVal nIndex As Long) As Long Private Declare Function CreateIC Lib gdi32 Alias CreateICA (ByVal lpDriverName As String, ByVal lpDeviceName As String, _ ByVal lpOutput As String, ByVal lpInitData As Long) As Long Public Sub PrintActiveView() Dim pMxDoc As IMxDocument Set pMxDoc = ThisDocument Dim pMxApp As IMxApplication Set pMxApp = 39。 Create a readonly reference to the application39。s current printer Dim pPrinter As IPrinter Set pPrinter = 39。 Initialize the three bounds variables used for printing. Leave VisibleBounds 39。 set to Nothing for n