Beispiel #1
0
 private function CreateAreaStyle($query, $ruleNode)
 {
     $style = new stdClass();
     $sym2DNodes = $ruleNode->getElementsByTagName("AreaSymbolization2D");
     $sym2DNode = $sym2DNodes->item(0);
     $labelNodes = $ruleNode->getElementsByTagName("Label");
     $fillNodes = $sym2DNode->getElementsByTagName("Fill");
     $strokeNodes = $sym2DNode->getElementsByTagName("Stroke");
     if ($labelNodes->length == 1) {
     }
     if ($fillNodes->length == 1) {
         $colorExpr = $fillNodes->item(0)->getElementsByTagName("ForegroundColor")->item(0)->nodeValue;
         $color = MgUtils::HtmlToRgba($colorExpr);
         if ($color === FALSE) {
             //Does not parse into a color. Assume FDO expression
             $colorAlias = "EXPR_AREA_FILL_COLOR_" . $this->areaStyleNo++;
             $query->AddComputedProperty($colorAlias, $colorExpr);
             $style->fillColor = function ($reader) use($colorAlias) {
                 $colorStr = MgUtils::GetBasicValueFromReader($reader, $colorAlias);
                 return MgUtils::HtmlToRgba($colorStr);
             };
         } else {
             $style->fillColor = function ($reader) use($color) {
                 return $color;
             };
         }
     }
     if ($strokeNodes->length == 1) {
         $style->outline = true;
         $colorExpr = $strokeNodes->item(0)->getElementsByTagName("Color")->item(0)->nodeValue;
         $color = MgUtils::HtmlToRgba($colorExpr);
         if ($color === FALSE) {
             //Does not parse into a color. Assume FDO expression
             $colorAlias = "EXPR_AREA_OUTLINE_COLOR_" . $this->areaStyleNo++;
             $query->AddComputedProperty($colorAlias, $colorExpr);
             $style->outlineColor = function ($reader) use($colorAlias) {
                 $colorStr = MgUtils::GetBasicValueFromReader($reader, $colorAlias);
                 return MgUtils::HtmlToRgba($colorStr);
             };
         } else {
             $style->outlineColor = function ($reader) use($color) {
                 return $color;
             };
         }
     }
     return $style;
 }