This follows on from this article Where did I click? (on the .NET control) and won't make much sense unless you read that one.
If you need to provide a general way for your users to find out more about chart features - then please read this.
Sometimes ENC symbols are hard for people to recognise or hold more information than is symbolised on the chart in there attributes and it can be useful to display that information on the screen - perhaps as an option off from a context menu.
The S57Draw class has a method called FeaturesAtPoint which returns a collection of the S-57/ENC features at a pixel position on the view. The follow code does a quick and dirty job of putting that information into a string and displaying it. For a really good UI you would write code depending on the feature type, take account of slave features, and so on. http://www.s-57.com is a good resource to find out about the ENC features that you find by the way.
private void OnControlMouseClick(object sender, MouseEventArgs e)
{
ENCX.PixelPoint pt = new ENCX.PixelPoint();
pt.X = (float) e.X;
pt.Y = (float) e.Y;
System.Text.StringBuilder s = new System.Text.StringBuilder();
ENCX.S57DrawnFeatures features = m_draw.FeaturesAtPoint(pt);
foreach(ENCX.S57DrawnFeature feature in features)
{
// ignore invisible things
if(!feature.Visible)
continue;
// only consider Point objects
if(m_senc.Geometry(feature.FeatureID) != ENCX.S57FeatureGeometry.FG_Point)
continue;
ENCX.IS57FeatureInfo info = m_senc.FeatureInfo(feature.FeatureID);
s.Append("Feature class: ");
s.Append(info.ObjectClass.Description);
s.Append(" (");
s.Append(info.ObjectClass.Acronym);
s.AppendLine(")");
foreach(ENCX.S57AttributeValue value in info.Attributes)
{
s.Append(value.Attribute.Name);
s.Append(" (");
s.Append(value.Attribute.Acronym);
s.Append(") = ");
s.AppendLine(value.Value);
}
s.AppendLine();
}
MessageBox.Show(s.ToString());
}
In the above code we get a collection of drawn features and from each one we get an S57FeatureIdentifier which allows us to ask the S57Manager about the feature.
We get the geometry of the feature and use this to confine ourselves to point features.
We also use the feature ID to get an S57FeatureInfo object from the S57Manager which gives us attribute values.
We could also get an S57FeaturePoint from the S57Manager (non point features have equaivalent line and area classes) this would allow you to find out the exact lat lon of the point.