[mapguide-trac] #1175: Failed to set map name using MgMap.Open

MapGuide Open Source trac_mapguide at osgeo.org
Mon Jan 4 11:28:28 EST 2010


#1175: Failed to set map name using MgMap.Open
---------------------+------------------------------------------------------
 Reporter:  liuar    |         Owner:         
     Type:  defect   |        Status:  closed 
 Priority:  low      |     Milestone:  2.2    
Component:  General  |       Version:  2.0.2  
 Severity:  trivial  |    Resolution:  fixed  
 Keywords:           |   External_id:  1289006
---------------------+------------------------------------------------------
Changes (by brucedechant):

  * milestone:  => 2.2

Old description:

> a.Assume we have a MapDefinition called
>Library://Test/Default.MapDefinition”;[[BR]]
> b.We create the map using the following code:[[BR]]
>
> {{{
>     MgMap map = new MgMap();
>     map.Create(resourceService, new
> MgResourceIdentifier(“Library://Test/Default.MapDefinition”),
> “Default1234”);
>     map.Save();
> }}}
>
> c.In other code, we want to use this map, so we use this code:[[BR]]
>
> {{{
>     MgMap map = new MgMap();
>     map.Open(resourceService, “Default1234”);
> }}}
>
> d.Now the Name property for map in step c) is supposed to be
> “Default1234”. However, you’ll find it’s still “Default”, the name of map
> definition, not the name of map.[[BR]]
>
> If you open the code of
> “\\trunk\MgDev\Common\MapGuideCommon\MapLayer\Map.cpp”, you’ll find the
> line 504 and 505 is like this:[[BR]]
>
> {{{
>     m_name = mapName;
>     MgResource::Open(m_resourceService, resId);
> }}}
>
> However, MgResource::Open will use the name of map definition, not the
> name of map to replace the value of m_name.[[BR]]
> So we should put “m_name = mapName;” behind “MgResource::Open”.

New description:

 * Assume we have a !MapDefinition called
 “Library://Test/Default.MapDefinition”
  * We create the map using the following code:

 {{{
     MgMap map = new MgMap();
     map.Create(resourceService, new
 MgResourceIdentifier(“Library://Test/Default.MapDefinition”),
 “Default1234”);
     map.Save();
 }}}

  * In other code, we want to use this map, so we use this code:

 {{{
     MgMap map = new MgMap();
     map.Open(resourceService, “Default1234”);
 }}}

  * Now the Name property for map in step c) is supposed to be
 “Default1234”. However, you’ll find it’s still “Default”, the name of map
 definition, not the name of map.

 If you open the code of
 “\\trunk\!MgDev\Common\!MapGuideCommon\!MapLayer\Map.cpp”, you’ll find the
 line 504 and 505 is like this:

 {{{
     m_name = mapName;
     MgResource::Open(m_resourceService, resId);
 }}}

 However, MgResource::Open() will use the name of map definition, not the
 name of map to replace the value of m_name.
 So we should put “m_name = mapName;” behind “MgResource::Open()”.

Comment:

 Fixed in trunk. Submission r4461

-- 
Ticket URL: <https://trac.osgeo.org/mapguide/ticket/1175#comment:4>
MapGuide Open Source <http://mapguide.osgeo.org/>
MapGuide Open Source Internals


More information about the mapguide-trac mailing list