AnsweredAssumed Answered

How can i clear the cache or viusalize buffer of globedisplay in c#

Question asked by sercanmetu on Dec 9, 2012
When i create a polygon element on the Globe control and give it to rasterize property using IGlobeGraphicsElementProperties  it works properly. However , when changing the position of the element by using updateElement() method, the old texture (contents of the previous screen for the element) is still shown on the screen (it is not refreshed).  Is there a way to update rasterize polygon element or is there a way to clear the buffer/cache wherever it is stored.I guess IGraphicContainer and visual buffer are working asynchronizely because when i debug the code in graphicsContainer element property seen as it wanted . But i cannot find where  the buffer/cache is stored in globedisplay. Same problem occurs when i want to delete the element although i delete the element it is seen on the screen.IGraphicContainer delete element does not work properly when a polygon element has rasterize property.
But when IGraphicContainer DeleteAllElements() method is called it deletes all element and works fine. My assumption is   DeleteAllElements() method clears the buffer/cache in a way but how ?Please help me. Any help will be appreciated. Here is the screenshots.


In figure 1 original element is seen. In figure 2 i tried to move element and update it. On the screen the updated elemnt is seen with some part of the previous elemnt property .

            IGraphicsContainer graphicsContainer3D = m_globeGraphicsLayer as IGraphicsContainer;




            x_old += 0.5;


            IPoint[] points = new IPoint[4];
            for (int i = 0; i < points.Length; i++)
            {
                points[i] = new ESRI.ArcGIS.Geometry.Point();
                ((IZAware)points[i]).ZAware = true;
            }
            points[0].PutCoords(x_old, 39.5);
            points[0].Z = 100000;

            points[1].PutCoords(x_old + 1.5, 40.0);
            points[1].Z = 50000;

            points[2].PutCoords(x_old + 1.5, 38.0);
            points[2].Z = 150000;

            points[3].PutCoords(x_old - 0.5, 37.0);
            points[3].Z = 20000;

            IPoint center = new ESRI.ArcGIS.Geometry.Point();
            ((IZAware)center).ZAware = true;
            center.PutCoords(x_old, 36);


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

           
            //0 dan 360 derece kadar iterate eder ve daire noktalarını nokta koleksiyonuna ekler.
            for (int i = 0; i <= 360; i += 1)
            {
                IPoint polygonpoint = new ESRI.ArcGIS.Geometry.Point();
                ((IZAware)polygonpoint).ZAware = true;
                double newLon;
                double newLat;
                ShiftCoordinate(center.X, center.Y, i, 22000, out newLon, out newLat);
                polygonpoint.PutCoords(newLon, newLat);
                polygonpoint.Z = 100000;

                coll.AddPoint(polygonpoint);
            }

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

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



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

            this.element.Geometry = getCircle() as IGeometry;/*coll as IGeometry;*/

            this.fillShapeElement = this.element as IFillShapeElement;
            fillShapeElement.Symbol = simpleFillSymbol;

            IGlobeGraphicsElementProperties asd2 = new GlobeGraphicsElementProperties();
            asd2.DrapeElement = false;
            asd2.Rasterize = true;
            m_globeGraphicsLayer.SetGlobeProperties(this.element as IElement, asd2);

graphicsContainer3D.AddElement(fillShapeElement as IElement, 1);

Attachments

Outcomes