// Copyright (C) 1995 Taligent, Inc. All rights reserved. void TCanvasPolygonCreationInteractor::EndInteraction () { #ifdef DEBUG ::qprintf ("TCanvasPolygonCreationInteractor::EndInteraction\n"); #endif if ( fTarget && GetNumberOfPoints() > 2 ) { // // Create and do a new polygon component command // if ( GetNumberOfPoints() > 3 ) { // // Check if user closed the loop // TGPoint distanceVector = GetLastPoint() - GetFirstPoint(); if ( distanceVector.VectorLength() < 4 ) RemoveLastPoint (); } TGPolygon p (GetPoints()); TCanvasPolygon* thePolygon = new TCanvasPolygon (p); TAdoptCanvasGraphicCmd *command = new TAdoptCanvasGraphicCmd (thePolygon); AdoptAndDo (new TToolCommandBindingTo<MCanvasSelection> (command, fTarget.OrphanObject())); } }