Please... someone... I need help)
Hello. Sorry for disturbing, but I have a same problem and I simply don't understand a source of that problem. I tried to drawing the OpenGL point, as you can see in the code below, but it doesn't work! Sorry for my english either.
Could you share with me your VB code? Some examples? Please! I never worked with OpenGL before.
ISceneGraphEvents_Event events = axSceneControl1.SceneGraph as ISceneGraphEvents_Event;
events.AfterDraw += new ISceneGraphEvents_AfterDrawEventHandler(events_AfterDraw);
void events_AfterDraw(ISceneViewer pViewer)
{
ISceneControlEvents_OnMouseDownEvent events = e;
if (events != null)
ISceneGraph pSceneGraph = axSceneControl1.SceneGraph;
object pOwner = null, //слой
pObject = null; //объект, на который указывает мышь
IPoint point = null;
pSceneGraph.Locate(pSceneGraph.ActiveViewer, events.x, events.y, esriScenePickMode.esriScenePickFastLocation, true, out point, out pOwner, out pObject);
if (point != null)
IGeometry geom = point as IGeometry;
geom.Project(axSceneControl1.Scene.SpatialReference);
point = geom as IPoint;
Gl.glPointSize(999.0f);
Gl.glColor3ub(0, 0, 0);
Gl.glBegin(Gl.GL_POINTS);
Gl.glVertex3d(point.X, point.Y, point.Z);
Gl.glEnd();
Gl.glFlush();
axSceneControl1.Invalidate();
}
Public Sub RefreshView() Dim pSxDoc As ISxDocument pSxDoc = My.ArcScene.Application.Document pSxDoc.Scene.SceneGraph.Invalidate(pSxDoc.Scene.SceneGraph.ActiveViewer, True, True) pSxDoc.Scene.SceneGraph.RefreshViewers() End Sub Private Sub btnRun_Click(sender As System.Object, e As System.EventArgs) Handles btnRun.Click Dim pSxDoc As ISxDocument pSxDoc = My.ArcScene.Application.Document Dim pScene As IScene pScene = pSxDoc.Scene Dim pLayer As ILayer Dim theLayer As String = cboLayer.Text pLayer = GetLayer(theLayer) Dim theFLayer As IFeatureLayer Dim theFClass As IFeatureClass theFLayer = pLayer theFClass = theFLayer.FeatureClass Dim theFeatCursor As IFeatureCursor Dim theFeature As IFeature theFeatCursor = theFClass.Search(Nothing, False) theFeature = theFeatCursor.NextFeature While Not theFeature Is Nothing Dim geom As IGeometry geom = theFeature.ShapeCopy geom.Project(pScene.SpatialReference) Dim thePoint As IPoint thePoint = geom GL.glPointSize(15.0F) GL.glColor3ub(255, 0, 0) GL.glBegin(GL.GL_POINTS) GL.glVertex3f(thePoint.X, thePoint.Y, thePoint.Z) GL.glEnd() theFeature = theFeatCursor.NextFeature End While RefreshView() End Sub
Hi,this thread describes how to get the spatial reference by casting the layer to an IGeoDataset. http://forums.esri.com/Thread.asp?c=159&f=1707&t=223709A ISurface has also a reference in its domain attribute, you can try this too.pt.SpatialReference = surface.Domain.SpatialReferenceI can send you my mail address as private message, but you have to enable it in your forum settings first.
pt.SpatialReference = surface.Domain.SpatialReference
Hi,I think you have to set the right spatial reference after setting the point coordinates and then project it to the reference of the scene.pt.SpatialReference = layer.SpatialReference; pt.Project(m_sceneHookHelper.Scene.SpatialReference);
pt.SpatialReference = layer.SpatialReference; pt.Project(m_sceneHookHelper.Scene.SpatialReference);
Public RasterLayer As IRasterLayer Public lyr As ILayer lyr = GetLayer(m_pDEMname) RasterLayer = CType(lyr, IRasterLayer) Private Function GetLayer(ByVal name As String) As ILayer 'Dim layer As ILayer For i As Integer = 0 To m_pScene.LayerCount - 1 If m_pScene.Layer(i).Name = name Then Return m_pScene.Layer(i) End If Next Return Nothing End Function
Dim pBasicmap As IBasicMap 'Dim ilayer As ILayer 'ilayer = CType(m_pScenecontrol.CustomProperty, ILayer) pBasicmap = CType(m_pScenecontrol.Scene, IBasicMap) 'pBasicmap.DeleteLayer(ilayer) pt.SpatialReference = pBasicmap.SpatialReference pt.Project(m_pScenecontrol.Scene.SpatialReference)
Hi,You�??re welcome, I understand your English very well.I think you can use my method. In my application the features are points from a shapefile, but your point coordinates should do fine as well. In case a terrain is loaded, I get the height of a point in ArcScene like that:ISurface surface = �?�; double height = surface.GetElevation(point) * surface.ZFactor;The surface I use is assigned to the shapefile layer, I guess you have already a reference to your terrain. The height can passed as z-coordinate to OpenGL:GL.glVertex3f((float) point.X, (float) point.Y, (float) height);
ISurface surface = �?�; double height = surface.GetElevation(point) * surface.ZFactor;
GL.glVertex3f((float) point.X, (float) point.Y, (float) height);
Hi,I use GeographicToGeocentric only in ArcGlobe, sorry for my misleading answer. In ArcScene, I just project my points to the spatial reference of the scene and pass the x- and y-coordinate to OpenGL for drawing.IGeometry geom = feature.ShapeCopy; geom.Project(m_sceneHookHelper.Scene.SpatialReference); IPoint point = geom as IPoint; GL.glPointSize(15.0f); GL.glColor3ub(255, 0, 0); GL.glBegin(GL.GL_POINTS); GL.glVertex3f((float)point.X, (float)point.Y, (float)0.0); GL.glEnd();
IGeometry geom = feature.ShapeCopy; geom.Project(m_sceneHookHelper.Scene.SpatialReference); IPoint point = geom as IPoint; GL.glPointSize(15.0f); GL.glColor3ub(255, 0, 0); GL.glBegin(GL.GL_POINTS); GL.glVertex3f((float)point.X, (float)point.Y, (float)0.0); GL.glEnd();
Hi,this can be done with the function GeographicToGeocentric, as described on this pagehttp://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#/How_to_draw_a_geographical_object_on_the_globe_using_direct_OpenGL_plug_in/0001000002vr000000/
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.