Recovering an ILayer or ILayerProperties from an INode

To get an ILayer pointer from an object you can call the method ReferenceMaker::GetReference() method on an INode object passing the value NODE_LAYER_REF.

ILayer* GetLayerFromNode(INode* node)
{
   return (ILayer*)node->GetReference(NODE_LAYER_REF);
}

You can then get a pointer to ILayerProperties from an ILayer by calling ILayer::GetInterface() with an interface id value of LAYERPROPERTIES_INTERFACE.

ILayerProperties* GetLayerPropertiesFromNode(INode* node)
{
   ILayer* layer = GetLayerFromNode(node);
   return layer->GetInterface(LAYERPROPERTIES_INTERFACE);
}