[mapguide-users] Re: Client side way to get FEATID's from FDO?

tmblackflag steve.calpoly at gmail.com
Wed Nov 9 12:28:39 EST 2011


1) Yes but i'm switching it over to a one click move as recommended.
2) The feature source was created via Map 3d's schema editor with all keys
and indexes automatically created by the tool. I've verified everything is
there. Here is my complete server side code to make this happen. While it
currently is written for the arrow key move, performance wise i still see it
taking 6-8 seconds to complete with them clicking where they want it since i
still have to look up the FEATID and run an update statement in the
database. As a side note, i have a separate process that inserts lines
(completely skips use of the feature reader) and it only takes 3 seconds. 


protected void MoveLabelPoint(string mgSessionId, string mapName, string
selectionXML, string direction)
    {

        InitializeWebTier();

        MgUserInformation userInfo = new MgUserInformation(mgSessionId);
        MgSiteConnection siteConnection = new MgSiteConnection();
        siteConnection.Open(userInfo);
        
        MgResourceService resService =
(MgResourceService)siteConnection.CreateService(MgServiceType.ResourceService);
        MgFeatureService featureService =
(MgFeatureService)siteConnection.CreateService(MgServiceType.FeatureService);

        MgMap map = new MgMap();
        map.Open(resService, mapName);

        //get FEATID information for selected feature (point)
        MgSelection selection = new MgSelection(map, selectionXML);
        MgLayer layer = (MgLayer)map.GetLayers().GetItem("Markup");
        string strLayerClassName = layer.GetFeatureClassName();
        string strSelection = selection.GenerateFilter(layer,
strLayerClassName);
        MgFeatureQueryOptions nameQuery = new MgFeatureQueryOptions();
        nameQuery.SetFilter(strSelection);
        MgResourceIdentifier resID = new
MgResourceIdentifier("Library://DATA CONNECTIONS/My.FeatureSource");
        MgFeatureReader featureReader = featureService.SelectFeatures(resID,
strLayerClassName, nameQuery);
        string strFeatID;
        if (featureReader.ReadNext())
        {
            strFeatID = featureReader.GetInt64("FEATID").ToString();

            switch (direction)
            {
                case "UP":
                    DataSource.UpdateCommand = "UPDATE MYTABLE T SET
T.GEOM.SDO_POINT.Y = T.GEOM.SDO_POINT.Y + 10 WHERE FEATID=" + strFeatID;
                    break;
                case "DOWN":
                    DataSource.UpdateCommand = "UPDATE MYTABLE  T SET
T.GEOM.SDO_POINT.Y = T.GEOM.SDO_POINT.Y - 10 WHERE FEATID=" + strFeatID;
                    break;
                case "LEFT":
                    DataSource.UpdateCommand = "UPDATE MYTABLE  T SET
T.GEOM.SDO_POINT.X = T.GEOM.SDO_POINT.X - 10 WHERE FEATID=" + strFeatID;
                    break;
                case "RIGHT":
                    DataSource.UpdateCommand = "UPDATE MYTABLE  T SET
T.GEOM.SDO_POINT.X = T.GEOM.SDO_POINT.X + 10 WHERE FEATID=" + strFeatID;
                    break;
            }

            DataSource.Update();
            bodyID.Attributes.Add("Onload", "RefreshMap();");
        }
        else
        {
            Response.Write("FEATID not found in Mapguide datasource.");
        }        
    }

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Client-side-way-to-get-FEATID-s-from-FDO-tp6976596p6978710.html
Sent from the MapGuide Users mailing list archive at Nabble.com.


More information about the mapguide-users mailing list