AutoCAD Map 3D API Training content : Part-2

By Partha Sarkar

This is in
continuation of my previous
post. In this post I am going to introduce you to Geospatial Platform API
"Resources" and highlight the differences in "Resources"
between AutoCAD Map 3D and Autodesk Infrastructure Map Server (AIMS) [or
MapGuide]. 

 

In the
Geospatial Platform API, resources are the files and configuration information
which are essential part of creating Layers (in Map 3D it's the FDO layers in
DisplayManager and not the AutoCAD Layers) and Maps. There are some common types of resources available in
Map 3D and AIMS; AIMS (MapGuide ) has some additional types. Map 3D And AIMS
Developer's guide has the detailed list of resources supported in Map 3D and
AIMS.

 

Resources are
stored in a resource repository. The repository is structured like a directory,
with documents, folders, and subfolders. Each resource is stored as XML and has
a unique path in the repository. The resource’s extension must match one of the
types defined in MgResourceType, but the rest of the name and the path is
arbitrary. The root’s path is Library:// and the path of a typical resource
might be Library://MyProjects/Project1/Roads.LayerDefinition 

 

AutoCAD Map
3D has a single repository named Library. This repository is contained within
the DWG file. 

AIMS uses
multiple repositories. The Library repository contains persistent, site-wide
data. There is a single Library repository for each AIMS site. There are
multiple Session repositories, each one containing data from a single AIMS
session. Session repositories are unique to an individual session and cannot be
shared. All AIMS repositories are managed on the site server. 

Some
resources are self-sufficient and do not refer to any other resources or files.
And some resources reference other resources. For example, layers and feature
sources are stored as separate resources. A layer resource refers to the
resources for the feature sources that are used in that layer.

Resource
Service enables us to manipulate resources in Map 3D and AIMS. Though
Geospatial Platform API is very consistent between AutoCAD Map 3D and AIMS, but
there are some differences in the way they handle resources as AIMS need to
manage the resources in a Server-client environment. Allowable resource types
are defined as static members of the class MgResourceType.

 

 
Resources

 

Resource
Types which are common between AutoCAD Map 3D and AIMS – FeatureSource,
LayerDefinition, SymbolDefinition.

 

Following
Resources are applicable only to AIMS – ApplicationDefinition, DrawingSource,
Folder, LoadProcedure, Map, MapDefinition, PrintLayout, Selection,
SymbolLibrary, or WebLayout resources

AutoCAD Map
3D does not use resource headers. They are only used in AIMS / MapGuide to
control permissions in the site repository. In AutoCAD Map 3D, pass a NULL
parameter for methods that require a resource header, such as SetResource.

Session
repositories are not supported in AutoCAD Map 3D. All resources must be stored
in the Library repository.

We have a
nice video titled 'AutoCAD Map 3D Resource Explorer' which explains working on Map
3D resources with associated code sample. You can view
the video online
or download
it along with the visual studio project.

 

Attached PDF will help you to understand working with 'Resources' and associated APIs which you would require in
your application development using Geospatial Platform API.

 

I hope this
is useful to you!


Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading