To be able to get the
NMapFeature for each shape, we recommend you create and assign a custom shape created listener to the map importer, which stores the
NMapFeature in the
Tag property of the created shape:
mapImporter.ShapeCreatedListener = new NCustomShapeCreatedListener();
class NCustomShapeCreatedListener : NShapeCreatedListener
{
public override bool OnPolygonCreated(NDiagramElement element, NMapFeature feature)
{
NShape shape = element as NShape;
if (shape != null)
{
shape.Tag = feature;
}
return true;
}
public override bool OnMultiPolygonCreated(NDiagramElement element, NMapFeature feature)
{
return OnPolygonCreated(element, feature);
}
}
You can then use the
Tag property of the shape in the event sink service's event handler to get the
NMapFeature the shape was created from. If in the event handler the hit node is a Model (not a shape) simply use its
ParentNode property to get its owner shape and then use the
Tag property of the shape to get the
NMapFeature it was created from.
Regarding your other question about the the EventSinkService now firing any events, please make sure that you have attached the document to a drawing view. If you have and it is still not working, please send us a sample project that demonstrates the problem. We will analyze your code and tell you how to fix it.
Best Regards,
Nevron Support Team