Attached Files | vtkCaptionActor2D.patch [^] (4,861 bytes) 1969-12-31 19:00 [Show Content] [Hide Content]diff -u version1/vtkCaptionActor2D.cxx version2/vtkCaptionActor2D.cxx
--- version1/vtkCaptionActor2D.cxx 2004-07-19 22:28:55.000000000 +0200
+++ version2/vtkCaptionActor2D.cxx 2004-07-19 22:55:17.000000000 +0200
@@ -60,6 +60,7 @@
this->Caption = NULL;
this->Border = 1;
+ this->Box = 0;
this->Leader = 1;
this->ThreeDimensionalLeader = 1;
this->LeaderGlyphSize = 0.025;
@@ -105,10 +106,28 @@
this->BorderActor = vtkActor2D::New();
this->BorderActor->SetMapper(this->BorderMapper);
- // Set border mapper coordinate system to Display.
+ // Construct the box
+ this->BoxPolyData = vtkPolyData::New();
+ this->BoxPolyData->SetPoints(this->BorderPolyData->GetPoints());
+ vtkCellArray *polys = vtkCellArray::New();
+ polys->InsertNextCell(4);
+ polys->InsertCellPoint(0);
+ polys->InsertCellPoint(1);
+ polys->InsertCellPoint(2);
+ polys->InsertCellPoint(3);
+ this->BoxPolyData->SetPolys(polys); polys->Delete();
+
+ this->BoxMapper = vtkPolyDataMapper2D::New();
+ this->BoxMapper->SetInput(this->BoxPolyData);
+
+ this->BoxActor = vtkActor2D::New();
+ this->BoxActor->SetMapper(this->BoxMapper);
+
+ // Set border and box mapper coordinate system to Display.
vtkCoordinate *coord=vtkCoordinate::New();
coord->SetCoordinateSystemToDisplay();
this->BorderMapper->SetTransformCoordinate(coord);
+ this->BoxMapper->SetTransformCoordinate(coord);
coord->Delete();
// This is for glyphing the head of the leader
@@ -187,6 +206,10 @@
this->BorderMapper->Delete();
this->BorderActor->Delete();
+ this->BoxActor->Delete();
+ this->BoxMapper->Delete();
+ this->BoxPolyData->Delete();
+
this->HeadPolyData->Delete();
this->LeaderPolyData->Delete();
this->HeadGlyph->Delete();
@@ -211,6 +234,7 @@
{
this->CaptionActor->ReleaseGraphicsResources(win);
this->BorderActor->ReleaseGraphicsResources(win);
+ this->BoxActor->ReleaseGraphicsResources(win);
this->LeaderActor2D->ReleaseGraphicsResources(win);
this->LeaderActor3D->ReleaseGraphicsResources(win);
}
@@ -219,6 +243,11 @@
{
int renderedSomething = 0;
+ if ( this->Box )
+ {
+ renderedSomething += this->BoxActor->RenderOverlay(viewport);
+ }
+
renderedSomething += this->CaptionActor->RenderOverlay(viewport);
if ( this->Border )
@@ -266,7 +295,7 @@
this->CaptionActor->GetPosition2Coordinate()->SetValue(
p3[0]-this->Padding,p3[1]-this->Padding,0.0);
- // Define the border
+ // Define the border and box
vtkPoints *pts = this->BorderPolyData->GetPoints();
pts->SetPoint(0, p2);
pts->SetPoint(1, p3[0],p2[1],p1[2]);
@@ -426,6 +455,11 @@
// Okay we are ready to render something
int renderedSomething = 0;
+ if ( this->Box )
+ {
+ renderedSomething += this->BoxActor->RenderOpaqueGeometry(viewport);
+ }
+
renderedSomething += this->CaptionActor->RenderOpaqueGeometry(viewport);
if ( this->Border )
{
@@ -489,6 +523,7 @@
}
os << indent << "Padding: " << this->Padding << "\n";
os << indent << "Border: " << (this->Border ? "On\n" : "Off\n");
+ os << indent << "Box: " << (this->Box ? "On\n" : "Off\n");
}
//----------------------------------------------------------------------------
@@ -500,6 +535,7 @@
this->SetCaption(a->GetCaption());
this->SetAttachmentPoint(a->GetAttachmentPoint());
this->SetBorder(a->GetBorder());
+ this->SetBox(a->GetBox());
this->SetLeader(a->GetLeader());
this->SetThreeDimensionalLeader(a->GetThreeDimensionalLeader());
this->SetLeaderGlyph(a->GetLeaderGlyph());
diff -u version1/vtkCaptionActor2D.h version2/vtkCaptionActor2D.h
--- version1/vtkCaptionActor2D.h 2004-07-19 22:28:45.000000000 +0200
+++ version2/vtkCaptionActor2D.h 2004-07-19 22:55:17.000000000 +0200
@@ -95,6 +95,17 @@
vtkBooleanMacro(Border,int);
// Description:
+ // Set/Get the flag that controls whether a box will be drawn/filled
+ // behind the text
+ vtkSetMacro(Box, int);
+ vtkGetMacro(Box, int);
+ vtkBooleanMacro(Box, int);
+
+ // Description:
+ // Get the box vtkProperty2D.
+ vtkProperty2D* GetBoxProperty() { return this->BoxActor->GetProperty(); };
+
+ // Description:
// Enable/disable drawing a "line" from the caption to the
// attachment point.
vtkSetMacro(Leader,int);
@@ -246,6 +257,7 @@
char *Caption;
int Border;
+ int Box;
int Leader;
int ThreeDimensionalLeader;
float LeaderGlyphSize;
@@ -263,6 +275,10 @@
vtkPolyDataMapper2D *BorderMapper;
vtkActor2D *BorderActor;
+ vtkPolyData *BoxPolyData;
+ vtkPolyDataMapper2D *BoxMapper;
+ vtkActor2D *BoxActor;
+
vtkPolyData *HeadPolyData; // single attachment point for glyphing
vtkGlyph3D *HeadGlyph; // for 3D leader
vtkPolyData *LeaderPolyData; // line represents the leader
caption.patch [^] (5,506 bytes) 1969-12-31 19:00 [Show Content] [Hide Content]Index: vtkCaptionActor2D.cxx
===================================================================
RCS file: /cvsroot/VTK/VTK/Hybrid/vtkCaptionActor2D.cxx,v
retrieving revision 1.29
diff -u -3 -p -r1.29 vtkCaptionActor2D.cxx
--- a/vtkCaptionActor2D.cxx 20 Jul 2004 18:27:45 -0000 1.29
+++ b/vtkCaptionActor2D.cxx 20 Jul 2004 18:40:22 -0000
@@ -58,6 +58,7 @@ vtkCaptionActor2D::vtkCaptionActor2D()
this->Caption = NULL;
this->Border = 1;
+ this->Box = 0;
this->Leader = 1;
this->ThreeDimensionalLeader = 1;
this->LeaderGlyphSize = 0.025;
@@ -103,10 +104,28 @@ vtkCaptionActor2D::vtkCaptionActor2D()
this->BorderActor = vtkActor2D::New();
this->BorderActor->SetMapper(this->BorderMapper);
- // Set border mapper coordinate system to Display.
+ // Construct the box
+ this->BoxPolyData = vtkPolyData::New();
+ this->BoxPolyData->SetPoints(this->BorderPolyData->GetPoints());
+ vtkCellArray *polys = vtkCellArray::New();
+ polys->InsertNextCell(4);
+ polys->InsertCellPoint(0);
+ polys->InsertCellPoint(1);
+ polys->InsertCellPoint(2);
+ polys->InsertCellPoint(3);
+ this->BoxPolyData->SetPolys(polys); polys->Delete();
+
+ this->BoxMapper = vtkPolyDataMapper2D::New();
+ this->BoxMapper->SetInput(this->BoxPolyData);
+
+ this->BoxActor = vtkActor2D::New();
+ this->BoxActor->SetMapper(this->BoxMapper);
+
+ // Set border and box mapper coordinate system to Display.
vtkCoordinate *coord = vtkCoordinate::New();
coord->SetCoordinateSystemToDisplay();
this->BorderMapper->SetTransformCoordinate(coord);
+ this->BoxMapper->SetTransformCoordinate(coord);
coord->Delete();
// This is for glyphing the head of the leader
@@ -185,6 +204,10 @@ vtkCaptionActor2D::~vtkCaptionActor2D()
this->BorderMapper->Delete();
this->BorderActor->Delete();
+ this->BoxActor->Delete();
+ this->BoxMapper->Delete();
+ this->BoxPolyData->Delete();
+
this->HeadPolyData->Delete();
this->LeaderPolyData->Delete();
this->HeadGlyph->Delete();
@@ -209,6 +232,7 @@ void vtkCaptionActor2D::ReleaseGraphicsR
{
this->CaptionActor->ReleaseGraphicsResources(win);
this->BorderActor->ReleaseGraphicsResources(win);
+ this->BoxActor->ReleaseGraphicsResources(win);
this->LeaderActor2D->ReleaseGraphicsResources(win);
this->LeaderActor3D->ReleaseGraphicsResources(win);
}
@@ -217,6 +241,11 @@ int vtkCaptionActor2D::RenderOverlay(vtk
{
int renderedSomething = 0;
+ if ( this->Box )
+ {
+ renderedSomething += this->BoxActor->RenderOverlay(viewport);
+ }
+
renderedSomething += this->CaptionActor->RenderOverlay(viewport);
if ( this->Border )
@@ -264,7 +293,7 @@ int vtkCaptionActor2D::RenderOpaqueGeome
this->CaptionActor->GetPosition2Coordinate()->SetValue(
p3[0]-this->Padding,p3[1]-this->Padding,0.0);
- // Define the border
+ // Define the border and box
vtkPoints *pts = this->BorderPolyData->GetPoints();
pts->SetPoint(0, p2);
pts->SetPoint(1, p3[0],p2[1],p1[2]);
@@ -433,6 +462,11 @@ int vtkCaptionActor2D::RenderOpaqueGeome
// Okay we are ready to render something
int renderedSomething = 0;
+ if ( this->Box )
+ {
+ renderedSomething += this->BoxActor->RenderOpaqueGeometry(viewport);
+ }
+
renderedSomething += this->CaptionActor->RenderOpaqueGeometry(viewport);
if ( this->Border )
{
@@ -496,6 +530,7 @@ void vtkCaptionActor2D::PrintSelf(ostrea
}
os << indent << "Padding: " << this->Padding << "\n";
os << indent << "Border: " << (this->Border ? "On\n" : "Off\n");
+ os << indent << "Box: " << (this->Box ? "On\n" : "Off\n");
}
//----------------------------------------------------------------------------
@@ -507,6 +542,7 @@ void vtkCaptionActor2D::ShallowCopy(vtkP
this->SetCaption(a->GetCaption());
this->SetAttachmentPoint(a->GetAttachmentPoint());
this->SetBorder(a->GetBorder());
+ this->SetBox(a->GetBox());
this->SetLeader(a->GetLeader());
this->SetThreeDimensionalLeader(a->GetThreeDimensionalLeader());
this->SetLeaderGlyph(a->GetLeaderGlyph());
Index: vtkCaptionActor2D.h
===================================================================
RCS file: /cvsroot/VTK/VTK/Hybrid/vtkCaptionActor2D.h,v
retrieving revision 1.14
diff -u -3 -p -r1.14 vtkCaptionActor2D.h
--- a/vtkCaptionActor2D.h 12 Dec 2003 19:57:16 -0000 1.14
+++ b/vtkCaptionActor2D.h 20 Jul 2004 18:40:22 -0000
@@ -92,6 +92,17 @@ public:
vtkBooleanMacro(Border,int);
// Description:
+ // Set/Get the flag that controls whether a box will be drawn/filled
+ // behind the text
+ vtkSetMacro(Box, int);
+ vtkGetMacro(Box, int);
+ vtkBooleanMacro(Box, int);
+
+ // Description:
+ // Get the box vtkProperty2D.
+ vtkProperty2D* GetBoxProperty() { return this->BoxActor->GetProperty(); };
+
+ // Description:
// Enable/disable drawing a "line" from the caption to the
// attachment point.
vtkSetMacro(Leader,int);
@@ -168,6 +179,7 @@ protected:
char *Caption;
int Border;
+ int Box;
int Leader;
int ThreeDimensionalLeader;
double LeaderGlyphSize;
@@ -185,6 +197,10 @@ private:
vtkPolyDataMapper2D *BorderMapper;
vtkActor2D *BorderActor;
+ vtkPolyData *BoxPolyData;
+ vtkPolyDataMapper2D *BoxMapper;
+ vtkActor2D *BoxActor;
+
vtkPolyData *HeadPolyData; // single attachment point for glyphing
vtkGlyph3D *HeadGlyph; // for 3D leader
vtkPolyData *LeaderPolyData; // line represents the leader
|