当前位置:网站首页>How to realize the reality of temporary graphic elements

How to realize the reality of temporary graphic elements

2022-07-26 13:23:00 WindOfMayGIS

How to realize the reality of temporary graphic elements

I. requirements description :

The processing results need to be displayed , Show it to yourself or users , Instead of storing .

Second, the idea of realization :

1. Instantiation Element , After the Element Put it in IGraphicsContainer in , Reuse IActiveView Refresh it ;

perhaps

2. Instantiation Element , take Element Put it in IElementCollection in , Reuse IGraphicsContainer and IActiveView Load refresh display .

Note here : If necessary Line If the object is temporarily displayed after it is put in , You need to LINE To Polyline Then put it in , Otherwise it will prompt “ Value is out of range ”.

  1. ISegmentCollection gc = new PolylineClass();  
  2. gc.AddSegment(line as ISegment);  
  3. IPolyline polyline = gc as IPolyline;  

Three code reference :

// Generate Element object , Store in ElementCollection in

publicIElementCollectionGeoColl = newElementCollection();

ITextElement pele1 = newTextElementClass();

                            pele1.Text = ".";

                            pele1.ScaleText = true;

                            IPoint pTempPoint4 = newPointClass();

                           pTempPoint4.PutCoords(xLoc1, yLoc1);

                            IElement pElement1 = pele1 asIElement;

                            pElement1.Geometry =pTempPoint4;

                           GeoColl.Add(pElement1);

// take ElementCollection adopt IGraphicsContainer and IActiveView Load refresh display

IActiveView pActiveView =axMapControl1.Map asIActiveView;

            IGraphicsContainerpGraphicsContainer = axMapControl1.Map asIGraphicsContainer;

           pGraphicsContainer.AddElements(LocFactory.GeoColl, 0);

            pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);

 

原网站

版权声明
本文为[WindOfMayGIS]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/207/202207261034155011.html