DATAKIT API  V2025.1
testlibpdfwrite.cpp File Reference

Functions

void AssignFacesColors (Dtk_MeshPtr &meshCube)
 
Dtk_ErrorStatus PdfwCreate3DAnnotations (Dtk_Double64 annotBBox[4], const Dtk_UInt32 &artworkIndex)
 
Dtk_ErrorStatus PdfwCreateViews ()
 
int PdfWriteSample (const Dtk_string &inResultDirectory)
 
Dtk_ErrorStatus PdfwSample_MV_association_5_3 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus PdfwSampleAsmInstances_3_3 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus PdfwSampleAssembly_3_1 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus PdfwSampleAxis_References_5_7 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus PdfwSampleBillboard_7_1 (const Dtk_string &inOutputFileName, const Dtk_string &inImageDirectory)
 
Dtk_ErrorStatus PdfwSampleBody_2_1 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus PdfwSampleBodyVisibility_2_3 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus PdfwSampleCloudPoint_6_1 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus PdfwSampleDocumentProperties_4_2 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus PdfwSampleInstancesColors_3_4 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus PdfwSampleInstancesVisibility_3_5 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus PdfwSampleLayoutMultipleViews_9_1 (const Dtk_string &pdfFileName)
 
Dtk_ErrorStatus PdfwSampleMeshes_1_2 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus PdfwSampleMetadatas_4_1 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus PdfwSampleModelview_section_5_5 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus PdfwSampleOneMesh_1_1 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus PdfwSampleOneMeshRender_1_3 (const Dtk_string &inOutputFileName, const Dtk_string &inImageDirectory)
 
Dtk_ErrorStatus PdfwSamplePartInstances_3_2 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus PdfwSamplePMI_Geom_association_5_4 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus PdfwSamplePMI_PMI_association_5_6 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus PdfwSampleSecuredPdf_8_1 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus PdfwSampleSimpleModelview_5_2 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus PdfwSampleSimplePMI_5_1 (const Dtk_string &inOutputFileName)
 
Dtk_ErrorStatus PdfwSampleWireBody_2_2 (const Dtk_string &inOutputFileName)
 
template<typename T >
void Shift (T &mesh, double sh)
 

Function Documentation

◆ AssignFacesColors()

void AssignFacesColors ( Dtk_MeshPtr meshCube)
967 {
968  for( Dtk_Size_t i = 1; i < 6; i++ )
969  meshCube->get_mesh_face( i )->info() = Dtk_Info::create();
970  meshCube->get_mesh_face( 1 )->info()->SetColor( Dtk_RGB( 0, 255, 0 ) );
971  meshCube->get_mesh_face( 2 )->info()->SetColor( Dtk_RGB( 0, 0, 255 ) );
972  meshCube->get_mesh_face( 3 )->info()->SetColor( Dtk_RGB( 255, 255, 0 ) );
973  meshCube->get_mesh_face( 4 )->info()->SetColor( Dtk_RGB( 255, 0, 255 ) );
974  meshCube->get_mesh_face( 5 )->info()->SetColor( Dtk_RGB( 0, 255, 255 ) );
975 }

◆ PdfwCreate3DAnnotations()

Dtk_ErrorStatus PdfwCreate3DAnnotations ( Dtk_Double64  annotBBox[4],
const Dtk_UInt32 artworkIndex 
)
926 {
927  Dtk_Double64 margin = 3.0;
930 
931  // first annotation 2d bbox (top right)
932  annotBBox[ 0 ] = margin / 2. + xPos;
933  annotBBox[ 1 ] = margin / 2. + yPos;
934  annotBBox[ 2 ] = xPos + width - margin;
935  annotBBox[ 3 ] = yPos + height - margin;
936 
937  CHECK_OK( Pdfw::Layout::Create3DAnnotation( artworkIndex, annotBBox, 0 ) );
938 
939  // second annotation 2d bbox (top left)
940  xPos = 0.0;
941  annotBBox[ 0 ] = margin + xPos;
942  annotBBox[ 1 ] = margin / 2. + yPos;
943  annotBBox[ 2 ] = xPos + width - margin / 2.;
944  annotBBox[ 3 ] = yPos + height - margin;
945  CHECK_OK( Pdfw::Layout::Create3DAnnotation( artworkIndex, annotBBox, 1 ) );
946 
947  // third annotation 2d bbox (bottom left)
948  yPos = 0.0;
949  annotBBox[ 0 ] = margin + xPos;
950  annotBBox[ 1 ] = margin + yPos;
951  annotBBox[ 2 ] = xPos + width - margin / 2.;
952  annotBBox[ 3 ] = yPos + height - margin / 2.;
953  CHECK_OK( Pdfw::Layout::Create3DAnnotation( artworkIndex, annotBBox, 2 ) );
954 
955  // fourth annotation 2d bbox (bottom right)
956  xPos = Pdfw::Layout::GetCurrentPageWidth() / 2.0;
957  annotBBox[ 0 ] = margin / 2. + xPos;
958  annotBBox[ 1 ] = margin + yPos;
959  annotBBox[ 2 ] = xPos + width - margin;
960  annotBBox[ 3 ] = yPos + height - margin / 2.;
961  CHECK_OK( Pdfw::Layout::Create3DAnnotation( artworkIndex, annotBBox, 3 ) );
962 
963  return dtkNoError;
964 }

◆ PdfwCreateViews()

Dtk_ErrorStatus PdfwCreateViews ( )
878 {
879 
880  // iso view
881  Dtk_pnt from( 30, 30, 30 );
882  Dtk_pnt to( 0, 0, 0 );
883  Dtk_dir up( -0.57735, 0.57735, -0.57735 );
884  Dtk_CameraPtr isoCam = Dtk_Camera::Create( from, to, 10, 10, up );
885  Dtk_ModelDisplayPtr isoMd = Dtk_ModelDisplay::Create( isoCam, NULL, 1 ); // create first activated view
886  Dtk_tab<Dtk_ID> tabNodeIDs;
887  isoMd->info() = Dtk_Info::create();
888  isoMd->info()->SetName( "Iso" );
889 
890  CHECK_OK( Pdfw::CreateModelDisplayWithVisibleNodes( isoMd, tabNodeIDs ) ); // Add ModelDisplay
891 
892  // top view
893  from = Dtk_pnt( 0, 0, 300 );
894  up = Dtk_dir( 0, 1, 0 );
895  Dtk_CameraPtr topCam = Dtk_Camera::Create( from, to, 10, 10, up );
896  Dtk_ModelDisplayPtr topMd = Dtk_ModelDisplay::Create( topCam, NULL, 0 ); // create first activated view
897  topMd->info() = Dtk_Info::create();
898  topMd->info()->SetName( "Top" );
899 
900  CHECK_OK( Pdfw::CreateModelDisplayWithVisibleNodes( topMd, tabNodeIDs ) ); // Add ModelDisplay
901 
902  // Front view
903  from = Dtk_pnt( 0, -300, 0 );
904  up = Dtk_dir( 0, 0, 1 );
905  Dtk_CameraPtr frontCam = Dtk_Camera::Create( from, to, 10, 10, up );
906  Dtk_ModelDisplayPtr frontMd = Dtk_ModelDisplay::Create( frontCam, NULL, 0 ); // create first activated view
907  frontMd->info() = Dtk_Info::create();
908  frontMd->info()->SetName( "Front" );
909 
910  CHECK_OK( Pdfw::CreateModelDisplayWithVisibleNodes( frontMd, tabNodeIDs ) ); // Add ModelDisplay
911 
912  // right view
913  from = Dtk_pnt( 300, 0, 0 );
914  up = Dtk_dir( 0, 0, 1 );
915  Dtk_CameraPtr rightCam = Dtk_Camera::Create( from, to, 10, 10, up );
916  Dtk_ModelDisplayPtr rightMd = Dtk_ModelDisplay::Create( rightCam, NULL, 0 ); // create first activated view
917  rightMd->info() = Dtk_Info::create();
918  rightMd->info()->SetName( "Right" );
919 
920  CHECK_OK( Pdfw::CreateModelDisplayWithVisibleNodes( rightMd, tabNodeIDs ) ); // Add ModelDisplay
921 
922  return dtkNoError;
923 }

◆ PdfWriteSample()

