AutoCAD Map 3D 2013 API - adndevblog.typepad.com · in AutoCAD Map . Title: AutoCAD Map 3D 2013 API...

24
© 2012 Autodesk AutoCAD ® Map 3D 2013 Platform API

Transcript of AutoCAD Map 3D 2013 API - adndevblog.typepad.com · in AutoCAD Map . Title: AutoCAD Map 3D 2013 API...

Page 1: AutoCAD Map 3D 2013 API - adndevblog.typepad.com · in AutoCAD Map . Title: AutoCAD Map 3D 2013 API Author: Partha Sarkar Subject: AutoCAD Map 3D 2013 API Created Date: 2/22/2013

© 2012 Autodesk

AutoCAD® Map 3D 2013 Platform API

Page 2: AutoCAD Map 3D 2013 API - adndevblog.typepad.com · in AutoCAD Map . Title: AutoCAD Map 3D 2013 API Author: Partha Sarkar Subject: AutoCAD Map 3D 2013 API Created Date: 2/22/2013

© 2012 Autodesk

Overview of the Geospatial Platform API

Page 3: AutoCAD Map 3D 2013 API - adndevblog.typepad.com · in AutoCAD Map . Title: AutoCAD Map 3D 2013 API Author: Partha Sarkar Subject: AutoCAD Map 3D 2013 API Created Date: 2/22/2013

© 2012 Autodesk

Contents

Map API Overview

Introduction to the Geospatial Platform API

Benefits of the Geospatial Platform API

Differences between Infrastructure Map Server

(MapGuide Enterprise) and Map 3D Geospatial

Platform APIs

Page 4: AutoCAD Map 3D 2013 API - adndevblog.typepad.com · in AutoCAD Map . Title: AutoCAD Map 3D 2013 API Author: Partha Sarkar Subject: AutoCAD Map 3D 2013 API Created Date: 2/22/2013

© 2012 Autodesk

AutoCAD Map 3D API

Da

ta C

on

ne

ct A

PI

AutoCAD API

Ma

p O

bje

ctA

RX

AP

I

Ma

p L

ISP

/AD

SR

X A

PI

Ma

p .

NE

T A

PI

Ma

p A

ctive

X A

PI

FDO API

Ge

osp

atia

l P

latf

orm

AP

I AcDb

Entities

FDO Data Store

Features

Page 5: AutoCAD Map 3D 2013 API - adndevblog.typepad.com · in AutoCAD Map . Title: AutoCAD Map 3D 2013 API Author: Partha Sarkar Subject: AutoCAD Map 3D 2013 API Created Date: 2/22/2013

© 2012 Autodesk

AutoCAD Map 3D Platform API

Consists of the Geospatial Platform API

and its Map 3D-specific extension

Several modules shared with AIMS / MGE

Based on FDO API

access to features through FDO Providers

.NET API

FDO

Ge

osp

atia

l P

latf

orm

AP

I M

ap P

latf

orm

A

PI

Page 6: AutoCAD Map 3D 2013 API - adndevblog.typepad.com · in AutoCAD Map . Title: AutoCAD Map 3D 2013 API Author: Partha Sarkar Subject: AutoCAD Map 3D 2013 API Created Date: 2/22/2013

© 2012 Autodesk

Architecture

FDO

Geospatial Platform

AIMS / MapGuide

Coordinate System

Resource Service

Feature Service

Geometry

Exceptions

System Types

Collections

Mapping Service

Drawing Service

Rendering Service

Tile Service

Shared Code

Map 3D

Data Connect API

Map Platform API

Shared

Interface

Site Service

Page 7: AutoCAD Map 3D 2013 API - adndevblog.typepad.com · in AutoCAD Map . Title: AutoCAD Map 3D 2013 API Author: Partha Sarkar Subject: AutoCAD Map 3D 2013 API Created Date: 2/22/2013

© 2012 Autodesk

