MapGuide Open Source 中关于map.create() 和 map.open() 的用法

简介:



关于map.create() 和 map.open()

(一)
MgMap在创建时,利用map definition中的数据初始化。MgMap对象可能有变化(内存中的对象),但map definition 不会变(保存在repository中的一个xml文件)
When the MgMap object is created, it is initialized with data from the map
definition. As a user interacts with the map, the MgMap may change, but the
map definition does not.

Map对象保存在session repository(服务器内存)中,所以可以被所有的页面访问到。你不能把map对象保存到library repository(服务器硬盘的文件)中。由浏览器负责map对象的创建,在地图浏览器第一次被加载时,会自动在session repository中创建map对象。Map的名字就是从definition中读出来的。
The map is saved in the session repository so it is available to all pages in the
same session. You cannot save a map in the library repository.
Map creation is handled by the Viewers. When a Viewer first loads, it creates
a map in the session repository. The map name is taken from the map
definition name. For example, if a web layout references a map definition
named Sheboygan.MapDefinition, then the Viewer will create a map named
Sheboygan.Map.

(二)
但是如果你的应用程序不使用地图浏览器(这种情况还比较少,就是光调用MapGuide的地图服务,而不显示,可能是用其他的第三方的东西显示地图。我们现在经常用到的都不属于这中情况,而大多数都是上面的第一种情形。)这时候就需要自己创建map对象并自行保存到repository中。
If your application does not use a Viewer, you can create the map and store
it in the repository yourself. To do this, your page must

■ Create an MgMap object.(创建MgMap对象)
■ Initialize the MgMap object from a map definition.(map definition中初始化MgMap对象)
■ Assign a name to the MgMap object.(赋予一个名字)
■ Save the map in the session repository.(保存到repository中)

For example, the following section of code creates an MgMap object named Sheboygan.Map, based on Sheboygan.MapDefinition.
下面就是一个自行创建map对象的例子代码,php的,其他语言也都类似:
$mapDefId = new MgResourceIdentifier(
"Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition");
$map = new MgMap();
$mapName = $mapDefId->GetName();
$map->Create($resourceService, $mapDefId, $mapName);
$mapId = new MgResourceIdentifier(
"SessionsessionId//$mapName." . MgResourceType::Map);
$map->Save($resourceService, $mapId);
 
 
 
更多MapGuide相关信息可以参考
 
作者: 峻祁连
邮箱:junqilian@163.com 
出处: http://junqilian.cnblogs.com 
转载请保留此信息。





本文转自峻祁连. Moving to Cloud/Mobile博客园博客,原文链接:http://www.cnblogs.com/junqilian/archive/2008/10/18/1314174.html ,如需转载请自行联系原作者

相关文章
|
数据安全/隐私保护
基础实验5-2.3:QQ帐户的申请与登陆(map的各种用法)
基础实验5-2.3:QQ帐户的申请与登陆(map的各种用法)
239 0
|
10月前
|
JavaScript 前端开发 开发者
flat、flatmap与map的用法区别
本文介绍了 JavaScript 数组方法 `flat()`、`flatMap()` 和 `map()` 的用法及区别。`flat()` 可按指定深度递归展平数组,参数为深度,默认一层;`flatMap()` 结合了 `map()` 和 `flat()` 功能,返回一维数组,长度可能不同于原数组;而 `map()` 返回与原数组长度一致的新数组。通过多个代码示例展示了三者的功能和差异,帮助开发者更好地理解和使用这些方法。
1135 0
|
存储 C++ 容器
【C++】map、set基本用法
本文介绍了C++ STL中的`map`和`set`两种关联容器。`map`用于存储键值对,每个键唯一;而`set`存储唯一元素,不包含值。两者均基于红黑树实现,支持高效的查找、插入和删除操作。文中详细列举了它们的构造方法、迭代器、容量检查、元素修改等常用接口,并简要对比了`map`与`set`的主要差异。此外,还介绍了允许重复元素的`multiset`和`multimap`。
373 3
【C++】map、set基本用法
|
存储 C++ 容器
C++ 第九节——map/set(用法+底层原理+模拟实现)
们需要知道的是,Map和Set的底层都是红黑树。
1370 1
C++ 第九节——map/set(用法+底层原理+模拟实现)
|
Java API 容器
Java 8 的流库:Filter、Map、FlatMap 及 Optional 的概念与用法
【6月更文挑战第9天】Java 8 引入了许多强大的新特性,其中流库(Stream API)和 Optional 类极大地简化了集合操作和空值处理。本文将深入探讨 filter、map、flatMap 以及 Optional 的概念和用法,并提供示例代码来展示其实际应用。
590 4
|
存储 人工智能 C++
map容器在C++中的具体用法以及相关注意点
map容器在C++中的具体用法以及相关注意点
397 1
|
Java API
Map.entry用法详解
Map.entry用法详解
|
存储 JavaScript 前端开发
TypeScript 中的 Map 对象定义、基本操作和常见用法
TypeScript 中的 Map 对象定义、基本操作和常见用法
1504 8
|
JavaScript 前端开发 索引
【面试题】JS中的map的理解及用法
【面试题】JS中的map的理解及用法
152 0