[mapguide-users] Re: create redline line and polygon using king fdo and MGOS

djonio DJonio at miami-airport.com
Wed May 26 14:59:28 EDT 2010


Ok, you want code here is some code. This should give you start. Obviously
you have to change to your maps/layer values.

SCRIBBLESESSION_LAYERNAME = "SCRIBBLESESSION";
SCRIBBLESESSION_TABLENAME = "SCRIBBLESESSION";
SCRIBBLESESSION_CLASS = "GISMIA~SCRIBBLESESSION~GEOMETRY";
SCRIBBLESESSION_ID is the unique key column on the table.
I have set up SCRIBBLESESSION_FDOSEQ sequence so KingOra uses that for the
key value for the insert.

_mapname and _site are globals and are as their names imply and are used.
Given the property collection this will do the insert and return back the
“key” of the record that was just inserted.


   private int InsertScribbleFeatureSDO(MgPropertyCollection
propertyValuesSDO)
    {
        int key = 0;
        int rtnval = 0;
        MgResourceService resourceService =
_site.CreateService(MgServiceType.ResourceService) as MgResourceService;
        MgMap map = new MgMap();
        map.Open(resourceService, _mapname);
        MgLayerBase scribblesessionLayer =
map.GetLayers().GetItem(SCRIBBLESESSION_LAYERNAME) as MgLayer;
        MgFeatureService featureService =
(MgFeatureService)_site.CreateService(MgServiceType.FeatureService);
        MgResourceIdentifier featureSourceId = new
MgResourceIdentifier(scribblesessionLayer.FeatureSourceId);
        MgFeatureCommandCollection commands = new
MgFeatureCommandCollection();
        commands.Add(new MgInsertFeatures(SCRIBBLESESSION_CLASS,
propertyValuesSDO));
        MgPropertyCollection done_it = 
featureService.UpdateFeatures(featureSourceId, commands, false);
        if (done_it.Count == 1)
        {
            MgProperty p = done_it[0];
            if (p.PropertyType == MgPropertyType.Feature)
            {
                MgFeatureProperty fp = p as MgFeatureProperty;
                MgFeatureReader fr = fp.GetValue();
                fr.ReadNext();
                key = fr.GetInt32("SCRIBBLESESSION_ID");
                rtnval = key;
            }
        }
        return rtnval;
    }

Based upon your comment: "...king fdo or autodesk fdo for oracle." you are
still confused. IMHO drop any thought of autodesk fdo for oracle focus on
kingora.

r,
dennis 
-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/create-redline-line-and-polygon-using-king-fdo-and-MGOS-tp5039612p5105216.html
Sent from the MapGuide Users mailing list archive at Nabble.com.


More information about the mapguide-users mailing list