Arcglobe中平行于opengl的方法
来源:互联网 发布:软件后端开发是什么 编辑:程序博客网 时间:2024/04/29 10:36
以下方法,不能在线程中调用。否则无效。。
例程:
create3Dlayer("addlayer");
createPoint( dLon, dLat, dAlt)
//创建简单的3D模型
public ISimpleMarker3DSymbol Create3Dmarker()
{
IMarkerSymbol markerSymbol = new SimpleMarker3DSymbolClass();
//Set the marker symbol's style and resolution.
((ISimpleMarker3DSymbol)markerSymbol).Style = esriSimple3DMarkerStyle.esriS3DMSSphere;
((ISimpleMarker3DSymbol)markerSymbol).ResolutionQuality = 1.0;
//Set the symbol's size and color.
markerSymbol.Size = 700;
return (ISimpleMarker3DSymbol)markerSymbol;
}
一、创建新图层
//创建3D显示层
public void create3Dlayer(string layername)
{
m_globeGraphicsLayer = new GlobeGraphicsLayerClass();
((ILayer)m_globeGraphicsLayer).Name = layername;
IScene scene = (IScene)m_globeDisplay.Globe;
//Add the new graphic layer to the globe.
scene.AddLayer((ILayer)m_globeGraphicsLayer, false);
//Activate the graphic layer.
scene.ActiveGraphicsLayer = (ILayer)m_globeGraphicsLayer;
}
二、创建简单模型
/// <summary>
/// 创建一个简单点
/// </summary>
/// <param name="dLon"></param>
/// <param name="dLat"></param>
/// <param name="dAlt"></param>
private void createPoint(double dLon, double dLat, double dAlt)
{
IPoint point = new PointClass();
IZAware zAware = point as IZAware;
zAware.ZAware = true;
point.PutCoords(dLon, dLat);
point.Z = dAlt;
//Create the element’s color (red).
IRgbColor color = new RgbColorClass();
color.Red = 255;
color.Green = 0;
color.Blue = 0;
//Create the element’s symbol.
IMarkerSymbol markerSymbol =(IMarkerSymbol) Create3Dmarker();
markerSymbol.Color = color as IColor;
//Create the new marker symbol’s element.
IElement trackElement = new MarkerElementClass();
//Set the element's symbol and geometry (location and shape).
((IMarkerElement)trackElement).Symbol = markerSymbol;
trackElement.Geometry = point as IPoint;
//Add the element to the graphic layer.
((IGraphicsContainer)m_globeGraphicsLayer).AddElement(trackElement, 0);
}
三、增加三维模型
/// <summary>
/// 增加3D模型
/// </summary>
/// <param name="dLon">经度</param>
/// <param name="dLat">维度</param>
/// <param name="dAlt">高程</param>
/// <param name="path">3D路径</param>
/// <returns></returns>
public int AddTrackElement(double dLon, double dLat, double dAlt, string path)
{
if (null == m_globeGraphicsLayer)
return -1;
//create a new point at the given position
IPoint point = new PointClass();
((IZAware)point).ZAware = true;
point.X = dLon;
point.Y = dLat;
point.Z = dAlt;
//set the color for the element (red)
IRgbColor color = new RgbColorClass();
color.Red = 255;
color.Green = 0;
color.Blue = 0;
//create a new 3D marker symbol
IMarkerSymbol markerSymbol = new SimpleMarker3DSymbolClass();
//Define a new Marker3DSymbol
IMarker3DSymbol pMarkerSym;
pMarkerSym = new Marker3DSymbolClass();
pMarkerSym.CreateFromFile(path);
pMarkerSym.UseMaterialDraping = true;
IMarkerPlacement pMarker3DPlace;
pMarker3DPlace = pMarkerSym as IMarkerPlacement;
//set the marker symbol's style and resolution
IMarkerSymbol pMarkerSymbol = pMarkerSym as IMarkerSymbol;
pMarkerSymbol.Size = 70;
// pMarkerSymbol.Color = color as IColor;
pMarkerSymbol.Angle = 90;
((ISimpleMarker3DSymbol)markerSymbol).Style = esriSimple3DMarkerStyle.esriS3DMSSphere;
((ISimpleMarker3DSymbol)markerSymbol).ResolutionQuality = 1.0;
//set the symbol's size and color
markerSymbol.Size = 700;
// markerSymbol.Color = color as IColor;
//crate the graphic element
IElement trackElement = new MarkerElementClass();
//set the elemet's symbol and geometry (location and shape)
((IMarkerElement)trackElement).Symbol = pMarkerSym as IMarkerSymbol;
trackElement.Geometry = point as IPoint;
//add the element to the graphics layer
int elemIndex = 0;
((IGraphicsContainer)m_globeGraphicsLayer).AddElement(trackElement, 0);
//get the elemet's index
m_globeGraphicsLayer.FindElementIndex(trackElement, out elemIndex);
return elemIndex;
}
四、更新元素
//更新3D层中某个图元
public void updateLayer(int m_trackObjectIndex,double dx,double dy,double dz)
{
//Get the element by its index.
// ILayer layer = null;
// layer.
IElement elem = ((IGraphicsContainer3D)m_globeGraphicsLayer).get_Element(m_trackObjectIndex);
//Get the geometry of the element.
IPoint point = elem.Geometry as IPoint;
double surfaceElevation;
m_globeDisplay.GetSurfaceElevation(point.X, point.Y, true, out surfaceElevation);
//Update the element's position.
point.PutCoords(point.X + dx, point.Y+dy);
point.Z = surfaceElevation;//point.Z+dz;
elem.Geometry = (IGeometry)point;
//Update the element in the graphic layer.
m_globeGraphicsLayer.UpdateElementByIndex(m_trackObjectIndex);
}
- Arcglobe中平行于opengl的方法
- matlab中绘制平行于坐标轴的直线
- arcglobe+opengl(1)
- MathType中关于平行且相等符号的编辑方法
- 判断两个边平行于坐标轴的矩阵相交
- java3D中平行光投影的实现
- java3D中平行光投影的实现
- arcglobe导入三维模型方法
- ArcGlobe开发中常用代码
- ArcGlobe、ArcSence中路径飞行
- TFS2013 平行移植方法
- VS2013 OpenGL超级宝典中OpenGL的配置方法
- POJ 1269 Intersecting Lines 判断直线间的状态(平行、重合、相交于一点)
- 判断 2个 平行于坐标系轴的正方形是否有重叠
- android 解决文本框和按钮不平行的方法
- mfc中使用OpenGL的方法
- VC6.0中OpenGl的配置方法
- VS2010中OpenGL环境的配置方法
- 猛牛尿尿
- Asp.net下C#自动化调用Word的实例与总结(转载)
- 用音频信号实现无线传感器网络节点间距测量
- appfuse + Quartz
- 动态模拟粒子溃堤效果
- Arcglobe中平行于opengl的方法
- 利用并口读写I2C程序
- ZigBee密西西比协议栈的中断回调usrSlowTimerInt()函数
- 清除 googleupdate.exe进程
- 利用Sql Server的top分页查询的通用构造方式
- 使用TestDirector管理测试用例和评估测试用例执行状况
- C++经典面试题
- joomla1.56 loader.php
- Mozilla将于2010年推出手机版火狐浏览器