[fusion-commits] r2296 - in trunk/widgets/Theme: classes templates

svn_fusion at osgeo.org svn_fusion at osgeo.org
Mon Dec 6 05:01:58 EST 2010


Author: liuar
Date: 2010-12-06 02:01:58 -0800 (Mon, 06 Dec 2010)
New Revision: 2296

Added:
   trunk/widgets/Theme/templates/arearuletemplate-2.3.0-Enhanced.xml
   trunk/widgets/Theme/templates/arearuletemplate-2.3.0.xml
Modified:
   trunk/widgets/Theme/classes/theme.php
Log:
Ticket #421
MapGuide upgraded LayerDefinition schema from 1.3.0 to 2.3.0.
So, the theme widget need to be enhanced to support the latest version of layer definition. 

The new layer definition could be found at  http://trac.osgeo.org/mapguide/browser/trunk/MgDev/Common/Schema/LayerDefinition-2.3.0.xsd


Modified: trunk/widgets/Theme/classes/theme.php
===================================================================
--- trunk/widgets/Theme/classes/theme.php	2010-12-06 09:17:57 UTC (rev 2295)
+++ trunk/widgets/Theme/classes/theme.php	2010-12-06 10:01:58 UTC (rev 2296)
@@ -257,22 +257,51 @@
         $areaTypeStyle = $vectorScaleRangecElement->getElementsByTagName('AreaTypeStyle')->item(0);
         
         // Remove any existing <AreaRule> elements.
