[fusion-trac] #324: Theme widget doesn't work because layer definition schema definition

Fusion trac_fusion at osgeo.org
Thu Nov 12 03:57:45 EST 2009


#324: Theme widget doesn't work because layer definition schema definition
--------------------------+-------------------------------------------------
 Reporter:  christinebao  |         Owner:  Christine Bao
     Type:  defect        |        Status:  new          
 Priority:  P2            |     Milestone:  Future       
Component:  Widgets       |       Version:  1.1.1        
 Severity:  Major         |    Resolution:               
 Keywords:  Theme         |   External_id:  1276805      
    State:  New           |       Browser:  All          
       Os:  All           |  
--------------------------+-------------------------------------------------
Comment (by christinebao):

 '''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>.[[BR]]
 In layer1.LayerDefinition, it's:[[BR]]

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

 }}}
 [[BR]]

 And in layer2.LayerDefinition it's:[[BR]]

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

 }}}
 [[BR]]

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

 '''How this defect happens?'''[[BR]]
 The theme widget works in this way:[[BR]]
 1. Remove the existing <AreaRule>.[[BR]]
 2. Create a series of new <AreaRule> based on user's setting.[[BR]]
 3. Append the new <AreaRule> to <AreaTypeStyle>.

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

 {{{
  <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>

 }}}
 [[BR]]
 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. [[BR]]
 In scenario 2, the above problem doesn't exist, so it works.

 '''How to fix?'''[[BR]]
 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.

-- 
Ticket URL: <http://trac.osgeo.org/fusion/ticket/324#comment:1>
Fusion <http://trac.osgeo.org/fusion>
Fusion is a web-mapping application development framework for MapServer and MapGuide OS.


More information about the fusion-trac mailing list