int PdfWriteSample ( const Dtk_string inResultDirectory)
1031 {
1032  Dtk_ErrorStatus errStatus;
1033  cout << endl << "----------------------------------------------" << endl;
1034  cout << "Pdf Write start" << endl;
1035 
1036  Dtk_string imageDirectory = inResultDirectory + L"../InputImages/";
1037  Dtk_string outputDirectory;
1038 
1039  // Choosing output directory and file name
1040  outputDirectory = inResultDirectory + L"dtk/Pdf/";
1041  outputDirectory.FixPathSeparator();
1042  outputDirectory.mkdir();
1043 
1044  Dtk_string pdfFileName = outputDirectory + L"PDFW_SampleOneMesh_1_1.pdf";
1045  errStatus = PdfwSampleOneMesh_1_1( pdfFileName );
1046 
1047  pdfFileName = outputDirectory + L"PDFW_SampleMeshes_1_2.pdf";
1048  errStatus = PdfwSampleMeshes_1_2( pdfFileName );
1049 
1050  pdfFileName = outputDirectory + L"PDFW_SampleOneMeshRender_1_3.pdf";
1051  errStatus = PdfwSampleOneMeshRender_1_3( pdfFileName, imageDirectory );
1052 
1053  pdfFileName = outputDirectory + L"PDFW_SampleBody_2_1.pdf";
1054  errStatus = PdfwSampleBody_2_1( pdfFileName );
1055 
1056  pdfFileName = outputDirectory + L"PDFW_SampleWireBody_2_2.pdf";
1057  errStatus = PdfwSampleWireBody_2_2( pdfFileName );
1058 
1059  pdfFileName = outputDirectory + L"PDFW_SampleBodyVisibility_2_3.pdf";
1060  errStatus = PdfwSampleBodyVisibility_2_3( pdfFileName );
1061 
1062  pdfFileName = outputDirectory + L"PDFW_SampleAssembly_3_1.pdf";
1063  errStatus = PdfwSampleAssembly_3_1( pdfFileName );
1064 
1065  pdfFileName = outputDirectory + L"PDFW_SamplePartInstances_3_2.pdf";
1066  errStatus = PdfwSamplePartInstances_3_2( pdfFileName );
1067 
1068  pdfFileName = outputDirectory + L"PDFW_SampleAsmInstances_3_3.pdf";
1069  errStatus = PdfwSampleAsmInstances_3_3( pdfFileName );
1070 
1071  pdfFileName = outputDirectory + L"PDFW_SampleInstancesColors_3_4.pdf";
1072  errStatus = PdfwSampleInstancesColors_3_4( pdfFileName );
1073 
1074  pdfFileName = outputDirectory + L"PDFW_SampleInstancesVisibility_3_5.pdf";
1075  errStatus = PdfwSampleInstancesVisibility_3_5( pdfFileName );
1076 
1077  pdfFileName = outputDirectory + L"PDFW_SampleMetadatas_4_1.pdf";
1078  errStatus = PdfwSampleMetadatas_4_1( pdfFileName );
1079 
1080  pdfFileName = outputDirectory + L"PDFW_SampleDocumentProperties_4_2.pdf";
1081  errStatus = PdfwSampleDocumentProperties_4_2( pdfFileName );
1082 
1083  pdfFileName = outputDirectory + L"PDFW_SampleSimplePMI_5_1.pdf";
1084  errStatus = PdfwSampleSimplePMI_5_1( pdfFileName );
1085 
1086  pdfFileName = outputDirectory + L"PDFW_SampleSimpleModelview_5_2.pdf";
1087  errStatus = PdfwSampleSimpleModelview_5_2( pdfFileName );
1088 
1089  pdfFileName = outputDirectory + L"PDFW_Sample_MV_association_5_3.pdf";
1090  errStatus = PdfwSample_MV_association_5_3( pdfFileName );
1091 
1092  pdfFileName = outputDirectory + L"PDFW_SamplePMI_Geom_association_5_4.pdf";
1093  errStatus = PdfwSamplePMI_Geom_association_5_4( pdfFileName );
1094 
1095  pdfFileName = outputDirectory + L"PDFW_SampleModelview_sections_5_5.pdf";
1096  errStatus = PdfwSampleModelview_section_5_5( pdfFileName );
1097 
1098  pdfFileName = outputDirectory + L"PDFW_SamplePMI_PMI_association_5_6.pdf";
1099  errStatus = PdfwSamplePMI_PMI_association_5_6( pdfFileName );
1100 
1101  pdfFileName = outputDirectory + L"PDFW_SampleAxis_References_5_7.pdf";
1102  errStatus = PdfwSampleAxis_References_5_7( pdfFileName );
1103 
1104  pdfFileName = outputDirectory + L"PDFW_SampleCloudPoint_6_1.pdf";
1105  errStatus = PdfwSampleCloudPoint_6_1( pdfFileName );
1106 
1107  pdfFileName = outputDirectory + L"PDFW_SampleBillboard_7_1.pdf";
1108 
1109  errStatus = PdfwSampleBillboard_7_1( pdfFileName, imageDirectory );
1110 
1111  pdfFileName = outputDirectory + L"PDFW_SampleSecuredPdf_8_1.pdf";
1112  errStatus = PdfwSampleSecuredPdf_8_1( pdfFileName );
1113 
1114  pdfFileName = outputDirectory + L"PDFW_SampleLayoutMultipleViews_9_1.pdf";
1115  errStatus = PdfwSampleLayoutMultipleViews_9_1( pdfFileName );
1116 
1117  cout << "Pdf Write end" << endl;
1118 
1119  return errStatus;
1120 }

◆ PdfwSample_MV_association_5_3()

Dtk_ErrorStatus PdfwSample_MV_association_5_3 ( const Dtk_string inOutputFileName)
587 {
588 
590  Pdfw::WriteOptions options;
591  Dtk_ID cylID, datumID;
592 
593  options.CreateDefaultView = DTK_FALSE; // no default view needed
594  // First we initialize writing with name of files
595  CHECK_OK( Pdfw::InitWrite( inOutputFileName, "", NULL, options ) );
596 
597  Dtk_BodyPtr cylinder = sampleWriter::CreateCyl( 100, 150 ); // Create a Cylinder radius=100, height=150 (with a green face)
598  cylinder->info()->SetName( "Body" );
599  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( cylinder ), cylID ) ); // Add the body
600 
601  Dtk_FdtPtr pmi = sampleWriter::CreateFdtDatum(); // Create an FDT (PMI)
602  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( pmi ), datumID ) ); // Add the PMI
603 
604 
606 
607  Dtk_tab<Dtk_ID> tabNodeIDs;
608  tabNodeIDs.push_back( cylID );
609  CHECK_OK( Pdfw::CreateModelDisplayWithVisibleNodes( mv, tabNodeIDs ) ); // create the model display with visible nodes
610 
611  Dtk_ModelDisplayPtr mv2 = Dtk_ModelDisplay::Create( mv->GetCamera(), NULL, 0 );// create desactivated model display
612  mv2->info() = Dtk_Info::create();
613  mv2->info()->SetName( "PMIView" );
614  tabNodeIDs.clear();
615  tabNodeIDs.push_back( cylID );
616  tabNodeIDs.push_back( datumID );
617  CHECK_OK( Pdfw::CreateModelDisplayWithVisibleNodes( mv2, tabNodeIDs ) ); // create the model display with visible nodes
618 
619  CHECK_OK( Pdfw::EndWrite() ); // Write final file and free memory allocated
620  cout << "=> " << inOutputFileName.c_str() << endl;
621  return dtkNoError;
622 }

◆ PdfwSampleAsmInstances_3_3()

Dtk_ErrorStatus PdfwSampleAsmInstances_3_3 ( const Dtk_string inOutputFileName)
269 {
270  Dtk_dir X( 1, 0, 0 );
271  Dtk_dir Y( 0, 1, 0 );
272  Dtk_dir Z( 0, 0, 1 );
273  Pdfw::WriteOptions options;
274  Dtk_ID axlesNodeID, axlesNodeID2, axleNodeID, axleID, wheelsNodeID, wheelNodeID, wheelID;
275  Dtk_InfoPtr info;
276 
277  // First we initialize writing with name of files
278  CHECK_OK( Pdfw::InitWrite( inOutputFileName, "", NULL, options ) );
279 
280  Dtk_string nodeName = "Axles";
281  CHECK_OK( Pdfw::InitNode( nodeName, Dtk_transfo(), info, axlesNodeID ) ); // open Axles Node, placement by default : identity matrix
282  Pdfw::StorePrototype( axlesNodeID ); // Store Axles node ID for future re-instanciation
283 
284  nodeName = "Axle";
285  CHECK_OK( Pdfw::InitNode( nodeName, Dtk_transfo(), info, axleNodeID ) ); // open Axle node
286  Dtk_BodyPtr axle = sampleWriter::CreateCyl( 0.2, 5 );
287  axle->info()->SetName( "axle" );
288  CHECK_OK( Pdfw::WriteBodyAndMesh( axle, Dtk_MeshPtr(), axleID ) );
289  CHECK_OK( Pdfw::EndNode() ); // close Axle
290 
291  nodeName = "Wheels";
292  CHECK_OK( Pdfw::InitNode( nodeName, Dtk_transfo(), info, wheelsNodeID ) ); // open Wheels node
293  nodeName = "Wheel1";
294  CHECK_OK( Pdfw::InitNode( nodeName, Dtk_transfo( X, Y, Z, Dtk_pnt( 0, 0, 5 ) ), info, wheelNodeID ) ); // open Wheel1 node
295  Pdfw::StorePrototype( wheelNodeID ); // Store Wheel node ID for future re-instanciation
296  Dtk_BodyPtr wheel = sampleWriter::CreateCyl( 1, 1 );
297  wheel->info()->SetName( "wheel" );
298  CHECK_OK( Pdfw::WriteBodyAndMesh( wheel, Dtk_MeshPtr(), wheelID ) ); // write the body
299  CHECK_OK( Pdfw::EndNode() ); // close Wheel
300 
301  nodeName = "Wheel2";
302  CHECK_OK( Pdfw::InitNode( nodeName, Dtk_transfo( X, -Y, -Z, Dtk_pnt() ), info, wheelsNodeID ) ); // open Wheel2 node
303  Pdfw::ReinstanciatePrototype( wheelNodeID ); // Re-instanciating Wheel node
304  CHECK_OK( Pdfw::EndNode() ); // close Wheel2
305 
306  CHECK_OK( Pdfw::EndNode() ); // close Wheels
307 
308  CHECK_OK( Pdfw::EndNode() ); // close Axles
309 
310  nodeName = "Axles2";
311  CHECK_OK( Pdfw::InitNode( nodeName, Dtk_transfo( X, Y, Z, Dtk_pnt( 10, 0, 0 ) ), info, axlesNodeID2 ) ); // Open Axles2 node
312  Pdfw::ReinstanciatePrototype( axlesNodeID ); // Re-instanciating Axle node
313  CHECK_OK( Pdfw::EndNode() ); // close Axles2
314 
315  CHECK_OK( Pdfw::EndWrite() ); // Write final file and free memory allocated
316  cout << "=> " << inOutputFileName.c_str() << endl;
317  return dtkNoError;
318 }

◆ PdfwSampleAssembly_3_1()

Dtk_ErrorStatus PdfwSampleAssembly_3_1 ( const Dtk_string inOutputFileName)
186 {
187  Pdfw::WriteOptions options;
188  Dtk_ID axleNodeID, axleID, wheelsNodeID, wheelNodeID, wheel2NodeID, wheel1ID, wheel2ID;
189  Dtk_InfoPtr info;
190  // First we initialize writing with name of files
191  CHECK_OK( Pdfw::InitWrite( inOutputFileName, "", NULL, options ) );
192 
193  Dtk_string nodeName = "Axle";
194  CHECK_OK( Pdfw::InitNode( nodeName, Dtk_transfo(), info, axleNodeID ) ); // open Axle node
195  Dtk_BodyPtr axle = sampleWriter::CreateCyl( 0.2, 5 );
196  axle->info()->SetName( "axle" );
197  CHECK_OK( Pdfw::WriteBodyAndMesh( axle, Dtk_MeshPtr(), axleID ) ); // write the body
198  CHECK_OK( Pdfw::EndNode() ); // close Axle
199 
200  nodeName = "Wheels";
201  CHECK_OK( Pdfw::InitNode( nodeName, Dtk_transfo(), info, wheelsNodeID ) ); // open Wheels node
202 
203  nodeName = "Wheel";
204  CHECK_OK( Pdfw::InitNode( nodeName, Dtk_transfo(), info, wheelNodeID ) ); // open Wheel node
205  Dtk_BodyPtr wheel = sampleWriter::CreateCyl( 1, 1 );
206  Shift( wheel, 2 );
207  CHECK_OK( Pdfw::WriteBodyAndMesh( wheel, Dtk_MeshPtr(), wheel1ID ) ); // write the body
208  CHECK_OK( Pdfw::EndNode() ); // close Wheel
209 
210  nodeName = "Wheel2";
211  CHECK_OK( Pdfw::InitNode( nodeName, Dtk_transfo(), info, wheel2NodeID ) ); // open Wheel2 node
212  Shift( wheel, 3 );
213  CHECK_OK( Pdfw::WriteBodyAndMesh( wheel, Dtk_MeshPtr(), wheel2ID ) ); // write the body
214  CHECK_OK( Pdfw::EndNode() ); // close Wheel2
215 
216  CHECK_OK( Pdfw::EndNode() ); // close Wheels
217 
218  CHECK_OK( Pdfw::EndWrite() );// Write final file and free memory allocated
219  cout << "=> " << inOutputFileName.c_str() << endl;
220  return dtkNoError;
221 }

