68
|
Chapter 4
Working with Map Layers, Map Features, and Printing
Adding Custom Page Elements
You can add custom page elements to the printout. Currently, the API can
only access symbols in the API symbol list. The API symbol list is a MWF or
EMF file containing a small set of predefined symbols. However, additional
symbols can be added to the list using Autodesk MapGuide
®
Author. Refer to
the topics “Adding Symbols for Use with the Viewer API” and “API Symbol
Manager dialog box” in the
Autodesk MapGuide Help
for more information.
The following example shows an
onEndLayout
event handler, written in
JavaScript, that adds a custom logo to the top left corner of the printout. Note
that the logo is rotated 90
°
. This example assumes that the
myLogo
symbol
has been added to the API symbol list by the map author:
function onEndLayout(layout, info)
{
// add 'myLogo' symbol to layout and return as 'sym'
var sym = layout.addSymbol("myLogo");
// function ends if symbol doesn't load properly
if (sym == null) return;
// display symbol the top-left corner of page
MGExtentEx ext = sym.getExtent();
ext.set(0, 0, 600, 600);
sym.setExtent(ext);
// rotate symbol
var attr = sym.getSymbolAttr();
if (attr != null) {
attr.setRotation(-90.0);
}
}
Содержание 15606-011408-9300 - MAP R6.3 UPG
Страница 1: ...15306 010000 5060 October 2001 Autodesk MapGuide Release 6 Developer s Guide ...
Страница 6: ...vi ...
Страница 16: ...16 ...
Страница 30: ...30 ...
Страница 84: ...84 ...
Страница 134: ...134 ...
Страница 202: ...202 ...