Fix for low performance while generating legend

7 messages Options
Embed this post
Permalink
Arthur Liu

Fix for low performance while generating legend

Reply Threaded More More options
Print post
Permalink
Hi all,



I've fixed the issue for the low performance while generating legend(Ticket #1023<https://trac.osgeo.org/mapguide/ticket/1023>). Would you please review it at https://trac.osgeo.org/mapguide/attachment/ticket/1023/Dynamic%20Legend.patch? Thanks.



Some comments:

The original implementation is generate all legend images for layers in the legend after the map loaded at one time. This will bring some performance issue(too many http requests).
To resolve this problem, we could generate the legend on demand. Generate a legend picture only when
1. The corresponding layer is visible in current scale.
2. The legend node is visible in the legend tree. (If any parent node of a legend node is collapsed, then the legend node is invisible).

I added a new property " iconWasRequested" for LayerItem and ScaleRangeItem (used for organize theme) in legend.js.  This is a flag to mark whether the legend image has been requested or not. The default value is false.  If the item displayed in the legend, the value will be set to true.  If the  item's legend image changed but the item is in a collapsed item, then the value will be set back to false, the HTTP request to generate the legend image will be sent out while the parent node expanded.

Arthur Liu
Software Development Engineer,
ACRD AEC IM,
Autodesk(r)
Office: 86-21-38664317
Mobile: 86-138-1658-3400
Address: No 399, Pudian Road,  Pudong New District,
Shanghai, 200122 China

_______________________________________________
mapguide-internals mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/mapguide-internals
Bruno Scott

Re: Fix for low performance while generating legend

Reply Threaded More More options
Print post
Permalink
Hi Arthur
Great patch, thanks a lot for sharing it with us.
I was about to do something similar but little simpler.
Yours is more flexible.
I've tested it and it works well.

Thanks again
Bruno Scott


Arthur Liu wrote:
Hi all,



I've fixed the issue for the low performance while generating legend(Ticket #1023<https://trac.osgeo.org/mapguide/ticket/1023>). Would you please review it at https://trac.osgeo.org/mapguide/attachment/ticket/1023/Dynamic%20Legend.patch? Thanks.



Some comments:

The original implementation is generate all legend images for layers in the legend after the map loaded at one time. This will bring some performance issue(too many http requests).
To resolve this problem, we could generate the legend on demand. Generate a legend picture only when
1. The corresponding layer is visible in current scale.
2. The legend node is visible in the legend tree. (If any parent node of a legend node is collapsed, then the legend node is invisible).

I added a new property " iconWasRequested" for LayerItem and ScaleRangeItem (used for organize theme) in legend.js.  This is a flag to mark whether the legend image has been requested or not. The default value is false.  If the item displayed in the legend, the value will be set to true.  If the  item's legend image changed but the item is in a collapsed item, then the value will be set back to false, the HTTP request to generate the legend image will be sent out while the parent node expanded.

Arthur Liu
Software Development Engineer,
ACRD AEC IM,
Autodesk(r)
Office: 86-21-38664317
Mobile: 86-138-1658-3400
Address: No 399, Pudian Road,  Pudong New District,
Shanghai, 200122 China

_______________________________________________
mapguide-internals mailing list
mapguide-internals@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-internals
Bruno Scott

Re: Fix for low performance while generating legend

Reply Threaded More More options
Print post
Permalink
I have a average of 0.01 seconds for each GetLegendImage request
I have also 300 layers.
With this patch i save 3 seconds loading the map.

I really think this patch should be part of 2.1 as it is extremely simple

Bruno
Flipper

RE: Fix for low performance while generating legend

Reply Threaded More More options
Print post
Permalink
Do you have a sample site where this change can be visualized?

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Bruno Scott
Sent: Wednesday, July 15, 2009 8:00 AM
To: [hidden email]
Subject: Re: [mapguide-internals] Fix for low performance while generating
legend


I have a average of 0.01 seconds for each GetLegendImage request
I have also 300 layers.
With this patch i save 3 seconds loading the map.

I really think this patch should be part of 2.1 as it is extremely simple

Bruno
--
View this message in context:
http://n2.nabble.com/Fix-for-low-performance-while-generating-legend-tp32608
62p3263027.html
Sent from the MapGuide Internals mailing list archive at Nabble.com.
_______________________________________________
mapguide-internals mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/mapguide-internals


_______________________________________________
mapguide-internals mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/mapguide-internals
Rock Beans

Re: Fix for low performance while generating legend

Reply Threaded More More options
Print post
Permalink
In reply to this post by Arthur Liu
Does this also fix the redundant requests when parent item is unchecked?

On Tue, Jul 14, 2009 at 10:25 PM, Arthur Liu<[hidden email]> wrote:

> Hi all,
>
>
>
> I've fixed the issue for the low performance while generating legend(Ticket #1023<https://trac.osgeo.org/mapguide/ticket/1023>). Would you please review it at https://trac.osgeo.org/mapguide/attachment/ticket/1023/Dynamic%20Legend.patch? Thanks.
>
>
>
> Some comments:
>
> The original implementation is generate all legend images for layers in the legend after the map loaded at one time. This will bring some performance issue(too many http requests).
> To resolve this problem, we could generate the legend on demand. Generate a legend picture only when
> 1. The corresponding layer is visible in current scale.
> 2. The legend node is visible in the legend tree. (If any parent node of a legend node is collapsed, then the legend node is invisible).
>
> I added a new property " iconWasRequested" for LayerItem and ScaleRangeItem (used for organize theme) in legend.js.  This is a flag to mark whether the legend image has been requested or not. The default value is false.  If the item displayed in the legend, the value will be set to true.  If the  item's legend image changed but the item is in a collapsed item, then the value will be set back to false, the HTTP request to generate the legend image will be sent out while the parent node expanded.
>
> Arthur Liu
> Software Development Engineer,
> ACRD AEC IM,
> Autodesk(r)
> Office: 86-21-38664317
> Mobile: 86-138-1658-3400
> Address: No 399, Pudian Road,  Pudong New District,
> Shanghai, 200122 China
>
> _______________________________________________
> mapguide-internals mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/mapguide-internals
>
_______________________________________________
mapguide-internals mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/mapguide-internals
Arthur Liu