◆ PdfwSampleAxis_References_5_7()

Dtk_ErrorStatus PdfwSampleAxis_References_5_7 ( const Dtk_string inOutputFileName)
743 {
744  Pdfw::WriteOptions options;
745  Dtk_ID axisSysID, planeID, axisID;
746  Dtk_tab<Dtk_ID> tabNodeIDs;
747 
748  // First we initialize writing with name of files
749  CHECK_OK( Pdfw::InitWrite( inOutputFileName, "", NULL, options ) );
750 
753  tabNodeIDs.push_back( axisSysID );
754 
756  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( refplane ), planeID ) );
757  tabNodeIDs.push_back( planeID );
758 
761  tabNodeIDs.push_back( axisID );
762 
763  CHECK_OK( Pdfw::EndWrite() ); // Write final file and free memory allocated
764  cout << "=> " << inOutputFileName.c_str() << endl;
765  return dtkNoError;
766 }

◆ PdfwSampleBillboard_7_1()

Dtk_ErrorStatus PdfwSampleBillboard_7_1 ( const Dtk_string inOutputFileName,
const Dtk_string inImageDirectory 
)
826 {
827  Pdfw::WriteOptions options;
828  Dtk_ID meshID;
829  Dtk_LeaderPtr emptyLeader;
830 
831  // First we initialize writing with name of files
832  CHECK_OK( Pdfw::InitWrite( inOutputFileName, "", NULL, options ) );
833  Dtk_MeshPtr meshCube = sampleWriter::CreateMeshCube(); // create a simple red cube
834 
835  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( meshCube ), meshID ) ); // write the cube
836 
837  // create a leader without terminator
838  Dtk_tab<Dtk_pnt> leaderPoints;
839  Dtk_pnt dtkLeaderEnd( 1., -1., 1. ), pictureOrigin( 2., -2, 2. );
840  leaderPoints.push_back( dtkLeaderEnd );
841  leaderPoints.push_back( pictureOrigin );
842  Dtk_LeaderPtr leader = Dtk_Leader::Create( 0, 0, dtkLeaderEnd, Dtk_Leader::TerminatorTypeNone, leaderPoints );
843 
844  // write parallel to screen image with leader
845  CHECK_OK( Pdfw::WriteParallelToScreenPicture( inImageDirectory + "logodtk.bmp", 20, 20, DTK_ANCHOR_TOP_RIGHT, false, true, Dtk_transfo(), leader ) );
846  // write pin to screen image
847  CHECK_OK( Pdfw::WritePinToScreenPicture( inImageDirectory + "logodtk.bmp", 20, 20, Dtk_pnt( 1., 100. ), DTK_ANCHOR_BOTTOM_LEFT, true, emptyLeader ) );
848 
849  CHECK_OK( Pdfw::EndWrite() ); // Write final file and free memory allocated
850  cout << "=> " << inOutputFileName.c_str() << endl;
851  return dtkNoError;
852 }

◆ PdfwSampleBody_2_1()

Dtk_ErrorStatus PdfwSampleBody_2_1 ( const Dtk_string inOutputFileName)
118 {
119  Pdfw::WriteOptions options;
120  Dtk_ID bodyID;
121  // First we initialize writing with name of files
122  CHECK_OK( Pdfw::InitWrite( inOutputFileName, "", NULL, options ) );
123  Dtk_BodyPtr cylinder = sampleWriter::CreateCyl( 1, 2 ); // Create a Cylinder radius=1, height=2 (with a green face)
124  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( cylinder ), bodyID ) ); // write the body
125 
126  CHECK_OK( Pdfw::EndWrite() ); // Write final file and free memory allocated
127  cout << "=> " << inOutputFileName.c_str() << endl;
128  return dtkNoError;
129 }

◆ PdfwSampleBodyVisibility_2_3()

Dtk_ErrorStatus PdfwSampleBodyVisibility_2_3 ( const Dtk_string inOutputFileName)
155 {
156  Pdfw::WriteOptions options;
157  Dtk_ID bodyID;
158 
159  // First we initialize writing with name of files
160  CHECK_OK( Pdfw::InitWrite( inOutputFileName, "", NULL, options ) );
161 
162 
163  Dtk_BodyPtr cylinder = sampleWriter::CreateCyl( 1, 2 );
164  cylinder->info()->SetName( "Cylinder.1" );
165  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( cylinder ), bodyID ) ); // write the 1st body
166 
167  Dtk_BodyPtr cylinder2 = sampleWriter::CreateCyl( 1, 2 );
168  Shift( cylinder2, 3 );
169  cylinder2->info()->SetName( "Cylinder.2" );
170  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( cylinder2 ), bodyID ) ); // write the 2nd body
171 
172  Dtk_BodyPtr cylinder3 = sampleWriter::CreateCyl( 1, 2 );
173  Shift( cylinder3, 6 );
174  cylinder3->info()->SetBlankedStatus( DTK_TRUE );
175  cylinder3->info()->SetName( "Cylinder.3" );
176  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( cylinder3 ), bodyID ) ); // write the 3rd body
177 
178  CHECK_OK( Pdfw::EndWrite() ); // Write final file and free memory allocated
179  cout << "=> " << inOutputFileName.c_str() << endl;
180  return dtkNoError;
181 }

◆ PdfwSampleCloudPoint_6_1()

Dtk_ErrorStatus PdfwSampleCloudPoint_6_1 ( const Dtk_string inOutputFileName)
771 {
772  Pdfw::WriteOptions options;
773  Dtk_tab<Dtk_pnt> tabPoints;
774  Dtk_Size_t i, j;
775  Dtk_transfo transfo;
776  Dtk_ID pointID;
777  Dtk_Double64 xPos = 0., yPos = 0., offset = 1.;
778  Dtk_Size_t numPointX = 200, numPointY = 200;
779  Dtk_tab<Dtk_RGB> tabColors;
780  Dtk_tab<Dtk_dir> tabNormals;
781 
782  options.CreateDefaultView = DTK_FALSE; // no default view needed
783  // First we initialize writing with name of files
784  CHECK_OK( Pdfw::InitWrite( inOutputFileName, "", NULL, options ) );
785 
786  // generating cloud point
787 
788  for( i = 0; i < numPointX; i++ )
789  {
790  for( j = 0; j < numPointY; j++ )
791  {
792  tabPoints.push_back( Dtk_pnt( xPos, yPos, 0. ) );
793  tabColors.push_back( Dtk_RGB( ( int )( std::rand() / double( RAND_MAX ) * 255 ),
794  ( int )( std::rand() / double( RAND_MAX ) * 255 ),
795  ( int )( std::rand() / double( RAND_MAX ) * 255 ) ) );
796  yPos += offset;
797  }
798  yPos = 0.;
799  xPos += offset;
800  }
801 
802 
803  CHECK_OK( Pdfw::WriteColoredPoints( tabPoints, tabNormals, tabColors, pointID ) ); // write the cloud point
804 
805  Dtk_pnt from( 300, 300, 300 );
806  Dtk_pnt to( numPointX / 2., numPointY / 2., 0 );
807  Dtk_dir up( 0., 1., 0. );
808  Dtk_CameraPtr cam = Dtk_Camera::Create( from, to, 200, 200, up );
809  Dtk_ModelDisplayPtr mv1 = Dtk_ModelDisplay::Create( cam, NULL, 1 ); // create activated view
810 
811  mv1->info() = Dtk_Info::create();
812  mv1->info()->SetName( "MainView" );
813  Dtk_tab<Dtk_ID>tabNodeIDs;
814  CHECK_OK( Pdfw::CreateModelDisplayWithVisibleNodes( mv1, tabNodeIDs ) ); // Add ModelDisplay
815 
816  CHECK_OK( Pdfw::EndWrite() ); // Write final file and free memory allocated
817  cout << "=> " << inOutputFileName.c_str() << endl;
818  return dtkNoError;
819 }

◆ PdfwSampleDocumentProperties_4_2()

Dtk_ErrorStatus PdfwSampleDocumentProperties_4_2 ( const Dtk_string inOutputFileName)
490 {
491  Pdfw::WriteOptions options;
493  Pdfw::PdfDocumentProperties docProperties;
494  Dtk_tab<Dtk_MetaDataPtr> metadatas;
495  Dtk_string application, pdfProducer, title, author, subject, keywords;
496 
497  // First we initialize writing with name of files
498  CHECK_OK( Pdfw::InitWrite( inOutputFileName, "", NULL, options ) );
499 
500  // We fill Pdfw::PdfDocumentProperties with information we want
501  title = inOutputFileName.filename();
502  docProperties.SetTitle( title ); // title
503 
504  author = "user";
505  docProperties.SetAuthor( author ); // author
506 
507  subject = "Datakit PDF SDK demo";
508  docProperties.SetSubject( subject ); // subject
509 
510  keywords = "Datakit;SDK;Demo";
511  docProperties.SetKeywords( keywords ); // keywords
512 
513 
514  application = "LibPdfWriteSample";
515  docProperties.SetApplication( application ); // application
516 
517  pdfProducer = "DATAKIT API Version " + Dtk_API::GetAPI()->GetVersion();
518  docProperties.SetPDFProducer( pdfProducer ); // producer
519 
520  metadatas.push_back( Dtk_MetaData::CreateMetaData( Dtk_MetaData::TypeFileProperty, "PartName", "SampleDocumentProperties_4_2" ) ); // custom metadata
521 
522  CHECK_OK( Pdfw::AddDocumentProperties( docProperties, metadatas ) ); // We add properties to the document
523 
524  CHECK_OK( Pdfw::EndWrite() ); // Write final file and free memory allocated
525  cout << "=> " << inOutputFileName.c_str() << endl;
526  return dtkNoError;
527 }

◆ PdfwSampleInstancesColors_3_4()

