One view/next view on GIS Secondary Development

Source: Internet
Author: User

This is the same as the full graph mentioned in the previous article. It is a command-class function. You only need to override the onclick () method when customizing the function. Similarly, if you want to write with a button, as long as you know that they correspond to controlsmapzoomtolastextentbackcommand and controlsmapzoomtolastextentforwardcommand, the subsequent code will be easy. Let's take a look at the code that implements these two functions in the button:

Code

# View on Region
Private void btngoback_click (Object sender, eventargs E)
{
Controlsmapzoomtolastextentbackcommand mapgoback = new controlsmapzoomtolastextentbackcommandclass ();
Mapgoback. oncreate (axmapmain. Object );
Mapgoback. onclick ();
}
# Endregion

# Next view of Region
Private void btngoforward_click (Object sender, eventargs E)
{
Controlsmapzoomtolastextentforwardcommand mapgoforward = new controlsmapzoomtolastextentforwardcommandclass ();
Mapgoforward. oncreate (axmapmain. Object );
Mapgoforward. onclick ();
}
# Endregion

 

The code for rewriting the onclick method is as follows:

Code

# View on Region
Public override void onclick ()
{
If (null = m_pactiveview) return;
Iextentstack m_stack = m_pactiveview.extentstack;
If (m_stack.canundo ())
{
M_stack.undo ();
}
}
# Endregion

# Region next view
Public override void onclick ()
{
If (null = m_pactiveview) return;
Iextentstack m_stack = m_pactiveview.extentstack;
If (m_stack.canredo ())
{
M_stack.redo ();
}
}
# Endregion

 

During rewriting, note that the iextentstack stack interface is used to store the map view for each operation on the stack. The canundo () and canredo () methods are provided, determine whether a view in the stack can be back or forward.

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.