[fusion-commits] r2469 - trunk/widgets/Redline/classes
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Mon Nov 28 04:03:35 EST 2011
Author: liuar
Date: 2011-11-28 01:03:35 -0800 (Mon, 28 Nov 2011)
New Revision: 2469
Modified:
trunk/widgets/Redline/classes/markupmanager.php
Log:
Fix ticket #494 Nothing happened with new a redline layer with duplicated name.
Generate a unique layer name while user input a duplicated layer name.
Modified: trunk/widgets/Redline/classes/markupmanager.php
===================================================================
--- trunk/widgets/Redline/classes/markupmanager.php 2011-11-23 03:12:48 UTC (rev 2468)
+++ trunk/widgets/Redline/classes/markupmanager.php 2011-11-28 09:03:35 UTC (rev 2469)
@@ -179,8 +179,25 @@
$map->Save($resourceService);
}
+ function UniqueMarkupName(&$markupName)
+ {
+ $availableMarkups = $this->GetAvailableMarkup();
+ foreach ($availableMarkups as &$availableMarkupName)
+ {
+ if($availableMarkupName == $markupName)
+ {
+ $markupName = $markupName . '_1';
+ $this->UniqueMarkupName($markupName);
+ break;
+ }
+ }
+ }
+
function CreateMarkup()
{
+ $markupName = $this->args['MARKUPNAME'];
+ $this->UniqueMarkupName($markupName);
+
$resourceService = $this->site->CreateService(MgServiceType::ResourceService);
$featureService = $this->site->CreateService(MgServiceType::FeatureService);
@@ -189,7 +206,7 @@
// Create the Markup Feature Source (SDF)
- $markupSdfResId = new MgResourceIdentifier($this->GetResourceIdPrefix() . $this->args['MARKUPNAME'] . '.FeatureSource');
+ $markupSdfResId = new MgResourceIdentifier($this->GetResourceIdPrefix() . $markupName . '.FeatureSource');
$markupSchema = MarkupSchemaFactory::CreateMarkupSchema();
$sdfParams = new MgCreateSdfParams('Default', $map->GetMapSRS(), $markupSchema);
@@ -252,7 +269,7 @@
$this->args['BORDERSIZEUNITS']); //<Unit> - Fill
$byteSource = new MgByteSource($markupLayerDefinition, strlen($markupLayerDefinition));
- $layerDefId = new MgResourceIdentifier($this->GetResourceIdPrefix() . $this->args['MARKUPNAME'] . '.LayerDefinition');
+ $layerDefId = new MgResourceIdentifier($this->GetResourceIdPrefix() . $markupName . '.LayerDefinition');
$resourceService->SetResource($layerDefId, $byteSource->GetReader(), null);
//Register markup with markup registry
More information about the fusion-commits
mailing list