Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
VTK
VTK
Commits
89d18141
Commit
89d18141
authored
Nov 03, 2005
by
Will Schroeder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ENH:Beginning merge process from Widgets-Redesign VTK branch
parent
42a385b3
Changes
116
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
116 changed files
with
22773 additions
and
0 deletions
+22773
-0
Graphics/Testing/Tcl/cursor2D.tcl
Graphics/Testing/Tcl/cursor2D.tcl
+77
-0
Graphics/vtkCursor2D.cxx
Graphics/vtkCursor2D.cxx
+352
-0
Graphics/vtkCursor2D.h
Graphics/vtkCursor2D.h
+133
-0
Rendering/Testing/Tcl/TestLeaderActor2D.tcl
Rendering/Testing/Tcl/TestLeaderActor2D.tcl
+60
-0
Rendering/vtkLeaderActor2D.cxx
Rendering/vtkLeaderActor2D.cxx
+719
-0
Rendering/vtkLeaderActor2D.h
Rendering/vtkLeaderActor2D.h
+208
-0
Widgets/Testing/Cxx/TestAffineWidget.cxx
Widgets/Testing/Cxx/TestAffineWidget.cxx
+181
-0
Widgets/Testing/Cxx/TestAngleWidget.cxx
Widgets/Testing/Cxx/TestAngleWidget.cxx
+131
-0
Widgets/Testing/Cxx/TestBorderWidget.cxx
Widgets/Testing/Cxx/TestBorderWidget.cxx
+107
-0
Widgets/Testing/Cxx/TestCameraWidget.cxx
Widgets/Testing/Cxx/TestCameraWidget.cxx
+106
-0
Widgets/Testing/Cxx/TestCaptionWidget.cxx
Widgets/Testing/Cxx/TestCaptionWidget.cxx
+112
-0
Widgets/Testing/Cxx/TestCheckerboardWidget.cxx
Widgets/Testing/Cxx/TestCheckerboardWidget.cxx
+135
-0
Widgets/Testing/Cxx/TestConstrainedHandleWidget.cxx
Widgets/Testing/Cxx/TestConstrainedHandleWidget.cxx
+156
-0
Widgets/Testing/Cxx/TestFocalPlaneContour.cxx
Widgets/Testing/Cxx/TestFocalPlaneContour.cxx
+145
-0
Widgets/Testing/Cxx/TestHandleWidget.cxx
Widgets/Testing/Cxx/TestHandleWidget.cxx
+143
-0
Widgets/Testing/Cxx/TestHandleWidget2D.cxx
Widgets/Testing/Cxx/TestHandleWidget2D.cxx
+181
-0
Widgets/Testing/Cxx/TestMeasureWidget.cxx
Widgets/Testing/Cxx/TestMeasureWidget.cxx
+207
-0
Widgets/Testing/Cxx/TestOrientedGlyphContour.cxx
Widgets/Testing/Cxx/TestOrientedGlyphContour.cxx
+161
-0
Widgets/Testing/Cxx/TestRectilinearWipeWidget.cxx
Widgets/Testing/Cxx/TestRectilinearWipeWidget.cxx
+136
-0
Widgets/Testing/Cxx/TestRotationWidget.cxx
Widgets/Testing/Cxx/TestRotationWidget.cxx
+135
-0
Widgets/Testing/Cxx/TestSeedWidget.cxx
Widgets/Testing/Cxx/TestSeedWidget.cxx
+131
-0
Widgets/Testing/Cxx/TestSeedWidget2.cxx
Widgets/Testing/Cxx/TestSeedWidget2.cxx
+150
-0
Widgets/Testing/Cxx/TestSliderWidget.cxx
Widgets/Testing/Cxx/TestSliderWidget.cxx
+178
-0
Widgets/Testing/Cxx/TestTextWidget.cxx
Widgets/Testing/Cxx/TestTextWidget.cxx
+107
-0
Widgets/Testing/Tcl/TestCameraWidget.tcl
Widgets/Testing/Tcl/TestCameraWidget.tcl
+47
-0
Widgets/Testing/Tcl/TestTextWidget.tcl
Widgets/Testing/Tcl/TestTextWidget.tcl
+48
-0
Widgets/vtkAbstractWidget.cxx
Widgets/vtkAbstractWidget.cxx
+228
-0
Widgets/vtkAbstractWidget.h
Widgets/vtkAbstractWidget.h
+119
-0
Widgets/vtkAffineRepresentation.cxx
Widgets/vtkAffineRepresentation.cxx
+54
-0
Widgets/vtkAffineRepresentation.h
Widgets/vtkAffineRepresentation.h
+98
-0
Widgets/vtkAffineRepresentation2D.cxx
Widgets/vtkAffineRepresentation2D.cxx
+1087
-0
Widgets/vtkAffineRepresentation2D.h
Widgets/vtkAffineRepresentation2D.h
+226
-0
Widgets/vtkAffineWidget.cxx
Widgets/vtkAffineWidget.cxx
+218
-0
Widgets/vtkAffineWidget.h
Widgets/vtkAffineWidget.h
+124
-0
Widgets/vtkAngleRepresentation.cxx
Widgets/vtkAngleRepresentation.cxx
+185
-0
Widgets/vtkAngleRepresentation.h
Widgets/vtkAngleRepresentation.h
+131
-0
Widgets/vtkAngleRepresentation2D.cxx
Widgets/vtkAngleRepresentation2D.cxx
+230
-0
Widgets/vtkAngleRepresentation2D.h
Widgets/vtkAngleRepresentation2D.h
+94
-0
Widgets/vtkAngleWidget.cxx
Widgets/vtkAngleWidget.cxx
+409
-0
Widgets/vtkAngleWidget.h
Widgets/vtkAngleWidget.h
+147
-0
Widgets/vtkBezierContourLineInterpolator.cxx
Widgets/vtkBezierContourLineInterpolator.cxx
+179
-0
Widgets/vtkBezierContourLineInterpolator.h
Widgets/vtkBezierContourLineInterpolator.h
+73
-0
Widgets/vtkBorderRepresentation.cxx
Widgets/vtkBorderRepresentation.cxx
+434
-0
Widgets/vtkBorderRepresentation.h
Widgets/vtkBorderRepresentation.h
+192
-0
Widgets/vtkBorderWidget.cxx
Widgets/vtkBorderWidget.cxx
+282
-0
Widgets/vtkBorderWidget.h
Widgets/vtkBorderWidget.h
+157
-0
Widgets/vtkBoundedPlanePointPlacer.cxx
Widgets/vtkBoundedPlanePointPlacer.cxx
+307
-0
Widgets/vtkBoundedPlanePointPlacer.h
Widgets/vtkBoundedPlanePointPlacer.h
+138
-0
Widgets/vtkCameraRepresentation.cxx
Widgets/vtkCameraRepresentation.cxx
+245
-0
Widgets/vtkCameraRepresentation.h
Widgets/vtkCameraRepresentation.h
+122
-0
Widgets/vtkCameraWidget.cxx
Widgets/vtkCameraWidget.cxx
+72
-0
Widgets/vtkCameraWidget.h
Widgets/vtkCameraWidget.h
+80
-0
Widgets/vtkCaptionRepresentation.cxx
Widgets/vtkCaptionRepresentation.cxx
+172
-0
Widgets/vtkCaptionRepresentation.h
Widgets/vtkCaptionRepresentation.h
+110
-0
Widgets/vtkCaptionWidget.cxx
Widgets/vtkCaptionWidget.cxx
+138
-0
Widgets/vtkCaptionWidget.h
Widgets/vtkCaptionWidget.h
+104
-0
Widgets/vtkCheckerboardRepresentation.cxx
Widgets/vtkCheckerboardRepresentation.cxx
+303
-0
Widgets/vtkCheckerboardRepresentation.h
Widgets/vtkCheckerboardRepresentation.h
+127
-0
Widgets/vtkCheckerboardWidget.cxx
Widgets/vtkCheckerboardWidget.cxx
+278
-0
Widgets/vtkCheckerboardWidget.h
Widgets/vtkCheckerboardWidget.h
+111
-0
Widgets/vtkConstrainedPointHandleRepresentation.cxx
Widgets/vtkConstrainedPointHandleRepresentation.cxx
+638
-0
Widgets/vtkConstrainedPointHandleRepresentation.h
Widgets/vtkConstrainedPointHandleRepresentation.h
+226
-0
Widgets/vtkContourLineInterpolator.cxx
Widgets/vtkContourLineInterpolator.cxx
+33
-0
Widgets/vtkContourLineInterpolator.h
Widgets/vtkContourLineInterpolator.h
+52
-0
Widgets/vtkContourRepresentation.cxx
Widgets/vtkContourRepresentation.cxx
+962
-0
Widgets/vtkContourRepresentation.h
Widgets/vtkContourRepresentation.h
+191
-0
Widgets/vtkContourWidget.cxx
Widgets/vtkContourWidget.cxx
+373
-0
Widgets/vtkContourWidget.h
Widgets/vtkContourWidget.h
+185
-0
Widgets/vtkEvent.cxx
Widgets/vtkEvent.cxx
+164
-0
Widgets/vtkEvent.h
Widgets/vtkEvent.h
+102
-0
Widgets/vtkFocalPlanePointPlacer.cxx
Widgets/vtkFocalPlanePointPlacer.cxx
+139
-0
Widgets/vtkFocalPlanePointPlacer.h
Widgets/vtkFocalPlanePointPlacer.h
+64
-0
Widgets/vtkHandleRepresentation.cxx
Widgets/vtkHandleRepresentation.cxx
+118
-0
Widgets/vtkHandleRepresentation.h
Widgets/vtkHandleRepresentation.h
+136
-0
Widgets/vtkHandleWidget.cxx
Widgets/vtkHandleWidget.cxx
+251
-0
Widgets/vtkHandleWidget.h
Widgets/vtkHandleWidget.h
+121
-0
Widgets/vtkMeasureRepresentation.cxx
Widgets/vtkMeasureRepresentation.cxx
+157
-0
Widgets/vtkMeasureRepresentation.h
Widgets/vtkMeasureRepresentation.h
+104
-0
Widgets/vtkMeasureRepresentation2D.cxx
Widgets/vtkMeasureRepresentation2D.cxx
+145
-0
Widgets/vtkMeasureRepresentation2D.h
Widgets/vtkMeasureRepresentation2D.h
+81
-0
Widgets/vtkMeasureWidget.cxx
Widgets/vtkMeasureWidget.cxx
+341
-0
Widgets/vtkMeasureWidget.h
Widgets/vtkMeasureWidget.h
+144
-0
Widgets/vtkOrientedGlyphContourRepresentation.cxx
Widgets/vtkOrientedGlyphContourRepresentation.cxx
+673
-0
Widgets/vtkOrientedGlyphContourRepresentation.h
Widgets/vtkOrientedGlyphContourRepresentation.h
+151
-0
Widgets/vtkPointHandleRepresentation2D.cxx
Widgets/vtkPointHandleRepresentation2D.cxx
+355
-0
Widgets/vtkPointHandleRepresentation2D.h
Widgets/vtkPointHandleRepresentation2D.h
+125
-0
Widgets/vtkPointHandleRepresentation3D.cxx
Widgets/vtkPointHandleRepresentation3D.cxx
+498
-0
Widgets/vtkPointHandleRepresentation3D.h
Widgets/vtkPointHandleRepresentation3D.h
+201
-0
Widgets/vtkPointPlacer.cxx
Widgets/vtkPointPlacer.cxx
+37
-0
Widgets/vtkPointPlacer.h
Widgets/vtkPointPlacer.h
+70
-0
Widgets/vtkRectilinearWipeRepresentation.cxx
Widgets/vtkRectilinearWipeRepresentation.cxx
+463
-0
Widgets/vtkRectilinearWipeRepresentation.h
Widgets/vtkRectilinearWipeRepresentation.h
+159
-0
Widgets/vtkRectilinearWipeWidget.cxx
Widgets/vtkRectilinearWipeWidget.cxx
+178
-0
Widgets/vtkRectilinearWipeWidget.h
Widgets/vtkRectilinearWipeWidget.h
+137
-0
Widgets/vtkSeedRepresentation.cxx
Widgets/vtkSeedRepresentation.cxx
+204
-0
Widgets/vtkSeedRepresentation.h
Widgets/vtkSeedRepresentation.h
+108
-0
Widgets/vtkSeedWidget.cxx
Widgets/vtkSeedWidget.cxx
+315
-0
Widgets/vtkSeedWidget.h
Widgets/vtkSeedWidget.h
+149
-0
Widgets/vtkSliderRepresentation.cxx
Widgets/vtkSliderRepresentation.cxx
+149
-0
Widgets/vtkSliderRepresentation.h
Widgets/vtkSliderRepresentation.h
+161
-0
Widgets/vtkSliderRepresentation3D.cxx
Widgets/vtkSliderRepresentation3D.cxx
+696
-0
Widgets/vtkSliderRepresentation3D.h
Widgets/vtkSliderRepresentation3D.h
+209
-0
Widgets/vtkSliderWidget.cxx
Widgets/vtkSliderWidget.cxx
+258
-0
Widgets/vtkSliderWidget.h
Widgets/vtkSliderWidget.h
+151
-0
Widgets/vtkTextRepresentation.cxx
Widgets/vtkTextRepresentation.cxx
+135
-0
Widgets/vtkTextRepresentation.h
Widgets/vtkTextRepresentation.h
+78
-0
Widgets/vtkTextWidget.cxx
Widgets/vtkTextWidget.cxx
+47
-0
Widgets/vtkTextWidget.h
Widgets/vtkTextWidget.h
+74
-0
Widgets/vtkWidgetCallbackMapper.cxx
Widgets/vtkWidgetCallbackMapper.cxx
+142
-0
Widgets/vtkWidgetCallbackMapper.h
Widgets/vtkWidgetCallbackMapper.h
+104
-0
Widgets/vtkWidgetEvent.cxx
Widgets/vtkWidgetEvent.cxx
+92
-0
Widgets/vtkWidgetEvent.h
Widgets/vtkWidgetEvent.h
+73
-0
Widgets/vtkWidgetEventTranslator.cxx
Widgets/vtkWidgetEventTranslator.cxx
+258
-0
Widgets/vtkWidgetEventTranslator.h
Widgets/vtkWidgetEventTranslator.h
+100
-0
Widgets/vtkWidgetRepresentation.cxx
Widgets/vtkWidgetRepresentation.cxx
+110
-0
Widgets/vtkWidgetRepresentation.h
Widgets/vtkWidgetRepresentation.h
+166
-0
No files found.
Graphics/Testing/Tcl/cursor2D.tcl
0 → 100644
View file @
89d18141
package require vtk
package require vtkinteraction
# create four cursors configured differently
vtkCursor2D cursor
eval cursor SetModelBounds 15 45 15 45 0 0
eval cursor SetFocalPoint 30 30 0
cursor AllOff
cursor AxesOn
cursor OutlineOn
vtkPolyDataMapper2D cursorMapper
cursorMapper SetInputConnection
[
cursor GetOutputPort
]
vtkActor2D cursorActor
cursorActor SetMapper cursorMapper
[
cursorActor GetProperty
]
SetColor 1 0 0
vtkCursor2D cursor2
eval cursor2 SetModelBounds 75 105 15 45 0 0
eval cursor2 SetFocalPoint 90 30 0
cursor2 AllOff
cursor2 AxesOn
cursor2 OutlineOn
cursor2 PointOn
vtkPolyDataMapper2D cursor2Mapper
cursor2Mapper SetInputConnection
[
cursor2 GetOutputPort
]
vtkActor2D cursor2Actor
cursor2Actor SetMapper cursor2Mapper
[
cursor2Actor GetProperty
]
SetColor 0 1 0
vtkCursor2D cursor3
eval cursor3 SetModelBounds 15 45 75 105 0 0
eval cursor3 SetFocalPoint 30 90 0
cursor3 AllOff
cursor3 AxesOn
cursor3 OutlineOff
cursor3 PointOn
cursor3 SetRadius 3
vtkPolyDataMapper2D cursor3Mapper
cursor3Mapper SetInputConnection
[
cursor3 GetOutputPort
]
vtkActor2D cursor3Actor
cursor3Actor SetMapper cursor3Mapper
[
cursor3Actor GetProperty
]
SetColor 0 1 0
vtkCursor2D cursor4
eval cursor4 SetModelBounds 75 105 75 105 0 0
eval cursor4 SetFocalPoint 90 90 0
cursor4 AllOff
cursor4 AxesOn
cursor4 SetRadius 0.0
vtkPolyDataMapper2D cursor4Mapper
cursor4Mapper SetInputConnection
[
cursor4 GetOutputPort
]
vtkActor2D cursor4Actor
cursor4Actor SetMapper cursor4Mapper
[
cursor4Actor GetProperty
]
SetColor 1 0 0
# rendering support
vtkRenderer ren1
vtkRenderWindow renWin
renWin AddRenderer ren1
vtkRenderWindowInteractor iren
iren SetRenderWindow renWin
# read data
ren1 AddActor cursorActor
ren1 AddActor cursor2Actor
ren1 AddActor cursor3Actor
ren1 AddActor cursor4Actor
ren1 SetBackground 0 0 0
renWin SetSize 120 120
renWin Render
iren AddObserver UserEvent
{
wm deiconify .vtkInteract
}
iren Initialize
# prevent the tk window from showing up then start the event loop
wm withdraw .
Graphics/vtkCursor2D.cxx
0 → 100644
View file @
89d18141
/*=========================================================================
Program: Visualization Toolkit
Module: vtkCursor2D.cxx
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#include "vtkCursor2D.h"
#include "vtkCellArray.h"
#include "vtkInformation.h"
#include "vtkInformationVector.h"
#include "vtkObjectFactory.h"
#include "vtkPolyData.h"
#include <math.h>
vtkCxxRevisionMacro
(
vtkCursor2D
,
"1.2"
);
vtkStandardNewMacro
(
vtkCursor2D
);
//---------------------------------------------------------------------------
// Construct with model bounds = (-10,10,-10,10, 0,0), focal point = (0,0,0),
// radius=2, all parts of cursor visible, and wrapping off.
vtkCursor2D
::
vtkCursor2D
()
{
this
->
ModelBounds
[
0
]
=
-
10.0
;
this
->
ModelBounds
[
1
]
=
10.0
;
this
->
ModelBounds
[
2
]
=
-
10.0
;
this
->
ModelBounds
[
3
]
=
10.0
;
this
->
ModelBounds
[
4
]
=
0.0
;
this
->
ModelBounds
[
5
]
=
0.0
;
this
->
FocalPoint
[
0
]
=
0.0
;
this
->
FocalPoint
[
1
]
=
0.0
;
this
->
FocalPoint
[
2
]
=
0.0
;
this
->
Outline
=
1
;
this
->
Axes
=
1
;
this
->
Point
=
1
;
this
->
Radius
=
2
;
this
->
Wrap
=
0
;
this
->
TranslationMode
=
0
;
this
->
SetNumberOfInputPorts
(
0
);
}
//---------------------------------------------------------------------------
int
vtkCursor2D
::
RequestData
(
vtkInformation
*
vtkNotUsed
(
request
),
vtkInformationVector
**
vtkNotUsed
(
inputVector
),
vtkInformationVector
*
outputVector
)
{
// get the info object
vtkInformation
*
outInfo
=
outputVector
->
GetInformationObject
(
0
);
// get the ouptut
vtkPolyData
*
output
=
vtkPolyData
::
SafeDownCast
(
outInfo
->
Get
(
vtkDataObject
::
DATA_OBJECT
()));
int
i
;
int
numPts
=
0
,
numVerts
=
0
,
numLines
=
0
;
vtkPoints
*
newPts
;
vtkCellArray
*
newLines
=
NULL
,
*
newVerts
=
NULL
;
double
x
[
3
];
vtkIdType
ptIds
[
5
];
// Check bounding box and origin
//
if
(
this
->
Wrap
)
{
for
(
i
=
0
;
i
<
2
;
i
++
)
{
this
->
FocalPoint
[
i
]
=
this
->
ModelBounds
[
2
*
i
]
+
fmod
((
double
)(
this
->
FocalPoint
[
i
]
-
this
->
ModelBounds
[
2
*
i
]),
(
double
)(
this
->
ModelBounds
[
2
*
i
+
1
]
-
this
->
ModelBounds
[
2
*
i
]));
}
}
else
{
for
(
i
=
0
;
i
<
2
;
i
++
)
{
if
(
this
->
FocalPoint
[
i
]
<
this
->
ModelBounds
[
2
*
i
]
)
{
this
->
FocalPoint
[
i
]
=
this
->
ModelBounds
[
2
*
i
];
}
if
(
this
->
FocalPoint
[
i
]
>
this
->
ModelBounds
[
2
*
i
+
1
]
)
{
this
->
FocalPoint
[
i
]
=
this
->
ModelBounds
[
2
*
i
+
1
];
}
}
}
// Allocate storage
//
if
(
this
->
Point
)
{
numPts
+=
1
;
numVerts
+=
1
;
}
if
(
this
->
Axes
)
{
numPts
+=
8
;
numLines
+=
3
;
}
if
(
this
->
Outline
)
{
numPts
+=
8
;
numLines
+=
12
;
}
if
(
numPts
)
{
newPts
=
vtkPoints
::
New
();
newPts
->
Allocate
(
numPts
);
newLines
=
vtkCellArray
::
New
();
newLines
->
Allocate
(
newLines
->
EstimateSize
(
numLines
,
2
));
}
else
{
return
1
;
}
if
(
numVerts
)
{
newVerts
=
vtkCellArray
::
New
();
newVerts
->
Allocate
(
newLines
->
EstimateSize
(
1
,
1
));
}
// Now create the representation. First the point (if requested).
//
if
(
this
->
Point
)
{
x
[
0
]
=
this
->
FocalPoint
[
0
];
x
[
1
]
=
this
->
FocalPoint
[
1
];
x
[
2
]
=
0.0
;
ptIds
[
0
]
=
newPts
->
InsertNextPoint
(
x
);
newVerts
->
InsertNextCell
(
1
,
ptIds
);
output
->
SetVerts
(
newVerts
);
newVerts
->
Delete
();
}
// Create axes
//
if
(
this
->
Axes
)
{
// The lines making up the x axis
x
[
0
]
=
this
->
ModelBounds
[
0
];
x
[
1
]
=
this
->
FocalPoint
[
1
];
x
[
2
]
=
this
->
ModelBounds
[
4
];
ptIds
[
0
]
=
newPts
->
InsertNextPoint
(
x
);
x
[
0
]
=
this
->
FocalPoint
[
0
]
-
this
->
Radius
;
x
[
1
]
=
this
->
FocalPoint
[
1
];
x
[
2
]
=
this
->
ModelBounds
[
4
];
ptIds
[
1
]
=
newPts
->
InsertNextPoint
(
x
);
newLines
->
InsertNextCell
(
2
,
ptIds
);
x
[
0
]
=
this
->
FocalPoint
[
0
]
+
this
->
Radius
;
x
[
1
]
=
this
->
FocalPoint
[
1
];
x
[
2
]
=
this
->
ModelBounds
[
4
];
ptIds
[
0
]
=
newPts
->
InsertNextPoint
(
x
);
x
[
0
]
=
this
->
ModelBounds
[
1
];
x
[
1
]
=
this
->
FocalPoint
[
1
];
x
[
2
]
=
this
->
ModelBounds
[
4
];
ptIds
[
1
]
=
newPts
->
InsertNextPoint
(
x
);
newLines
->
InsertNextCell
(
2
,
ptIds
);
// The lines making up the y axis
x
[
0
]
=
this
->
FocalPoint
[
0
];
x
[
1
]
=
this
->
ModelBounds
[
2
];
x
[
2
]
=
this
->
ModelBounds
[
4
];
ptIds
[
0
]
=
newPts
->
InsertNextPoint
(
x
);
x
[
0
]
=
this
->
FocalPoint
[
0
];
x
[
1
]
=
this
->
FocalPoint
[
1
]
-
this
->
Radius
;
x
[
2
]
=
this
->
ModelBounds
[
4
];
ptIds
[
1
]
=
newPts
->
InsertNextPoint
(
x
);
newLines
->
InsertNextCell
(
2
,
ptIds
);
x
[
0
]
=
this
->
FocalPoint
[
0
];
x
[
1
]
=
this
->
FocalPoint
[
1
]
+
this
->
Radius
;
x
[
2
]
=
this
->
ModelBounds
[
4
];
ptIds
[
0
]
=
newPts
->
InsertNextPoint
(
x
);
x
[
0
]
=
this
->
FocalPoint
[
0
];
x
[
1
]
=
this
->
ModelBounds
[
3
];
x
[
2
]
=
this
->
ModelBounds
[
4
];
ptIds
[
1
]
=
newPts
->
InsertNextPoint
(
x
);
newLines
->
InsertNextCell
(
2
,
ptIds
);
}
// Create outline
//
if
(
this
->
Outline
)
{
x
[
0
]
=
this
->
ModelBounds
[
0
];
x
[
1
]
=
this
->
ModelBounds
[
2
];
x
[
2
]
=
this
->
ModelBounds
[
4
];
ptIds
[
0
]
=
newPts
->
InsertNextPoint
(
x
);
x
[
0
]
=
this
->
ModelBounds
[
1
];
x
[
1
]
=
this
->
ModelBounds
[
2
];
x
[
2
]
=
this
->
ModelBounds
[
4
];
ptIds
[
1
]
=
newPts
->
InsertNextPoint
(
x
);
x
[
0
]
=
this
->
ModelBounds
[
1
];
x
[
1
]
=
this
->
ModelBounds
[
3
];
x
[
2
]
=
this
->
ModelBounds
[
4
];
ptIds
[
2
]
=
newPts
->
InsertNextPoint
(
x
);
x
[
0
]
=
this
->
ModelBounds
[
0
];
x
[
1
]
=
this
->
ModelBounds
[
3
];
x
[
2
]
=
this
->
ModelBounds
[
4
];
ptIds
[
3
]
=
newPts
->
InsertNextPoint
(
x
);
ptIds
[
4
]
=
ptIds
[
0
];
newLines
->
InsertNextCell
(
5
,
ptIds
);
}
// Update ourselves and release memory
//
output
->
SetPoints
(
newPts
);
newPts
->
Delete
();
if
(
newLines
)
{
output
->
SetLines
(
newLines
);
newLines
->
Delete
();
}
return
1
;
}
//---------------------------------------------------------------------------
// Set the boundary of the 3D cursor.
void
vtkCursor2D
::
SetModelBounds
(
double
xmin
,
double
xmax
,
double
ymin
,
double
ymax
,
double
zmin
,
double
zmax
)
{
if
(
xmin
!=
this
->
ModelBounds
[
0
]
||
xmax
!=
this
->
ModelBounds
[
1
]
||
ymin
!=
this
->
ModelBounds
[
2
]
||
ymax
!=
this
->
ModelBounds
[
3
]
||
zmin
!=
this
->
ModelBounds
[
4
]
||
zmax
!=
this
->
ModelBounds
[
5
]
)
{
this
->
Modified
();
this
->
ModelBounds
[
0
]
=
xmin
;
this
->
ModelBounds
[
1
]
=
xmax
;
this
->
ModelBounds
[
2
]
=
ymin
;
this
->
ModelBounds
[
3
]
=
ymax
;
this
->
ModelBounds
[
4
]
=
ymin
;
this
->
ModelBounds
[
5
]
=
ymax
;
for
(
int
i
=
0
;
i
<
3
;
i
++
)
{
if
(
this
->
ModelBounds
[
2
*
i
]
>
this
->
ModelBounds
[
2
*
i
+
1
]
)
{
this
->
ModelBounds
[
2
*
i
]
=
this
->
ModelBounds
[
2
*
i
+
1
];
}
}
}
}
//---------------------------------------------------------------------------
void
vtkCursor2D
::
SetFocalPoint
(
double
x
[
3
])
{
if
(
x
[
0
]
==
this
->
FocalPoint
[
0
]
&&
x
[
1
]
==
this
->
FocalPoint
[
1
]
)
{
return
;
}
this
->
Modified
();
double
v
[
3
];
for
(
int
i
=
0
;
i
<
2
;
i
++
)
{
v
[
i
]
=
x
[
i
]
-
this
->
FocalPoint
[
i
];
this
->
FocalPoint
[
i
]
=
x
[
i
];
if
(
this
->
TranslationMode
)
{
this
->
ModelBounds
[
2
*
i
]
+=
v
[
i
];
this
->
ModelBounds
[
2
*
i
+
1
]
+=
v
[
i
];
}
else
if
(
this
->
Wrap
)
//wrap
{
this
->
FocalPoint
[
i
]
=
this
->
ModelBounds
[
2
*
i
]
+
fmod
((
double
)(
this
->
FocalPoint
[
i
]
-
this
->
ModelBounds
[
2
*
i
]),
(
double
)(
this
->
ModelBounds
[
2
*
i
+
1
]
-
this
->
ModelBounds
[
2
*
i
]));
}
else
//clamp
{
if
(
x
[
i
]
<
this
->
ModelBounds
[
2
*
i
]
)
{
this
->
FocalPoint
[
i
]
=
this
->
ModelBounds
[
2
*
i
];
}
if
(
x
[
i
]
>
this
->
ModelBounds
[
2
*
i
+
1
]
)
{
this
->
FocalPoint
[
i
]
=
this
->
ModelBounds
[
2
*
i
+
1
];
}
}
}
}
//---------------------------------------------------------------------------
void
vtkCursor2D
::
SetModelBounds
(
double
bounds
[
6
])
{
this
->
SetModelBounds
(
bounds
[
0
],
bounds
[
1
],
bounds
[
2
],
bounds
[
3
],
bounds
[
6
],
bounds
[
5
]);
}
//---------------------------------------------------------------------------
// Turn every part of the 3D cursor on.
void
vtkCursor2D
::
AllOn
()
{
this
->
OutlineOn
();
this
->
AxesOn
();
this
->
PointOn
();
}
//---------------------------------------------------------------------------
// Turn every part of the 3D cursor off.
void
vtkCursor2D
::
AllOff
()
{
this
->
OutlineOff
();
this
->
AxesOff
();
this
->
PointOff
();
}
//---------------------------------------------------------------------------
void
vtkCursor2D
::
PrintSelf
(
ostream
&
os
,
vtkIndent
indent
)
{
this
->
Superclass
::
PrintSelf
(
os
,
indent
);
os
<<
indent
<<
"ModelBounds:
\n
"
;
os
<<
indent
<<
" Xmin,Xmax: ("
<<
this
->
ModelBounds
[
0
]
<<
", "
<<
this
->
ModelBounds
[
1
]
<<
")
\n
"
;
os
<<
indent
<<
" Ymin,Ymax: ("
<<
this
->
ModelBounds
[
2
]
<<
", "
<<
this
->
ModelBounds
[
3
]
<<
")
\n
"
;
os
<<
indent
<<
" Zmin,Zmax: ("
<<
this
->
ModelBounds
[
4
]
<<
", "
<<
this
->
ModelBounds
[
5
]
<<
")
\n
"
;
os
<<
indent
<<
"Focal Point: ("
<<
this
->
FocalPoint
[
0
]
<<
", "
<<
this
->
FocalPoint
[
1
]
<<
", "
<<
this
->
FocalPoint
[
2
]
<<
")
\n
"
;
os
<<
indent
<<
"Outline: "
<<
(
this
->
Outline
?
"On
\n
"
:
"Off
\n
"
);
os
<<
indent
<<
"Axes: "
<<
(
this
->
Axes
?
"On
\n
"
:
"Off
\n
"
);
os
<<
indent
<<
"Point: "
<<
(
this
->
Point
?
"On
\n
"
:
"Off
\n
"
);
os
<<
indent
<<
"Radius: "
<<
this
->
Radius
<<
"
\n
"
;
os
<<
indent
<<
"Wrap: "
<<
(
this
->
Wrap
?
"On
\n
"
:
"Off
\n
"
);
os
<<
indent
<<
"Translation Mode: "
<<
(
this
->
TranslationMode
?
"On
\n
"
:
"Off
\n
"
);
}
Graphics/vtkCursor2D.h
0 → 100644
View file @
89d18141
/*=========================================================================
Program: Visualization Toolkit
Module: vtkCursor2D.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkCursor2D - generate a 2D cursor representation
// .SECTION Description
// vtkCursor2D is a class that generates a 2D cursor representation.
// The cursor consists of two intersection axes lines that meet at the
// cursor focus. Several optional features are available as well. An
// optional 2D bounding box may be enabled. An inner radius, centered at
// the focal point, can be set that erases the intersecting lines (e.g.,
// it leaves a clear area under the focal point so you can see
// what you are selecting). And finally, an optional point can be
// enabled located at the focal point. All of these features can be turned
// on and off independently.
//
#ifndef __vtkCursor2D_h
#define __vtkCursor2D_h
#include "vtkPolyDataAlgorithm.h"
class
VTK_GRAPHICS_EXPORT
vtkCursor2D
:
public
vtkPolyDataAlgorithm
{
public:
vtkTypeRevisionMacro
(
vtkCursor2D
,
vtkPolyDataAlgorithm
);
void
PrintSelf
(
ostream
&
os
,
vtkIndent
indent
);
// Description:
// Construct with model bounds = (-10,10,-10,10), focal point = (0,0),
// radius=2, all parts of cursor visible, and wrapping off.
static
vtkCursor2D
*
New
();
// Description:
// Set / get the bounding box of the 2D cursor. This defines the outline
// of the cursor, and where the focal point should lie.
void
SetModelBounds
(
double
xmin
,
double
xmax
,
double
ymin
,
double
ymax
,
double
zmin
,
double
zmax
);
void
SetModelBounds
(
double
bounds
[
6
]);
vtkGetVectorMacro
(
ModelBounds
,
double
,
6
);
// Description:
// Set/Get the position of cursor focus. If translation mode is on,
// then the entire cursor (including bounding box, cursor, and shadows)
// is translated. Otherwise, the focal point will either be clamped to the
// bounding box, or wrapped, if Wrap is on. (Note: this behavior requires
// that the bounding box is set prior to the focal point.) Note that the
// method takes a 3D point but ignores the z-coordinate value.
void
SetFocalPoint
(
double
x
[
3
]);
void
SetFocalPoint
(
double
x
,
double
y
,
double
z
)
{
double
xyz
[
3
];
xyz
[
0
]
=
x
;
xyz
[
1
]
=
y
;
xyz
[
2
]
=
z
;
this
->
SetFocalPoint
(
xyz
);
}
vtkGetVectorMacro
(
FocalPoint
,
double
,
3
);
// Description:
// Turn on/off the wireframe bounding box.
vtkSetMacro
(
Outline
,
int
);
vtkGetMacro
(
Outline
,
int
);
vtkBooleanMacro
(
Outline
,
int
);
// Description:
// Turn on/off the wireframe axes.
vtkSetMacro
(
Axes
,
int
);
vtkGetMacro
(
Axes
,
int
);
vtkBooleanMacro
(
Axes
,
int
);
// Description:
// Specify a radius for a circle. This erases the cursor
// lines around the focal point.
vtkSetClampMacro
(
Radius
,
double
,
0.0
,
VTK_LARGE_FLOAT
);
vtkGetMacro
(
Radius
,
double
);
// Description:
// Turn on/off the point located at the cursor focus.
vtkSetMacro
(
Point
,
int
);
vtkGetMacro
(
Point
,
int
);
vtkBooleanMacro
(
Point
,
int
);
// Description:
// Enable/disable the translation mode. If on, changes in cursor position
// cause the entire widget to translate along with the cursor.
// By default, translation mode is off.
vtkSetMacro
(
TranslationMode
,
int
);
vtkGetMacro
(
TranslationMode
,
int
);
vtkBooleanMacro
(
TranslationMode
,
int
);
// Description:
// Turn on/off cursor wrapping. If the cursor focus moves outside the
// specified bounds, the cursor will either be restrained against the
// nearest "wall" (Wrap=off), or it will wrap around (Wrap=on).
vtkSetMacro
(
Wrap
,
int
);
vtkGetMacro
(
Wrap
,
int
);
vtkBooleanMacro
(
Wrap
,
int
);
// Description:
// Turn every part of the cursor on or off.
void
AllOn
();
void
AllOff
();
protected:
vtkCursor2D
();
~
vtkCursor2D
()
{}
int
RequestData
(
vtkInformation
*
,
vtkInformationVector
**
,
vtkInformationVector
*
);
double
ModelBounds
[
6
];
double
FocalPoint
[
3
];
int
Outline
;
int
Axes
;
int
Point
;
double
Radius
;
int
TranslationMode
;
int
Wrap
;
private:
vtkCursor2D
(
const
vtkCursor2D
&
);
// Not implemented.
void
operator
=
(
const
vtkCursor2D
&
);
// Not implemented.
};
#endif
Rendering/Testing/Tcl/TestLeaderActor2D.tcl
0 → 100644
View file @
89d18141
package require vtk
package require vtkinteraction