[fusion-commits] r2782 - in sandbox/redline_advanced_stylization/widgets/Redline: . classes templates

svn_fusion at osgeo.org svn_fusion at osgeo.org
Fri Sep 13 01:42:27 PDT 2013


Author: jng
Date: 2013-09-13 01:42:27 -0700 (Fri, 13 Sep 2013)
New Revision: 2782

Modified:
   sandbox/redline_advanced_stylization/widgets/Redline/classes/markupmanager.php
   sandbox/redline_advanced_stylization/widgets/Redline/editmarkupstyle.php
   sandbox/redline_advanced_stylization/widgets/Redline/templates/markuplayerdefinition_advanced.xml
Log:
#595: Support init of the edit style UI from a Redline Layer Definition using Advanced Stylization. We (ab)use the ExtendedData element to store the edit style UI settings, allowing us to restore from it if required.

Modified: sandbox/redline_advanced_stylization/widgets/Redline/classes/markupmanager.php
===================================================================
--- sandbox/redline_advanced_stylization/widgets/Redline/classes/markupmanager.php	2013-09-13 08:00:35 UTC (rev 2781)
+++ sandbox/redline_advanced_stylization/widgets/Redline/classes/markupmanager.php	2013-09-13 08:42:27 UTC (rev 2782)
@@ -164,6 +164,7 @@
 
     function GetLayerStyle($layerDef)
     {
+        $basic = (strcmp($this->args["REDLINESTYLIZATION"], "BASIC") == 0);
         $style = new LayerStyle();
         $resId = new MgResourceIdentifier($layerDef);
         $resourceService = $this->site->CreateService(MgServiceType::ResourceService);
@@ -171,84 +172,170 @@
 
         $doc = new DOMDocument();
         $doc->loadXML($br->ToString());
-        $vsr = $doc->getElementsByTagName("VectorScaleRange")->item(0);
+        
+        if ($basic) {
+            $vsr = $doc->getElementsByTagName("VectorScaleRange")->item(0);
 
-        $pts = $vsr->getElementsByTagName("PointTypeStyle");
-        $ats = $vsr->getElementsByTagName("AreaTypeStyle");
-        $lts = $vsr->getElementsByTagName("LineTypeStyle");
+            $pts = $vsr->getElementsByTagName("PointTypeStyle");
+            $ats = $vsr->getElementsByTagName("AreaTypeStyle");
+            $lts = $vsr->getElementsByTagName("LineTypeStyle");
 
-        if ($pts->length > 0) {
-            $pr = $pts->item(0);
-            $prLabel = $pr->getElementsByTagName("Label")->item(0);
-            $prMark = $pr->getElementsByTagName("PointSymbolization2D")->item(0)->getElementsByTagName("Mark")->item(0);
+            if ($pts->length > 0) {
+                $pr = $pts->item(0);
+                $prLabel = $pr->getElementsByTagName("Label")->item(0);
+                $prMark = $pr->getElementsByTagName("PointSymbolization2D")->item(0)->getElementsByTagName("Mark")->item(0);
 
-            $style->LABEL_SIZE_UNITS = $prLabel->getElementsByTagName("Unit")->item(0)->nodeValue;
-            $style->LABEL_FONT_SIZE = $prLabel->getElementsByTagName("SizeX")->item(0)->nodeValue;
-            $style->LABEL_FORE_COLOR = $this->StripAlphaFromColorString($prLabel->getElementsByTagName("ForegroundColor")->item(0)->nodeValue);
-            $style->LABEL_BACK_COLOR = $this->StripAlphaFromColorString($prLabel->getElementsByTagName("BackgroundColor")->item(0)->nodeValue);
-            $style->LABEL_BACK_STYLE = $prLabel->getElementsByTagName("BackgroundStyle")->item(0)->nodeValue;
-            $style->LABEL_BOLD = $prLabel->getElementsByTagName("Bold")->item(0)->nodeValue;
-            $style->LABEL_ITALIC = $prLabel->getElementsByTagName("Italic")->item(0)->nodeValue;
-            $style->LABEL_UNDERLINE = $prLabel->getElementsByTagName("Underlined")->item(0)->nodeValue;
+                $style->LABEL_SIZE_UNITS = $prLabel->getElementsByTagName("Unit")->item(0)->nodeValue;
+                $style->LABEL_FONT_SIZE = $prLabel->getElementsByTagName("SizeX")->item(0)->nodeValue;
+                $style->LABEL_FORE_COLOR = $this->StripAlphaFromColorString($prLabel->getElementsByTagName("ForegroundColor")->item(0)->nodeValue);
+                $style->LABEL_BACK_COLOR = $this->StripAlphaFromColorString($prLabel->getElementsByTagName("BackgroundColor")->item(0)->nodeValue);
+                $style->LABEL_BACK_STYLE = $prLabel->getElementsByTagName("BackgroundStyle")->item(0)->nodeValue;
+                $style->LABEL_BOLD = $prLabel->getElementsByTagName("Bold")->item(0)->nodeValue;
+                $style->LABEL_ITALIC = $prLabel->getElementsByTagName("Italic")->item(0)->nodeValue;
+                $style->LABEL_UNDERLINE = $prLabel->getElementsByTagName("Underlined")->item(0)->nodeValue;
 
-            $style->MARKER_SIZE_UNITS = $prMark->getElementsByTagName("Unit")->item(0)->nodeValue;
-            $style->MARKER_SIZE = $prMark->getElementsByTagName("SizeX")->item(0)->nodeValue;
-            $style->MARKER_TYPE = $prMark->getElementsByTagName("Shape")->item(0)->nodeValue;
+                $style->MARKER_SIZE_UNITS = $prMark->getElementsByTagName("Unit")->item(0)->nodeValue;
+                $style->MARKER_SIZE = $prMark->getElementsByTagName("SizeX")->item(0)->nodeValue;
+                $style->MARKER_TYPE = $prMark->getElementsByTagName("Shape")->item(0)->nodeValue;
 
-            $style->MARKER_COLOR = $this->StripAlphaFromColorString($prMark->getElementsByTagName("ForegroundColor")->item(0)->nodeValue);
-            //$style->MARKER_COLOR = $this->StripAlphaFromColorString($prMark->item(7)->childNodes->item(2)->nodeValue);
-        }
-        if ($lts->length > 0) {
-            $lr = $lts->item(0);
-            $lrLabel = $lr->getElementsByTagName("Label")->item(0);
-            $lrSym = $lr->getElementsByTagName("LineSymbolization2D")->item(0);
+                $style->MARKER_COLOR = $this->StripAlphaFromColorString($prMark->getElementsByTagName("ForegroundColor")->item(0)->nodeValue);
+                //$style->MARKER_COLOR = $this->StripAlphaFromColorString($prMark->item(7)->childNodes->item(2)->nodeValue);
+            }
+            if ($lts->length > 0) {
+                $lr = $lts->item(0);
+                $lrLabel = $lr->getElementsByTagName("Label")->item(0);
+                $lrSym = $lr->getElementsByTagName("LineSymbolization2D")->item(0);
 
-            $style->LABEL_SIZE_UNITS = $lrLabel->getElementsByTagName("Unit")->item(0)->nodeValue;
-            $style->LABEL_FONT_SIZE = $lrLabel->getElementsByTagName("SizeX")->item(0)->nodeValue;
-            $style->LABEL_FORE_COLOR = $this->StripAlphaFromColorString($lrLabel->getElementsByTagName("ForegroundColor")->item(0)->nodeValue);
-            $style->LABEL_BACK_COLOR = $this->StripAlphaFromColorString($lrLabel->getElementsByTagName("BackgroundColor")->item(0)->nodeValue);
-            $style->LABEL_BACK_STYLE = $lrLabel->getElementsByTagName("BackgroundStyle")->item(0)->nodeValue;
+                $style->LABEL_SIZE_UNITS = $lrLabel->getElementsByTagName("Unit")->item(0)->nodeValue;
+                $style->LABEL_FONT_SIZE = $lrLabel->getElementsByTagName("SizeX")->item(0)->nodeValue;
+                $style->LABEL_FORE_COLOR = $this->StripAlphaFromColorString($lrLabel->getElementsByTagName("ForegroundColor")->item(0)->nodeValue);
+                $style->LABEL_BACK_COLOR = $this->StripAlphaFromColorString($lrLabel->getElementsByTagName("BackgroundColor")->item(0)->nodeValue);
+                $style->LABEL_BACK_STYLE = $lrLabel->getElementsByTagName("BackgroundStyle")->item(0)->nodeValue;
 
-            if ($pts->length == 0) {
-                $style->LABEL_BOLD = $lrLabel->getElementsByTagName("Bold")->item(0)->nodeValue;
-                $style->LABEL_ITALIC = $lrLabel->getElementsByTagName("Italic")->item(0)->nodeValue;
-                $style->LABEL_UNDERLINE = $lrLabel->getElementsByTagName("Underlined")->item(0)->nodeValue;
+                if ($pts->length == 0) {
+                    $style->LABEL_BOLD = $lrLabel->getElementsByTagName("Bold")->item(0)->nodeValue;
+                    $style->LABEL_ITALIC = $lrLabel->getElementsByTagName("Italic")->item(0)->nodeValue;
+                    $style->LABEL_UNDERLINE = $lrLabel->getElementsByTagName("Underlined")->item(0)->nodeValue;
+                }
+
+                $style->LINE_PATTERN = $lrSym->getElementsByTagName("LineStyle")->item(0)->nodeValue;
+                $style->LINE_THICKNESS = $lrSym->getElementsByTagName("Thickness")->item(0)->nodeValue;
+                $style->LINE_COLOR = $this->StripAlphaFromColorString($lrSym->getElementsByTagName("Color")->item(0)->nodeValue);
+                $style->LINE_SIZE_UNITS = $lrSym->getElementsByTagName("Unit")->item(0)->nodeValue;
             }
+            if ($ats->length > 0) {
+                $ar = $ats->item(0);
+                $arLabel = $ar->getElementsByTagName("Label")->item(0);
+                $arSym = $ar->getElementsByTagName("AreaSymbolization2D")->item(0);
 
-            $style->LINE_PATTERN = $lrSym->getElementsByTagName("LineStyle")->item(0)->nodeValue;
-            $style->LINE_THICKNESS = $lrSym->getElementsByTagName("Thickness")->item(0)->nodeValue;
-            $style->LINE_COLOR = $this->StripAlphaFromColorString($lrSym->getElementsByTagName("Color")->item(0)->nodeValue);
-            $style->LINE_SIZE_UNITS = $lrSym->getElementsByTagName("Unit")->item(0)->nodeValue;
-        }
-        if ($ats->length > 0) {
-            $ar = $ats->item(0);
-            $arLabel = $ar->getElementsByTagName("Label")->item(0);
-            $arSym = $ar->getElementsByTagName("AreaSymbolization2D")->item(0);
+                $style->LABEL_SIZE_UNITS = $arLabel->getElementsByTagName("Unit")->item(0)->nodeValue;
+                $style->LABEL_FONT_SIZE = $arLabel->getElementsByTagName("SizeX")->item(0)->nodeValue;
+                $style->LABEL_FORE_COLOR = $this->StripAlphaFromColorString($arLabel->getElementsByTagName("ForegroundColor")->item(0)->nodeValue);
+                $style->LABEL_BACK_COLOR = $this->StripAlphaFromColorString($arLabel->getElementsByTagName("BackgroundColor")->item(0)->nodeValue);
+                $style->LABEL_BACK_STYLE = $arLabel->getElementsByTagName("BackgroundStyle")->item(0)->nodeValue;
 
-            $style->LABEL_SIZE_UNITS = $arLabel->getElementsByTagName("Unit")->item(0)->nodeValue;
-            $style->LABEL_FONT_SIZE = $arLabel->getElementsByTagName("SizeX")->item(0)->nodeValue;
-            $style->LABEL_FORE_COLOR = $this->StripAlphaFromColorString($arLabel->getElementsByTagName("ForegroundColor")->item(0)->nodeValue);
-            $style->LABEL_BACK_COLOR = $this->StripAlphaFromColorString($arLabel->getElementsByTagName("BackgroundColor")->item(0)->nodeValue);
-            $style->LABEL_BACK_STYLE = $arLabel->getElementsByTagName("BackgroundStyle")->item(0)->nodeValue;
+                if ($pts->length == 0 && $lts->length == 0)
+                {
+                    $style->LABEL_BOLD = $arLabel->getElementsByTagName("Bold")->item(0)->nodeValue;
+                    $style->LABEL_ITALIC = $arLabel->getElementsByTagName("Italic")->item(0)->nodeValue;
+                    $style->LABEL_UNDERLINE = $arLabel->getElementsByTagName("Underlined")->item(0)->nodeValue;
+                }
 
-            if ($pts->length == 0 && $lts->length == 0)
-            {
-                $style->LABEL_BOLD = $arLabel->getElementsByTagName("Bold")->item(0)->nodeValue;
-                $style->LABEL_ITALIC = $arLabel->getElementsByTagName("Italic")->item(0)->nodeValue;
-                $style->LABEL_UNDERLINE = $arLabel->getElementsByTagName("Underlined")->item(0)->nodeValue;
-            }
+                $arSymFill = $arSym->getElementsByTagName("Fill")->item(0);
+                $arSymStroke = $arSym->getElementsByTagName("Stroke")->item(0);
 
-            $arSymFill = $arSym->getElementsByTagName("Fill")->item(0);
-            $arSymStroke = $arSym->getElementsByTagName("Stroke")->item(0);
+                $style->FILL_PATTERN = $arSymFill->getElementsByTagName("FillPattern")->item(0)->nodeValue;
+                $style->FILL_FORE_COLOR = $this->StripAlphaFromColorString($arSymFill->getElementsByTagName("ForegroundColor")->item(0)->nodeValue);
+                $style->FILL_BACK_COLOR = $this->StripAlphaFromColorString($arSymFill->getElementsByTagName("BackgroundColor")->item(0)->nodeValue);
 
-            $style->FILL_PATTERN = $arSymFill->getElementsByTagName("FillPattern")->item(0)->nodeValue;
-            $style->FILL_FORE_COLOR = $this->StripAlphaFromColorString($arSymFill->getElementsByTagName("ForegroundColor")->item(0)->nodeValue);
-            $style->FILL_BACK_COLOR = $this->StripAlphaFromColorString($arSymFill->getElementsByTagName("BackgroundColor")->item(0)->nodeValue);
-
-            $style->BORDER_PATTERN = $arSymStroke->getElementsByTagName("LineStyle")->item(0)->nodeValue;
-            $style->BORDER_THICKNESS = $arSymStroke->getElementsByTagName("Thickness")->item(0)->nodeValue;
-            $style->BORDER_COLOR = $this->StripAlphaFromColorString($arSymStroke->getElementsByTagName("Color")->item(0)->nodeValue);
-            $style->BORDER_SIZE_UNITS = $arSymStroke->getElementsByTagName("Unit")->item(0)->nodeValue;
+                $style->BORDER_PATTERN = $arSymStroke->getElementsByTagName("LineStyle")->item(0)->nodeValue;
+                $style->BORDER_THICKNESS = $arSymStroke->getElementsByTagName("Thickness")->item(0)->nodeValue;
+                $style->BORDER_COLOR = $this->StripAlphaFromColorString($arSymStroke->getElementsByTagName("Color")->item(0)->nodeValue);
+                $style->BORDER_SIZE_UNITS = $arSymStroke->getElementsByTagName("Unit")->item(0)->nodeValue;
+            }
+        } else {
+            //Ironically, Advanced Stylization is simpler here, because as part of creating the Layer Definition we've stuffed all the relevant settings under ExtendedData for easy retrieval
+            $extData = $doc->getElementsByTagName("ExtendedData1");
+            if ($extData->length == 1) {
+                $ext = $extData->item(0);
+                $nodes = $ext->getElementsByTagName("MG_MARKER_COLOR");
+                if ($nodes->length == 1)
+                    $style->MARKER_COLOR = $nodes->item(0)->nodeValue;
+                $nodes = $ext->getElementsByTagName("MG_MARKER_TYPE");
+                if ($nodes->length == 1)
+                    $style->MARKER_TYPE = $nodes->item(0)->nodeValue;
+                $nodes = $ext->getElementsByTagName("MG_MARKER_UNITS");
+                if ($nodes->length == 1)
+                    $style->MARKER_SIZE_UNITS = $nodes->item(0)->nodeValue;
+                $nodes = $ext->getElementsByTagName("MG_MARKER_SIZE");
+                if ($nodes->length == 1)
+                    $style->MARKER_SIZE = $nodes->item(0)->nodeValue;
+                $nodes = $ext->getElementsByTagName("MG_LINE_COLOR");
+                if ($nodes->length == 1)
+                    $style->LINE_COLOR = $nodes->item(0)->nodeValue;
+                $nodes = $ext->getElementsByTagName("MG_LINE_PATTERN");
+                if ($nodes->length == 1)
+                    $style->LINE_PATTERN = $nodes->item(0)->nodeValue;
+                $nodes = $ext->getElementsByTagName("MG_LINE_UNITS");
+                if ($nodes->length == 1)
+                    $style->LINE_SIZE_UNITS = $nodes->item(0)->nodeValue;
+                $nodes = $ext->getElementsByTagName("MG_LINE_THICKNESS");
+                if ($nodes->length == 1)
+                    $style->LINE_THICKNESS = $nodes->item(0)->nodeValue;
+                $nodes = $ext->getElementsByTagName("MG_FILL_PATTERN");
+                if ($nodes->length == 1)
+                    $style->FILL_PATTERN = $nodes->item(0)->nodeValue;
+                $nodes = $ext->getElementsByTagName("MG_FILL_FORE_TRANSPARENCY");
+                if ($nodes->length == 1)
+                    $style->FILL_TRANSPARENCY = $nodes->item(0)->nodeValue;
+                $nodes = $ext->getElementsByTagName("MG_FILL_FORE_COLOR");
+                if ($nodes->length == 1)
+                    $style->FILL_FORE_COLOR = $nodes->item(0)->nodeValue;
+                $nodes = $ext->getElementsByTagName("MG_FILL_BACK_COLOR");
+                if ($nodes->length == 1)
+                    $style->FILL_BACK_COLOR = $nodes->item(0)->nodeValue;
+                $nodes = $ext->getElementsByTagName("MG_FILL_BACK_TRANSPARENCY");
+                if ($nodes->length == 1)
+                    $style->FILL_BACK_TRANS = $nodes->item(0)->nodeValue;
+                $nodes = $ext->getElementsByTagName("MG_BORDER_PATTERN");
+                if ($nodes->length == 1)
+                    $style->BORDER_PATTERN = $nodes->item(0)->nodeValue;
+                $nodes = $ext->getElementsByTagName("MG_BORDER_UNITS");
+                if ($nodes->length == 1)
+                    $style->BORDER_SIZE_UNITS = $nodes->item(0)->nodeValue;
+                $nodes = $ext->getElementsByTagName("MG_BORDER_COLOR");
+                if ($nodes->length == 1)
+                    $style->BORDER_COLOR = $nodes->item(0)->nodeValue;
+                $nodes = $ext->getElementsByTagName("MG_BORDER_THICKNESS");
+                if ($nodes->length == 1)
+                    $style->BORDER_THICKNESS = $nodes->item(0)->nodeValue;
+                $nodes = $ext->getElementsByTagName("MG_LABEL_FONT_UNITS");
+                if ($nodes->length == 1)
+                    $style->LABEL_SIZE_UNITS = $nodes->item(0)->nodeValue;
+                $nodes = $ext->getElementsByTagName("MG_LABEL_FONT_SIZE");
+                if ($nodes->length == 1)
+                    $style->LABEL_FONT_SIZE = $nodes->item(0)->nodeValue;
+                $nodes = $ext->getElementsByTagName("MG_BOLD");
+                if ($nodes->length == 1)
+                    $style->LABEL_BOLD = $nodes->item(0)->nodeValue;
+                $nodes = $ext->getElementsByTagName("MG_ITALIC");
+                if ($nodes->length == 1)
+                    $style->LABEL_ITALIC = $nodes->item(0)->nodeValue;
+                $nodes = $ext->getElementsByTagName("MG_UNDERLINE");
+                if ($nodes->length == 1)
+                    $style->LABEL_UNDERLINE = $nodes->item(0)->nodeValue;
+                $nodes = $ext->getElementsByTagName("MG_LABEL_FORECOLOR");
+                if ($nodes->length == 1)
+                    $style->LABEL_FORE_COLOR = $nodes->item(0)->nodeValue;
+                $nodes = $ext->getElementsByTagName("MG_LABEL_BACKCOLOR");
+                if ($nodes->length == 1)
+                    $style->LABEL_BACK_COLOR = $nodes->item(0)->nodeValue;
+                $nodes = $ext->getElementsByTagName("MG_LABEL_STYLE");
+                if ($nodes->length == 1)
+                    $style->LABEL_BACK_STYLE = $nodes->item(0)->nodeValue;
+                
+                //Ignore back style, we can't figure this out yet for advanced stylization
+            }
         }
         return $style;
     }
@@ -548,6 +635,35 @@
             $markupLayerDefinition = str_replace("#{BORDER_THICKNESS}", MarkupManager::SizeInMM($this->args['BORDERTHICKNESS'], $this->args['BORDERSIZEUNITS']), $markupLayerDefinition);
             $markupLayerDefinition = str_replace("#{BORDER_COLOR}", 'FF' . $this->args['BORDERCOLOR'], $markupLayerDefinition);
             
+            //Fill in the UI values under ExtendedData, so we can read from this element if we need to go back to Edit Style UI
+            $markupLayerDefinition = str_replace("#{MG_RESOURCE_ID}", $featureSourceId, $markupLayerDefinition);
+            $markupLayerDefinition = str_replace("#{MG_FEATURE_CLASS}", $className, $markupLayerDefinition);
+            $markupLayerDefinition = str_replace("#{MG_FILL_PATTERN}", $this->args["FILLPATTERN"], $markupLayerDefinition);
+            $markupLayerDefinition = str_replace("#{MG_BORDER_PATTERN}", $this->args["BORDERPATTERN"], $markupLayerDefinition);
+            $markupLayerDefinition = str_replace("#{MG_LINE_PATTERN}", $this->args["LINEPATTERN"], $markupLayerDefinition);
+            $markupLayerDefinition = str_replace("#{MG_LABEL_FONT_SIZE}", $this->args["LABELFONTSIZE"], $markupLayerDefinition);
+            $markupLayerDefinition = str_replace("#{MG_LABEL_FONT_UNITS}", $this->args["LABELSIZEUNITS"], $markupLayerDefinition);
+            $markupLayerDefinition = str_replace("#{MG_LABEL_FORECOLOR}", $this->args["LABELFORECOLOR"], $markupLayerDefinition);
+            $markupLayerDefinition = str_replace("#{MG_LABEL_BACKCOLOR}", $this->args["LABELBACKCOLOR"], $markupLayerDefinition);
+            $markupLayerDefinition = str_replace("#{MG_BOLD}", $bold, $markupLayerDefinition);
+            $markupLayerDefinition = str_replace("#{MG_ITALIC}", $italic, $markupLayerDefinition);
+            $markupLayerDefinition = str_replace("#{MG_UNDERLINE}", $underline, $markupLayerDefinition);
+            $markupLayerDefinition = str_replace("#{MG_MARKER_TYPE}", $this->args["MARKERTYPE"], $markupLayerDefinition);
+            $markupLayerDefinition = str_replace("#{MG_MARKER_SIZE}", $this->args["MARKERSIZE"], $markupLayerDefinition);
+            $markupLayerDefinition = str_replace("#{MG_MARKER_UNITS}", $this->args["MARKERSIZEUNITS"], $markupLayerDefinition);
+            $markupLayerDefinition = str_replace("#{MG_MARKER_COLOR}", $this->args["MARKERCOLOR"], $markupLayerDefinition);
+            $markupLayerDefinition = str_replace("#{MG_LINE_THICKNESS}", $this->args["LINETHICKNESS"], $markupLayerDefinition);
+            $markupLayerDefinition = str_replace("#{MG_LINE_UNITS}", $this->args["LINESIZEUNITS"], $markupLayerDefinition);
+            $markupLayerDefinition = str_replace("#{MG_LINE_COLOR}", $this->args["LINECOLOR"], $markupLayerDefinition);
+            $markupLayerDefinition = str_replace("#{MG_FILL_BACK_COLOR}", $this->args["FILLBACKCOLOR"], $markupLayerDefinition);
+            $markupLayerDefinition = str_replace("#{MG_FILL_FORE_COLOR}", $this->args["FILLFORECOLOR"], $markupLayerDefinition);
+            $markupLayerDefinition = str_replace("#{MG_FILL_FORE_TRANSPARENCY}", $hexFgTransparency, $markupLayerDefinition);
+            $markupLayerDefinition = str_replace("#{MG_FILL_BACK_TRANSPARENCY}", $hexBgTransparency, $markupLayerDefinition);
+            $markupLayerDefinition = str_replace("#{MG_BORDER_THICKNESS}", $this->args["BORDERTHICKNESS"], $markupLayerDefinition);
+            $markupLayerDefinition = str_replace("#{MG_BORDER_UNITS}", $this->args["BORDERSIZEUNITS"], $markupLayerDefinition);
+            $markupLayerDefinition = str_replace("#{MG_BORDER_COLOR}", $this->args["BORDERCOLOR"], $markupLayerDefinition);
+            $markupLayerDefinition = str_replace("#{MG_LABEL_STYLE}", $this->args["LABELBACKSTYLE"], $markupLayerDefinition);
+            
             //print_r($markupLayerDefinition);
         }
         return $markupLayerDefinition;

Modified: sandbox/redline_advanced_stylization/widgets/Redline/editmarkupstyle.php
===================================================================
--- sandbox/redline_advanced_stylization/widgets/Redline/editmarkupstyle.php	2013-09-13 08:00:35 UTC (rev 2781)
+++ sandbox/redline_advanced_stylization/widgets/Redline/editmarkupstyle.php	2013-09-13 08:42:27 UTC (rev 2782)
@@ -18,7 +18,7 @@
     //Get the layer style and feature source for this Layer Definition. The whole UI is initialized from the values found here
     $style = $markupManager->GetLayerStyle($args["EDITMARKUPLAYER"]);
     $editFeatureSource = $markupManager->GetFeatureSource($args["EDITMARKUPLAYER"]);
-    
+
     $errorMsg = null;
     $errorDetail = null;
     $defaultFormat = null;
@@ -227,9 +227,9 @@
         function Cancel()
         {
         <? if ($defaultFormat != null && $defaultGeomType != null) { ?>
-            window.location.href="markupmain.php?SESSION=<?= $args['SESSION']?>&MAPNAME=<?= $args['MAPNAME']?>&REDLINEFORMAT=<?= $defaultFormat ?>&REDLINEGEOMTYPE=<?= $defaultGeomType ?>";
+            window.location.href="markupmain.php?SESSION=<?= $args['SESSION']?>&MAPNAME=<?= $args['MAPNAME']?>&REDLINESTYLIZATION=<?= $args['REDLINESTYLIZATION'] ?>&REDLINEFORMAT=<?= $defaultFormat ?>&REDLINEGEOMTYPE=<?= $defaultGeomType ?>";
         <? } else { ?>
-            window.location.href="markupmain.php?SESSION=<?= $args['SESSION']?>&MAPNAME=<?= $args['MAPNAME']?>";
+            window.location.href="markupmain.php?SESSION=<?= $args['SESSION']?>&MAPNAME=<?= $args['MAPNAME']?>&REDLINESTYLIZATION=<?= $args['REDLINESTYLIZATION'] ?>";
         <? } ?>
         }
     </script>

Modified: sandbox/redline_advanced_stylization/widgets/Redline/templates/markuplayerdefinition_advanced.xml
===================================================================
--- sandbox/redline_advanced_stylization/widgets/Redline/templates/markuplayerdefinition_advanced.xml	2013-09-13 08:00:35 UTC (rev 2781)
+++ sandbox/redline_advanced_stylization/widgets/Redline/templates/markuplayerdefinition_advanced.xml	2013-09-13 08:42:27 UTC (rev 2782)
@@ -1011,5 +1011,35 @@
         </CompositeRule>
       </CompositeTypeStyle>
     </VectorScaleRange>
+    <ExtendedData1>
+      <!-- To be able to init the Edit Redline Style UI from this Layer Definition, store the style settings here -->
+      <MG_RESOURCE_ID>#{MG_RESOURCE_ID}</MG_RESOURCE_ID>
+      <MG_FEATURE_CLASS>#{MG_FEATURE_CLASS}</MG_FEATURE_CLASS>
+      <MG_FILL_PATTERN>#{MG_FILL_PATTERN}</MG_FILL_PATTERN>
+      <MG_BORDER_PATTERN>#{MG_BORDER_PATTERN}</MG_BORDER_PATTERN>
+      <MG_LINE_PATTERN>#{MG_LINE_PATTERN}</MG_LINE_PATTERN>
+      <MG_LABEL_FONT_SIZE>#{MG_LABEL_FONT_SIZE}</MG_LABEL_FONT_SIZE>
+      <MG_LABEL_FONT_UNITS>#{MG_LABEL_FONT_UNITS}</MG_LABEL_FONT_UNITS>
+      <MG_LABEL_FORECOLOR>#{MG_LABEL_FORECOLOR}</MG_LABEL_FORECOLOR>
+      <MG_LABEL_BACKCOLOR>#{MG_LABEL_BACKCOLOR}</MG_LABEL_BACKCOLOR>
+      <MG_LABEL_STYLE>#{MG_LABEL_STYLE}</MG_LABEL_STYLE>
+      <MG_BOLD>#{MG_BOLD}</MG_BOLD>
+      <MG_ITALIC>#{MG_ITALIC}</MG_ITALIC>
+      <MG_UNDERLINE>#{MG_UNDERLINE}</MG_UNDERLINE>
+      <MG_MARKER_TYPE>#{MG_MARKER_TYPE}</MG_MARKER_TYPE>
+      <MG_MARKER_SIZE>#{MG_MARKER_SIZE}</MG_MARKER_SIZE>
+      <MG_MARKER_UNITS>#{MG_MARKER_UNITS}</MG_MARKER_UNITS>
+      <MG_MARKER_COLOR>#{MG_MARKER_COLOR}</MG_MARKER_COLOR>
+      <MG_LINE_THICKNESS>#{MG_LINE_THICKNESS}</MG_LINE_THICKNESS>
+      <MG_LINE_UNITS>#{MG_LINE_UNITS}</MG_LINE_UNITS>
+      <MG_LINE_COLOR>#{MG_LINE_COLOR}</MG_LINE_COLOR>
+      <MG_FILL_BACK_COLOR>#{MG_FILL_BACK_COLOR}</MG_FILL_BACK_COLOR>
+      <MG_FILL_FORE_COLOR>#{MG_FILL_FORE_COLOR}</MG_FILL_FORE_COLOR>
+      <MG_FILL_FORE_TRANSPARENCY>#{MG_FILL_FORE_TRANSPARENCY}</MG_FILL_FORE_TRANSPARENCY>
+      <MG_FILL_BACK_TRANSPARENCY>#{MG_FILL_BACK_TRANSPARENCY}</MG_FILL_BACK_TRANSPARENCY>
+      <MG_BORDER_THICKNESS>#{MG_BORDER_THICKNESS}</MG_BORDER_THICKNESS>
+      <MG_BORDER_UNITS>#{MG_BORDER_UNITS}</MG_BORDER_UNITS>
+      <MG_BORDER_COLOR>#{MG_BORDER_COLOR}</MG_BORDER_COLOR>
+    </ExtendedData1>
   </VectorLayerDefinition>
 </LayerDefinition>



More information about the fusion-commits mailing list