Autodesk 15606-011408-9300 Developer Guide - Page 68
Adding Custom Elements, Adding Symbols for Use with the Viewer API
UPC - 606121429548
View all Autodesk 15606-011408-9300 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 68 highlights
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); } } 68 | Chapter 4 Working with Map Layers, Map Features, and Printing