Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
ParaView
ParaView
Commits
8ff63775
Commit
8ff63775
authored
Sep 25, 2012
by
Sebastien Jourdain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix id management for representation delivery
Change-Id: If6181d6753312ebc7148d163e91dd0d18c8f02b3
parent
5f490998
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
124 additions
and
50 deletions
+124
-50
ParaViewCore/ClientServerCore/Rendering/vtkCompositeRepresentation.cxx
...ClientServerCore/Rendering/vtkCompositeRepresentation.cxx
+3
-0
ParaViewCore/ClientServerCore/Rendering/vtkCompositeSliceRepresentation.cxx
...tServerCore/Rendering/vtkCompositeSliceRepresentation.cxx
+10
-0
ParaViewCore/ClientServerCore/Rendering/vtkCompositeSliceRepresentation.h
...entServerCore/Rendering/vtkCompositeSliceRepresentation.h
+5
-0
ParaViewCore/ClientServerCore/Rendering/vtkPVCompositeRepresentation.cxx
...ientServerCore/Rendering/vtkPVCompositeRepresentation.cxx
+10
-0
ParaViewCore/ClientServerCore/Rendering/vtkPVCompositeRepresentation.h
...ClientServerCore/Rendering/vtkPVCompositeRepresentation.h
+5
-0
ParaViewCore/ClientServerCore/Rendering/vtkPVDataDeliveryManager.cxx
...e/ClientServerCore/Rendering/vtkPVDataDeliveryManager.cxx
+7
-42
ParaViewCore/ClientServerCore/Rendering/vtkPVDataDeliveryManager.h
...ore/ClientServerCore/Rendering/vtkPVDataDeliveryManager.h
+1
-2
ParaViewCore/ClientServerCore/Rendering/vtkPVDataRepresentation.cxx
...re/ClientServerCore/Rendering/vtkPVDataRepresentation.cxx
+17
-0
ParaViewCore/ClientServerCore/Rendering/vtkPVDataRepresentation.h
...Core/ClientServerCore/Rendering/vtkPVDataRepresentation.h
+20
-0
ParaViewCore/ClientServerCore/Rendering/vtkPVRenderView.cxx
ParaViewCore/ClientServerCore/Rendering/vtkPVRenderView.cxx
+1
-6
ParaViewCore/ClientServerCore/Rendering/vtkSelectionRepresentation.cxx
...ClientServerCore/Rendering/vtkSelectionRepresentation.cxx
+10
-0
ParaViewCore/ClientServerCore/Rendering/vtkSelectionRepresentation.h
...e/ClientServerCore/Rendering/vtkSelectionRepresentation.h
+5
-0
ParaViewCore/ServerManager/Rendering/vtkSMRepresentationProxy.cxx
...Core/ServerManager/Rendering/vtkSMRepresentationProxy.cxx
+27
-0
ParaViewCore/ServerManager/Rendering/vtkSMRepresentationProxy.h
...ewCore/ServerManager/Rendering/vtkSMRepresentationProxy.h
+3
-0
No files found.
ParaViewCore/ClientServerCore/Rendering/vtkCompositeRepresentation.cxx
View file @
8ff63775
...
...
@@ -77,6 +77,9 @@ void vtkCompositeRepresentation::AddRepresentation(
{
assert
(
repr
!=
NULL
&&
key
!=
NULL
);
// Make sure the representation that we register is already initialized
repr
->
Initialize
(
1
,
0
);
// Should abort if no initialized as 1 > 0
if
(
this
->
Internals
->
Representations
.
find
(
key
)
!=
this
->
Internals
->
Representations
.
end
())
{
...
...
ParaViewCore/ClientServerCore/Rendering/vtkCompositeSliceRepresentation.cxx
View file @
8ff63775
...
...
@@ -370,3 +370,13 @@ vtkDataObject* vtkCompositeSliceRepresentation::GetRenderedDataObject(int vtkNot
{
return
this
->
InternalSliceFilter
->
GetInputDataObject
(
0
,
0
);
}
//----------------------------------------------------------------------------
unsigned
int
vtkCompositeSliceRepresentation
::
Initialize
(
unsigned
int
minIdAvailable
,
unsigned
int
maxIdAvailable
)
{
unsigned
int
newMin
=
this
->
OutlineRepresentation
->
Initialize
(
minIdAvailable
,
maxIdAvailable
);
return
this
->
Superclass
::
Initialize
(
newMin
,
maxIdAvailable
);
}
ParaViewCore/ClientServerCore/Rendering/vtkCompositeSliceRepresentation.h
View file @
8ff63775
...
...
@@ -72,6 +72,11 @@ public:
// Override to provide input array name regardless if any slice cut the actual data.
virtual
vtkDataObject
*
GetRenderedDataObject
(
int
port
);
// Description:
// Override because of internal composite representations that need to be
// initilized as well.
virtual
unsigned
int
Initialize
(
unsigned
int
minIdAvailable
,
unsigned
int
maxIdAvailable
);
//BTX
protected:
vtkCompositeSliceRepresentation
();
...
...
ParaViewCore/ClientServerCore/Rendering/vtkPVCompositeRepresentation.cxx
View file @
8ff63775
...
...
@@ -235,3 +235,13 @@ void vtkPVCompositeRepresentation::PrintSelf(ostream& os, vtkIndent indent)
{
this
->
Superclass
::
PrintSelf
(
os
,
indent
);
}
//----------------------------------------------------------------------------
unsigned
int
vtkPVCompositeRepresentation
::
Initialize
(
unsigned
int
minIdAvailable
,
unsigned
int
maxIdAvailable
)
{
unsigned
int
minId
=
minIdAvailable
;
minId
=
this
->
CubeAxesRepresentation
->
Initialize
(
minId
,
maxIdAvailable
);
minId
=
this
->
SelectionRepresentation
->
Initialize
(
minId
,
maxIdAvailable
);
return
this
->
Superclass
::
Initialize
(
minId
,
maxIdAvailable
);
}
ParaViewCore/ClientServerCore/Rendering/vtkPVCompositeRepresentation.h
View file @
8ff63775
...
...
@@ -79,6 +79,11 @@ public:
virtual
void
SetPointFieldDataArrayName
(
const
char
*
);
virtual
void
SetCellFieldDataArrayName
(
const
char
*
);
// Description:
// Override because of internal composite representations that need to be
// initilized as well.
virtual
unsigned
int
Initialize
(
unsigned
int
minIdAvailable
,
unsigned
int
maxIdAvailable
);
//BTX
protected:
vtkPVCompositeRepresentation
();
...
...
ParaViewCore/ClientServerCore/Rendering/vtkPVDataDeliveryManager.cxx
View file @
8ff63775
...
...
@@ -182,16 +182,7 @@ public:
vtkItem
*
GetItem
(
vtkPVDataRepresentation
*
repr
,
bool
use_second
)
{
RepresentationToIdMapType
::
iterator
iter
=
this
->
RepresentationToIdMap
.
find
(
repr
);
if
(
iter
!=
this
->
RepresentationToIdMap
.
end
())
{
unsigned
int
index
=
iter
->
second
;
return
use_second
?
&
(
this
->
ItemsMap
[
index
].
second
)
:
&
(
this
->
ItemsMap
[
index
].
first
);
}
return
NULL
;
return
this
->
GetItem
(
repr
->
GetUniqueIdentifier
(),
use_second
);
}
unsigned
long
GetVisibleDataSize
(
bool
use_second_if_available
)
...
...
@@ -212,10 +203,6 @@ public:
return
size
;
}
typedef
std
::
map
<
vtkPVDataRepresentation
*
,
unsigned
int
>
RepresentationToIdMapType
;
RepresentationToIdMapType
RepresentationToIdMap
;
ItemsMapType
ItemsMap
;
};
//*****************************************************************************
...
...
@@ -349,47 +336,25 @@ unsigned long vtkPVDataDeliveryManager::GetVisibleDataSize(bool low_res)
}
//----------------------------------------------------------------------------
void
vtkPVDataDeliveryManager
::
RegisterRepresentation
(
unsigned
int
id
,
vtkPVDataRepresentation
*
repr
)
void
vtkPVDataDeliveryManager
::
RegisterRepresentation
(
vtkPVDataRepresentation
*
repr
)
{
this
->
Internals
->
RepresentationToIdMap
[
repr
]
=
id
;
assert
(
"A representation must have a valid UniqueIdentifier"
&&
repr
->
GetUniqueIdentifier
());
vtkInternals
::
vtkItem
item
;
item
.
Representation
=
repr
;
this
->
Internals
->
ItemsMap
[
id
].
first
=
item
;
this
->
Internals
->
ItemsMap
[
repr
->
GetUniqueIdentifier
()
].
first
=
item
;
vtkInternals
::
vtkItem
item2
;
item2
.
Representation
=
repr
;
this
->
Internals
->
ItemsMap
[
id
].
second
=
item2
;
this
->
Internals
->
ItemsMap
[
repr
->
GetUniqueIdentifier
()
].
second
=
item2
;
}
//----------------------------------------------------------------------------
void
vtkPVDataDeliveryManager
::
UnRegisterRepresentation
(
vtkPVDataRepresentation
*
repr
)
{
vtkInternals
::
RepresentationToIdMapType
::
iterator
iter
=
this
->
Internals
->
RepresentationToIdMap
.
find
(
repr
);
if
(
iter
==
this
->
Internals
->
RepresentationToIdMap
.
end
())
{
vtkErrorMacro
(
"Invalid argument."
);
return
;
}
this
->
Internals
->
ItemsMap
.
erase
(
iter
->
second
);
this
->
Internals
->
RepresentationToIdMap
.
erase
(
iter
);
}
//----------------------------------------------------------------------------
unsigned
int
vtkPVDataDeliveryManager
::
GetRepresentationId
(
vtkPVDataRepresentation
*
repr
)
{
vtkInternals
::
RepresentationToIdMapType
::
iterator
iter
=
this
->
Internals
->
RepresentationToIdMap
.
find
(
repr
);
if
(
iter
==
this
->
Internals
->
RepresentationToIdMap
.
end
())
{
vtkErrorMacro
(
"Invalid argument."
);
return
0
;
}
return
iter
->
second
;
this
->
Internals
->
ItemsMap
.
erase
(
repr
->
GetUniqueIdentifier
());
}
//----------------------------------------------------------------------------
...
...
ParaViewCore/ClientServerCore/Rendering/vtkPVDataDeliveryManager.h
View file @
8ff63775
...
...
@@ -51,9 +51,8 @@ public:
// makes it possible for representations to communicate with the storage
// directly using a self pointer, while enables views on different processes
// to communicate information about representations using their unique ids.
void
RegisterRepresentation
(
unsigned
int
id
,
vtkPVDataRepresentation
*
);
void
RegisterRepresentation
(
vtkPVDataRepresentation
*
repr
);
void
UnRegisterRepresentation
(
vtkPVDataRepresentation
*
);
unsigned
int
GetRepresentationId
(
vtkPVDataRepresentation
*
);
vtkPVDataRepresentation
*
GetRepresentation
(
unsigned
int
);
// Description:
...
...
ParaViewCore/ClientServerCore/Rendering/vtkPVDataRepresentation.cxx
View file @
8ff63775
...
...
@@ -48,6 +48,8 @@ vtkPVDataRepresentation::vtkPVDataRepresentation()
this
->
ForcedCacheKey
=
0.0
;
this
->
NeedUpdate
=
true
;
this
->
UniqueIdentifier
=
0
;
}
//----------------------------------------------------------------------------
...
...
@@ -79,6 +81,7 @@ vtkExecutive* vtkPVDataRepresentation::CreateDefaultExecutive()
int
vtkPVDataRepresentation
::
ProcessViewRequest
(
vtkInformationRequestKey
*
request
,
vtkInformation
*
,
vtkInformation
*
)
{
assert
(
"We must have an ID at that time"
&&
this
->
UniqueIdentifier
);
assert
(
this
->
GetExecutive
()
->
IsA
(
"vtkPVDataRepresentationPipeline"
));
if
(
this
->
GetVisibility
()
==
false
)
{
...
...
@@ -100,6 +103,20 @@ void vtkPVDataRepresentation::MarkModified()
this
->
NeedUpdate
=
true
;
}
//----------------------------------------------------------------------------
unsigned
int
vtkPVDataRepresentation
::
Initialize
(
unsigned
int
minIdAvailable
,
unsigned
int
maxIdAvailable
)
{
// Already initialized ?
if
(
this
->
UniqueIdentifier
)
{
return
minIdAvailable
;
}
assert
(
"Invalid Representation Id. Not enough reserved ids."
&&
(
maxIdAvailable
>=
minIdAvailable
));
this
->
UniqueIdentifier
=
minIdAvailable
;
return
(
1
+
this
->
UniqueIdentifier
);
}
//----------------------------------------------------------------------------
int
vtkPVDataRepresentation
::
RequestData
(
vtkInformation
*
,
vtkInformationVector
**
,
vtkInformationVector
*
)
...
...
ParaViewCore/ClientServerCore/Rendering/vtkPVDataRepresentation.h
View file @
8ff63775
...
...
@@ -63,6 +63,25 @@ public:
// update-suppressor.
virtual
void
MarkModified
();
// Description:
// Initialize the representation with an identifier range so each internal
// representation can own a unique ID.
// If a representation requires more IDs than the set of ids provided,
// the representation MUST complains by an error or abort explaining how many
// ids where expected so the number of reserved ids could be easily adjust.
// Unless noted otherwise, this method must be called before calling any
// other methods on this class.
// @CallOnAllProcessess
// Internally you can pick an id that follow that condition
// minIdAvailable <= id <= maxIdAvailable
// Return the minIdAvailable after initialization so that new range could be used
virtual
unsigned
int
Initialize
(
unsigned
int
minIdAvailable
,
unsigned
int
maxIdAvailable
);
// Description:
// Return 0 if the Initialize() method was not called otherwise a unique ID
// that will be shared across the processes for that same object.
unsigned
int
GetUniqueIdentifier
()
{
return
this
->
UniqueIdentifier
;
}
// Description:
// Get/Set the visibility for this representation. When the visibility of
// representation of false, all view passes are ignored.
...
...
@@ -172,6 +191,7 @@ protected:
double
UpdateTime
;
bool
UpdateTimeValid
;
unsigned
int
UniqueIdentifier
;
private:
vtkPVDataRepresentation
(
const
vtkPVDataRepresentation
&
);
// Not implemented
void
operator
=
(
const
vtkPVDataRepresentation
&
);
// Not implemented
...
...
ParaViewCore/ClientServerCore/Rendering/vtkPVRenderView.cxx
View file @
8ff63775
...
...
@@ -83,12 +83,8 @@ class vtkPVRenderView::vtkInternals
std
::
map
<
int
,
vtkWeakPointer
<
vtkPVDataRepresentation
>
>
PropMap
;
public:
unsigned
int
UniqueId
;
vtkNew
<
vtkPVDataDeliveryManager
>
DeliveryManager
;
vtkInternals
()
:
UniqueId
(
1
)
{
}
void
RegisterSelectionProp
(
int
id
,
vtkProp
*
,
vtkPVDataRepresentation
*
rep
)
{
...
...
@@ -384,8 +380,7 @@ void vtkPVRenderView::AddRepresentationInternal(vtkDataRepresentation* rep)
// We only increase that counter when widget are not involved as in
// collaboration mode only the master has the widget in its representation
this
->
SynchronizationCounter
++
;
unsigned
int
id
=
this
->
Internals
->
UniqueId
++
;
this
->
Internals
->
DeliveryManager
->
RegisterRepresentation
(
id
,
dataRep
);
this
->
Internals
->
DeliveryManager
->
RegisterRepresentation
(
dataRep
);
}
this
->
Superclass
::
AddRepresentationInternal
(
rep
);
...
...
ParaViewCore/ClientServerCore/Rendering/vtkSelectionRepresentation.cxx
View file @
8ff63775
...
...
@@ -279,3 +279,13 @@ void vtkSelectionRepresentation::SetCellFieldDataArrayName(const char* val)
{
this
->
LabelRepresentation
->
SetCellFieldDataArrayName
(
val
);
}
//----------------------------------------------------------------------------
unsigned
int
vtkSelectionRepresentation
::
Initialize
(
unsigned
int
minIdAvailable
,
unsigned
int
maxIdAvailable
)
{
unsigned
int
minId
=
minIdAvailable
;
minId
=
this
->
LabelRepresentation
->
Initialize
(
minId
,
maxIdAvailable
);
minId
=
this
->
GeometryRepresentation
->
Initialize
(
minId
,
maxIdAvailable
);
return
this
->
Superclass
::
Initialize
(
minId
,
maxIdAvailable
);
}
ParaViewCore/ClientServerCore/Rendering/vtkSelectionRepresentation.h
View file @
8ff63775
...
...
@@ -92,6 +92,11 @@ public:
virtual
void
SetPointFieldDataArrayName
(
const
char
*
val
);
virtual
void
SetCellFieldDataArrayName
(
const
char
*
val
);
// Description:
// Override because of internal composite representations that need to be
// initilized as well.
virtual
unsigned
int
Initialize
(
unsigned
int
minIdAvailable
,
unsigned
int
maxIdAvailable
);
//BTX
protected:
vtkSelectionRepresentation
();
...
...
ParaViewCore/ServerManager/Rendering/vtkSMRepresentationProxy.cxx
View file @
8ff63775
...
...
@@ -24,6 +24,8 @@
#include <assert.h>
#define MAX_NUMBER_OF_INTERNAL_REPRESENTATIONS 10
vtkStandardNewMacro
(
vtkSMRepresentationProxy
);
//----------------------------------------------------------------------------
vtkSMRepresentationProxy
::
vtkSMRepresentationProxy
()
...
...
@@ -56,6 +58,16 @@ void vtkSMRepresentationProxy::CreateVTKObjects()
return
;
}
// Initialize vtkPVDataRepresentation with a unique ID
vtkClientServerStream
stream
;
stream
<<
vtkClientServerStream
::
Invoke
<<
VTKOBJECT
(
this
)
<<
"Initialize"
<<
static_cast
<
unsigned
int
>
(
this
->
GetGlobalID
())
<<
static_cast
<
unsigned
int
>
(
this
->
GetGlobalID
()
+
MAX_NUMBER_OF_INTERNAL_REPRESENTATIONS
)
<<
vtkClientServerStream
::
End
;
this
->
ExecuteStream
(
stream
);
vtkObject
::
SafeDownCast
(
this
->
GetClientSideObject
())
->
AddObserver
(
vtkCommand
::
UpdateDataEvent
,
this
,
&
vtkSMRepresentationProxy
::
OnVTKRepresentationUpdated
);
...
...
@@ -279,3 +291,18 @@ void vtkSMRepresentationProxy::PrintSelf(ostream& os, vtkIndent indent)
{
this
->
Superclass
::
PrintSelf
(
os
,
indent
);
}
//---------------------------------------------------------------------------
vtkTypeUInt32
vtkSMRepresentationProxy
::
GetGlobalID
()
{
bool
has_gid
=
this
->
HasGlobalID
();
if
(
!
has_gid
&&
this
->
Session
!=
NULL
)
{
// reserve 1+MAX_NUMBER_OF_INTERNAL_REPRESENTATIONS contiguous IDs for the source proxies and possible extract
// selection proxies.
this
->
SetGlobalID
(
this
->
GetSession
()
->
GetNextChunkGlobalUniqueIdentifier
(
1
+
MAX_NUMBER_OF_INTERNAL_REPRESENTATIONS
));
}
return
this
->
GlobalID
;
}
ParaViewCore/ServerManager/Rendering/vtkSMRepresentationProxy.h
View file @
8ff63775
...
...
@@ -56,6 +56,9 @@ public:
// Called after the view updates.
virtual
void
ViewUpdated
(
vtkSMProxy
*
view
);
// Description:
// Overridden to reserve additional IDs for use by internal composite representation
virtual
vtkTypeUInt32
GetGlobalID
();
//BTX
protected:
vtkSMRepresentationProxy
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment