天天看点

Globe模仿光源照射

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;

}

继续阅读