Graphic layout-custom Element

Source: Internet
Author: User

An important function of GIS is plotting, and the final solution of the plotting function involves formatting. GIS layout is not purely physical. In fact, the ultimate goal of a practical typographical system is the simplicity of interaction, the richness of information, and the flexibility of customization. These three indicators are the best basis for evaluating the GIS plotting system.

In the ArcGIS Desktop System, the layout of the plotting part is completely controlled by the element, and different map elements are provided through different types of elements. There are two main types of elements: Graphic Element and frame element. For specific differences, see ESRI development help. This article focuses on customizing an element through the underlying layer to improve the flexibility of the element in system customization.

Before implementing custom elements, review the features of elements in layout. In layout, we will get an element containing the map by default. to enrich the map, we need to add the pointing north, scale, and legend. These three types are generally generated by wizard and belong to mapsurround element. the advantage of the Wizard is quick and custom, but what highlights the same advantages is its disadvantages and lack of flexibility. The most important thing is that the customized style is very ugly, in fact, in China, the Wizard is generally not used to generate elements. The most common method is to generate elements by combining common graphic elements, for example.

When you define graphic elements, several trivial elements are combined to obtain the final groupelement for control. Because groupelement is a single element, it is easy to control. Why do I have to write another element from the underlying layer? The reason is that although groupelement is easy to control, it cannot modify the internal elements of groupelement. Of course, many people say that you can scatter groupelement and modify it, and then obtain the required element modification, after modification, combine the changes. Many people actually do this, but unfortunately it is not perfect. If the combination uses the name to identify the element, the names will not exist after the combination, you must identify the element by other means, so that the elements can still be controlled by the identifiers before and after the combination. This is only one of the problems. One of the other problems is what I encountered. If we need to add tables to enrich the information on the map, how can we deal with it. If you are familiar with ArcGIS, you will be told to insert tables directly by adding an element that supports OLE objects. Unfortunately, this function can only be used on the desktop, you cannot use it in arcengine, Ole
Element belongs to the arcmapui class library. That is to say, if you want to change the table content, you need to edit it in the OLE object editing environment. That is to say, if you insert an Excel table, you can only edit the element in an Excel file.

Many people have asked me how to solve this problem? The answer I have given is that you can either customize the OLE element object without moving it, or you can create an element that supports tables by yourself. I am flexible and customizable, and once and for all, it is difficult to implement it. I am not familiar with it or I have not done ArcGIS extension myself. ESRI only provides an example to implement the triangle element. It is very simple. You can refer to it. Of course, implementing similar table functions is still quite difficult.

The first step is to determine which interfaces you need to implement. For details, refer to the implementation of the triangle element.

Step 2: design the parameters that need to be passed in the Custom Interface

Step 3: Test Cases

// Add custom elementielementptr ipelement (clsid_hydroinfoelement); ipointptr ippoint (clsid_point); HR = ippoint-> putcoords (0, 0); ipelement-> put_geometry (ippoint ); hR = ipgraphicscontainer-> addelement (ipelement, 0); ipropertysetptr ippropertyset (clsid_propertyset); HR = ippropertyset-> setproperty (ccombstr (" "), ccomvariant ("Office of General Flood Control and Drought Relief Headquarters"); HR = ippropertyset-> setproperty (ccombstr (""), ccomvariant ("Yangtze River Water Conservancy commission of the Ministry of Water Resources ")); hR = ippropertyset-> setproperty (ccombstr (""), ccomvariant (""); HR = ippropertyset-> setproperty (ccombstr (" "), ccomvariant (""); HR = ippropertyset-> setproperty (ccombstr ("release time"), ccomvariant (""); ihydroinfoelementptr iphydroinfoelement; iphydroinfoelement = ipelement; hR = iphydroinfoelement-> put_hydroinfoproperties (ippropertyset); // set the description text font itextsymbolptr iptextsymbol (plaintext); ifontdispptr ipfontdisp (plaintext); ifontptr ipfont; ipfont = ipfontdisp; hR = ipfont-> put_name (ccombstr (""); HR = iptextsymbol-> put_font (ipfontdisp); HR = iptextsymbol-> put_size (12 ); hR = iphydroinfoelement-> put_hydroinfotextsymbol (iptextsymbol); // refresh iactiveviewptr ipactiveview; ipactiveview = ipgraphicscontainer; HR = ipactiveview-> refresh ();

Step 4: implement the internal methods of all interfaces by yourself

Omitted

Step 5: Test on ArcMap or arcengine

The most direct way to change the content of a custom table element is to re-pass the propertyset parameter to one side, which greatly reduces the development of arcengine, generally, you only need to customize the interface for passing in parameters or simply control parameters through a program. All other effects are automatically controlled by table element. Of course, the power of customization is not limited here. Other complicated or tedious tasks can be converted to custom elements. Custom elements, coupled with typographical rules, can solve almost all typographical problems.

Reprinted please indicate Source: http://blog.csdn.net/jx1228

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.