Visual data filtering

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Visual data filtering

.dragonfly

Hello.

 

I am quite new to FDO so please be patient with me.

I have a question which could seem little silly.

 

I enclose a code snippet which I use to load data from SHP files during an opening of DWG file to which the SHP data is onnected.

 

What I need is:

If I SELECT data using a select command, I need to show this result in AutoCAD Civil 3D as well (visually).

Is there anything in FDO what I can use to do this, or is it no longer a part of FDO?

 

Thank you very much for your answer.

 

Zdenek Neustupa

 

 

public void LoadData(string featClass)

{

string name = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Name;

string myShpFileOrDirectory = name.Remove(name.LastIndexOf('\\') + 1) + "geo_2011";

 

OSGeo.FDO.IConnectionManager mConnMgr = OSGeo.FDO.ClientServices.FeatureAccessManager.GetConnectionManager();

OSGeo.FDO.Connections.IConnection mProvConn = mConnMgr.CreateConnection("OSGeo.SHP");

OSGeo.FDO.Connections.IConnectionInfo connInfo = mProvConn.ConnectionInfo;

OSGeo.FDO.Connections.IConnectionPropertyDictionary connPropDict = connInfo.ConnectionProperties;

 

connPropDict.SetProperty("DefaultFileLocation", myShpFileOrDirectory);

 

mProvConn.Open();

OSGeo.FDO.Commands.Feature.ISelect selCmd = (OSGeo.FDO.Commands.Feature.ISelect)mProvConn.CreateCommand(OSGeo.FDO.Commands.CommandType.CommandType_Select);

 

selCmd.SetFeatureClassName(featClass);

selCmd.SetFilter("CAO>45.0");

 

OSGeo.FDO.Commands.Feature.IReader myReader = selCmd.Execute();

 

while (myReader.ReadNext())

{

       // put SELECT result to data grid and show it in Win Form to user

}

 

myReader.Close();

myReader.Dispose();

mProvConn.Close();

mProvConn.Dispose();

}

 


_______________________________________________
fdo-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fdo-users
Reply | Threaded
Open this post in threaded view
|

Re: Visual data filtering

Jackie Ng
Civil3D should have the same FDO data connect functionality as AutoCAD Map3D.

So you should just be able to follow the link below to bring a SHP file into the current drawing that can be filtered and whose attribute data can be displayed in a grid with the Data Table:

http://docs.autodesk.com/CIV3D/2012/ENU/filesMUG/GUID-9E2597F9-9DA8-4825-B62D-8EB21BAD423-131.htm

This procedure requires no programming

- Jackie
Reply | Threaded
Open this post in threaded view
|

Re: Visual data filtering

.dragonfly
Thank you.

Yes I know about this functionality. But I need to do this exact thing
programmatically.
Is there any possibility?

Zdenek Neustupa


-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Jackie Ng
Sent: Thursday, March 15, 2012 1:53 PM
To: [hidden email]
Subject: [fdo-users] Re: Visual data filtering

Civil3D should have the same FDO data connect functionality as AutoCAD
Map3D.

So you should just be able to follow the link below to bring a SHP file into
the current drawing that can be filtered and whose attribute data can be
displayed in a grid with the Data Table:

http://docs.autodesk.com/CIV3D/2012/ENU/filesMUG/GUID-9E2597F9-9DA8-4825-B62
D-8EB21BAD423-131.htm

This procedure requires no programming

- Jackie

--
View this message in context:
http://osgeo-org.1560.n6.nabble.com/Visual-data-filtering-tp4620958p4621200.
html
Sent from the FDO Users mailing list archive at Nabble.com.
_______________________________________________
fdo-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fdo-users

_______________________________________________
fdo-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fdo-users
Reply | Threaded
Open this post in threaded view
|

Re: Visual data filtering

Partha P. Sarkar

Hi Zdenek,

 

FDO API will work in Civil 3D also as it's built on top of Map 3D. Try using MgFeatureQueryOptions object.

 

Try the following code snippet -

 

                AcMapMap currentMap = AcMapMap.GetCurrentMap();

                MgLayerCollection layers = currentMap.GetLayers();

                MgLayerBase layer = layers.GetItem("Roads");

                MgFeatureService fs = AcMapServiceFactory.GetService(MgServiceType.FeatureService) as MgFeatureService;

                string fsId = layer.GetFeatureSourceId();

                string className = layer.GetFeatureClassName();

                MgFeatureQueryOptions query = new MgFeatureQueryOptions();

                query.SetFilter("FeatId = 5");

                MgResourceIdentifier resId = new MgResourceIdentifier(fsId);

                MgFeatureReader featureReader = fs.SelectFeatures(resId, className, query);

 

 

Hope this helps.

 