AutoCAD Map 3D Platform API

FDO

Geo

sp

ati

al P

latf

orm

AP

I M

ap

Pla

tfo

rm A

PI

Namespaces

Autodesk.Gis.Map.Platform

Autodesk.Gis.Map.Platform.Interop

OSGeo.MapGuide

OSGeo.FDO*

OSGeo.FDO.Common*

Page 8: AutoCAD Map 3D 2013 API - adndevblog.typepad.com · in AutoCAD Map . Title: AutoCAD Map 3D 2013 API Author: Partha Sarkar Subject: AutoCAD Map 3D 2013 API Created Date: 2/22/2013

© 2012 Autodesk

API Components

Exceptions Collections

Map and Layers Geometry

Resource Service

Common

Feature Service Feature-Entity Service

Coordinate System

Page 9: AutoCAD Map 3D 2013 API - adndevblog.typepad.com · in AutoCAD Map . Title: AutoCAD Map 3D 2013 API Author: Partha Sarkar Subject: AutoCAD Map 3D 2013 API Created Date: 2/22/2013

© 2012 Autodesk

Resource Service

Resources

Files and configuration information

required for map and layer display

Layer definition and Feature source

Stored in drawings or drawing

templates and are specific to the

drawing

Resource Service

Used for manipulating resources

Adding resources to Map

Copying resources

Checking for existence of resources

Getting the contents of a resource

SDF SHP Oracle

Library://

LayerDef.

FeatureSrc.

DW

G D

ata

base

Repository

Page 10: AutoCAD Map 3D 2013 API - adndevblog.typepad.com · in AutoCAD Map . Title: AutoCAD Map 3D 2013 API Author: Partha Sarkar Subject: AutoCAD Map 3D 2013 API Created Date: 2/22/2013

© 2012 Autodesk

Resource Service

Resource Identifier String that uniquely identifies a resource

// using Platform API using OSGeo.MapGuide; // Get the resource service AcMapResourceService resService = (AcMapResourceService ) AcMapServiceFactory.GetService (MgServiceType.ResourceService); // Create a resource Id for a layer definition resource MgResourceIdentifier resId = new MgResourceIdentifier("Library://Data/Raster/Redding.LayerDefinition"); MgByteReader byteRdr = null; // If the layer definition exists output it if resServ.ResourceExists(resId) { byteRdr = resServ.GetResourceContent(id); MgByteSink byteSink = new MgByteSink(byteRdr); byteSink.ToFile(@"c:\ReddingLayerDef.Xml"); }

Page 11: AutoCAD Map 3D 2013 API - adndevblog.typepad.com · in AutoCAD Map . Title: AutoCAD Map 3D 2013 API Author: Partha Sarkar Subject: AutoCAD Map 3D 2013 API Created Date: 2/22/2013

© 2012 Autodesk

Feature Service

Provides access to FDO

functionality Providers and Capabilities

Creating feature sources

Querying for features

Creating and modifying

features

Enhanced in AutoCAD

Map with events to track

feature creation,

modification and deletion

FDO

FeatureService

Page 12: AutoCAD Map 3D 2013 API - adndevblog.typepad.com · in AutoCAD Map . Title: AutoCAD Map 3D 2013 API Author: Partha Sarkar Subject: AutoCAD Map 3D 2013 API Created Date: 2/22/2013

© 2012 Autodesk

Feature Service

Selecting Features

// using platform API using OSGeo.MapGuide; // Get the feature service AcMapFeatureService featureService = AcMapServiceFactory.GetService(ServiceType.FeatureService) as AcMapFeatureService; // Resource identifier MgResourceIdentifier resId = new MgResourceIdentifier( "Library://SDF_1.FeatureSource"); String className="SDF_2_Schema:Hauptstrassen"; // Define filter for selection MgFeatureQueryOptions options = new MgFeatureQueryOptions(); options.SetFilter("Year > 1999"); // Select features MgFeatureReader ftrReader = featureService.SelectFeatures(resId, className, options);

