private void ksAzimuth_ValueChanged(object sender, DevComponents.Instrumentation.ValueChangedEventArgs e) { if (n == 1) { return; } else { lblAziumth.Text = ksAzimuth.Value.ToString(); pVector3D.Azimuth = getradians(Convert.ToDouble(lblAziumth.Text)); pSceneGraph.SunVector = pVector3D; pSceneGraph.RefreshViewers(); } }
private void 影像叠加ToolStripMenuItem_Click(object sender, System.EventArgs e) { ISceneGraph pSceneGraph = this.axSceneControl1.SceneGraph; IScene pScene = pSceneGraph.Scene; ILayer layer = pScene.get_Layer(0); ITinLayer tinLayer = layer as ITinLayer; layer = pScene.get_Layer(1); IRasterLayer rasterLayer = layer as IRasterLayer; ITinAdvanced tinAdvanced; ISurface surface; tinAdvanced = tinLayer.Dataset as ITinAdvanced; surface = tinAdvanced.Surface; ILayerExtensions layerExtensions = (ILayerExtensions)rasterLayer; I3DProperties i3dProperties = null; for (int i = 0; i < layerExtensions.ExtensionCount; i++) { if (layerExtensions.get_Extension(i) is I3DProperties) { i3dProperties = (I3DProperties)layerExtensions.get_Extension(i); } }//get 3d properties from extension i3dProperties.BaseOption = esriBaseOption.esriBaseSurface; i3dProperties.BaseSurface = surface; i3dProperties.Apply3DProperties(rasterLayer); pSceneGraph.RefreshViewers(); }
/// <summary> /// 刷新指定图层 /// </summary> /// <param name="pObject"></param> public void RefreshLayer(object pObject) { if (this.m_sceneControl == null) { return; } ISceneGraph pSceneGragh = m_sceneControl.SceneGraph; pSceneGragh.Invalidate(pObject, true, false); pSceneGragh.ActiveViewer.Redraw(true); pSceneGragh.RefreshViewers(); }
public override void OnMouseUp(int Button, int Shift, int X, int Y) { //Get the scene graph ISceneGraph pSceneGraph = m_pSceneHookHelper.SceneGraph; //Get the scene IScene pScene = (IScene)m_pSceneHookHelper.Scene; IPoint pPoint; object pOwner, pObject; //Translate screen coordinates into a 3D point pSceneGraph.Locate(pSceneGraph.ActiveViewer, X, Y, esriScenePickMode.esriScenePickGeography, true, out pPoint, out pOwner, out pObject); //Get a selection environment ISelectionEnvironment pSelectionEnv; pSelectionEnv = new SelectionEnvironmentClass(); if (Shift == 0) { pSelectionEnv.CombinationMethod = ESRI.ArcGIS.Carto.esriSelectionResultEnum.esriSelectionResultNew; //Clear previous selection if (pOwner == null) { pScene.ClearSelection(); return; } } else { pSelectionEnv.CombinationMethod = ESRI.ArcGIS.Carto.esriSelectionResultEnum.esriSelectionResultAdd; } //If the layer is a selectable feature layer if (pOwner is IFeatureLayer) { IFeatureLayer pFeatureLayer = (IFeatureLayer)pOwner; if (pFeatureLayer.Selectable == true) { //Select by Shape pScene.SelectByShape(pPoint, pSelectionEnv, false); } } //Refresh the scene viewer pSceneGraph.RefreshViewers(); }
public static void AddFlyByGraphic(ISceneGraph isceneGraph_0, IGeometry igeometry_0, FlyByUtils.FlyByElementType flyByElementType_0, System.Drawing.Color color_0, System.Drawing.Color color_1, System.Drawing.Color color_2, System.Drawing.Color color_3, bool bool_0) { if (!igeometry_0.IsEmpty) { IGraphicsContainer3D graphicsContainer3D = isceneGraph_0.Scene.BasicGraphicsLayer as IGraphicsContainer3D; if (!FlyByUtils.LayerIsExist(isceneGraph_0.Scene, graphicsContainer3D as ILayer)) { isceneGraph_0.Scene.AddLayer(graphicsContainer3D as ILayer, true); } switch (flyByElementType_0) { case FlyByUtils.FlyByElementType.FLYBY_PATH: if (FlyByUtils.pPathElem != null) { graphicsContainer3D.DeleteElement(FlyByUtils.pPathElem); } break; case FlyByUtils.FlyByElementType.FLYBY_OBSERVER: if (FlyByUtils.pObserverElem != null) { graphicsContainer3D.DeleteElement(FlyByUtils.pObserverElem); } break; case FlyByUtils.FlyByElementType.FLYBY_TARGET: if (FlyByUtils.pTargetElem != null) { graphicsContainer3D.DeleteElement(FlyByUtils.pTargetElem); } break; } ISymbol flyBySymbol = FlyByUtils.GetFlyBySymbol(color_0, color_1, color_2, color_3, flyByElementType_0); IElement element; switch (igeometry_0.GeometryType) { case esriGeometryType.esriGeometryPoint: { element = new MarkerElement(); IMarkerElement markerElement = element as IMarkerElement; markerElement.Symbol = (flyBySymbol as IMarkerSymbol); break; } case esriGeometryType.esriGeometryMultipoint: return; case esriGeometryType.esriGeometryPolyline: { element = new LineElement(); ILineElement lineElement = element as ILineElement; lineElement.Symbol = (flyBySymbol as ILineSymbol); break; } default: return; } switch (flyByElementType_0) { case FlyByUtils.FlyByElementType.FLYBY_ANCHORS: { IElementProperties elementProperties = element as IElementProperties; elementProperties.Name = "SceneFlyBy.AnchorPoint"; break; } case FlyByUtils.FlyByElementType.FLYBY_PATH: FlyByUtils.pPathElem = element; break; case FlyByUtils.FlyByElementType.FLYBY_OBSERVER: FlyByUtils.pObserverElem = element; break; case FlyByUtils.FlyByElementType.FLYBY_TARGET: FlyByUtils.pTargetElem = element; break; case FlyByUtils.FlyByElementType.FLYBY_STATIC: { IElementProperties elementProperties = element as IElementProperties; elementProperties.Name = "SceneFlyBy.StaticLoc"; break; } } element.Geometry = igeometry_0; graphicsContainer3D.AddElement(element); if (bool_0) { isceneGraph_0.RefreshViewers(); } } }
public static void DeleteFlyByElement(ISceneGraph isceneGraph_0, FlyByUtils.FlyByElementType flyByElementType_0, bool bool_0) { IGraphicsLayer basicGraphicsLayer = isceneGraph_0.Scene.BasicGraphicsLayer; IGraphicsContainer3D graphicsContainer3D = basicGraphicsLayer as IGraphicsContainer3D; switch (flyByElementType_0) { case FlyByUtils.FlyByElementType.FLYBY_PATH: if (FlyByUtils.pPathElem != null) { graphicsContainer3D.DeleteElement(FlyByUtils.pPathElem); } break; case FlyByUtils.FlyByElementType.FLYBY_OBSERVER: if (FlyByUtils.pObserverElem != null) { graphicsContainer3D.DeleteElement(FlyByUtils.pObserverElem); } break; case FlyByUtils.FlyByElementType.FLYBY_TARGET: if (FlyByUtils.pTargetElem != null) { graphicsContainer3D.DeleteElement(FlyByUtils.pTargetElem); } break; case FlyByUtils.FlyByElementType.FLYBY_STATIC: graphicsContainer3D.Reset(); for (IElementProperties elementProperties = graphicsContainer3D.Next() as IElementProperties; elementProperties != null; elementProperties = (graphicsContainer3D.Next() as IElementProperties)) { if (elementProperties.Name == "SceneFlyBy.StaticLoc") { graphicsContainer3D.DeleteElement(elementProperties as IElement); break; } } break; case FlyByUtils.FlyByElementType.FLYBY_BACKDROP: graphicsContainer3D.Reset(); for (IElementProperties elementProperties = graphicsContainer3D.Next() as IElementProperties; elementProperties != null; elementProperties = (graphicsContainer3D.Next() as IElementProperties)) { if (elementProperties.Name == "_BACKDROP_") { graphicsContainer3D.DeleteElement(elementProperties as IElement); break; } } break; case FlyByUtils.FlyByElementType.FLYBY_ALL: if (FlyByUtils.pPathElem != null) { graphicsContainer3D.DeleteElement(FlyByUtils.pPathElem); } if (FlyByUtils.pObserverElem != null) { graphicsContainer3D.DeleteElement(FlyByUtils.pObserverElem); } if (FlyByUtils.pTargetElem != null) { graphicsContainer3D.DeleteElement(FlyByUtils.pTargetElem); } graphicsContainer3D.Reset(); for (IElementProperties elementProperties = graphicsContainer3D.Next() as IElementProperties; elementProperties != null; elementProperties = (graphicsContainer3D.Next() as IElementProperties)) { if (elementProperties.Name == "_BACKDROP_" || elementProperties.Name == "SceneFlyBy.AnchorPoint" || elementProperties.Name == "SceneFlyBy.StaticLoc") { graphicsContainer3D.DeleteElement(elementProperties as IElement); graphicsContainer3D.Reset(); } } break; } if (bool_0) { isceneGraph_0.RefreshViewers(); } }
public static void RefreshApp(ISceneGraph isceneGraph_0) { isceneGraph_0.RefreshViewers(); }