Globe模仿光源照射
http://bbs.esrichina-bj.cn/esri/viewthread.php?tid=38855 假如在Globe的地球上方有一個點光源,點光源照射地球形, 那麼在空中應該形成一個三維的圓錐, 請問這個三維的圓錐怎樣構造并添加到Globe中去。 不知道這樣的東西有沒有人做過? 經過研究問題解決了。 代碼:下面的代碼在北京上方添加了一個三菱錐 static public IElement AddTaperToLayer(IGlobe pGlobe) { ILayer pLayer = new GlobeGraphicsLayerClass(); pLayer.Name = "錐"; pGlobe.GlobeDisplay.Scene.AddLayer(pLayer, true); IMultiPatch pMultiPatch = new MultiPatchClass(); //IFillShapeElement pFillElement; //ITextureFillSymbol pTextureFillSymbol = new TextureFillSymbolClass(); //pTextureFillSymbol.CreateFillSymbolFromFile(""); //pTextureFillSymbol.Size = 10000; //Dim pCamera As ICamera //Set pCamera = SceneControl1.Scene.SceneGraph.ActiveViewer.Camera IPoint pPoint1 = new PointClass(); pPoint1.PutCoords(106, 44); IZAware zAware1 = pPoint1 as IZAware; zAware1.ZAware = true; pPoint1.Z = 3000000; IPoint pPoint2 = new PointClass(); pPoint2.PutCoords(110, 48); IZAware zAware2 = pPoint2 as IZAware; zAware2.ZAware = true; pPoint2.Z = 0; IPoint pPoint3 = new PointClass(); pPoint3.PutCoords(106, 44); IZAware zAware3 = pPoint3 as IZAware; zAware3.ZAware = true; pPoint3.Z = 0; IPoint pPoint4 = new PointClass(); pPoint4.PutCoords(102, 48); IZAware zAware4 = pPoint4 as IZAware; zAware4.ZAware = true; pPoint4.Z = 0; IGeometryCollection pGeometryCollection = pMultiPatch as IGeometryCollection; IPointCollection pStrip1 = new TriangleStripClass() as IPointCollection; IPointCollection pStrip2 = new TriangleStripClass() as IPointCollection; IPointCollection pStrip3 = new TriangleStripClass() as IPointCollection; IPointCollection pStrip4 = new TriangleStripClass() as IPointCollection; object o = Type.Missing; pStrip1.AddPoint(pPoint1,ref o,ref o); pStrip1.AddPoint(pPoint1, ref o, ref o); pStrip1.AddPoint(pPoint2, ref o, ref o); pStrip1.AddPoint(pPoint3, ref o, ref o); pStrip2.AddPoint(pPoint1, ref o, ref o); pStrip2.AddPoint(pPoint2, ref o, ref o); pStrip2.AddPoint(pPoint4, ref o, ref o); pStrip3.AddPoint(pPoint1, ref o, ref o); pStrip3.AddPoint(pPoint3, ref o, ref o); pStrip3.AddPoint(pPoint4, ref o, ref o); pStrip4.AddPoint(pPoint2, ref o, ref o); pStrip4.AddPoint(pPoint3, ref o, ref o); pStrip4.AddPoint(pPoint4, ref o, ref o); IGeometry2 pGeometry1 = pStrip1 as IGeometry2; IGeometry2 pGeometry2 = pStrip2 as IGeometry2; IGeometry2 pGeometry3 = pStrip3 as IGeometry2; IGeometry2 pGeometry4 = pStrip4 as IGeometry2; pGeometryCollection.AddGeometry(pGeometry1, ref o,ref o); pGeometryCollection.AddGeometry(pGeometry2, ref o, ref o); pGeometryCollection.AddGeometry(pGeometry3, ref o, ref o); pGeometryCollection.AddGeometry(pGeometry4, ref o, ref o); IGeometry pGeometry = pMultiPatch as IGeometry; IElement pElement = new MultiPatchElementClass()as IElement ; pElement.Geometry = pGeometry; IGraphicsContainer pGraphicsContainer = pLayer as IGraphicsContainer; pGraphicsContainer.AddElement(pElement, 1); return null; } |