Page 13: AutoCAD Map 3D 2013 API - adndevblog.typepad.com · in AutoCAD Map . Title: AutoCAD Map 3D 2013 API Author: Partha Sarkar Subject: AutoCAD Map 3D 2013 API Created Date: 2/22/2013

© 2012 Autodesk

Feature-Entity Service

Enables AutoCAD Selection API

support for Features Selection set management

Support for feature highlighting

AcMapFeatureEntityService

//select feature on Map

PromptSelectionResult selResult = ed.GetSelection(); if (selResult.Status == PromptStatus.OK)

{

SelectionSet selSet = selResult.Value; MgSelectionBase selectionBase = AcMapFeatureEntityService.GetSelection(selSet);

// Deal with Selected Features

}

Page 14: AutoCAD Map 3D 2013 API - adndevblog.typepad.com · in AutoCAD Map . Title: AutoCAD Map 3D 2013 API Author: Partha Sarkar Subject: AutoCAD Map 3D 2013 API Created Date: 2/22/2013

© 2012 Autodesk

Mapping Service

Provides access to map

and map layers

Get and set map and layer

properties

Root class AcMapMap

extends MgMapBase

MgLayerCollection MgLayerGroupCollection

MgMapBase

AcMapMap

MgLayerBase

AcMapLayer

MgLayerGroup

AcMapLayerGroup

Page 15: AutoCAD Map 3D 2013 API - adndevblog.typepad.com · in AutoCAD Map . Title: AutoCAD Map 3D 2013 API Author: Partha Sarkar Subject: AutoCAD Map 3D 2013 API Created Date: 2/22/2013

© 2012 Autodesk

Mapping Service

Accessing Map and Layer objects

AcMapMap currentMap = AcMapMap.GetCurrentMap() ; MgLayerCollection layers = currentMap.GetLayers(); MgLayerGroupCollection layerGroups = currentMap.GetLayerGroups(); //Iterate through layers and toggle visibility foreach (AcMapLayer layer in layers) { bool visibility = IsVisible(); layer.SetVisible(!visibility); }

Page 16: AutoCAD Map 3D 2013 API - adndevblog.typepad.com · in AutoCAD Map . Title: AutoCAD Map 3D 2013 API Author: Partha Sarkar Subject: AutoCAD Map 3D 2013 API Created Date: 2/22/2013

© 2012 Autodesk

Geometry

Contains geometric object

types and operations to

manipulate them

Supports

spatial comparisons

between objects

creation of new objects

based on the

intersection, difference,

or union of existing

objects

creation of buffers

around objects

MgMultiPolygon

MgPoint

MgLineString

MgPolygon

MgCurveString

MgCurvePolygon

MgMultiPoint

MgMultiLineString

MgMultiCurveString

MgMultiCurvePolygon

MgMultiGeometry

Page 17: AutoCAD Map 3D 2013 API - adndevblog.typepad.com · in AutoCAD Map . Title: AutoCAD Map 3D 2013 API Author: Partha Sarkar Subject: AutoCAD Map 3D 2013 API Created Date: 2/22/2013

© 2012 Autodesk

Coordinate Systems

MgCoordinateSystem

MgCoordinateSystemType

MgCoordinateSystemTransform

MgCoordinateSystemMeasure

MgCoordinateSystemFactory

Provides unified access to

coordinate system information

Enables coordinate system

transformations

Page 18: AutoCAD Map 3D 2013 API - adndevblog.typepad.com · in AutoCAD Map . Title: AutoCAD Map 3D 2013 API Author: Partha Sarkar Subject: AutoCAD Map 3D 2013 API Created Date: 2/22/2013

© 2012 Autodesk

Utility Classes

Common

The Common classes

provide a set of utility

classes

MgByte

MgByteSink

MgService

MgMimeType

MgFeatureInformation

MgByteReader

