Axscenecontrol and axglobecontrol refresh

Source: Internet
Author: User

3D development in AE mainly involves scenecontrol and globecontrol. Their expressions differ greatly from those of two-dimensional mapcontrol. Therefore, 3D development often feels "constrained. It is quite uncomfortable to refresh the page. We may have updated the scene content in the control, but no matter what the operation is, the update cannot be displayed. In fact, only the two-dimensional map is used to, instead of 3D view, AE also provides some refreshing methods, mostly refreshing the viewer, basically, the requirements can still be met.

For example, if we modify the rendering of a layer in the control, we usually call the refreshviewers method to refresh (iscenegraph is under scene and iglobedisplay is under globe), but the layers in the control do not change, here is the refresh problem. You need to refresh the layers.

Below are two examples of modifying layer rendering:

Public sub texturelinesymbol () 'Scene VBA test modifying layer Rendering

Dim psxdoc as isxdocument

Set psxdoc = thisdocument

Dim ptexturesym as itexturelinesymbol

Set ptexturesym = new texturelinesymbol

Ptexturesym. createlinesymbolfromfile "F: \ states.jpg"

Ptexturesym. width = 0.02

Dim psimplinesym as isimplelinesymbol

Set psimplinesym = new simplelinesymbol

Psimplinesym. style. = esrislsdashdot

Dim plinesym as ilinesymbol

Set plinesym = psimplinesym

Psimplinesym. width = 0.02

Dim psimprender as isimplerenderer

Set psimprender = new simplerenderer

Psimprender. Label = "road name"

Set psimprender. symbol = psimplinesym 'ptexturesym

Dim pgolympus R as igeofeaturelayer

Dim pscene as iscene

Set pscene = psxdoc. Scene

Set pgolympus r = pscene. layer (0)

Set pgolympus R. Renderer = psimprender

Psxdoc. updatecontents

Dim PSG as iscenegraph

Set PSG = pscene. scenegraph

'Refresh like this.

PSG. invalidate fig, true, false

'Pscene. scenegraph. activeviewer. redraw true

PSG. refreshviewers

'Refresh in either of the following ways does not fail, but the effect remains unchanged.

'Psg. refreshviewers

'

'Dim pactview as iactiveview

'Set pactview = pscene

'Pactview. partialrefresh esriviewgeography, nothing, nothing 'is supported, but the refresh method is not supported.

End sub

Refresh in globe:

Pglobe. addlayertype pfeatlyr, esriglobelayertypedraped, true

'Dim pscenegraph as iscenegraph

'Set pscenegraph = pscene. scenegraph '. The obtained pscenegraph is null.

'Pscenegraph. invalidate pfeatlyr, true, true

Pglobe. globedisplay. refreshviewers

// C # test and modify globe layer rendering in the project

Private void button#click (Object sender, eventargs e) // modify the rendering of the globe Layer

{

Iscene pscene = This. axglobecontrol1.globe as iscene;

Ilayer player = pscene. get_layer (0 );

MessageBox. Show (player. Name );

Igeofeaturelayer fig = player as igeofeaturelayer;

Isimplelinesymbol plinesym = new simplelinesymbolclass ();

Irgbcolor pcolor = new rgbcolorclass ();

Pcolor. Blue = 0;

Pcolor. Green = 0;

Pcolor. red= 255;

Plinesym. Color = pcolor as icolor;

Isimplerenderer psimplerender = new simplerendererclass ();

Psimplerender. symbol = plinesym as isymbol;

Pgolympus R. Renderer = psimplerender as ifeaturerenderer;

Iglobedisplay pglobedisp = This. axglobecontrol1.globedisplay;

// Refresh in the following ways will not change

Pglobedisp. refreshviewers ();

Iactiveview pactview = This. axglobecontrol1.globe as iactiveview;

Pactview. partialrefresh (esriviewdrawphase. esriviewgeography, null, null );

// The refresh method below is effective. You can modify the rendering method for both the vector 3D layer and the Raster Vector layer.

Iglobedisplaylayers2 pgdisplyrs = pglobedisp as iglobedisplaylayers2;

Pgdisplyrs. refreshlayer (player );

This. axtoccontrol1.update ();

}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.