RE: Fix for low performance while generating legend

Reply Threaded More More options
Print post
Permalink
I am afraid not. If a parent folder is unchecked but expanded, the sub-items' legend image should displayed in the legend, right?

Regards,
Arthur

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Rock Beans
Sent: Thursday, July 16, 2009 1:37 AM
To: MapGuide Internals Mail List
Subject: Re: [mapguide-internals] Fix for low performance while generating legend

Does this also fix the redundant requests when parent item is unchecked?

On Tue, Jul 14, 2009 at 10:25 PM, Arthur Liu<[hidden email]> wrote:

> Hi all,
>
>
>
> I've fixed the issue for the low performance while generating legend(Ticket #1023<https://trac.osgeo.org/mapguide/ticket/1023>). Would you please review it at https://trac.osgeo.org/mapguide/attachment/ticket/1023/Dynamic%20Legend.patch? Thanks.
>
>
>
> Some comments:
>
> The original implementation is generate all legend images for layers in the legend after the map loaded at one time. This will bring some performance issue(too many http requests).
> To resolve this problem, we could generate the legend on demand. Generate a legend picture only when
> 1. The corresponding layer is visible in current scale.
> 2. The legend node is visible in the legend tree. (If any parent node of a legend node is collapsed, then the legend node is invisible).
>
> I added a new property " iconWasRequested" for LayerItem and ScaleRangeItem (used for organize theme) in legend.js.  This is a flag to mark whether the legend image has been requested or not. The default value is false.  If the item displayed in the legend, the value will be set to true.  If the  item's legend image changed but the item is in a collapsed item, then the value will be set back to false, the HTTP request to generate the legend image will be sent out while the parent node expanded.
>
> Arthur Liu
> Software Development Engineer,
> ACRD AEC IM,
> Autodesk(r)
> Office: 86-21-38664317
> Mobile: 86-138-1658-3400
> Address: No 399, Pudian Road,  Pudong New District,
> Shanghai, 200122 China
>
> _______________________________________________
> mapguide-internals mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/mapguide-internals
>
_______________________________________________
mapguide-internals mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/mapguide-internals
_______________________________________________
mapguide-internals mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/mapguide-internals
Rock Beans

Re: Fix for low performance while generating legend

Reply Threaded More More options
Print post
Permalink
I would agree with the icons. I think we are on separate topics. I
will try and explain better. It seems when a parent item is unchecked
and a child object is checked by user it submits a lot of information
back and forth from the server that really doesn't do anything on the
map since the parent item is unchecked.Have you noticed this?

Nice work on the patch though, long time we have waited for something
to be done on the legend. I personally can't understand why the legend
HAS to be there for the map to work. Even when you say no legend it
just makes the frame 0px but it is still there scripting away the
resources.

//The Rock




On Wed, Jul 15, 2009 at 8:29 PM, Arthur Liu<[hidden email]> wrote:

> I am afraid not. If a parent folder is unchecked but expanded, the sub-items' legend image should displayed in the legend, right?
>
> Regards,
> Arthur
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]] On Behalf Of Rock Beans
> Sent: Thursday, July 16, 2009 1:37 AM
> To: MapGuide Internals Mail List
> Subject: Re: [mapguide-internals] Fix for low performance while generating legend
>
> Does this also fix the redundant requests when parent item is unchecked?
>
> On Tue, Jul 14, 2009 at 10:25 PM, Arthur Liu<[hidden email]> wrote:
>> Hi all,
>>
>>
>>
>> I've fixed the issue for the low performance while generating legend(Ticket #1023<https://trac.osgeo.org/mapguide/ticket/1023>). Would you please review it at https://trac.osgeo.org/mapguide/attachment/ticket/1023/Dynamic%20Legend.patch? Thanks.
>>
>>
>>
>> Some comments:
>>
>> The original implementation is generate all legend images for layers in the legend after the map loaded at one time. This will bring some performance issue(too many http requests).
>> To resolve this problem, we could generate the legend on demand. Generate a legend picture only when
>> 1. The corresponding layer is visible in current scale.
>> 2. The legend node is visible in the legend tree. (If any parent node of a legend node is collapsed, then the legend node is invisible).
>>
>> I added a new property " iconWasRequested" for LayerItem and ScaleRangeItem (used for organize theme) in legend.js.  This is a flag to mark whether the legend image has been requested or not. The default value is false.  If the item displayed in the legend, the value will be set to true.  If the  item's legend image changed but the item is in a collapsed item, then the value will be set back to false, the HTTP request to generate the legend image will be sent out while the parent node expanded.
>>
>> Arthur Liu
>> Software Development Engineer,
>> ACRD AEC IM,
>> Autodesk(r)
>> Office: 86-21-38664317
>> Mobile: 86-138-1658-3400
>> Address: No 399, Pudian Road,  Pudong New District,
>> Shanghai, 200122 China
>>
>> _______________________________________________
>> mapguide-internals mailing list
>> [hidden email]
>> http://lists.osgeo.org/mailman/listinfo/mapguide-internals
>>
> _______________________________________________
> mapguide-internals mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/mapguide-internals
> _______________________________________________
> mapguide-internals mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/mapguide-internals
>
_______________________________________________
mapguide-internals mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/mapguide-internals