Developer's Guide
Total Page:16
File Type:pdf, Size:1020Kb
Autodesk MapGuide® Enterprise 2011 Developer’s Guide April 2010 © 2010 Autodesk, Inc. All Rights Reserved. Except as otherwise permitted by Autodesk, Inc., this publication, or parts thereof, may not be reproduced in any form, by any method, for any purpose. Certain materials included in this publication are reprinted with the permission of the copyright holder. Trademarks The following are registered trademarks or trademarks of Autodesk, Inc., and/or its subsidiaries and/or affiliates in the USA and other countries: 3DEC (design/logo), 3December, 3December.com, 3ds Max, Algor, Alias, Alias (swirl design/logo), AliasStudio, Alias|Wavefront (design/logo), ATC, AUGI, AutoCAD, AutoCAD Learning Assistance, AutoCAD LT, AutoCAD Simulator, AutoCAD SQL Extension, AutoCAD SQL Interface, Autodesk, Autodesk Envision, Autodesk Intent, Autodesk Inventor, Autodesk Map, Autodesk MapGuide, Autodesk Streamline, AutoLISP, AutoSnap, AutoSketch, AutoTrack, Backburner, Backdraft, Built with ObjectARX (logo), Burn, Buzzsaw, CAiCE, Civil 3D, Cleaner, Cleaner Central, ClearScale, Colour Warper, Combustion, Communication Specification, Constructware, Content Explorer, Dancing Baby (image), DesignCenter, Design Doctor, Designer's Toolkit, DesignKids, DesignProf, DesignServer, DesignStudio, Design Web Format, Discreet, DWF, DWG, DWG (logo), DWG Extreme, DWG TrueConvert, DWG TrueView, DXF, Ecotect, Exposure, Extending the Design Team, Face Robot, FBX, Fempro, Fire, Flame, Flare, Flint, FMDesktop, Freewheel, GDX Driver, Green Building Studio, Heads-up Design, Heidi, HumanIK, IDEA Server, i-drop, ImageModeler, iMOUT, Incinerator, Inferno, Inventor, Inventor LT, Kaydara, Kaydara (design/logo), Kynapse, Kynogon, LandXplorer, Lustre, MatchMover, Maya, Mechanical Desktop, Moldflow, Moonbox, MotionBuilder, Movimento, MPA, MPA (design/logo), Moldflow Plastics Advisers, MPI, Moldflow Plastics Insight, MPX, MPX (design/logo), Moldflow Plastics Xpert, Mudbox, Multi-Master Editing, Navisworks, ObjectARX, ObjectDBX, Open Reality, Opticore, Opticore Opus, Pipeplus, PolarSnap, PortfolioWall, Powered with Autodesk Technology, Productstream, ProjectPoint, ProMaterials, RasterDWG, RealDWG, Real-time Roto, Recognize, Render Queue, Retimer,Reveal, Revit, Showcase, ShowMotion, SketchBook, Smoke, Softimage, Softimage|XSI (design/logo), Sparks, SteeringWheels, Stitcher, Stone, StudioTools, ToolClip, Topobase, Toxik, TrustedDWG, ViewCube, Visual, Visual LISP, Volo, Vtour, Wire, Wiretap, WiretapCentral, XSI, and XSI (design/logo). All other brand names, product names or trademarks belong to their respective holders. Disclaimer THIS PUBLICATION AND THE INFORMATION CONTAINED HEREIN IS MADE AVAILABLE BY AUTODESK, INC. "AS IS." AUTODESK, INC. DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE REGARDING THESE MATERIALS. Published by: Autodesk, Inc. 111 McInnis Parkway San Rafael, CA 94903, USA Contents Chapter 1 Introduction . 1 What This Guide Covers . 1 Essential Concepts . 1 Preparing to Run the Examples . 2 Resources and Repositories . 3 Library and Session . 3 Maps . 4 Hello, Map – Displaying a Web Layout . 5 Hello, Map 2 – Adding a Custom Command . 7 Web Layouts and MapGuide Server Pages . 7 MapGuide Page Flow . 8 Example Code . 9 How This Page Works . 11 Understanding Services . 12 Chapter 2 The MapGuide Viewer . 13 Introduction . 13 The AJAX Viewer . 13 Custom Commands . 15 Understanding Viewer Frames . 15 MapGuide Viewer API . 17 Calling the Viewer API with an Invoke Script Command . 19 Calling the Viewer API from the Script Frame . 19 iii Calling the Viewer API from the Task Pane . 20 Extending Map Initialization Functionality . 21 The Hello Viewer Sample . 21 Embedding a Viewer in Your Own Page . 23 Chapter 3 Interacting With Layers . 27 Overview of Layers . 27 Basic Layer Properties . 27 Layer Groups . 28 Base Layer Groups . 28 Layer Style . 29 Layer Visibility . 29 Example: Actual Visibility . 30 Enumerating Map Layers . 30 Example . 30 Manipulating Layers . 31 Changing Basic Properties . 31 Example . 31 Changing Visibility . 32 Chapter 4 Working With Feature Data . 35 Overview of Features . 35 Querying Feature Data . 36 Feature Readers . 36 Selecting with the Web API . 37 Basic Filters . 37 Spatial Filters . 38 Example: Selection . 41 Active Selections . 43 Selecting with the Viewer . 43 Passing Viewer Information to the Web Server . 43 Additional Parameters to an Invoke URL Command . 44 Passing Parameters From an Invoke Script command . 45 Passing Parameters From the Task Pane Frame . 45 Working With the Active Selection . 46 Example: Listing Selected Parcels . 46 Setting the Active Selection With the Web API . 49 Example: Setting the Active Selection . 49 Chapter 5 Modifying Maps and Layers . 53 Introduction . 53 Adding An Existing Layer To A Map . 53 Creating Layers By Modifying XML . 53 Another Way To Create Layers . 56 iv | Contents Example - Creating A Layer That Uses Area Rules . 60 Example - Using Line Rules . 61 Example - Using Point Rules . 62 Adding Layers To A Map . 64 Making Changes Permanent . 67 Chapter 6 Analyzing Features . 69 Introduction . 69 Representation of Geometry . 69 Geometry Objects . 70 Comparing Geometry Objects . 71 Coordinate Systems . 72 Measuring Distance . 73 Temporary Feature Sources . 74 Inserting, Deleting, and Updating Features . 77 Creating a Buffer . 78 Example . 80 Chapter 7 Digitizing and Redlining . 89 Introduction . 89 Digitizing . 89 Redlining . 90 Passing Coordinates . 90 Creating a Feature Source . 91 Creating A Layer . 93 Chapter 8 Custom Output . 95 Introduction . 95 Rendering Service . 97 Mapping Service . 97 Chapter 9 Flexible Web Layouts . 101 Introduction . 101 Creating Templates . 102 Application Definitions . 109 Creating Components . 110 The Map Component . 111 Working With Selections . 113 Fusion API . 118 Methods . 118 Events . 120 Units . 121 Contents | v Chapter 10 Flexible Web Layouts Examples . 123 Overview . 123 Installing the Examples . 123 Running the Examples . 124 Firefox and Firebug . 124 Hello World: A Simple Invoke Script . 125 Example 1: Creating a Widget . 125 Example 2: Selections . 129 Example 3: Dialogs and Events . 131 Example 4: Updating the Site Repository . 136 Example 5: Anonymous Login . 141 Chapter 11 Using MapGuide Logging . 143 Introduction . 143 Logs and Logging Detail . 143 Access.