Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Bill Lorensen
VTK
Commits
b49705f6
Commit
b49705f6
authored
Jul 22, 2011
by
George Zagaris
Browse files
Merge remote-tracking branch 'pvvtk/master' into AMR-Refactoring
parents
f6575a8b
cf8930e5
Changes
110
Hide whitespace changes
Inline
Side-by-side
CMake/CTestCustom.ctest.in
View file @
b49705f6
...
...
@@ -84,6 +84,7 @@ ENDIF("@CMAKE_SYSTEM@" MATCHES "OSF")
SET(CTEST_CUSTOM_WARNING_EXCEPTION
${CTEST_CUSTOM_WARNING_EXCEPTION}
"Utilities/vtktiff/"
"list.[0-9]+. : warning C4702: unreachable code"
"xtree.[0-9]+. : warning C4702: unreachable code"
"vector.[0-9]+. : warning C4702: unreachable code"
"warning LNK4221"
...
...
Charts/vtkAxis.cxx
View file @
b49705f6
...
...
@@ -389,11 +389,11 @@ void vtkAxis::SetMinimumLimit(double lowest)
{
return
;
}
this
->
MinimumLimit
=
lowest
;
if
(
this
->
Minimum
<
lowest
)
{
this
->
SetMinimum
(
lowest
);
}
this
->
MinimumLimit
=
lowest
;
}
//-----------------------------------------------------------------------------
...
...
@@ -417,11 +417,11 @@ void vtkAxis::SetMaximumLimit(double highest)
{
return
;
}
if
(
this
->
Maximum
<
highest
)
this
->
MaximumLimit
=
highest
;
if
(
this
->
Maximum
>
highest
)
{
this
->
SetMaximum
(
highest
);
}
this
->
MaximumLimit
=
highest
;
}
//-----------------------------------------------------------------------------
...
...
Charts/vtkColorTransferControlPointsItem.cxx
View file @
b49705f6
...
...
@@ -80,6 +80,10 @@ unsigned long int vtkColorTransferControlPointsItem::GetControlPointsMTime()
//-----------------------------------------------------------------------------
void
vtkColorTransferControlPointsItem
::
SetColorTransferFunction
(
vtkColorTransferFunction
*
t
)
{
if
(
this
->
ColorTransferFunction
)
{
this
->
ColorTransferFunction
->
RemoveObserver
(
this
->
Callback
);
}
vtkSetObjectBodyMacro
(
ColorTransferFunction
,
vtkColorTransferFunction
,
t
);
if
(
this
->
ColorTransferFunction
)
{
...
...
@@ -162,15 +166,11 @@ vtkIdType vtkColorTransferControlPointsItem::AddPoint(double* newPos)
{
return
-
1
;
}
#ifndef NDEBUG
vtkIdType
expectedPoint
=
#endif
this
->
vtkControlPointsItem
::
AddPoint
(
newPos
);
double
rgb
[
3
]
=
{
0.
,
0.
,
0.
};
this
->
ColorTransferFunction
->
GetColor
(
newPos
[
0
],
rgb
);
vtkIdType
addedPoint
=
this
->
ColorTransferFunction
->
AddRGBPoint
(
newPos
[
0
],
rgb
[
0
],
rgb
[
1
],
rgb
[
2
]);
assert
(
addedPoint
==
expect
edPoint
);
this
->
vtkControlPointsItem
::
AddPointId
(
add
edPoint
);
return
addedPoint
;
}
...
...
Charts/vtkColorTransferFunctionItem.cxx
View file @
b49705f6
...
...
@@ -62,9 +62,9 @@ void vtkColorTransferFunctionItem::PrintSelf(ostream &os, vtkIndent indent)
}
//-----------------------------------------------------------------------------
void
vtkColorTransferFunctionItem
::
Get
Bounds
(
double
*
bounds
)
void
vtkColorTransferFunctionItem
::
Compute
Bounds
(
double
*
bounds
)
{
this
->
Superclass
::
Get
Bounds
(
bounds
);
this
->
Superclass
::
Compute
Bounds
(
bounds
);
if
(
this
->
ColorTransferFunction
)
{
double
*
range
=
this
->
ColorTransferFunction
->
GetRange
();
...
...
@@ -100,7 +100,7 @@ void vtkColorTransferFunctionItem::ComputeTexture()
}
// Could depend of the screen resolution
const
int
dimension
=
256
;
const
int
dimension
=
this
->
GetTextureWidth
()
;
double
*
values
=
new
double
[
dimension
];
// Texture 1D
this
->
Texture
->
SetExtent
(
0
,
dimension
-
1
,
...
...
@@ -117,7 +117,7 @@ void vtkColorTransferFunctionItem::ComputeTexture()
unsigned
char
*
ptr
=
reinterpret_cast
<
unsigned
char
*>
(
this
->
Texture
->
GetScalarPointer
(
0
,
0
,
0
));
this
->
ColorTransferFunction
->
MapScalarsThroughTable2
(
values
,
ptr
,
VTK_DOUBLE
,
dimension
,
1
,
4
);
values
,
ptr
,
VTK_DOUBLE
,
dimension
,
VTK_LUMINANCE
,
VTK_RGBA
);
if
(
this
->
Opacity
!=
1.0
)
{
for
(
int
i
=
0
;
i
<
dimension
;
++
i
)
...
...
Charts/vtkColorTransferFunctionItem.h
View file @
b49705f6
...
...
@@ -31,10 +31,6 @@ public:
vtkTypeMacro
(
vtkColorTransferFunctionItem
,
vtkScalarsToColorsItem
);
virtual
void
PrintSelf
(
ostream
&
os
,
vtkIndent
indent
);
// Description:
// Reimplemented to return the range of the lookup table
virtual
void
GetBounds
(
double
bounds
[
4
]);
void
SetColorTransferFunction
(
vtkColorTransferFunction
*
t
);
vtkGetObjectMacro
(
ColorTransferFunction
,
vtkColorTransferFunction
);
...
...
@@ -42,6 +38,10 @@ protected:
vtkColorTransferFunctionItem
();
virtual
~
vtkColorTransferFunctionItem
();
// Description:
// Reimplemented to return the range of the lookup table
virtual
void
ComputeBounds
(
double
bounds
[
4
]);
virtual
void
ComputeTexture
();
vtkColorTransferFunction
*
ColorTransferFunction
;
private:
...
...
Charts/vtkCompositeControlPointsItem.cxx
View file @
b49705f6
...
...
@@ -38,6 +38,7 @@ vtkStandardNewMacro(vtkCompositeControlPointsItem);
//-----------------------------------------------------------------------------
vtkCompositeControlPointsItem
::
vtkCompositeControlPointsItem
()
{
this
->
PointsFunction
=
ColorAndOpacityPointsFunction
;
this
->
OpacityFunction
=
0
;
this
->
Updating
=
false
;
this
->
ColorFill
=
true
;
...
...
@@ -72,18 +73,26 @@ void vtkCompositeControlPointsItem::PrintSelf(ostream &os, vtkIndent indent)
//-----------------------------------------------------------------------------
unsigned
long
int
vtkCompositeControlPointsItem
::
GetControlPointsMTime
()
{
unsigned
long
int
mTime
=
this
->
Superclass
::
GetControlPointsMTime
();
if
(
this
->
OpacityFunction
)
{
return
this
->
OpacityFunction
->
GetMTime
();
mTime
=
std
::
max
(
mTime
,
this
->
OpacityFunction
->
GetMTime
()
)
;
}
return
this
->
Superclass
::
GetControlPointsM
Time
()
;
return
m
Time
;
}
//-----------------------------------------------------------------------------
void
vtkCompositeControlPointsItem
::
SetOpacityFunction
(
vtkPiecewiseFunction
*
function
)
{
if
(
this
->
OpacityFunction
)
{
this
->
OpacityFunction
->
RemoveObserver
(
this
->
Callback
);
}
vtkSetObjectBodyMacro
(
OpacityFunction
,
vtkPiecewiseFunction
,
function
);
this
->
MergeColorTransferFunction
();
if
(
this
->
PointsFunction
==
ColorAndOpacityPointsFunction
)
{
this
->
SilentMergeTransferFunctions
();
}
if
(
this
->
OpacityFunction
)
{
this
->
OpacityFunction
->
AddObserver
(
vtkCommand
::
ModifiedEvent
,
this
->
Callback
);
...
...
@@ -95,11 +104,19 @@ void vtkCompositeControlPointsItem::SetOpacityFunction(vtkPiecewiseFunction* fun
//-----------------------------------------------------------------------------
void
vtkCompositeControlPointsItem
::
SetColorTransferFunction
(
vtkColorTransferFunction
*
c
)
{
// Observation will be set Superclass::SetColorTransferFunction
if
(
this
->
ColorTransferFunction
)
{
this
->
ColorTransferFunction
->
RemoveObserver
(
this
->
Callback
);
}
// We need to set the color transfer function here (before
// Superclass::SetPiecewiseFunction) to be able to have a valid
// color transfer function for MergeColorTransferFunction().
vtkSetObjectBodyMacro
(
ColorTransferFunction
,
vtkColorTransferFunction
,
c
);
this
->
MergeColorTransferFunction
();
if
(
this
->
PointsFunction
==
ColorAndOpacityPointsFunction
)
{
this
->
SilentMergeTransferFunctions
();
}
this
->
Superclass
::
SetColorTransferFunction
(
c
);
}
//-----------------------------------------------------------------------------
...
...
@@ -112,75 +129,160 @@ void vtkCompositeControlPointsItem::ComputePoints()
this
->
Superclass
::
ComputePoints
();
}
//-----------------------------------------------------------------------------
void
vtkCompositeControlPointsItem
::
DrawPoint
(
vtkContext2D
*
painter
,
vtkIdType
index
)
{
if
(
this
->
PointsFunction
==
ColorPointsFunction
||
this
->
PointsFunction
==
ColorAndOpacityPointsFunction
)
{
this
->
Superclass
::
DrawPoint
(
painter
,
index
);
return
;
}
if
(
this
->
PointsFunction
==
OpacityPointsFunction
&&
this
->
ColorFill
&&
this
->
ColorTransferFunction
)
{
double
xvms
[
4
];
this
->
OpacityFunction
->
GetNodeValue
(
index
,
xvms
);
unsigned
char
*
rgb
=
this
->
ColorTransferFunction
->
MapValue
(
xvms
[
0
]);
painter
->
GetBrush
()
->
SetColorF
(
rgb
[
0
]
/
255.
,
rgb
[
1
]
/
255.
,
rgb
[
2
]
/
255.
,
0.55
);
}
this
->
vtkControlPointsItem
::
DrawPoint
(
painter
,
index
);
}
//-----------------------------------------------------------------------------
int
vtkCompositeControlPointsItem
::
GetNumberOfPoints
()
const
{
if
(
this
->
ColorTransferFunction
&&
(
this
->
PointsFunction
==
ColorPointsFunction
||
this
->
PointsFunction
==
ColorAndOpacityPointsFunction
))
{
return
this
->
Superclass
::
GetNumberOfPoints
();
}
if
(
this
->
OpacityFunction
&&
(
this
->
PointsFunction
==
OpacityPointsFunction
||
this
->
PointsFunction
==
ColorAndOpacityPointsFunction
))
{
return
this
->
OpacityFunction
->
GetSize
();
}
return
0
;
}
//-----------------------------------------------------------------------------
void
vtkCompositeControlPointsItem
::
SetControlPoint
(
vtkIdType
index
,
double
*
newPos
)
{
this
->
Superclass
::
SetControlPoint
(
index
,
newPos
);
this
->
OpacityFunction
->
SetNodeValue
(
index
,
newPos
);
if
(
this
->
PointsFunction
==
ColorPointsFunction
||
this
->
PointsFunction
==
ColorAndOpacityPointsFunction
)
{
this
->
Superclass
::
SetControlPoint
(
index
,
newPos
);
}
if
(
this
->
OpacityFunction
&&
(
this
->
PointsFunction
==
OpacityPointsFunction
||
this
->
PointsFunction
==
ColorAndOpacityPointsFunction
))
{
this
->
OpacityFunction
->
SetNodeValue
(
index
,
newPos
);
}
}
//-----------------------------------------------------------------------------
void
vtkCompositeControlPointsItem
::
GetControlPoint
(
vtkIdType
index
,
double
*
pos
)
{
if
(
!
this
->
OpacityFunction
)
if
(
!
this
->
OpacityFunction
||
this
->
PointsFunction
==
ColorPointsFunction
)
{
this
->
Superclass
::
GetControlPoint
(
index
,
pos
);
if
(
this
->
OpacityFunction
)
{
pos
[
1
]
=
this
->
OpacityFunction
->
GetValue
(
pos
[
0
]);
}
return
;
}
this
->
OpacityFunction
->
GetNodeValue
(
index
,
pos
);
}
//-----------------------------------------------------------------------------
void
vtkCompositeControlPointsItem
::
EditPoint
(
float
tX
,
float
tY
)
{
this
->
Superclass
::
EditPoint
(
tX
,
tY
);
if
(
!
this
->
OpacityFunction
)
if
(
this
->
PointsFunction
==
ColorPointsFunction
||
this
->
PointsFunction
==
ColorAnd
Opacity
Points
Function
)
{
return
;
this
->
Superclass
::
EditPoint
(
tX
,
tY
)
;
}
double
xvms
[
4
];
this
->
OpacityFunction
->
GetNodeValue
(
this
->
CurrentPoint
,
xvms
);
xvms
[
2
]
+=
tX
;
xvms
[
3
]
+=
tY
;
this
->
OpacityFunction
->
SetNodeValue
(
this
->
CurrentPoint
,
xvms
);
if
(
this
->
CurrentPoint
>
0
)
if
(
this
->
OpacityFunction
&&
(
this
->
PointsFunction
==
ColorPointsFunction
||
this
->
PointsFunction
==
ColorAndOpacityPointsFunction
))
{
this
->
OpacityFunction
->
GetNodeValue
(
this
->
CurrentPoint
-
1
,
xvms
);
double
xvms
[
4
];
this
->
OpacityFunction
->
GetNodeValue
(
this
->
CurrentPoint
,
xvms
);
xvms
[
2
]
+=
tX
;
xvms
[
3
]
+=
tY
;
this
->
ColorTransferFunction
->
SetNodeValue
(
this
->
CurrentPoint
-
1
,
xvms
);
this
->
OpacityFunction
->
SetNodeValue
(
this
->
CurrentPoint
,
xvms
);
// Not sure why we move the point before too
if
(
this
->
CurrentPoint
>
0
)
{
this
->
OpacityFunction
->
GetNodeValue
(
this
->
CurrentPoint
-
1
,
xvms
);
xvms
[
2
]
+=
tX
;
xvms
[
3
]
+=
tY
;
this
->
OpacityFunction
->
SetNodeValue
(
this
->
CurrentPoint
-
1
,
xvms
);
}
}
}
//-----------------------------------------------------------------------------
vtkIdType
vtkCompositeControlPointsItem
::
AddPoint
(
double
*
newPos
)
{
bool
oldUpdating
=
this
->
Updating
;
this
->
Updating
=
true
;
vtkIdType
addedPoint
=
this
->
Superclass
::
AddPoint
(
newPos
);
this
->
Updating
=
oldUpdating
;
if
(
!
this
->
OpacityFunction
)
vtkIdType
addedPoint
=
-
1
;
if
(
this
->
OpacityFunction
&&
(
this
->
PointsFunction
==
OpacityPointsFunction
||
this
->
PointsFunction
==
ColorAndOpacityPointsFunction
))
{
return
addedPoint
;
bool
oldUpdating
=
this
->
Updating
;
if
(
this
->
PointsFunction
==
ColorAndOpacityPointsFunction
)
{
this
->
Updating
=
true
;
}
addedPoint
=
this
->
OpacityFunction
->
AddPoint
(
newPos
[
0
],
newPos
[
1
]);
if
(
this
->
PointsFunction
==
OpacityPointsFunction
)
{
this
->
vtkControlPointsItem
::
AddPointId
(
addedPoint
);
}
this
->
Updating
=
oldUpdating
;
}
return
this
->
OpacityFunction
->
AddPoint
(
newPos
[
0
],
newPos
[
1
]);
if
(
this
->
PointsFunction
==
ColorPointsFunction
||
this
->
PointsFunction
==
ColorAndOpacityPointsFunction
)
{
addedPoint
=
this
->
Superclass
::
AddPoint
(
newPos
);
}
return
addedPoint
;
}
//-----------------------------------------------------------------------------
vtkIdType
vtkCompositeControlPointsItem
::
RemovePoint
(
double
*
currentPoint
)
{
bool
oldUpdating
=
this
->
Updating
;
this
->
Updating
=
true
;
vtkIdType
removedPoint
=
this
->
Superclass
::
RemovePoint
(
currentPoint
);
this
->
Updating
=
oldUpdating
;
if
(
!
this
->
OpacityFunction
)
vtkIdType
removedPoint
=
-
1
;
if
(
this
->
PointsFunction
==
ColorPointsFunction
||
this
->
PointsFunction
==
ColorAndOpacityPointsFunction
)
{
return
removedPoint
;
bool
oldUpdating
=
this
->
Updating
;
if
(
this
->
PointsFunction
==
ColorAndOpacityPointsFunction
)
{
this
->
Updating
=
true
;
}
removedPoint
=
this
->
Superclass
::
RemovePoint
(
currentPoint
);
this
->
Updating
=
oldUpdating
;
}
return
this
->
OpacityFunction
->
RemovePoint
(
currentPoint
[
0
]);
if
(
this
->
OpacityFunction
&&
(
this
->
PointsFunction
==
OpacityPointsFunction
||
this
->
PointsFunction
==
ColorAndOpacityPointsFunction
))
{
removedPoint
=
this
->
OpacityFunction
->
RemovePoint
(
currentPoint
[
0
]);
}
return
removedPoint
;
}
//-----------------------------------------------------------------------------
void
vtkCompositeControlPointsItem
::
Merge
Color
TransferFunction
()
void
vtkCompositeControlPointsItem
::
MergeTransferFunction
s
()
{
if
(
!
this
->
ColorTransferFunction
||
!
this
->
OpacityFunction
)
{
...
...
@@ -211,3 +313,10 @@ void vtkCompositeControlPointsItem::MergeColorTransferFunction()
this
->
OpacityFunction
->
AddPoint
(
xrgbms
[
0
],
value
,
xrgbms
[
4
],
xrgbms
[
5
]);
}
}
//-----------------------------------------------------------------------------
void
vtkCompositeControlPointsItem
::
SilentMergeTransferFunctions
()
{
bool
wasUpdating
=
this
->
Updating
;
this
->
MergeTransferFunctions
();
this
->
Updating
=
wasUpdating
;
}
Charts/vtkCompositeControlPointsItem.h
View file @
b49705f6
...
...
@@ -50,6 +50,25 @@ public:
void
SetOpacityFunction
(
vtkPiecewiseFunction
*
opacity
);
vtkGetObjectMacro
(
OpacityFunction
,
vtkPiecewiseFunction
);
enum
PointsFunction
{
ColorPointsFunction
=
1
,
OpacityPointsFunction
=
2
,
ColorAndOpacityPointsFunction
=
3
};
// Description:
// PointsFunction controls wether the points represent the
// ColorTransferFunction, OpacityTransferFunction or both.
// If ColorPointsFunction, only the points of the ColorTransfer function are
// used.
// If OpacityPointsFunction, only the points of the Opacity function are used
// If ColorAndOpacityPointsFunction, the points of both functions are shared
// by both functions.
// ColorAndOpacityPointsFunction by default.
// Note: Set the mode before the functions are set. ColorPointsFunction is
// not fully supported.
vtkSetMacro
(
PointsFunction
,
int
);
vtkGetMacro
(
PointsFunction
,
int
);
// Description:
// Add a point to the function. Returns the index of the point (0 based),
// or -1 on error.
...
...
@@ -69,14 +88,19 @@ protected:
virtual
unsigned
long
int
GetControlPointsMTime
();
virtual
void
ComputePoints
();
virtual
int
GetNumberOfPoints
()
const
;
virtual
void
DrawPoint
(
vtkContext2D
*
painter
,
vtkIdType
index
);
virtual
void
GetControlPoint
(
vtkIdType
index
,
double
*
pos
);
virtual
void
SetControlPoint
(
vtkIdType
index
,
double
*
point
);
virtual
void
EditPoint
(
float
tX
,
float
tY
);
void
MergeColorTransferFunction
();
void
MergeTransferFunctions
();
void
SilentMergeTransferFunctions
();
int
PointsFunction
;
vtkPiecewiseFunction
*
OpacityFunction
;
bool
Updating
;
private:
vtkCompositeControlPointsItem
(
const
vtkCompositeControlPointsItem
&
);
// Not implemented.
void
operator
=
(
const
vtkCompositeControlPointsItem
&
);
// Not implemented.
...
...
Charts/vtkCompositeTransferFunctionItem.cxx
View file @
b49705f6
...
...
@@ -65,9 +65,9 @@ void vtkCompositeTransferFunctionItem::PrintSelf(ostream &os, vtkIndent indent)
}
//-----------------------------------------------------------------------------
void
vtkCompositeTransferFunctionItem
::
Get
Bounds
(
double
*
bounds
)
void
vtkCompositeTransferFunctionItem
::
Compute
Bounds
(
double
*
bounds
)
{
this
->
Superclass
::
Get
Bounds
(
bounds
);
this
->
Superclass
::
Compute
Bounds
(
bounds
);
if
(
this
->
OpacityFunction
)
{
double
*
opacityRange
=
this
->
OpacityFunction
->
GetRange
();
...
...
@@ -103,7 +103,7 @@ void vtkCompositeTransferFunctionItem::ComputeTexture()
this
->
Texture
=
vtkImageData
::
New
();
}
const
int
dimension
=
this
->
Texture
->
GetExtent
()[
1
]
+
1
;
const
int
dimension
=
this
->
Get
Texture
Width
()
;
double
*
values
=
new
double
[
dimension
];
this
->
OpacityFunction
->
GetTable
(
bounds
[
0
],
bounds
[
1
],
dimension
,
values
);
unsigned
char
*
ptr
=
...
...
Charts/vtkCompositeTransferFunctionItem.h
View file @
b49705f6
...
...
@@ -29,10 +29,6 @@ public:
vtkTypeMacro
(
vtkCompositeTransferFunctionItem
,
vtkColorTransferFunctionItem
);
virtual
void
PrintSelf
(
ostream
&
os
,
vtkIndent
indent
);
// Description:
// Reimplemented to return the range of the piecewise function
virtual
void
GetBounds
(
double
bounds
[
4
]);
void
SetOpacityFunction
(
vtkPiecewiseFunction
*
opacity
);
vtkGetObjectMacro
(
OpacityFunction
,
vtkPiecewiseFunction
);
...
...
@@ -40,6 +36,10 @@ protected:
vtkCompositeTransferFunctionItem
();
virtual
~
vtkCompositeTransferFunctionItem
();
// Description:
// Reimplemented to return the range of the piecewise function
virtual
void
ComputeBounds
(
double
bounds
[
4
]);
virtual
void
ComputeTexture
();
vtkPiecewiseFunction
*
OpacityFunction
;
...
...
Charts/vtkContextInteractorStyle.cxx
View file @
b49705f6
...
...
@@ -83,10 +83,10 @@ void vtkContextInteractorStyle::SetScene(vtkContextScene* scene)
}
//----------------------------------------------------------------------------
void
vtkContextInteractorStyle
::
ProcessSceneEvents
(
vtkObject
*
object
,
void
vtkContextInteractorStyle
::
ProcessSceneEvents
(
vtkObject
*
vtkNotUsed
(
object
)
,
unsigned
long
event
,
void
*
clientdata
,
void
*
calldata
)
void
*
vtkNotUsed
(
calldata
)
)
{
vtkContextInteractorStyle
*
self
=
reinterpret_cast
<
vtkContextInteractorStyle
*>
(
clientdata
);
...
...
@@ -309,7 +309,7 @@ void vtkContextInteractorStyle::OnMouseWheelForward()
int
x
=
this
->
Interactor
->
GetEventPosition
()[
0
];
int
y
=
this
->
Interactor
->
GetEventPosition
()[
1
];
eatEvent
=
this
->
Scene
->
MouseWheelEvent
(
+
1.0
*
this
->
MouseWheelMotionFactor
,
x
,
y
);
this
->
Scene
->
MouseWheelEvent
(
static_cast
<
int
>
(
this
->
MouseWheelMotionFactor
)
,
x
,
y
);
}
if
(
!
eatEvent
)
{
...
...
@@ -329,7 +329,7 @@ void vtkContextInteractorStyle::OnMouseWheelBackward()
int
x
=
this
->
Interactor
->
GetEventPosition
()[
0
];
int
y
=
this
->
Interactor
->
GetEventPosition
()[
1
];
eatEvent
=
this
->
Scene
->
MouseWheelEvent
(
-
1.0
*
this
->
MouseWheelMotionFactor
,
x
,
y
);
this
->
Scene
->
MouseWheelEvent
(
-
static_cast
<
int
>
(
this
->
MouseWheelMotionFactor
)
,
x
,
y
);
}
if
(
!
eatEvent
)
{
...
...
Charts/vtkControlPointsItem.cxx
View file @
b49705f6
...
...
@@ -87,6 +87,7 @@ void vtkControlPointsItem::PrintSelf(ostream &os, vtkIndent indent)
//-----------------------------------------------------------------------------
void
vtkControlPointsItem
::
GetBounds
(
double
bounds
[
4
])
{
// valid user bounds ? use them
if
(
this
->
UserBounds
[
0
]
<=
this
->
UserBounds
[
1
]
&&
this
->
UserBounds
[
2
]
<=
this
->
UserBounds
[
3
])
{
...
...
@@ -96,8 +97,9 @@ void vtkControlPointsItem::GetBounds(double bounds[4])
bounds
[
3
]
=
this
->
UserBounds
[
3
];
return
;
}
if
(
this
->
Bounds
[
0
]
>
this
->
Bounds
[
1
]
||
this
->
Bounds
[
2
]
>
this
->
Bounds
[
3
])
// invalid bounds ? compute them
if
(
!
(
this
->
Bounds
[
0
]
<=
this
->
Bounds
[
1
]
&&
this
->
Bounds
[
2
]
>
this
->
Bounds
[
3
]))
{
this
->
ComputeBounds
();
}
...
...
@@ -119,17 +121,36 @@ void vtkControlPointsItem::ResetBounds()
//-----------------------------------------------------------------------------
void
vtkControlPointsItem
::
ComputeBounds
()
{
this
->
Bounds
[
0
]
=
this
->
Bounds
[
2
]
=
VTK_DOUBLE_MAX
;
this
->
Bounds
[
1
]
=
this
->
Bounds
[
3
]
=
-
VTK_DOUBLE_MAX
;
double
oldBounds
[
4
];
oldBounds
[
0
]
=
this
->
Bounds
[
0
];
oldBounds
[
1
]
=
this
->
Bounds
[
1
];
oldBounds
[
2
]
=
this
->
Bounds
[
2
];
oldBounds
[
3
]
=
this
->
Bounds
[
3
];
this
->
ComputeBounds
(
this
->
Bounds
);
if
(
this
->
Bounds
[
0
]
!=
oldBounds
[
0
]
||
this
->
Bounds
[
1
]
!=
oldBounds
[
1
]
||
this
->
Bounds
[
2
]
!=
oldBounds
[
2
]
||
this
->
Bounds
[
3
]
!=
oldBounds
[
3
])
{
this
->
Modified
();
}
}
//-----------------------------------------------------------------------------
void
vtkControlPointsItem
::
ComputeBounds
(
double
*
bounds
)
{
bounds
[
0
]
=
bounds
[
2
]
=
VTK_DOUBLE_MAX
;
bounds
[
1
]
=
bounds
[
3
]
=
-
VTK_DOUBLE_MAX
;
for
(
vtkIdType
i
=
0
;
i
<
this
->
GetNumberOfPoints
();
++
i
)
{
double
point
[
4
];
this
->
GetControlPoint
(
i
,
point
);
this
->
Bounds
[
0
]
=
std
::
min
(
this
->
Bounds
[
0
],
point
[
0
]);
this
->
Bounds
[
1
]
=
std
::
max
(
this
->
Bounds
[
1
],
point
[
0
]);
this
->
Bounds
[
2
]
=
std
::
min
(
this
->
Bounds
[
2
],
point
[
1
]);
this
->
Bounds
[
3
]
=
std
::
max
(
this
->
Bounds
[
3
],
point
[
1
]);
this
->
Modified
();
bounds
[
0
]
=
std
::
min
(
bounds
[
0
],
point
[
0
]);
bounds
[
1
]
=
std
::
max
(
bounds
[
1
],
point
[
0
]);
bounds
[
2
]
=
std
::
min
(
bounds
[
2
],
point
[
1
]);
bounds
[
3
]
=
std
::
max
(
bounds
[
3
],
point
[
1
]);
}
}
...
...
@@ -580,40 +601,23 @@ vtkIdType vtkControlPointsItem::GetControlPointId(double* point)
}
//-----------------------------------------------------------------------------
v
tkIdType
vtkControlPointsItem
::
AddPoint
(
double
*
newPos
)
v
oid
vtkControlPointsItem
::
AddPoint
Id
(
vtkIdType
addedPointId
)
{
assert
(
addedPointId
!=
-
1
);
// offset all the point ids
const
int
pointsCount
=
this
->
GetNumberOfPoints
();
vtkIdType
previousPointId
=
pointsCount
;
for
(
vtkIdType
i
=
0
;
i
<
pointsCount
;
++
i
)
{
double
point
[
4
];
this
->
GetControlPoint
(
i
,
point
);
if
(
point
[
0
]
>=
newPos
[
0
])
{
previousPointId
=
i
-
1
;
break
;
}
}
if
(
previousPointId
==
pointsCount
)
{
return
previousPointId
;
}
const
int
selectionCount
=
this
->
Selection
->
GetNumberOfTuples
();
for
(
vtkIdType
i
=
0
;
i
<
selectionCount
;
++
i
)
{
vtkIdType
pointId
=
this
->
Selection
->
GetValue
(
i
);
if
(
pointId
>
previous
PointId
)
if
(
pointId
>
=
added
PointId
)
{
this
->
Selection
->
SetValue
(
i
,
++
pointId
);
}
}
if
(
this
->
CurrentPoint
!=
-
1
&&
this
->
CurrentPoint
>=
previousPointId
)