sercanmetu

Which parts are refreshed when navigate tool mouse clicked?

Discussion created by sercanmetu on Jun 7, 2012
axGlobeControl1.Globe.GlobeUnits = esriUnits.esriMeters;



            ISpatialReferenceFactory3 spatialReferenceFactory = (ISpatialReferenceFactory3)new SpatialReferenceEnvironment();
            IGeographicCoordinateSystem geographic = spatialReferenceFactory.CreateGeographicCoordinateSystem((int)ESRI.ArcGIS.Geometry.esriSRGeoCSType.esriSRGeoCS_WGS1984);
            geographic.SetDomain(-180, 180, -90, 90);
            geographic.SetZDomain(-10000000000000, 100000000000000);

            axGlobeControl1.BackColor = Color.DarkGray;

            m_globeControl = axGlobeControl1.Object as IGlobeControl;

            //cast the GlobeViewUtil from the GlobeCamera
            m_globeViewUtil = m_globeControl.GlobeCamera as IGlobeViewUtil;

            //Create the graphic layer.
            IGlobeGraphicsLayer m_globeGraphicsLayer = new GlobeGraphicsLayerClass();
            ((ILayer)m_globeGraphicsLayer).Name = "DynamicObjects";


            axGlobeControl1.GlobeDisplay.Scene.AddLayer((ILayer)m_globeGraphicsLayer, true);

            IRasterLayer rasterLayer = new ESRI.ArcGIS.Carto.RasterLayer();
            rasterLayer.CreateFromFilePath(@"D:\Raster\Elevation\elevation.tif");

            axGlobeControl1.GlobeDisplay.Scene.AddLayer(rasterLayer as ILayer);

            /*writeShapefile();

            IFeatureLayer featureLayer = new FeatureLayer();
                     
            IWorkspaceFactory wf = new ShapefileWorkspaceFactory();
            IFeatureWorkspace workspace = (IFeatureWorkspace)wf.OpenFromFile(@"D:\", 0);
            IFeatureClass featureClass = workspace.OpenFeatureClass("ff.shp");

            featureLayer.FeatureClass = featureClass;

            axGlobeControl1.GlobeDisplay.Scene.AddLayer(featureLayer as ILayer);*/

            ISpatialReferenceFactory3 spatialReferenceFactory5 = (ISpatialReferenceFactory3)new SpatialReferenceEnvironment();
            IVerticalCoordinateSystem verticalCS;

            IGeographicCoordinateSystem2 GCS;
            ISpatialReference3 spatialReference;
            GCS = spatialReferenceFactory5.CreateGeographicCoordinateSystem((int)esriSRGeoCSType.esriSRGeoCS_WGS1984) as IGeographicCoordinateSystem2;

            spatialReference = GCS as ISpatialReference3;

            verticalCS = spatialReferenceFactory5.CreateVerticalCoordinateSystem((int)esriSRVerticalCSType.esriSRVertCS_WGS1984);

            spatialReference.VerticalCoordinateSystem = verticalCS;


            IPointCollection coll = new Polygon();
            ((IZAware)coll).ZAware = true;

            ((IGeometry)coll).SpatialReference = spatialReference;

            IPointCollection coll2 = new Polygon();
            ((IZAware)coll2).ZAware = true;

            ((IGeometry)coll2).SpatialReference = spatialReference;

            IPointCollection polylineEsri = new Polyline();
            ((IZAware)polylineEsri).ZAware = true;

            ((IGeometry)polylineEsri).SpatialReference = spatialReference;

            IPoint[] points = new IPoint[8];
            for (int i = 0; i < 8; i++)
            {
                points[i] = new ESRI.ArcGIS.Geometry.Point();
                ((IZAware)points[i]).ZAware = true;
                points[i].SpatialReference = spatialReference;
            }

            points[0].PutCoords(27, 41);
            points[0].Z = 650000;

            points[1].PutCoords(27.5, 32.5);
            points[1].Z = 700000;

            points[2].PutCoords(40, 32);
            points[2].Z = 800000;

            points[3].PutCoords(35, 39);
            points[3].Z = 550000;


            points[4].PutCoords(27, 41);
            points[4].Z = 500000;

            points[5].PutCoords(27.5, 32.5);
            points[5].Z = 500000;

            points[6].PutCoords(40, 32);
            points[6].Z = 500000;

            points[7].PutCoords(35, 39);
            points[7].Z = 500000;

            coll.AddPoint(points[0]);
            coll.AddPoint(points[1]);
            coll.AddPoint(points[2]);
            coll.AddPoint(points[3]);

            coll2.AddPoint(points[4]);
            coll2.AddPoint(points[5]);
            coll2.AddPoint(points[6]);
            coll2.AddPoint(points[7]);




            IExtrude2 ext = (IExtrude2)new GeometryEnvironment();
            IGeometry geom = ext.Extrude(1, coll as IGeometry);


            geom.SpatialReference = spatialReference;

            IMultiPatch patch2 = geom as IMultiPatch;
            ((IGeometry)patch2).SpatialReference = spatialReference;

            IMultiPatch patch = CreateMultipatch();



            ((IGeometry)patch).SpatialReference = spatialReference;



            IRgbColor color = new RgbColor();
            color.Red = 255;
            color.Green = 0;
            color.Blue = 0;
            color.Transparency = 255;

            IRgbColor color2 = new RgbColor();
            color2.Red = 0;
            color2.Green = 0;
            color2.Blue = 255;
            color2.Transparency = 75;


            ISimpleFillSymbol simpleFillSymbol = new SimpleFillSymbol();
            simpleFillSymbol.Color = color;

            ISimpleFillSymbol simpleFillSymbol2 = new SimpleFillSymbol();
            simpleFillSymbol2.Color = color2;

            IElement element = new MultiPatchElement();
            element.Geometry = patch2 as IGeometry;

            IElement element2 = new MultiPatchElement();
            element2.Geometry = patch as IGeometry;

            IPoint pts = new ESRI.ArcGIS.Geometry.Point();
            ((IZAware)pts).ZAware = true;

            IPoint pts2 = new ESRI.ArcGIS.Geometry.Point();
            ((IZAware)pts2).ZAware = true;

            pts.PutCoords(39, 30);
            pts.Z = 0;

            pts2.PutCoords(40, 44);
            pts2.Z = 600000;

            IElement polygonElement = new MultiPatchElement();//PolygonElement();
            polygonElement.Geometry = AirPatch(pts, pts2) as IGeometry;//coll as IGeometry;

            IFillShapeElement fillShapeElement = element as IFillShapeElement;
            fillShapeElement.Symbol = simpleFillSymbol2;

            IFillShapeElement fillShapeElement2 = element2 as IFillShapeElement;
            fillShapeElement2.Symbol = simpleFillSymbol;

            IFillShapeElement fillShapeElement3 = polygonElement as IFillShapeElement;
            fillShapeElement3.Symbol = simpleFillSymbol;


            IGraphicsContainer3D graphicsContainer3D = m_globeGraphicsLayer as IGraphicsContainer3D;
            graphicsContainer3D.AddElement(fillShapeElement2 as IElement);
            graphicsContainer3D.AddElement(fillShapeElement as IElement);


            IGlobeGraphicsElementProperties asd = new GlobeGraphicsElementProperties();
            asd.UseCallOutLine = true;
            asd.OrientationMode = esriGlobeGraphicsOrientation.esriGlobeGraphicsOrientationLocal;
            asd.DrapeElement = true;
            asd.DrapedDensificationDistance = 500000;
            asd.DrapeZOffset = 100000;
            asd.FixedScreenSize = true;
            asd.Illuminate = false;
            m_globeGraphicsLayer.SetGlobeProperties(fillShapeElement2 as IElement, asd);



            IGlobeGraphicsElementProperties asd2 = new GlobeGraphicsElementProperties();
            asd2.OrientationMode = esriGlobeGraphicsOrientation.esriGlobeGraphicsOrientationLocal;
            asd2.DrapeElement = true;
            asd2.Illuminate = false;
            asd2.DrapeZOffset = 550000;
            m_globeGraphicsLayer.SetGlobeProperties(fillShapeElement as IElement, asd2);


            m_globeGraphicsLayer.UpdateAllElements();



            GC.Collect();
            GC.WaitForPendingFinalizers();

            /*axGlobeControl1.GlobeDisplay.ActiveViewer.Redraw(true);*/


            /*(axGlobeControl1.GlobeDisplay as IGlobeDisplayLayers).RefreshLayer((ILayer)m_globeGraphicsLayer);


            ICustomGlobeLayer custom = m_globeGraphicsLayer as ICustomGlobeLayer;
            custom.DrawImmediate(axGlobeControl1.GlobeViewer);


            axGlobeControl1.Invalidate();
            axGlobeControl1.Hide();
            axGlobeControl1.Update();
            axGlobeControl1.Enabled = true;
            axGlobeControl1.Show();
            axGlobeControl1.Refresh();*/


            axGlobeControl1.GlobeDisplay.RefreshViewers();



i try to give globe properties to element. ?t is drawn to wrong place after i pressed the mouse button it is drawn to the correct place.
Problem is globe properties are set later. But i cannot refresh the globe as if mouse click. Is there a way to refresh the layer, elements or whatever to solve
this problem. I tried lots of thing namely updating elements, refreshing layer, refreshing axglobecontrol , redraw activeviewer but i am unable to refresh. Please
help me. Thanks in advance.

Outcomes