\n";
if ($this->name != "") $temp .= $offset." ".htmlspecialchars($this->name)."\n";
if ($this->title != "") $temp .= $offset."
".htmlspecialchars($this->title)."\n";
if ($this->legendgraphic != "") $temp .= $this->legendgraphic->generateXml($offset." ");
if ($this->filter != "") $temp .= $offset." ".$this->filter."\n";
if ($this->minscaledenominator != "") $temp .= $offset." ".htmlspecialchars($this->minscaledenominator)."\n";
if ($this->maxscaledenominator != "") $temp .= $offset." ".htmlspecialchars($this->maxscaledenominator)."\n";
foreach($this->symbolizers as $symbolizer)
{
$temp .= $symbolizer->generateXml($offset." ");
}
$temp .= $offset."\n";
return $temp;
}
/**
* creates the html-form-fragment for this object
*
* @param $id string containing a prefix that should be used to identify this
* object's html fields. This must be done, so that the generateObjectFromPost(...)
* function can address the fields belonging to this object in the http-post.
*
* @param string $offset string used for formatting the output
* @return string containing the html-form-fragment
*/
function generateHtmlForm($id, $offset = "")
{
$temp = "";
$temp .= $offset."\n";
//Table in the first cell for the attributes of this rule
###### -----------> Fenster Rule Eigenschaften
$temp .= $offset." \n";
//End Table in first cell
$temp .= $offset." | \n";
$temp .= $offset."\n";
$temp .= $offset."-\n";
$temp .= $offset." | \n";
$temp .= $offset."\n";
//Second cell for the symbolizers and the legendgraphic
// Table1 in second cell
$temp .= $offset."\n";
$temp .= $offset."\n";
########### -----------> LEGENDGRAPHIC
if ($this->legendgraphic != "")
{
$temp .= $offset."\n";
$temp .= $this->legendgraphic->generateHtmlForm($id."_legendgraphic", $offset." ");
$temp .= $offset." | \n";
$temp .= $offset." \n";
}
else
{
$temp .= $offset."\n";
$temp .= $offset."LegendGraphic:\n";
$temp .= $offset." | \n";
$temp .= $offset."\n";
$temp .= $offset." \n";
$temp .= $offset." | \n";
$temp .= $offset."\n";
$temp .= $offset."\n";
$temp .= $offset."\n";
$temp .= $offset."id."\">\n";
$temp .= $offset." hinzufügen\n";
$temp .= $offset." | \n";
$temp .= $offset."\n";
$temp .= $offset." \n";
$temp .= $offset." | \n";
$temp .= $offset." \n";
}
$temp .= $offset." \n";
//End Table1 in second cell
$temp .= $offset." | \n";
$temp .= $offset."\n";
$temp .= $offset."\n";
$temp .= $offset."\n";
$temp .= $offset."-\n";
$temp .= $offset." | \n";
$temp .= $offset."\n";
// Table in second cell
$temp .= $offset."\n";
//End Table in second cell
$temp .= $offset." | \n";
$temp .= $offset."
\n";
return $temp;
}
/**
* populates the member fields of a new object from the data in the http-post-request
* to rebuild the object after the submission of the html-form.
*
* creates its own child objects from the post parameters and calls their
* generateObjectFromPost(...) function
*
* @param string $id string that contains a prefix for the html-form-fields
* that is common to all of the fields belonging to this object
*/
function generateObjectFromPost($id = "")
{
$this->name = $_REQUEST[$id."_name"];
$this->title = $_REQUEST[$id."_title"];
$this->filter = $_REQUEST[$id."_filter"];
$this->minscaledenominator = $_REQUEST[$id."_minscale"];
$this->maxscaledenominator = $_REQUEST[$id."_maxscale"];
if (isset($_REQUEST[$id."_legendgraphic"]))
{
$this->legendgraphic = new LegendGraphic();
$this->legendgraphic->generateObjectFromPost($id."_legendgraphic");
}
$countSymbolizers = 0;
while (isset($_REQUEST[$id."_symbolizer_".$countSymbolizers]))
{
$symbolizer = "";
if ($_REQUEST[$id."_symbolizer_".$countSymbolizers] == "linesymbolizer")
{
$symbolizer = new LineSymbolizer();
}
else if ($_REQUEST[$id."_symbolizer_".$countSymbolizers] == "polygonsymbolizer")
{
$symbolizer = new PolygonSymbolizer();
}
else if ($_REQUEST[$id."_symbolizer_".$countSymbolizers] == "pointsymbolizer")
{
$symbolizer = new PointSymbolizer();
}
else if ($_REQUEST[$id."_symbolizer_".$countSymbolizers] == "textsymbolizer")
{
$symbolizer = new TextSymbolizer();
}
else if ($_REQUEST[$id."_symbolizer_".$countSymbolizers] == "rastersymbolizer")
{
$symbolizer = new RasterSymbolizer();
}
$symbolizer->generateObjectFromPost($id."_symbolizer_".$countSymbolizers);
$this->symbolizers[] = $symbolizer;
$countSymbolizers++;
}
}
/**
* Function that adds a symbolizer to the symbolizers array.
*
* This function is called from sld_function_handler.php
*
* @param string $symbolizer string containing the type of the symbolizer that has to be added
*/
function addSymbolizer($symbolizer)
{
if ($symbolizer == "linesymbolizer")
{
$this->symbolizers[] = new LineSymbolizer();
}
else if ($symbolizer == "textsymbolizer")
{
$this->symbolizers[] = new TextSymbolizer();
}
else if ($symbolizer == "polygonsymbolizer")
{
$this->symbolizers[] = new PolygonSymbolizer();
}
else if ($symbolizer == "rastersymbolizer")
{
$this->symbolizers[] = new RasterSymbolizer();
}
else if ($symbolizer == "pointsymbolizer")
{
$this->symbolizers[] = new PointSymbolizer();
}
}
/**
* Deletes the symbolizer at the given index from the symbolizers array.
*
* This function is called from sld_function_handler.php
*
* @param int $index index of the symbolizer that should be deleted.
*/
function deleteSymbolizer($index)
{
array_splice($this->symbolizers, $index, 1);
}
}
?>