Thanks,

Partha Sarkar

 

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Zdenek Neustupa
Sent: Thursday, March 15, 2012 7:38 PM
To: 'FDO Users Mail List'
Subject: RE: [fdo-users] Re: Visual data filtering

 

Thank you.

 

Yes I know about this functionality. But I need to do this exact thing programmatically.

Is there any possibility?

 

Zdenek Neustupa

 

 

-----Original Message-----

From: [hidden email]

[mailto:[hidden email]] On Behalf Of Jackie Ng

Sent: Thursday, March 15, 2012 1:53 PM

To: [hidden email]

Subject: [fdo-users] Re: Visual data filtering

 

Civil3D should have the same FDO data connect functionality as AutoCAD Map3D.

 

So you should just be able to follow the link below to bring a SHP file into the current drawing that can be filtered and whose attribute data can be displayed in a grid with the Data Table:

 

http://docs.autodesk.com/CIV3D/2012/ENU/filesMUG/GUID-9E2597F9-9DA8-4825-B62

D-8EB21BAD423-131.htm

 

This procedure requires no programming

 

- Jackie

 

--

View this message in context:

http://osgeo-org.1560.n6.nabble.com/Visual-data-filtering-tp4620958p4621200.

html

Sent from the FDO Users mailing list archive at Nabble.com.

_______________________________________________

fdo-users mailing list

[hidden email]

http://lists.osgeo.org/mailman/listinfo/fdo-users

 

_______________________________________________

fdo-users mailing list

[hidden email]

http://lists.osgeo.org/mailman/listinfo/fdo-users


_______________________________________________
fdo-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fdo-users
Reply | Threaded
Open this post in threaded view
|

Re: Visual data filtering

.dragonfly

Thank you very much.

 

I was using MgLayer just to set Visibility.

If I need to process the query through all layers in my map, do I have to do the same for all layers in MgLayerCollection object?

 

Thanks.

 

Zdeněk Neustupa

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Partha P. Sarkar
Sent: Thursday, March 15, 2012 4:37 PM
To: FDO Users Mail List
Subject: RE: [fdo-users] Re: Visual data filtering

 

Hi Zdenek,

 

FDO API will work in Civil 3D also as it's built on top of Map 3D. Try using MgFeatureQueryOptions object.

 

Try the following code snippet -

 

                AcMapMap currentMap = AcMapMap.GetCurrentMap();

                MgLayerCollection layers = currentMap.GetLayers();

                MgLayerBase layer = layers.GetItem("Roads");

                MgFeatureService fs = AcMapServiceFactory.GetService(MgServiceType.FeatureService) as MgFeatureService;

                string fsId = layer.GetFeatureSourceId();

                string className = layer.GetFeatureClassName();

                MgFeatureQueryOptions query = new MgFeatureQueryOptions();

                query.SetFilter("FeatId = 5");

                MgResourceIdentifier resId = new MgResourceIdentifier(fsId);

                MgFeatureReader featureReader = fs.SelectFeatures(resId, className, query);

 

 

Hope this helps.

 

Thanks,

Partha Sarkar

 

-----Original Message-----
From: [hidden email] [[hidden email]] On Behalf Of Zdenek Neustupa
Sent: Thursday, March 15, 2012 7:38 PM
To: 'FDO Users Mail List'
Subject: RE: [fdo-users] Re: Visual data filtering

 

Thank you.

 

Yes I know about this functionality. But I need to do this exact thing programmatically.

Is there any possibility?

 

Zdenek Neustupa

 

 

-----Original Message-----

From: [hidden email]

[[hidden email]] On Behalf Of Jackie Ng

Sent: Thursday, March 15, 2012 1:53 PM

To: [hidden email]

Subject: [fdo-users] Re: Visual data filtering

 

Civil3D should have the same FDO data connect functionality as AutoCAD Map3D.

 

So you should just be able to follow the link below to bring a SHP file into the current drawing that can be filtered and whose attribute data can be displayed in a grid with the Data Table:

 

http://docs.autodesk.com/CIV3D/2012/ENU/filesMUG/GUID-9E2597F9-9DA8-4825-B62

D-8EB21BAD423-131.htm

 

This procedure requires no programming

 

- Jackie

 

--

View this message in context:

http://osgeo-org.1560.n6.nabble.com/Visual-data-filtering-tp4620958p4621200.

html

Sent from the FDO Users mailing list archive at Nabble.com.

_______________________________________________

fdo-users mailing list

[hidden email]

http://lists.osgeo.org/mailman/listinfo/fdo-users

 

_______________________________________________

fdo-users mailing list

[hidden email]

http://lists.osgeo.org/mailman/listinfo/fdo-users


_______________________________________________
fdo-users mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/fdo-users