#pragma once /*========================================================================= medInria Copyright (c) INRIA 2013 - 2020. All rights reserved. See LICENSE.txt for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. =========================================================================*/ #include #include // For returning Polygon Points #include #include #include // For Polygon Points class vtkInriaInteractorStyleDrawPolygon : public vtkInteractorStyle { public: static vtkInriaInteractorStyleDrawPolygon *New(); vtkTypeMacro(vtkInriaInteractorStyleDrawPolygon, vtkInteractorStyle) void PrintSelf(ostream& os, vtkIndent indent); /** * Event: handle cursor entering in the window */ virtual void OnEnter(); virtual void OnLeftButtonDown(); virtual void OnLeftButtonUp(); std::vector GetPolygonPoints(); void ResetPolygon(); void SetView(medAbstractView *view); protected: vtkInriaInteractorStyleDrawPolygon(); ~vtkInriaInteractorStyleDrawPolygon(); virtual void DrawPolygon(); int StartPosition[2]; int EndPosition[2]; int On; medAbstractView *view; vtkUnsignedCharArray *PixelArray; private: vtkInriaInteractorStyleDrawPolygon(const vtkInriaInteractorStyleDrawPolygon&) = delete; void operator=(const vtkInriaInteractorStyleDrawPolygon&) = delete; template vtkVector substraction(const vtkVector &v1,const vtkVector &v2) { vtkVector ret; for (int i = 0; i < Size; ++i) ret[i] = v1[i] - v2[i]; return ret; } template A SquaredNorm(const vtkVector &v) const { A result = 0; for (int i = 0; i < Size; ++i) { result += v[i] * v[i]; } return result; } class vtkInternal; vtkInternal *Internal; };