Dtk_ErrorStatus PdfwSampleInstancesColors_3_4 ( const Dtk_string inOutputFileName)
323 {
324  Dtk_dir X( 1, 0, 0 );
325  Dtk_dir Y( 0, 1, 0 );
326  Dtk_dir Z( 0, 0, 1 );
327  Pdfw::WriteOptions options;
328  Dtk_ID axlesNodeID, axlesNodeID2, axlesNodeID3, axlesNodeID4, axlesNodeID5, axleNodeID, axleID, wheelsNodeID, wheelNodeID, wheelID;
329  Dtk_InfoPtr info;
330 
331  // First we initialize writing with name of files
332  CHECK_OK( Pdfw::InitWrite( inOutputFileName, "", NULL, options ) );
333 
334  Dtk_string nodeName = "Axles";
335  CHECK_OK( Pdfw::InitNode( nodeName, Dtk_transfo(), info, axlesNodeID ) ); // open Axles node, placement by default : identity matrix
336  Pdfw::StorePrototype( axlesNodeID ); // Store Axles node ID for future re-instanciation
337 
338  nodeName = "Axle";
339  CHECK_OK( Pdfw::InitNode( nodeName, Dtk_transfo(), info, axleNodeID ) ); // open Axle node
340  Dtk_BodyPtr axle = sampleWriter::CreateCyl( 0.2, 5 );
341  axle->info()->SetName( "axle" );
342  CHECK_OK( Pdfw::WriteBodyAndMesh( axle, Dtk_MeshPtr(), axleID ) ); // write the body
343  CHECK_OK( Pdfw::EndNode() ); // close Axle
344 
345  nodeName = "Wheels";
346  CHECK_OK( Pdfw::InitNode( nodeName, Dtk_transfo(), info, wheelsNodeID ) ); // open Wheels node
347  nodeName = "Wheel1";
348  CHECK_OK( Pdfw::InitNode( nodeName, Dtk_transfo( X, Y, Z, Dtk_pnt( 0, 0, 5 ) ), info, wheelNodeID ) ); // open wheel1 node
349  Pdfw::StorePrototype( wheelNodeID ); // Store Wheel node ID for future re-instanciation
350  Dtk_BodyPtr wheel = sampleWriter::CreateCyl( 1, 1 );
351  wheel->info()->SetName( "wheel" );
352  CHECK_OK( Pdfw::WriteBodyAndMesh( wheel, Dtk_MeshPtr(), wheelID ) ); // write the body
353  CHECK_OK( Pdfw::EndNode() ); // close Wheel1
354 
355  nodeName = "Wheel2";
356  CHECK_OK( Pdfw::InitNode( nodeName, Dtk_transfo( X, -Y, -Z, Dtk_pnt() ), info, wheelsNodeID ) ); // open wheel2 node
357  Pdfw::ReinstanciatePrototype( wheelNodeID ); // Re-instanciating Wheel node
358  CHECK_OK( Pdfw::EndNode() ); // close wheel2
359 
360  CHECK_OK( Pdfw::EndNode() ); // close Wheels
361 
362  CHECK_OK( Pdfw::EndNode() ); // close Axles
363 
365  nodeName = "Axles2";
366  Dtk_InfoPtr axle2Info = Dtk_Info::create();
367 
368  axle2Info->SetColor( Dtk_RGB( 255, 0, 0, 128 ) );// Give a RED color with transparency
369  CHECK_OK( Pdfw::InitNode( nodeName,
370  Dtk_transfo( X, Y, Z, Dtk_pnt( 5, 0, 0 ) ),
371  axle2Info,
372  Pdfw::keepsubcolor, // Keep mesh existing colors
373  axlesNodeID2 ) ); // reinstance whole subassembly with matrix
374  Pdfw::ReinstanciatePrototype( axlesNodeID ); // Re-instanciating Axles node
375  CHECK_OK( Pdfw::EndNode() ); // close Axles2
376 
378  nodeName = "Axles3";
379  Dtk_InfoPtr axle3Info = Dtk_Info::create();
380  axle3Info->SetColor( Dtk_RGB( 0, 0, 255, 255 ) );// Give a BLUE opaque color
381 
382  CHECK_OK( Pdfw::InitNode( nodeName,
383  Dtk_transfo( X, Y, Z, Dtk_pnt( 10, 0, 0 ) ),
384  axle3Info,
385  Pdfw::attributeoverwrite, // Overwrites existing colors/transparency
386  axlesNodeID3 ) );
387  Pdfw::ReinstanciatePrototype( axlesNodeID );
388  CHECK_OK( Pdfw::EndNode() ); // close Axles3
389 
391  nodeName = "Axles4";
392  Dtk_InfoPtr axle4Info = Dtk_Info::create();
393  axle4Info->SetColor( Dtk_RGB( 255, 255, 0, 128 ) );// Give a YELLOW color with transparency
394 
395  CHECK_OK( Pdfw::InitNode( nodeName,
396  Dtk_transfo( X, Y, Z, Dtk_pnt( 15, 0, 0 ) ),
397  axle4Info,
398  Pdfw::keepsubcolor | Pdfw::keepsubtransparency, // Keep mesh existing color / transparency
399  axlesNodeID4 ) );
400  Pdfw::ReinstanciatePrototype( axlesNodeID );
401  CHECK_OK( Pdfw::EndNode() ); // close Axles4*
402 
404  nodeName = "Axles5";
405  Dtk_InfoPtr axle5Info = Dtk_Info::create();
406  axle5Info->SetColor( Dtk_RGB( 0, 255, 255 ) );// Give a BLUE GREEN color
407 
408  CHECK_OK( Pdfw::InitNode( nodeName, Dtk_transfo( X, Y, Z, Dtk_pnt( 20, 0, 0 ) ), axle5Info, axlesNodeID5 ) );
409  Pdfw::ReinstanciatePrototype( axlesNodeID );
410  CHECK_OK( Pdfw::EndNode() ); // close Axles5
411 
412  CHECK_OK( Pdfw::EndWrite() ); // Write final file and free memory allocated
413  cout << "=> " << inOutputFileName.c_str() << endl;
414  return dtkNoError;
415 }

◆ PdfwSampleInstancesVisibility_3_5()

Dtk_ErrorStatus PdfwSampleInstancesVisibility_3_5 ( const Dtk_string inOutputFileName)
420 {
421  Dtk_dir X( 1, 0, 0 );
422  Dtk_dir Y( 0, 1, 0 );
423  Dtk_dir Z( 0, 0, 1 );
424  Pdfw::WriteOptions options;
425  Dtk_ID axleNodeID, axleID, wheelsNodeID, wheelNodeID, wheelID;
426  Dtk_InfoPtr info;
427 
428  // First we initialize writing with name of files
429  CHECK_OK( Pdfw::InitWrite( inOutputFileName, "", NULL, options ) );
430 
431  Dtk_string nodeName = "Axle";
432  CHECK_OK( Pdfw::InitNode( nodeName, Dtk_transfo(), info, axleNodeID ) ); // open Axle node
433  Dtk_BodyPtr axle = sampleWriter::CreateCyl( 0.2, 5 );
434  axle->info()->SetName( "axle" );
435  CHECK_OK( Pdfw::WriteBodyAndMesh( axle, Dtk_MeshPtr(), axleID ) ); // write the body
436  CHECK_OK( Pdfw::EndNode() ); // close Axle
437 
438  nodeName = "Wheels";
439  CHECK_OK( Pdfw::InitNode( nodeName, Dtk_transfo(), info, wheelsNodeID ) ); // open Wheels node
440  nodeName = "Wheel1";
441  CHECK_OK( Pdfw::InitNode( nodeName, Dtk_transfo( X, Y, Z, Dtk_pnt( 0, 0, 5 ) ), info, wheelNodeID ) ); // open Wheel1 node
442  Pdfw::StorePrototype( wheelNodeID ); // Store Wheel node ID for future re-instanciation
443  Dtk_BodyPtr wheel = sampleWriter::CreateCyl( 1, 1 );
444  wheel->info()->SetName( "wheel" );
445  CHECK_OK( Pdfw::WriteBodyAndMesh( wheel, Dtk_MeshPtr(), wheelID ) ); // write the body
446  CHECK_OK( Pdfw::EndNode() ); // close Wheel1
447 
448  Dtk_InfoPtr wheelInfo = Dtk_Info::create();
449  wheelInfo->SetBlankedStatus( 1 );
450  nodeName = "Wheel2";
451  CHECK_OK( Pdfw::InitNode( nodeName, Dtk_transfo( X, -Y, -Z, Dtk_pnt() ), wheelInfo, wheelsNodeID ) ); // open invisible Wheel2
452  Pdfw::ReinstanciatePrototype( wheelNodeID ); // Re-instanciating Wheel node
453  CHECK_OK( Pdfw::EndNode() ); // close Wheel2
454 
455  CHECK_OK( Pdfw::EndNode() ); // close Wheels
456 
457  CHECK_OK( Pdfw::EndWrite() ); // Write final file and free memory allocated
458  cout << "=> " << inOutputFileName.c_str() << endl;
459  return dtkNoError;
460 }

◆ PdfwSampleLayoutMultipleViews_9_1()

Dtk_ErrorStatus PdfwSampleLayoutMultipleViews_9_1 ( const Dtk_string pdfFileName)
979 {
980  Pdfw::WriteOptions options;
981  Dtk_string artworkName, nodeName;
982  Dtk_UInt32 artworkIndex = 0;
983  Dtk_Double64 annotBBox[ 4 ];
984  Dtk_transfo transfo;
985  // We set the options of Writer
987  options.CreateDefaultView = DTK_FALSE;
988  options.ShowToolbar = DTK_FALSE;
989  options.ConvertRenderInfos = DTK_TRUE;
990 
991  // First we initialize writing with name of files
992  CHECK_OK( Pdfw::InitWrite( pdfFileName, "", NULL, options ) );
993 
994  // We open a new grey page
995  CHECK_OK( Pdfw::Layout::InitPage( Dtk_RGB( 200, 200, 200 ) ) );
996 
997  // Let's initialise the artwork
998  artworkName = "myArtwork";
999  CHECK_OK( Pdfw::Layout::Init3DArtwork( artworkName, &options ) );
1000 
1001  // add the render
1002  Dtk_RenderInfosPtr renderInfos = NULL;
1003  //RenderInfos Sample
1004  Dtk_MeshPtr meshCube = sampleWriter::CreateMeshCube(); // create a simple red cube
1005 
1006  // assigning faces colors
1007  AssignFacesColors( meshCube );
1008 
1009  // let's write the mesh cube
1011 
1012  // end of artwork
1013  CHECK_OK( Pdfw::Layout::End3DArtwork( artworkIndex ) );
1014 
1015  // create the wiews
1016  PdfwCreateViews();
1017 
1018  // create the annotations
1019  PdfwCreate3DAnnotations( annotBBox, artworkIndex );
1020 
1021  // close the page
1023  // Finally closing pdf file
1024  CHECK_OK( Pdfw::EndWrite() );
1025 
1026  cout << "=> " << pdfFileName.c_str() << endl;
1027  return dtkNoError;
1028 }