MgByteSource

MgColor

MgDateTime

MgWarning

Page 19: AutoCAD Map 3D 2013 API - adndevblog.typepad.com · in AutoCAD Map . Title: AutoCAD Map 3D 2013 API Author: Partha Sarkar Subject: AutoCAD Map 3D 2013 API Created Date: 2/22/2013

© 2012 Autodesk

Utility Classes

MgByteSource

Byte data source with a specific content type

Can be initialized from an array of bytes in memory or a file

MgByteReader Reads data from MgByteSource

MgByteSource::GetReader()

MgByteSink Used for writing MgByteReader

data to file Construct with MgByteReader and

call ToFile()

MgByteSource

MgByteReader

MgByteSink

File

byte [ ]

Other APIs

Page 20: AutoCAD Map 3D 2013 API - adndevblog.typepad.com · in AutoCAD Map . Title: AutoCAD Map 3D 2013 API Author: Partha Sarkar Subject: AutoCAD Map 3D 2013 API Created Date: 2/22/2013

© 2012 Autodesk

Utility Classes

MgService Base class for all Services

(AcMapFeatureService and

AcMapResourceService) MgService

MgResourceService

AcMapResourceService

MgFeatureService

AcMapFeatureService

Page 21: AutoCAD Map 3D 2013 API - adndevblog.typepad.com · in AutoCAD Map . Title: AutoCAD Map 3D 2013 API Author: Partha Sarkar Subject: AutoCAD Map 3D 2013 API Created Date: 2/22/2013

© 2012 Autodesk

Utility Classes

Collections Container for a set

of objects of the

same type

MgCollection

MgStringCollection

MgPolygonCollection

MgLineStringCollection

MgCoordinateCollection

MgGeometryCollection

MgIntCollection

MgPointCollection

MgPropertyCollection

MgLinerRingCollection

MgCurveRingCollection

MgFeatureSchemaCollection

Page 22: AutoCAD Map 3D 2013 API - adndevblog.typepad.com · in AutoCAD Map . Title: AutoCAD Map 3D 2013 API Author: Partha Sarkar Subject: AutoCAD Map 3D 2013 API Created Date: 2/22/2013

© 2012 Autodesk

Utility Classes

Exceptions A set of classes

representing all

possible exceptions

that can be generated

by the application.

100+ classes

MgFileNotFoundException

MgGeometryException

MgInvalidCoordinate-

SystemException

MgFileIoException

MgFdoException

MgOutOfMemoryException

MgClassNotFoundException MgInvalidCastException

MgResourcesException MgOverflowException

Page 23: AutoCAD Map 3D 2013 API - adndevblog.typepad.com · in AutoCAD Map . Title: AutoCAD Map 3D 2013 API Author: Partha Sarkar Subject: AutoCAD Map 3D 2013 API Created Date: 2/22/2013

© 2012 Autodesk

Benefits of the Geospatial Platform API

Programming against features without worrying about any

AcDb constructs

Highly scalable way of working with features Build common code for Geoprocessing tools (like buffer) that

can be shared between Map and MapGuide

Directly access data in various data sources

Added data access and functionality enhancements through

Open Source community

Page 24: AutoCAD Map 3D 2013 API - adndevblog.typepad.com · in AutoCAD Map . Title: AutoCAD Map 3D 2013 API Author: Partha Sarkar Subject: AutoCAD Map 3D 2013 API Created Date: 2/22/2013

© 2012 Autodesk

AIMS / MGE and Map 3D Geospatial Platform

APIs - Differences

No DrawingSource, LoadProcedure, MapDefinition,

PrintLayout, SymbolSet, or WebLayout resources

Use AcMapServiceFactory.GetService() to create service in

AutoCAD Map Resources are stored in DWG in AutoCAD Map

No session repository in Map, only Library://

No resource headers in Map

Methods relating to the unimplemented resources (above) are not

in AutoCAD Map