[mapguide-users] Selection and Zoom Problem

meli-m meli-m at arcor.de
Mon Dec 4 02:35:56 EST 2006


Are you sure that the javascript is called? How?
Try by alert if the javascript just haves the right string.

greetings,



Markus Roth wrote:
> 
> Hello,
>  
> I have a problem with selections. In my .aspx  (VB) site I generate the
> selection string for the javascript. This works fine, but the feature is
> not highlighted and no properties are shown in the Properties frame!?! But
> in the statusbar the Info is shown that 1 feature is selected. I only use
> one layer that is based on sdf file.
> When I push the Button „Zoom to selection“ after one feature is selected,
> the map always zooms to coordinates X: 0.0 ; Y: 0.0!
> Has anyone an idea what is wrong?
>  
> This is a sample of a generated selection string:
> <?xml version="1.0" encoding="UTF-8"?><FeatureSet
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:noNamespaceSchemaLocation="FeatureSet-1.0.0.xsd"> <Layer
> id="e82e9c52-ffff-ffff-8000-000cf1ae97f8">  <Class
> id="SDF_2_Schema:sp_Lieg_flurstueck_F">   <ID>MTc2MQA=</ID>  </Class>
> </Layer></FeatureSet>
>  
> Here is my code:
>  
> Code from aspx.vb site:
>  
> Private Function SelectionOb(ByVal Filter As String, ByVal LayerName As
> String)
>  
>         Try
>             MapGuideApi.MgInitializeWebTier("
 Path to webconfig.ini")
>  
>             '##
>             Dim userInfo As New MgUserInformation(sessionID)
>  
>             '##
>             Dim siteConnection As New MgSiteConnection()
>             siteConnection.Open(userInfo)
>  
>             '##
>             Dim resourceService As MgResourceService =
> siteConnection.CreateService(MgServiceType.ResourceService)
>             Dim featureService As MgFeatureService =
> siteConnection.CreateService(MgServiceType.FeatureService)
>             Dim renderingService As MgRenderingService =
> siteConnection.CreateService(MgServiceType.RenderingService)
>  
>             '##
>             Dim MapDefID As New MgResourceIdentifier(mapDefinition)
>             Dim Map As New MgMap()
>             Dim mapname As String
>             mapname = MapDefID.GetName()
>             Map.Open(resourceService, mapname)
>  
>             '##
>             Dim layers As MgLayerCollection = Map.GetLayers()
>             Dim layer As MgLayer
>             Dim layername1 As String = ""
>             Dim i As Integer = 0
>             Do Until layername1 = LayerName
>                 layer = layers.GetItem(i)
>                 layername1 = layer.GetName()
>                 i += 1
>             Loop
>  
>             '##
>             Dim query As New MgFeatureQueryOptions()
>             query.SetFilter(Filter)
>             Dim featureClassName As String = layer.GetFeatureClassName()
>             Dim featureSource As MgResourceIdentifier = New
> MgResourceIdentifier(layer.GetFeatureSourceId())
>             Dim features As MgFeatureReader =
> featureService.SelectFeatures(featureSource, featureClassName, query)
>             Dim hasResult As Boolean = features.ReadNext()
>             Dim Selection As MgSelection = New MgSelection(Map)
>  
>             Select Case features.GetPropertyType("Key")
>                 Case MgPropertyType.Int32
>                     Selection.AddFeatureIdInt32(layer, featureClassName,
> features.GetInt32("Key"))
>                 Case MgPropertyType.String
>                     Selection.AddFeatureIdString(layer, featureClassName,
> features.GetString("Key"))
>             End Select
>  
>             selectiontext = Selection.ToXml()
>             TextBox1.Text = selectiontext
>             
>             layer.ForceRefresh()
>             Map.Save(resourceService)
>  
>             features.Close()
>             query = Nothing
>  
>         Catch ex As Exception
>             Label1.Text = ex.ToString
>         End Try
>     End Function
>  
>  
> The javascript:
>  
> function Select(){
> var seltext = '<%=selectiontext %>';
> parent.parent.mapFrame.SetSelectionXML(seltext);
> }
> 

-- 
View this message in context: http://www.nabble.com/Selection-and-Zoom-Problem-tf2595417.html#a7671831
Sent from the MapGuide Users mailing list archive at Nabble.com.





More information about the Mapguide_users mailing list