Opened 15 years ago

Closed 15 years ago

#324 closed defect (fixed)

Theme widget doesn't work because layer definition schema definition

Reported by: christinebao Owned by: Christine Bao
Priority: P2 Milestone: Future
Component: Widgets Version: 1.1.1
Severity: Major Keywords: Theme
Cc: Chris Claydon Browser: All
External ID: 1276805 Operating System: All
state: New

Description

Steps to reproduce:

Scenario 1:

  1. Load the attached bayarea_cities.sdf, let's name the layer as layer1.LayerDefinition.
  2. Create a map based on layer1.LayerDefinition using default setting, and create a flexible web layout based on the map using default setting. Let's name the web as web1.ApplicationDefinition.
  3. Open web1 in browser, choose Theme widget, using the default setting, and Apply.

Result: Nothing happens. The map is not themed.

Scenario 2:

  1. Load the attached bayarea_cities.sdf, let's name the layer as layer2.LayerDefinition. Make some change in layer2.LayerDefinition, for example, choose "OBJECTID" as Tooltips displayed for feature.
  2. Create a map based on layer2.LayerDefinition using default setting, and create a flexible web layout based on the map using default setting. Let's name the web as web2.ApplicationDefinition.
  3. Open web2 in browser, choose Theme widget, using the default setting, and Apply.

Result: The map is themed.

Attachments (3)

bayarea_cities.sdf (650.0 KB ) - added by christinebao 15 years ago.
Ticket#324.patch (2.4 KB ) - added by christinebao 15 years ago.
RefineTicket#324.patch (2.4 KB ) - added by christinebao 15 years ago.

Download all attachments as: .zip

Change History (7)

by christinebao, 15 years ago

Attachment: bayarea_cities.sdf added

comment:1 by christinebao, 15 years ago

Tech diagnosis:

The key point is the original layer definition. Please use MapAgent / GetResourceContent to check the layer definitioins. Please pay special attention to the element <AreaTypeStyle>.
In layer1.LayerDefinition, it's:

<AreaTypeStyle>
	<AreaRule>
		...
	</AreaRule>
	<ShowInLegend>true</ShowInLegend>
</AreaTypeStyle>


And in layer2.LayerDefinition it's:

<AreaTypeStyle>
	<AreaRule>
		...
	</AreaRule>
</AreaTypeStyle>


The difference is layer1.LayerDefinition contains additional element <ShowInLegend> besides <AreaRule>, while layer2.LayerDefinition doesn't.

How this defect happens?
The theme widget works in this way:

  1. Remove the existing <AreaRule>.
  2. Create a series of new <AreaRule> based on user's setting.
  3. Append the new <AreaRule> to <AreaTypeStyle>.

LayerDefinition-1.3.0.xsd defines <AreaTypeStyle> in this way:

 <xs:complexType name="AreaTypeStyleType">
    <xs:annotation>
      <xs:documentation>Style specification of a polygon geometry type.</xs:documentation>
    </xs:annotation>
    <xs:sequence>
      <xs:element name="AreaRule" type="AreaRuleType" maxOccurs="unbounded">
        <xs:annotation>
          <xs:documentation>Rules to define a theme.</xs:documentation>
        </xs:annotation>
      </xs:element>
      <xs:element name="ShowInLegend" type="xs:boolean" default="true" minOccurs="0"/>
      <xs:element name="ExtendedData1" type="ExtendedDataType" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>


It requires <AreaRule> must be ahead of <ShowInLegend>.

In scenario 1, because new <AreaRule> is appended to <AreaTypeStyle>, and it goes after <ShowInLegend>, an exception throws out when saving to DB XML.
In scenario 2, the above problem doesn't exist, so it works.

How to fix?
theme.php function ApplyTheme(): should decide whether <AreaTypeStyle> has additional element besides <AreaRule>. If yes, the new <AreaRule> should insert into first node. If no the new <AreaRule> should be appended.

by christinebao, 15 years ago

Attachment: Ticket#324.patch added

by christinebao, 15 years ago

Attachment: RefineTicket#324.patch added

comment:3 by christinebao, 15 years ago

Refine the patch by http://trac.osgeo.org/fusion/attachment/ticket/324/RefineTicket%23324.patch.

The new area rule should be inserted by order, otherwise the legend will be disordered.

comment:4 by christinebao, 15 years ago

Resolution: fixed
Status: newclosed

Commit the patch to fix defect.

Note: See TracTickets for help on using tickets.