+        if($areaTypeStyle != null)
+        {
+            $areaRuleList = $areaTypeStyle->getElementsByTagName('AreaRule');
+            $ruleCount = $areaRuleList->length;
+            for($index = 0; $index < $ruleCount; $index++)
+            {
+                $areaTypeStyle->removeChild($areaRuleList->item(0));
+            }
 
-        $areaRuleList = $areaTypeStyle->getElementsByTagName('AreaRule');
-        $ruleCount = $areaRuleList->length;
-        for($index = 0; $index < $ruleCount; $index++)
-        {
-            $areaTypeStyle->removeChild($areaRuleList->item(0));
+            $hasChild = $areaTypeStyle->hasChildNodes();
+            if($hasChild)
+            {
+              $element = $areaTypeStyle->childNodes->item(0);
+            }
         }
 
-        $hasChild = $areaTypeStyle->hasChildNodes();
-        if($hasChild)
+        $CompositeTypeStyles = $vectorScaleRangecElement->getElementsByTagName('CompositeTypeStyle');
+        
+        // Remove any existing <CompositeTypeStyle> elements with Polygon <GeometryContext>.
+        if($CompositeTypeStyles != null)
         {
-          $element = $areaTypeStyle->childNodes->item(0);
+            $template = 'templates/arearuletemplate-'.$version.'-Enhanced.xml';
+            $styleCount = $CompositeTypeStyles->length;
+            for($index = 0; $index < $styleCount; $index++)
+            {
+
+                $CompositeTypeStyle = $CompositeTypeStyles->item($index);
+                $GeometryContexts = $CompositeTypeStyle->getElementsByTagName('GeometryContext');
+                $contextCount = $GeometryContexts->length;
+
+                for($i = 0; $i < $contextCount; $i++)
+                {
+                    $GeometryContext = $GeometryContexts->item($i);
+                    if($GeometryContext->nodeValue == 'Polygon')
+                    {
+                        $vectorScaleRangecElement->removeChild($CompositeTypeStyle);
+                        $index--;
+                        $styleCount--;
+                        break;
+                    }
+                }
+            }
         }
 
-        // Now create the new <AreaRule> elements.
-
+        // Now create the new <AreaRule> or <CompositeTypeStyle> elements.
         $areaRuleTemplate = file_get_contents($template);
         $aggregateOptions = new MgFeatureAggregateOptions();
 
@@ -316,13 +345,22 @@
 
                 $areaDoc = DOMDocument::loadXML($areaRuleXML);
                 $areaNode = $doc->importNode($areaDoc->documentElement, true);
-                if($hasChild)
+                if($areaTypeStyle != null)
                 {
-                  $areaTypeStyle->insertBefore($areaNode, $element);
+                    if($hasChild)
+                    {
+                      $areaTypeStyle->insertBefore($areaNode, $element);
+                    }
+                    else
+                    {
+                      $areaTypeStyle->appendChild($areaNode);
+                    }
                 }
-                else
+                if($CompositeTypeStyles != null)
                 {
-                  $areaTypeStyle->appendChild($areaNode);
+                    $compositeTypeStyle = $doc->createElement('CompositeTypeStyle');
+                    $compositeTypeStyle->appendChild($areaNode);
+                    $vectorScaleRangecElement->appendChild($compositeTypeStyle);
                 }
 
                 $portion += $increment;
@@ -361,13 +399,22 @@
 
                 $areaDoc = DOMDocument::loadXML($areaRuleXML);
                 $areaNode = $doc->importNode($areaDoc->documentElement, true);
-                if($hasChild)
+                if($areaTypeStyle != null)
                 {
-                   $areaTypeStyle->insertBefore($areaNode, $element);
+                    if($hasChild)
+                    {
+                      $areaTypeStyle->insertBefore($areaNode, $element);
+                    }
+                    else
+                    {
+                      $areaTypeStyle->appendChild($areaNode);
+                    }
                 }
-                else
+                if($CompositeTypeStyles != null)
                 {
-                   $areaTypeStyle->appendChild($areaNode);
+                    $compositeTypeStyle = $doc->createElement('CompositeTypeStyle');
+                    $compositeTypeStyle->appendChild($areaNode);
+                    $vectorScaleRangecElement->appendChild($compositeTypeStyle);
                 }
 
                 $portion += $increment;

Added: trunk/widgets/Theme/templates/arearuletemplate-2.3.0-Enhanced.xml
===================================================================
--- trunk/widgets/Theme/templates/arearuletemplate-2.3.0-Enhanced.xml	                        (rev 0)
+++ trunk/widgets/Theme/templates/arearuletemplate-2.3.0-Enhanced.xml	2010-12-06 10:01:58 UTC (rev 2296)
@@ -0,0 +1,85 @@
+<CompositeRule>
+  <LegendLabel>%s</LegendLabel>
+  <Filter>%s</Filter>
+  <CompositeSymbolization>
+    <SymbolInstance>
+      <SimpleSymbolDefinition>
+        <Name>Solid Fill</Name>
+        <Description>Default Area Symbol</Description>
+        <Graphics>
+          <Path>
+            <Geometry>M 0.0,0.0 h 100.0 v 100.0 h -100.0 z</Geometry>
+            <FillColor>%s</FillColor>
+          </Path>
+        </Graphics>
+        <AreaUsage>
+          <RepeatX>100.0</RepeatX>
+          <RepeatY>100.0</RepeatY>
+        </AreaUsage>
+        <ParameterDefinition>
+          <Parameter>
+            <Identifier>FILLCOLOR</Identifier>
+            <DefaultValue>0xffbfbfbf</DefaultValue>
+            <DisplayName>&amp;Fill Color</DisplayName>
+            <Description>Fill Color</Description>
+            <DataType>FillColor</DataType>
+          </Parameter>
+        </ParameterDefinition>
+      </SimpleSymbolDefinition>
+      <ParameterOverrides>
+        <Override>
+          <SymbolName>Solid Fill</SymbolName>
+          <ParameterIdentifier>FILLCOLOR</ParameterIdentifier>
+          <ParameterValue>0xffbfbfbf</ParameterValue>
+        </Override>
+      </ParameterOverrides>
+      <GeometryContext>Polygon</GeometryContext>
+    </SymbolInstance>
+    <SymbolInstance>
+      <SimpleSymbolDefinition>
+        <Name>Solid Line</Name>
+        <Description>Default Line Symbol</Description>
+        <Graphics>
+          <Path>
+            <Geometry>M 0.0,0.0 L 1.0,0.0</Geometry>
+            <LineColor>%s</LineColor>
+            <LineWeight>0.0</LineWeight>
+            <LineWeightScalable>false</LineWeightScalable>
+          </Path>
+        </Graphics>
+        <LineUsage>
+          <Repeat>1.0</Repeat>
+        </LineUsage>
+        <ParameterDefinition>
+          <Parameter>
+            <Identifier>LINECOLOR</Identifier>
+            <DefaultValue>0xff000000</DefaultValue>
+            <DisplayName>Line &amp;Color</DisplayName>
+            <Description>Line Color</Description>
+            <DataType>LineColor</DataType>
+          </Parameter>
+          <Parameter>
+            <Identifier>LINEWEIGHT</Identifier>
+            <DefaultValue>0.0</DefaultValue>
+            <DisplayName>Line &amp;Thickness</DisplayName>
+            <Description>Line Thickness</Description>
+            <DataType>LineWeight</DataType>
+          </Parameter>
+        </ParameterDefinition>
+      </SimpleSymbolDefinition>
+      <ParameterOverrides>
+        <Override>
+          <SymbolName>Solid Line</SymbolName>
+          <ParameterIdentifier>LINECOLOR</ParameterIdentifier>
+          <ParameterValue>0xff000000</ParameterValue>
+        </Override>
+        <Override>
+          <SymbolName>Solid Line</SymbolName>
+          <ParameterIdentifier>LINEWEIGHT</ParameterIdentifier>
+          <ParameterValue>0.0</ParameterValue>
+        </Override>
+      </ParameterOverrides>
+      <GeometryContext>Polygon</GeometryContext>
+    </SymbolInstance>
+  </CompositeSymbolization>
+</CompositeRule>
\ No newline at end of file

Added: trunk/widgets/Theme/templates/arearuletemplate-2.3.0.xml
===================================================================
--- trunk/widgets/Theme/templates/arearuletemplate-2.3.0.xml	                        (rev 0)
+++ trunk/widgets/Theme/templates/arearuletemplate-2.3.0.xml	2010-12-06 10:01:58 UTC (rev 2296)
@@ -0,0 +1,18 @@
+<AreaRule>
+ <LegendLabel>%s</LegendLabel>
+ <Filter>%s</Filter>
+ <AreaSymbolization2D>
+  <Fill>
+   <FillPattern>Solid</FillPattern>
+   <ForegroundColor>%s</ForegroundColor>
+   <BackgroundColor>FF000000</BackgroundColor>
+  </Fill>
+  <Stroke>
+   <LineStyle>Solid</LineStyle>
+   <Thickness>0</Thickness>
+   <Color>%s</Color>
+   <Unit>Inches</Unit>
+   <SizeContext>DeviceUnits</SizeContext>
+  </Stroke>
+ </AreaSymbolization2D>
+</AreaRule>
\ No newline at end of file



More information about the fusion-commits mailing list