Select to view content in your preferred language

Cut Polygon

849
1
11-24-2010 10:04 AM
shravanshravan
Emerging Contributor
for the cut polygon snippet, i used "base tool" &  in the base tool, we have a class by name "class1" where  i pasted the snippet. could you please tell me in order to access this tool how the declaration has to be done and where it has to be done - whether onclick(), onmousedown();...
public override void OnClick()
        {
           
             
            // TODO: Add cut1.OnClick implementation
        }

        public override void OnMouseDown(int Button, int Shift, int X, int Y)
        {
            // TODO:  Add cut1.OnMouseDown implementation
        }

        public override void OnMouseMove(int Button, int Shift, int X, int Y)
        {
            // TODO:  Add cut1.OnMouseMove implementation
        }

        public override void OnMouseUp(int Button, int Shift, int X, int Y)
        {
            // TODO:  Add cut1.OnMouseUp implementation
        }






#region "Cut Polygon"

///<summary>Use a polyline to cut a polygon.</summary>
/// 
///<param name="polygon">An IPolygon interface that is the polygon to be split.</param>
///<param name="polyline">An IPolyline interface that is used to cut the input polygon.</param>
///  
///<returns>An IGeometryCollection with polygons resulting from the split.</returns>
///  
///<remarks></remarks>
public IGeometryCollection CutPolygon(IPolygon polygon, IPolyline polyline)
{
  if(polygon == null || polyline == null)
  {
    return null;
  }
  ITopologicalOperator4 topologicalOperator4 = polygon as ITopologicalOperator4; // Dynamic Cast
  IGeometryCollection geometryCollection = topologicalOperator4.Cut2(polyline);

  return geometryCollection;
}
#endregion
0 Kudos
1 Reply
Venkata_RaoTammineni
Regular Contributor
hi,

You have to use onmousedown event for basetool.


Thanks and Regards,

Venkat Tammineni
0 Kudos