◆ PdfwSampleMeshes_1_2()

Dtk_ErrorStatus PdfwSampleMeshes_1_2 ( const Dtk_string inOutputFileName)
46 {
47  Pdfw::WriteOptions options;
48  Dtk_ID meshID;
49 
50  options.PointSize = 5.; // setting point size
51  // First we initialize writing with name of files
52  CHECK_OK( Pdfw::InitWrite( inOutputFileName, "", NULL, options ) );
53 
54  Dtk_MeshPtr CubeMesh = sampleWriter::CreateMeshCube(); // create a simple red cube
55  CubeMesh->info()->SetName( "ColoredCube" );
56  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( CubeMesh ), meshID ) ); // write the cube
57 
58  Dtk_MeshPtr CubePervertexColorMesh = sampleWriter::CreateMeshCubeVertexColor(); // create a per vertex color cube
59  Shift( CubePervertexColorMesh, 3 ); // translate it not to be on previous geometry
60  CubePervertexColorMesh->info() = Dtk_Info::create();
61  CubePervertexColorMesh->info()->SetName( "VertexColoredCube" );
62  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( CubePervertexColorMesh ), meshID ) ); // write the cube
63 
64  Dtk_MeshPtr TransparentCube = sampleWriter::CreateMeshCube(); // create a simple red cube
65  TransparentCube->info()->SetColor( Dtk_RGB( 0, 255, 0, 128 ) ); // set whole cube as green and transparent
66  TransparentCube->info()->SetName( "TransparentCube" );
67  Shift( TransparentCube, 6 ); // translate it not to be on previous geometry
68  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( TransparentCube ), meshID ) ); // write the cube
69 
70  Dtk_MeshPtr TransparentOneFaceCube = sampleWriter::CreateMeshCube(); // create a simple red cube
71  if( TransparentOneFaceCube->get_nb_mesh_face() == 6 )
72  {
73  if( TransparentOneFaceCube->get_mesh_face( 3 )->info().IsNULL() )
74  TransparentOneFaceCube->get_mesh_face( 3 )->info() = Dtk_Info::create();
75  TransparentOneFaceCube->get_mesh_face( 3 )->info()->SetColor( Dtk_RGB( 0, 0, 255, 128 ) ); // set face 3 as blue and transparent
76  }
77  Shift( TransparentOneFaceCube, 9 ); // translate it not to be on previous geometry
78  TransparentCube->info()->SetName( "TransparentCubeColoredFace" );
79  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( TransparentOneFaceCube ), meshID ) ); // write the cube
80 
81  Dtk_MeshPtr MeshWire = sampleWriter::CreateMeshWire(); // create wire mesh
82  Shift( MeshWire, 12 ); // translate it not to be on previous geometry
83  MeshWire->info() = Dtk_Info::create();
84  MeshWire->info()->SetName( "WireMesh" );
85  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( MeshWire ), meshID ) ); // write the cube
86 
87  Dtk_MeshPtr MeshPoints = sampleWriter::CreateMeshPoints(); // create a mesh wich contain only orange points.
88  Shift( MeshPoints, 15 ); // translate it not to be on previous geometry
89  MeshPoints->info()->SetName( "PointMesh" );
90  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( MeshPoints ), meshID ) ); // write the cube
91 
92  CHECK_OK( Pdfw::EndWrite() ); // Write final file and free memory allocated
93  cout << "=> " << inOutputFileName.c_str() << endl;
94  return dtkNoError;
95 }

◆ PdfwSampleMetadatas_4_1()

Dtk_ErrorStatus PdfwSampleMetadatas_4_1 ( const Dtk_string inOutputFileName)
465 {
466  Pdfw::WriteOptions options;
467  Dtk_ID axleID;
468  // First we initialize writing with name of files
469  CHECK_OK( Pdfw::InitWrite( inOutputFileName, "", NULL, options ) );
470 
471  Dtk_string nodeName = "Metadata";
472  CHECK_OK( Pdfw::InitNode( nodeName ) ); // Metadata creation
473 
474  Dtk_tab<Dtk_MetaDataPtr> tabMetadata;
475  tabMetadata.push_back( Dtk_MetaData::CreateMetaData( Dtk_MetaData::TypeProperty, "MyTitle", "MyValue" ) );
476  CHECK_OK( Pdfw::AddNodeMetadata( tabMetadata ) ); // Adding metadata to node
477  Dtk_BodyPtr axle = sampleWriter::CreateCyl( 0.2, 5 );
478  axle->info()->SetName( "axle" );
479  CHECK_OK( Pdfw::WriteBodyAndMesh( axle, Dtk_MeshPtr(), axleID ) ); // write the body
480 
481  CHECK_OK( Pdfw::EndNode() ); // close Metadata
482  CHECK_OK( Pdfw::EndWrite() ); // Write final file and free memory allocated
483  cout << "=> " << inOutputFileName.c_str() << endl;
484  return dtkNoError;
485 }

◆ PdfwSampleModelview_section_5_5()

Dtk_ErrorStatus PdfwSampleModelview_section_5_5 ( const Dtk_string inOutputFileName)
658 {
659  Pdfw::WriteOptions options;
661  Dtk_ID bodyID, datumID, curveID;
662 
663  options.CreateDefaultView = DTK_FALSE; // no default view needed
664  // setting cross section graphic properties
665  options.CrossSection.CuttingPlaneColor = Dtk_RGB( 255, 255, 255 );
666  options.CrossSection.CuttingPlaneOpacity = 0.9;
667  options.CrossSection.IntersectionColor = Dtk_RGB( 155, 255, 0 );;
668  options.CrossSection.AddSectionCap = false;
669  // First we initialize writing with name of files
670  CHECK_OK( Pdfw::InitWrite( inOutputFileName, "", NULL, options ) );
671 
672  Dtk_BodyPtr cylinder = sampleWriter::CreateCyl( 100, 150 ); // Create a Cylinder radius=100, height=150 (with a green face)
673  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( cylinder ), bodyID ) ); // Add the body
674 
675  Dtk_FdtPtr pmi = sampleWriter::CreateFdtDatum(); // Create an FDT (PMI)
676  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( pmi ), datumID ) ); // Add the PMI
677 
678  Dtk_ModelDisplayPtr mv1 = sampleWriter::CreateModelDisplayActivated(); // create first activated view
680  Dtk_tab<Dtk_ID>tabNodeIDs;
681  tabNodeIDs.push_back( bodyID );
682  tabNodeIDs.push_back( datumID );
683  CHECK_OK( Pdfw::CreateModelDisplayWithVisibleNodes( mv1, tabNodeIDs ) ); // Add ModelDisplay
684 
685  CHECK_OK( Pdfw::CreateModelDisplayWithVisibleNodes( mv2, tabNodeIDs ) ); // Add ModelDisplay
686 
687  CHECK_OK( Pdfw::CreateNodeConnectorHighlight( datumID, bodyID, 1 ) ); // Connect datum PMI on body, on face index 1
688 
689  Dtk_EllipsePtr ellipse = Dtk_Ellipse::Create( Dtk_pnt(), Dtk_dir( 0., 0., 1. ), Dtk_dir( 1., 0., 0. ), 100 );
690  ellipse->info() = Dtk_Info::create();
691  ellipse->info()->SetName( "Curve" );
692  ellipse->info()->SetBlankedStatus( DTK_TRUE );
693  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( ellipse ), curveID ) ); // Add the curve
694  //for curve
695  CHECK_OK( Pdfw::CreateNodeConnectorHighlight( datumID, curveID ) ); // Connect datum PMI on curve
696 
697  CHECK_OK( Pdfw::EndWrite() ); // Write final file and free memory allocated
698  cout << "=> " << inOutputFileName.c_str() << endl;
699  return dtkNoError;
700 }

◆ PdfwSampleOneMesh_1_1()

Dtk_ErrorStatus PdfwSampleOneMesh_1_1 ( const Dtk_string inOutputFileName)
23 {
24  Pdfw::WriteOptions options;
25  Dtk_ID meshID;
26  CHECK_OK( Pdfw::InitWrite( inOutputFileName, "", NULL, options ) );
27  Dtk_MeshPtr CubeMesh = sampleWriter::CreateMeshCube(); // create a simple red cube
28  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( CubeMesh ), meshID ) ); // write the cube
29 
30  CHECK_OK( Pdfw::EndWrite() ); // Write final file and free memory allocated
31  cout << "=> " << inOutputFileName.c_str() << endl;
32  return dtkNoError;
33 }

◆ PdfwSampleOneMeshRender_1_3()

Dtk_ErrorStatus PdfwSampleOneMeshRender_1_3 ( const Dtk_string inOutputFileName,
const Dtk_string inImageDirectory 
)
100 {
101  Pdfw::WriteOptions options;
102  Dtk_ID meshID;
103 
104  // First we initialize writing with name of files
105  CHECK_OK( Pdfw::InitWrite( inOutputFileName, "", NULL, options ) );
106  Dtk_MeshPtr meshCube = sampleWriter::CreateTexturedMeshCube( inImageDirectory ); // create a simple textured cube
107 
108  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( meshCube ), meshID ) ); // write the cube
109 
110  CHECK_OK( Pdfw::EndWrite() ); // Write final file and free memory allocated
111  cout << "=> " << inOutputFileName.c_str() << endl;
112  return dtkNoError;
113 }

◆ PdfwSamplePartInstances_3_2()

