[mapguide-users] try to update
SDFFeatureSource...my codedon'twork.
andrea tiveron - metodi srl
andrea.tiveron at e-metodi.it
Wed Apr 11 15:31:33 EDT 2007
hi Maciej,
thanks a lot of for your answer
I correct my code, like above
I hope that this is a good solution for everybody
andrea
$featureSourceId = new MgResourceIdentifier('Library:// ...........
layer.FeatureSource');
$byteReader = $resourceService->GetResourceContent($featureSourceId);
$strMapXML = $byteReader->ToString();
$insertPoint = strpos($strMapXML,'<Value>TRUE</Value>');
if ($insertPoint != 0)
{
$content = trim(substr_replace($strMapXML, '<Value>FALSE</Value>',
$insertPoint, 19));
try
{
$byteSource = new MgByteSource($content, strlen($content));
$byteSource->SetMimeType(MgMimeType::Xml);
$resourceService->SetResource($featureSourceId,
$byteSource->GetReader(), null);
$result = 'Ok1';
return $result;
}
catch (MgException $e)
{
$result = 'Ko'.$e->GetMessage();
return $result;
}
}
else
{
$result = 'Ok2';
return $result;
}
-----Original Message-----
From: mapguide-users-bounces at lists.osgeo.org
[mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Maciej
Skorczewski
Sent: Wednesday, April 11, 2007 6:48 PM
To: MapGuide Users Mail List
Subject: Re: [mapguide-users] try to update SDFFeatureSource...my
codedon'twork.
hi andrea !
some time ago i have ask about this problem.
i have make it.
check mailing list again.
http://www.nabble.com/try-to-update-SDF-FeatureSource...my-code-don%27t-work
.-tf3333895s16610.html#a9315211
ps. you should use
http://127.0.0.1:8008/mapguide/mapagent/
and add some xml files (source of it is on mailing list) search it on this
post
http://www.nabble.com/try-to-update-SDF-FeatureSource...my-code-don%27t-work
.-tf3333895s16610.html#a9315211
andrea tiveron - metodi srl napisal(a):
> I want replace ReadOnly flag to false programmatically by code but my
> code isn't correct I don't know why?
>
> here is the code:
>
> // Create a filter containing the IDs of the selected
> features on this layer
> $layerClassName = $layer->GetFeatureClassName();
> $selectionString =
> $selection->GenerateFilter($layer,
> $layerClassName);
> // Get the feature resource for the selected layer
> $layerFeatureId = $layer->GetFeatureSourceId();
> $byteReader =
> $resourceService->GetResourceContent($layerFeatureId);
> $strMapXML = $byteReader->ToString();
> $insertPoint =
strpos($strMapXML,'<Value>TRUE</Value>');
> if ($insertPoint != '')
> {
> $content = trim(substr_replace($strMapXML,
> '<Value>FALSE</Value>', $insertPoint, 19));
>
> $resourceService->SetResource($featureSourceId,
> $content, NULL);
> }
>
> andrea
--
Maciej Skórczewski
www.procad.pl
_______________________________________________
mapguide-users mailing list
mapguide-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users
More information about the mapguide-users
mailing list