AnnGetPoint... example for Visual J++

Note: This topic is for Document/Medical only.

In the AnnDrawn event, this example checks to see if the annotation object is a polygon. If it is a polygon, the example gets the number of points that define the object; then it gets the arrays of X and Y coordinates and displays the points in a message box.

private void LEAD1_annDrawn(Object source, LTOCXU.LEAD.AnnDrawnEvent e)
{
   short sType = LEAD1.AnnGetType( e.hObject );
   if( sType == LTOCXU.AnnObjectConstants.ANNOBJECT_POLYGON )  // Is the object a polygon?
   {
      MessageBox.show( "Object is a Polygon" );
      int nPoints = LEAD1.AnnGetPointCount( e.hObject );  // get the number of points
      SafeArray xPoints = LEAD1.AnnGetPointX( e.hObject ).toSafeArray();  // get the X coordinates
      SafeArray yPoints = LEAD1.AnnGetPointY( e.hObject ).toSafeArray();  // get the Y coordinates

      String strMsg = "(";
      for( int a = 0 ; a < nPoints ; a++ )
         strMsg += "{" + xPoints.getInt( a ) + "," + yPoints.getInt( a ) + "}";
      strMsg += ")";
      MessageBox.show( strMsg, "The Polygon's " + nPoints + " points are:", MessageBox.OK );
   }
}