LayerTableRecord pLay = (LayerTableRecord)trans.GetObject(obj, OpenMode.ForRead);CLayerInfo info = new CLayerInfo(pLay.Color, pLay.LineWeight, pLay.LinetypeObjectId);
But how to implement the below lines
CMapLayerInfo m_mapLayerInfo;
m_mapLayerInfo.SetAt( asLayers.GetAt(i), info ). If I go for deinition of CMapLayerInfo it is taking me to the another afxtempl.h file.
Can anyone tell me how to convert the above code in c#.
Please it is urgent.
There is not typically a lot of C++ conversation on this forum. This may be a good question for the crew over at http://www.theswamp.org.
That being said, however, let me take a stab at it:
It appears that the C# code would require another class comparable to “CMapLayerInfo”.
Presumably, that class has a method setup to iterate through all the layers named in asLayers and transfer to them the information stored info.
If that actually is the case then I imagine your C# class CLayerInfo should make public the variables color, lineweight, and (perhaps) objecteId. Or, if validation is an issue, provide the appropriate Get/Set procedures.
Whatever you have mentioned is absolutely correct.When I go for the definition for cMapLayerInfo it takes me into another header file which contains the following code
typedef CMap CMapLayerInfo;
If I go for CMap definition it takes me into afxtempl.h which is predefined header file.
So I cannot create class for cMapLayerInfo. Is there any other way to make use of afxtempl.h in c#
It is possible to access some of the UnManaged objects and functions from Managed code using Platform Invoke. It is bit of an arcane art so you may have some luck at the Swamp, Autodesk’s Discussions ObjectARX forum, or even on the Through the Interface blog (http://through-the-interface.typepad.com/through_the_interface/2006/07/calling_objecta.html and
http://through-the-interface.typepad.com/through_the_interface/2008/08/using-the-pinvo.html). I even have a query (towards the bottom) on that second blog listing.
Unfortunately, the return advise may not come in a timely fashion.