Dtk_ErrorStatus PdfwSamplePartInstances_3_2 ( const Dtk_string inOutputFileName)
226 {
227  Dtk_dir X( 1, 0, 0 );
228  Dtk_dir Y( 0, 1, 0 );
229  Dtk_dir Z( 0, 0, 1 );
230  Pdfw::WriteOptions options;
231  Dtk_ID axleNodeID, axleID, wheelsID, wheelNodeID, wheelID;
232  Dtk_InfoPtr info;
233 
234  // First we initialize writing with name of files
235  CHECK_OK( Pdfw::InitWrite( inOutputFileName, "", NULL, options ) );
236 
237  Dtk_string nodeName = "Axle";
238  CHECK_OK( Pdfw::InitNode( nodeName, Dtk_transfo(), info, axleNodeID ) ); // open Axle Node
239  Dtk_BodyPtr axle = sampleWriter::CreateCyl( 0.2, 5 );
240  axle->info()->SetName( "axle" );
241  CHECK_OK( Pdfw::WriteBodyAndMesh( axle, Dtk_MeshPtr(), axleID ) );
242  CHECK_OK( Pdfw::EndNode() ); // close Axle
243 
244  nodeName = "Wheels";
245  CHECK_OK( Pdfw::InitNode( nodeName, Dtk_transfo(), info, wheelsID ) ); // open Wheels Node
246  nodeName = "Wheel1";
247  CHECK_OK( Pdfw::InitNode( nodeName, Dtk_transfo( X, Y, Z, Dtk_pnt( 0, 0, 5 ) ), info, wheelNodeID ) ); // open Wheel1 Node
248  Pdfw::StorePrototype( wheelNodeID ); // Store Wheel node ID for future re-instanciation
249  Dtk_BodyPtr wheel = sampleWriter::CreateCyl( 1, 1 );
250  wheel->info()->SetName( "wheel" );
251  CHECK_OK( Pdfw::WriteBodyAndMesh( wheel, Dtk_MeshPtr(), wheelID ) ); // write the body
252  CHECK_OK( Pdfw::EndNode() ); // close Wheel1
253 
254  nodeName = "Wheel2";
255  CHECK_OK( Pdfw::InitNode( nodeName, Dtk_transfo( X, -Y, -Z, Dtk_pnt() ) ) ); // open Wheel2 node
256  Pdfw::ReinstanciatePrototype( wheelNodeID ); // Re-instanciating Wheel node
257  CHECK_OK( Pdfw::EndNode() ); // close Wheel2
258 
259  CHECK_OK( Pdfw::EndNode() ); // close Wheels
260 
261  CHECK_OK( Pdfw::EndWrite() ); // Write final file and free memory allocated
262  cout << "=> " << inOutputFileName.c_str() << endl;
263  return dtkNoError;
264 }

◆ PdfwSamplePMI_Geom_association_5_4()

Dtk_ErrorStatus PdfwSamplePMI_Geom_association_5_4 ( const Dtk_string inOutputFileName)
627 {
628  Pdfw::WriteOptions options;
629  Dtk_ID bodyID, datumID;
630 
631  options.CreateDefaultView = DTK_FALSE; // no default view needed
632  // First we initialize writing with name of files
633  CHECK_OK( Pdfw::InitWrite( inOutputFileName, "", NULL, options ) );
634 
635  Dtk_BodyPtr cylinder = sampleWriter::CreateCyl( 100, 150 ); // Create a Cylinder radius=100, height=150 (with a green face)
636  cylinder->info()->SetName( "Body" );
637  CHECK_OK( Pdfw::WriteBodyAndMesh( cylinder, Dtk_MeshPtr(), bodyID ) ); // Add the body
638 
639  Dtk_FdtPtr pmi = sampleWriter::CreateFdtDatum(); // Create an FDT (PMI)
640  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( pmi ), datumID ) ); // Add the PMI
641  CHECK_OK( Pdfw::CreateNodeConnectorHighlight( datumID, bodyID, 1 ) ); // Connect datum PMI on body, on face index 1
642 
644  mv->info()->SetName( "myView" );
645  Dtk_tab<Dtk_ID>tabNodeIDs;
646  tabNodeIDs.push_back( bodyID );
647  tabNodeIDs.push_back( datumID );
648  CHECK_OK( Pdfw::CreateModelDisplayWithVisibleNodes( mv, tabNodeIDs ) ); // Add ModelDisplay with visible nodes
649 
650  CHECK_OK( Pdfw::EndWrite() ); // Write final file and free memory allocated
651  cout << "=> " << inOutputFileName.c_str() << endl;
652  return dtkNoError;
653 }

◆ PdfwSamplePMI_PMI_association_5_6()

Dtk_ErrorStatus PdfwSamplePMI_PMI_association_5_6 ( const Dtk_string inOutputFileName)
705 {
706  Pdfw::WriteOptions options;
707  Dtk_ID bodyID, datumID;
708  Dtk_tab<Dtk_ID> tabPMIIDs;
709 
710  // First we initialize writing with name of files
711  options.CreateDefaultView = DTK_FALSE; // no default view needed
712  CHECK_OK( Pdfw::InitWrite( inOutputFileName, "", NULL, options ) );
713 
714  Dtk_BodyPtr cylinder = sampleWriter::CreateCyl( 100, 150 ); // Create a Cylinder radius=100, height=150 (with a green face)
715  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( cylinder ), bodyID ) ); // Add the body
716 
717  int i;
718  for( i = 0; i < 10; i++ ) // create 10 PMI
719  {
720  Dtk_FdtPtr pmi = sampleWriter::CreateFdtDatum(); // Create an FDT (PMI)
721  Shift( pmi, 15 * i );
722  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( pmi ), datumID ) ); // Add the PMI
723  tabPMIIDs.push_back( datumID );
724  }
726  mv2->info()->SetName( "SecondView" );
727  Dtk_tab<Dtk_ID>tabNodeIDs;
728  tabNodeIDs.push_back( bodyID );
729  tabNodeIDs += tabPMIIDs;
730  CHECK_OK( Pdfw::CreateModelDisplayWithVisibleNodes( mv2, tabNodeIDs ) ); // Add ModelDisplay with visible nodes
731 
732  CHECK_OK( Pdfw::CreateNodeConnectorHighlight( tabNodeIDs[ 5 ], tabNodeIDs[ 7 ] ) ); // Connect datum PMI on body, on face index 1
733 
734  CHECK_OK( Pdfw::EndWrite() ); // Write final file and free memory allocated
735  cout << "=> " << inOutputFileName.c_str() << endl;
736  return dtkNoError;
737 }

◆ PdfwSampleSecuredPdf_8_1()

Dtk_ErrorStatus PdfwSampleSecuredPdf_8_1 ( const Dtk_string inOutputFileName)
857 {
858  Pdfw::WriteOptions options;
859  Dtk_ID meshID;
860 
861  // setting protection password
862  options.OwnerPassword = "password";
863 
864  // First we initialize writing with name of files
865  CHECK_OK( Pdfw::InitWrite( inOutputFileName, "", NULL, options ) );
866  Dtk_MeshPtr meshCube = sampleWriter::CreateMeshCube(); // create a simple red cube
867 
868  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( meshCube ), meshID ) ); // write the cube
869 
870  CHECK_OK( Pdfw::EndWrite() ); // Write final file and free memory allocated
871  cout << "=> " << inOutputFileName.c_str() << endl;
872  return dtkNoError;
873 }

◆ PdfwSampleSimpleModelview_5_2()

Dtk_ErrorStatus PdfwSampleSimpleModelview_5_2 ( const Dtk_string inOutputFileName)
555 {
556  Pdfw::WriteOptions options;
558  options.CreateDefaultView = DTK_FALSE; // no default view needed
559  // First we initialize writing with name of files
560  CHECK_OK( Pdfw::InitWrite( inOutputFileName, "", NULL, options ) );
561 
562 
563  Dtk_BodyPtr cylinder = sampleWriter::CreateCyl( 100, 150 ); // Create a Cylinder radius=100, height=150 (with a green face)
564  cylinder->info()->SetName( "Body" );
565  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( cylinder ) ) ); // Add the body
566 
567  Dtk_FdtPtr pmi = sampleWriter::CreateFdtDatum(); // Create an FDT (PMI)
568  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( pmi ) ) ); // Add the PMI
569 
570  Dtk_ModelDisplayPtr mvfit, mv2;
572  Dtk_tab<Dtk_ID> tabNodeIDs;
573  CHECK_OK( Pdfw::CreateModelDisplayWithVisibleNodes( mvfit, tabNodeIDs ) );
574 
577 
578  CHECK_OK( Pdfw::EndWrite() ); // Write final file and free memory allocated
579  cout << "=> " << inOutputFileName.c_str() << endl;
580  return dtkNoError;
581 }

◆ PdfwSampleSimplePMI_5_1()

Dtk_ErrorStatus PdfwSampleSimplePMI_5_1 ( const Dtk_string inOutputFileName)
534 {
535  Pdfw::WriteOptions options;
536  Dtk_ID axleID;
537  // First we initialize writing with name of files
538  CHECK_OK( Pdfw::InitWrite( inOutputFileName, "", NULL, options ) );
539 
540  Dtk_BodyPtr cylinder = sampleWriter::CreateCyl( 100, 150 ); // Create a Cylinder radius=1, height=2 (with a green face)
541  cylinder->info()->SetName( "Body" );
542  CHECK_OK( Pdfw::WriteBodyAndMesh( cylinder, Dtk_MeshPtr(), axleID ) ); // Add the body
543 
544  Dtk_FdtPtr pmi = sampleWriter::CreateFdtDatum(); // Create an FDT (PMI)
545  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( pmi ) ) ); // Add the PMI
546 
547  CHECK_OK( Pdfw::EndWrite() ); // Write final file and free memory allocated
548  cout << "=> " << inOutputFileName.c_str() << endl;
549  return dtkNoError;
550 }

◆ PdfwSampleWireBody_2_2()

Dtk_ErrorStatus PdfwSampleWireBody_2_2 ( const Dtk_string inOutputFileName)
134 {
135  Pdfw::WriteOptions options;
136  Dtk_ID bodyID;
137  // First we initialize writing with name of files
138  CHECK_OK( Pdfw::InitWrite( inOutputFileName, "", NULL, options ) );
139 
141  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( wire ), bodyID ) ); // write the body
142 
144  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( wire2 ), bodyID ) ); // write the body
145 
146  CHECK_OK( Pdfw::EndWrite() ); // Write final file and free memory allocated
147  cout << "=> " << inOutputFileName.c_str() << endl;
148  return dtkNoError;
149 }

◆ Shift()

template<typename T >
void Shift ( T &  mesh,
double  sh 
)
39 {
40  Dtk_transfo t;
41  t.addTranslate( Dtk_dir( sh, 0, 0 ) );
42  mesh->Transform( t );
43 }
sampleWriter::CreateAxis
Dtk_BodyPtr CreateAxis()
Definition: testcreatecube.cpp:1492
PdfwSampleSecuredPdf_8_1
Dtk_ErrorStatus PdfwSampleSecuredPdf_8_1(const Dtk_string &inOutputFileName)
Definition: testlibpdfwrite.cpp:856
Dtk_ModelDisplay::Create
static Dtk_ModelDisplayPtr Create(const Dtk_CameraPtr &inCamera, const Dtk_EntityPtr &inClippingEntity, const Dtk_bool inIsActivated)
Full featured constructor.
Pdfw::CreateModelDisplayWithVisibleNodes
DtkErrorStatus CreateModelDisplayWithVisibleNodes(Dtk_ModelDisplayPtr &inModelDisplay, Dtk_tab< Dtk_ID > &inTabVisibleNodes, Pdfw::RenderMode inRenderMode=Pdfw::Unset, Pdfw::Lighting inLighting=Pdfw::UnsetLighting)
Create a model display.
Dtk_ID
uint32_t Dtk_ID
Definition: define.h:689
Dtk_transfo
This is the Transformation dedicated class.
Definition: dtk_transfo.hpp:19
Pdfw::AddNodeMetadata
DtkErrorStatus AddNodeMetadata(Dtk_tab< Dtk_MetaDataPtr > &inTabMetadata)
Add table of metadata to current node.
Pdfw::Layout::Create3DAnnotation
DtkErrorStatus Create3DAnnotation(Dtk_UInt32 inArtworkIndex, Dtk_Double64 inBBox[4], Dtk_Int32 inModelDisplayIndex=-1, Dtk_Int32 inLayerID=-1, RenderMode inRenderMode=Unset, Lighting inLighting=UnsetLighting, Dtk_bool inAnnotActivation=0)
Creates 3D Annotation from 3D artwork in current page with its 2d bounding box.
Shift
void Shift(T &mesh, double sh)
Definition: testlibpdfwrite.cpp:38
Pdfw::WriteOptions
This class provides several options to tune Pdf Writer. It must be provided to Pdfw::InitWrite method...
Definition: pdfw.hpp:113
PdfwSampleMetadatas_4_1
Dtk_ErrorStatus PdfwSampleMetadatas_4_1(const Dtk_string &inOutputFileName)
Definition: testlibpdfwrite.cpp:464
Pdfw::InitWrite
DtkErrorStatus InitWrite(const Dtk_string &inOutputFile, const Dtk_string &inLogFile, Licence_dtk inLicFct, WriteOptions &inOptions)
Initialize the PDF Writer
sampleWriter::CreateMeshCube
Dtk_MeshPtr CreateMeshCube()
Mesh Cube sample.
Definition: testcreatemesh.cpp:207
PdfwSampleAxis_References_5_7
Dtk_ErrorStatus PdfwSampleAxis_References_5_7(const Dtk_string &inOutputFileName)
Definition: testlibpdfwrite.cpp:742
Pdfw::WriteOptions::PointSize
Dtk_Double64 PointSize
Size of points.
Definition: pdfw.hpp:163
Pdfw::WriteOptions::Layout
LayoutOptions Layout
Definition: pdfw.hpp:193
sampleWriter::CreateCyl
Dtk_BodyPtr CreateCyl(double radius, double height)
Definition: testcreatecube.cpp:1791
sampleWriter::CreateMeshCubeVertexColor
Dtk_MeshPtr CreateMeshCubeVertexColor()
Definition: testcreatemesh.cpp:299
sampleWriter::CreateModelDisplayWithSection
Dtk_ModelDisplayPtr CreateModelDisplayWithSection()
Definition: testcreatefdt.cpp:254
sampleWriter::CreateMeshPoints
Dtk_MeshPtr CreateMeshPoints()
Points mesh sample.
Definition: testcreatemesh.cpp:439
Pdfw::Layout::EndPage
Dtk_ErrorStatus EndPage()
End of page.
Pdfw::LayoutOptions::CreateAutomaticLayout
Dtk_bool CreateAutomaticLayout
DTK_TRUE : Creates automatic layout (One page with filled with 3D Annotation), DTK_FALSE : You must u...
Definition: pdfw.hpp:37
DTK_TRUE
#define DTK_TRUE
Definition: define.h:727
Pdfw::PdfDocumentProperties::SetKeywords
void SetKeywords(const Dtk_string &inString)
Add Keywords in Document Catalog Metadata.
sampleWriter::CreateInfinitePlane
Dtk_BodyPtr CreateInfinitePlane()
Definition: testcreatecube.cpp:1435
PdfwSamplePartInstances_3_2
Dtk_ErrorStatus PdfwSamplePartInstances_3_2(const Dtk_string &inOutputFileName)
Definition: testlibpdfwrite.cpp:225
AssignFacesColors
void AssignFacesColors(Dtk_MeshPtr &meshCube)
Definition: testlibpdfwrite.cpp:966
Dtk_UInt32
uint32_t Dtk_UInt32
Definition: define.h:688
Dtk_string
This is a high level string class.
Definition: dtk_string.hpp:58
Pdfw::Layout::GetCurrentPageWidth
Dtk_Double64 GetCurrentPageWidth()
Gets current page width.
DTK_ANCHOR_BOTTOM_LEFT
@ DTK_ANCHOR_BOTTOM_LEFT
Definition: util_draw_dtk.hpp:106
Dtk_Size_t
size_t Dtk_Size_t
Definition: define.h:712
Pdfw::Layout::GetCurrentPageHeight
Dtk_Double64 GetCurrentPageHeight()
Gets current page height.
Dtk_MetaData::TypeFileProperty
@ TypeFileProperty
Definition: dtk_metadata.hpp:29
Pdfw::PdfDocumentProperties::SetTitle
void SetTitle(const Dtk_string &inString)
Add Title in Document Catalog Metadata.
Pdfw::WriteOptions::CrossSection
cross_section CrossSection
Cross section parameters.
Definition: pdfw.hpp:165
Pdfw::cross_section::CuttingPlaneOpacity
Dtk_Double64 CuttingPlaneOpacity
Definition: pdfw.hpp:28
sampleWriter::CreateAxisSystem
Dtk_AxisSystemPtr CreateAxisSystem()
Definition: testcreatecube.cpp:1465
PdfwSampleLayoutMultipleViews_9_1
Dtk_ErrorStatus PdfwSampleLayoutMultipleViews_9_1(const Dtk_string &pdfFileName)
Definition: testlibpdfwrite.cpp:978
DTK_FALSE
#define DTK_FALSE
Definition: define.h:728
PdfwSampleModelview_section_5_5
Dtk_ErrorStatus PdfwSampleModelview_section_5_5(const Dtk_string &inOutputFileName)
Definition: testlibpdfwrite.cpp:657
PdfwCreateViews
Dtk_ErrorStatus PdfwCreateViews()
Definition: testlibpdfwrite.cpp:877
Pdfw::cross_section::CuttingPlaneColor
Dtk_RGB CuttingPlaneColor
Definition: pdfw.hpp:27
PdfwSampleBillboard_7_1
Dtk_ErrorStatus PdfwSampleBillboard_7_1(const Dtk_string &inOutputFileName, const Dtk_string &inImageDirectory)
Definition: testlibpdfwrite.cpp:825
Dtk_Ellipse::Create
static Dtk_EllipsePtr Create(const Dtk_Ellipse &inEllipseToCopy)
Pdfw::keepsubtransparency
@ keepsubtransparency
Definition: pdfw.hpp:16
Dtk_Double64
double Dtk_Double64
Definition: define.h:699
Dtk_Info::SetBlankedStatus
Dtk_ErrorStatus SetBlankedStatus(const Dtk_Int32 &inBlankedStatus)
Pdfw::ReinstanciatePrototype
DtkErrorStatus ReinstanciatePrototype(Dtk_ID inID)
Reinstanciate children of node to reinstanciate in current node.
Pdfw::PdfDocumentProperties
Definition: pdfw.hpp:197
PdfwSampleInstancesVisibility_3_5
Dtk_ErrorStatus PdfwSampleInstancesVisibility_3_5(const Dtk_string &inOutputFileName)
Definition: testlibpdfwrite.cpp:419
Pdfw::Layout::Init3DArtwork
DtkErrorStatus Init3DArtwork(Dtk_string inAnnotName=Dtk_string(), Pdfw::WriteOptions *inWriteOptions=NULL)
Starts Writing of 3D Artwork (3D model)
Pdfw::PdfDocumentProperties::SetAuthor
void SetAuthor(const Dtk_string &inString)
Add Author in Document Catalog Metadata.
Pdfw::StorePrototype
void StorePrototype(Dtk_ID inID)
Stores the identifier of a node.
Dtk_API::GetAPI
static Dtk_API * GetAPI()
Get DATAKIT API.
sampleWriter::CreateMeshWire
Dtk_MeshPtr CreateMeshWire()
Wire mesh sample.
Definition: testcreatemesh.cpp:388
Pdfw::PdfDocumentProperties::SetPDFProducer
void SetPDFProducer(const Dtk_string &inString)
Add PDFProducer in Document Catalog Metadata.
PdfwSampleOneMesh_1_1
Dtk_ErrorStatus PdfwSampleOneMesh_1_1(const Dtk_string &inOutputFileName)
Definition: testlibpdfwrite.cpp:22
Dtk_string::filename
Dtk_string filename() const
File Utility : Retrieves the filename in Dtk_string form.
sampleWriter::CreateTexturedMeshCube
Dtk_MeshPtr CreateTexturedMeshCube(const Dtk_string &inImageDirectory)
Textured Mesh Cube sample.
Definition: testcreatemesh.cpp:272
Pdfw::EndWrite
DtkErrorStatus EndWrite()
Creation of the output file and free the PDF Writer
Dtk_MeshPtr
Dtk_SmartPtr< Dtk_mesh > Dtk_MeshPtr
Definition: dtk_maindoc.hpp:20
PdfwSampleCloudPoint_6_1
Dtk_ErrorStatus PdfwSampleCloudPoint_6_1(const Dtk_string &inOutputFileName)
Definition: testlibpdfwrite.cpp:770
DTK_ANCHOR_TOP_RIGHT
@ DTK_ANCHOR_TOP_RIGHT
Definition: util_draw_dtk.hpp:102
sampleWriter::CreateFdtDatum
Dtk_FdtPtr CreateFdtDatum()
Create Simple Datum.
Definition: testcreatefdt.cpp:19
Pdfw::EndNode
DtkErrorStatus EndNode()
End the node.
Dtk_MetaData::TypeProperty
@ TypeProperty
Definition: dtk_metadata.hpp:28
PdfwSampleBodyVisibility_2_3
Dtk_ErrorStatus PdfwSampleBodyVisibility_2_3(const Dtk_string &inOutputFileName)
Definition: testlibpdfwrite.cpp:154
PdfwSampleMeshes_1_2
Dtk_ErrorStatus PdfwSampleMeshes_1_2(const Dtk_string &inOutputFileName)
Definition: testlibpdfwrite.cpp:45
Dtk_SmartPtr< Dtk_Entity >::DtkDynamicCast
static Dtk_SmartPtr< Dtk_Entity > DtkDynamicCast(const Dtk_SmartPtr< T2 > &p)
Definition: util_ptr_dtk.hpp:101
Dtk_ErrorStatus
Dtk_ErrorStatus
Definition: error_dtk.hpp:6
Dtk_SmartPtr::IsNULL
Dtk_bool IsNULL() const
Definition: util_ptr_dtk.hpp:118
Dtk_API::GetVersion
Dtk_string GetVersion() const
GetVersion of DatakitLibs.
CHECK_OK
#define CHECK_OK(X)
Definition: testwriters.h:9
Dtk_SmartPtr< Dtk_Camera >
Dtk_string::c_str
const char * c_str() const
Retrieve the ASCII conversion string.
Pdfw::WriteOptions::OwnerPassword
Dtk_string OwnerPassword
Definition: pdfw.hpp:172
PdfwSampleInstancesColors_3_4
Dtk_ErrorStatus PdfwSampleInstancesColors_3_4(const Dtk_string &inOutputFileName)
Definition: testlibpdfwrite.cpp:322
PdfwSampleAssembly_3_1
Dtk_ErrorStatus PdfwSampleAssembly_3_1(const Dtk_string &inOutputFileName)
Definition: testlibpdfwrite.cpp:185
Dtk_string::mkdir
int mkdir() const
File Utility : Create a Directory.
PdfwSampleSimplePMI_5_1
Dtk_ErrorStatus PdfwSampleSimplePMI_5_1(const Dtk_string &inOutputFileName)
Definition: testlibpdfwrite.cpp:533
Pdfw::keepsubcolor
@ keepsubcolor
Definition: pdfw.hpp:15
Dtk_pnt
This is a mathematical point class.
Definition: dtk_pnt.hpp:22
PdfwSamplePMI_Geom_association_5_4
Dtk_ErrorStatus PdfwSamplePMI_Geom_association_5_4(const Dtk_string &inOutputFileName)
Definition: testlibpdfwrite.cpp:626
Pdfw::WritePinToScreenPicture
Dtk_ErrorStatus WritePinToScreenPicture(const Dtk_string &inPictureFilePath, Dtk_Double64 inPictureWidth, Dtk_Double64 inPictureHeight, Dtk_pnt inPictureOrigin, Dtk_anchor_type inAnchorType, bool inIsOnTop, Dtk_LeaderPtr &inLeader)
Creates a picture parallel to screen with an attached leader line.
Pdfw::Layout::End3DArtwork
DtkErrorStatus End3DArtwork(Dtk_UInt32 &outartworkIndex)
Ends Writing of 3D Artwork.
PdfwSampleAsmInstances_3_3
Dtk_ErrorStatus PdfwSampleAsmInstances_3_3(const Dtk_string &inOutputFileName)
Definition: testlibpdfwrite.cpp:268
Dtk_string::FixPathSeparator
void FixPathSeparator()
File Utility : Fixes path separator consistency. It lets you replace the '\' or '/' by the OS needed ...
Pdfw::WriteColoredPoints
Dtk_ErrorStatus WriteColoredPoints(Dtk_tab< Dtk_pnt > &inTabPoints, Dtk_tab< Dtk_dir > &inTabNormals, Dtk_tab< Dtk_RGB > &inTabColors, Dtk_ID &outID, Dtk_InfoPtr inInfo=Dtk_InfoPtr())
Write colored points provided in parameter in one node.
PdfwSample_MV_association_5_3
Dtk_ErrorStatus PdfwSample_MV_association_5_3(const Dtk_string &inOutputFileName)
Definition: testlibpdfwrite.cpp:586
PdfwSampleDocumentProperties_4_2
Dtk_ErrorStatus PdfwSampleDocumentProperties_4_2(const Dtk_string &inOutputFileName)
Definition: testlibpdfwrite.cpp:489
Pdfw::WriteEntity
Dtk_ErrorStatus WriteEntity(const Dtk_EntityPtr &inEntity)
Write the entity provided in parameter in a node.
Dtk_Leader::Create
static Dtk_LeaderPtr Create()
Base constructor.
Dtk_Camera::Create
static Dtk_CameraPtr Create()
Base constructor.
sampleWriter::CreateModelDisplayActivated
Dtk_ModelDisplayPtr CreateModelDisplayActivated()
Definition: testcreatefdt.cpp:228
Pdfw::cross_section::AddSectionCap
Dtk_bool AddSectionCap
Definition: pdfw.hpp:24
Dtk_tab
This is a high level array class.
Definition: util_stl_dtk.hpp:85
Dtk_transfo::addTranslate
void addTranslate(const Dtk_dir &V)
Translate the Dtk_transfo.
Pdfw::InitNode
DtkErrorStatus InitNode(Dtk_string &inNodeName, const Dtk_transfo &inTransfo=Dtk_transfo())
Initialize a node.
PdfwCreate3DAnnotations
Dtk_ErrorStatus PdfwCreate3DAnnotations(Dtk_Double64 annotBBox[4], const Dtk_UInt32 &artworkIndex)
Definition: testlibpdfwrite.cpp:925
Pdfw::WriteOptions::ConvertRenderInfos
Dtk_bool ConvertRenderInfos
DTK_TRUE : Creates render infos (lightning + texturing), DTK_FALSE : no render infos.
Definition: pdfw.hpp:159
PdfwSamplePMI_PMI_association_5_6
Dtk_ErrorStatus PdfwSamplePMI_PMI_association_5_6(const Dtk_string &inOutputFileName)
Definition: testlibpdfwrite.cpp:704
Pdfw::WriteParallelToScreenPicture
Dtk_ErrorStatus WriteParallelToScreenPicture(const Dtk_string &inPictureFilePath, Dtk_Double64 inPictureWidth, Dtk_Double64 inPictureHeight, Dtk_anchor_type inAnchorType, bool inIsZoomable, bool inIsOnTop, Dtk_transfo inTransfo, Dtk_LeaderPtr &inLeader)
Creates a parallel to screen picture with an attached leader line.
Pdfw::PdfDocumentProperties::SetSubject
void SetSubject(const Dtk_string &inString)
Add Subject in Document Catalog Metadata.
PdfwSampleWireBody_2_2
Dtk_ErrorStatus PdfwSampleWireBody_2_2(const Dtk_string &inOutputFileName)
Definition: testlibpdfwrite.cpp:133
sampleWriter::CreateCurves
Dtk_BodyPtr CreateCurves()
Definition: testcreatecube.cpp:1292
PdfwSampleSimpleModelview_5_2
Dtk_ErrorStatus PdfwSampleSimpleModelview_5_2(const Dtk_string &inOutputFileName)
Definition: testlibpdfwrite.cpp:554
sampleWriter::CreateCurvesStyle
Dtk_BodyPtr CreateCurvesStyle()
Definition: testcreatecube.cpp:1370
Pdfw::AddDocumentProperties
Dtk_ErrorStatus AddDocumentProperties(const Pdfw::PdfDocumentProperties &inDocProperties, const Dtk_tab< Dtk_MetaDataPtr > &inMetadatas)
Writing Document Properties.
Pdfw::PdfDocumentProperties::SetApplication
void SetApplication(const Dtk_string &inString)
Add Application in Document Catalog Metadata.
dtkNoError
@ dtkNoError
Definition: error_dtk.hpp:140
Dtk_tab::push_back
void push_back(const T &x)
Inserts an element at the end of the array.
Definition: util_stl_dtk.hpp:415
PdfwSampleOneMeshRender_1_3
Dtk_ErrorStatus PdfwSampleOneMeshRender_1_3(const Dtk_string &inOutputFileName, const Dtk_string &inImageDirectory)
Definition: testlibpdfwrite.cpp:99
Pdfw::attributeoverwrite
@ attributeoverwrite
Definition: pdfw.hpp:14
Dtk_tab::clear
void clear(int no_delete=0)
Resets the Dtk_tab content.
Definition: util_stl_dtk.hpp:351
PdfwSampleBody_2_1
Dtk_ErrorStatus PdfwSampleBody_2_1(const Dtk_string &inOutputFileName)
Definition: testlibpdfwrite.cpp:117
Pdfw::WriteBodyAndMesh
DtkErrorStatus WriteBodyAndMesh(const Dtk_BodyPtr &inBody, const Dtk_MeshPtr &inMesh, Dtk_ID &outID)
Write the entities provided in parameter in a node.
Pdfw::cross_section::IntersectionColor
Dtk_RGB IntersectionColor
Definition: pdfw.hpp:26
Dtk_RGB
Definition: dtk_rgb.hpp:7
Dtk_Info::SetColor
Dtk_ErrorStatus SetColor(const int &R, const int &G, const int &B)
Dtk_Info::create
static Dtk_SmartPtr< Dtk_Info > create()
Dtk_dir
This is a mathematical direction class.
Definition: dtk_dir.hpp:15
Pdfw::CreateNodeConnectorHighlight
Dtk_ErrorStatus CreateNodeConnectorHighlight(const Dtk_ID &inPointingNodeID, const Dtk_ID &inPointedNodeID, const Dtk_UInt32 &inFaceIndex=-1, Dtk_Int32 inReasonLink=0)
Create a connexion between two nodes for visual response.
Pdfw::WriteOptions::CreateDefaultView
Dtk_bool CreateDefaultView
DTK_TRUE : Creates Default View (isometric view), DTK_FALSE : no default view.
Definition: pdfw.hpp:139
Pdfw::Layout::InitPage
Dtk_ErrorStatus InitPage(Dtk_RGB inColor=Dtk_RGB(255, 255, 255), Dtk_Double64 inWidth=842, Dtk_Double64 inHeight=595)
LAYOUT METHODS.
Dtk_Leader::TerminatorTypeNone
@ TerminatorTypeNone
Definition: util_draw_dtk.hpp:2001
sampleWriter::CreateModelDisplayDesactivated
Dtk_ModelDisplayPtr CreateModelDisplayDesactivated()
Definition: testcreatefdt.cpp:241
Dtk_MetaData::CreateMetaData
static Dtk_MetaDataPtr CreateMetaData(const MetaDataTypeEnum &inEnumType, Dtk_string inTitle, Dtk_string inValue, Dtk_string inValueType=Dtk_string(L"STRING"))
Create a Dtk_MetaDataPtr .
Pdfw::WriteOptions::ShowToolbar
Dtk_bool ShowToolbar
DTK_TRUE : Show 3D Toolbar, DTK_FALSE : Hides 3D Toolbar.
Definition: pdfw.hpp:145