DATAKIT SDK  V2026.4
testlibpdfwrite.cpp File Reference

Functions

void AssignFacesColors (Dtk_MeshPtr &inoutMeshCube)
 
Dtk_ErrorStatus PdfwCreate3DAnnotations (Dtk_Double64 outAnnotBBox[4], const Dtk_UInt32 &inArtworkIndex)
 
Dtk_ErrorStatus PdfwCreateViews ()
 
DtkErrorStatus 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 &inOutputFileName)
 
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)
 PDF write sample entry point: orchestrates all PDF sample functions. More...
 
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 &inoutMesh, double inShiftAmount)
 

Function Documentation

◆ AssignFacesColors()

void AssignFacesColors ( Dtk_MeshPtr &  inoutMeshCube)
994 {
995  for( Dtk_Size_t faceIdx = 1; faceIdx < 6; faceIdx++ )
996  inoutMeshCube->get_mesh_face( faceIdx )->info() = Dtk_Info::Create();
997  inoutMeshCube->get_mesh_face( 1 )->info()->SetColor( Dtk_RGB( 0, 255, 0 ) );
998  inoutMeshCube->get_mesh_face( 2 )->info()->SetColor( Dtk_RGB( 0, 0, 255 ) );
999  inoutMeshCube->get_mesh_face( 3 )->info()->SetColor( Dtk_RGB( 255, 255, 0 ) );
1000  inoutMeshCube->get_mesh_face( 4 )->info()->SetColor( Dtk_RGB( 255, 0, 255 ) );
1001  inoutMeshCube->get_mesh_face( 5 )->info()->SetColor( Dtk_RGB( 0, 255, 255 ) );
1002 }

◆ PdfwCreate3DAnnotations()

Dtk_ErrorStatus PdfwCreate3DAnnotations ( Dtk_Double64  outAnnotBBox[4],
const Dtk_UInt32 &  inArtworkIndex 
)
953 {
954  Dtk_Double64 margin = 3.0;
957 
958  // first annotation 2d bbox (top right)
959  outAnnotBBox[ 0 ] = margin / 2. + xPos;
960  outAnnotBBox[ 1 ] = margin / 2. + yPos;
961  outAnnotBBox[ 2 ] = xPos + width - margin;
962  outAnnotBBox[ 3 ] = yPos + height - margin;
963 
964  CHECK_OK( Pdfw::Layout::Create3DAnnotation( inArtworkIndex, outAnnotBBox, 0 ) );
965 
966  // second annotation 2d bbox (top left)
967  xPos = 0.0;
968  outAnnotBBox[ 0 ] = margin + xPos;
969  outAnnotBBox[ 1 ] = margin / 2. + yPos;
970  outAnnotBBox[ 2 ] = xPos + width - margin / 2.;
971  outAnnotBBox[ 3 ] = yPos + height - margin;
972  CHECK_OK( Pdfw::Layout::Create3DAnnotation( inArtworkIndex, outAnnotBBox, 1 ) );
973 
974  // third annotation 2d bbox (bottom left)
975  yPos = 0.0;
976  outAnnotBBox[ 0 ] = margin + xPos;
977  outAnnotBBox[ 1 ] = margin + yPos;
978  outAnnotBBox[ 2 ] = xPos + width - margin / 2.;
979  outAnnotBBox[ 3 ] = yPos + height - margin / 2.;
980  CHECK_OK( Pdfw::Layout::Create3DAnnotation( inArtworkIndex, outAnnotBBox, 2 ) );
981 
982  // fourth annotation 2d bbox (bottom right)
983  xPos = Pdfw::Layout::GetCurrentPageWidth() / 2.0;
984  outAnnotBBox[ 0 ] = margin / 2. + xPos;
985  outAnnotBBox[ 1 ] = margin + yPos;
986  outAnnotBBox[ 2 ] = xPos + width - margin;
987  outAnnotBBox[ 3 ] = yPos + height - margin / 2.;
988  CHECK_OK( Pdfw::Layout::Create3DAnnotation( inArtworkIndex, outAnnotBBox, 3 ) );
989 
990  return dtkNoError;
991 }

◆ PdfwCreateViews()

Dtk_ErrorStatus PdfwCreateViews ( )
904 {
905 
906  // iso view
907  Dtk_pnt from( 30, 30, 30 );
908  Dtk_pnt to( 0, 0, 0 );
909  Dtk_dir up( -0.57735, 0.57735, -0.57735 );
910  Dtk_CameraPtr isoCam = Dtk_Camera::Create( from, to, 10, 10, up );
911  Dtk_ModelDisplayPtr isoMd = Dtk_ModelDisplay::Create( isoCam, NULL, 1 ); // create first activated view
912  Dtk_tab<Dtk_ID> tabNodeIDs;
913  isoMd->info() = Dtk_Info::Create();
914  isoMd->info()->SetName( "Iso" );
915 
916  CHECK_OK( Pdfw::CreateModelDisplayWithVisibleNodes( isoMd, tabNodeIDs ) ); // Add ModelDisplay
917 
918  // top view
919  from = Dtk_pnt( 0, 0, 300 );
920  up = Dtk_dir( 0, 1, 0 );
921  Dtk_CameraPtr topCam = Dtk_Camera::Create( from, to, 10, 10, up );
922  Dtk_ModelDisplayPtr topMd = Dtk_ModelDisplay::Create( topCam, NULL, 0 ); // create first activated view
923  topMd->info() = Dtk_Info::Create();
924  topMd->info()->SetName( "Top" );
925 
926  CHECK_OK( Pdfw::CreateModelDisplayWithVisibleNodes( topMd, tabNodeIDs ) ); // Add ModelDisplay
927 
928  // Front view
929  from = Dtk_pnt( 0, -300, 0 );
930  up = Dtk_dir( 0, 0, 1 );
931  Dtk_CameraPtr frontCam = Dtk_Camera::Create( from, to, 10, 10, up );
932  Dtk_ModelDisplayPtr frontMd = Dtk_ModelDisplay::Create( frontCam, NULL, 0 ); // create first activated view
933  frontMd->info() = Dtk_Info::Create();
934  frontMd->info()->SetName( "Front" );
935 
936  CHECK_OK( Pdfw::CreateModelDisplayWithVisibleNodes( frontMd, tabNodeIDs ) ); // Add ModelDisplay
937 
938  // right view
939  from = Dtk_pnt( 300, 0, 0 );
940  up = Dtk_dir( 0, 0, 1 );
941  Dtk_CameraPtr rightCam = Dtk_Camera::Create( from, to, 10, 10, up );
942  Dtk_ModelDisplayPtr rightMd = Dtk_ModelDisplay::Create( rightCam, NULL, 0 ); // create first activated view
943  rightMd->info() = Dtk_Info::Create();
944  rightMd->info()->SetName( "Right" );
945 
946  CHECK_OK( Pdfw::CreateModelDisplayWithVisibleNodes( rightMd, tabNodeIDs ) ); // Add ModelDisplay
947 
948  return dtkNoError;
949 }

◆ PdfWriteSample()

DtkErrorStatus PdfWriteSample ( const Dtk_string &  inResultDirectory)
1059 {
1060  Dtk_ErrorStatus errStatus;
1061  std::cout << std::endl << "----------------------------------------------" << std::endl;
1062  std::cout << "Pdf Write start" << std::endl;
1063 
1064  Dtk_string imageDirectory = L"../InputFiles/Images/";
1065  Dtk_string outputDirectory;
1066 
1067  // Choosing output directory and file name
1068  outputDirectory = inResultDirectory + L"Pdf/";
1069  outputDirectory.FixPathSeparator();
1070  outputDirectory.mkdir();
1071 
1072  Dtk_string pdfFileName = outputDirectory + L"PDFW_SampleOneMesh_1_1.pdf";
1073  errStatus = PdfwSampleOneMesh_1_1( pdfFileName );
1074 
1075  pdfFileName = outputDirectory + L"PDFW_SampleMeshes_1_2.pdf";
1076  errStatus = PdfwSampleMeshes_1_2( pdfFileName );
1077 
1078  pdfFileName = outputDirectory + L"PDFW_SampleOneMeshRender_1_3.pdf";
1079  errStatus = PdfwSampleOneMeshRender_1_3( pdfFileName, imageDirectory );
1080 
1081  pdfFileName = outputDirectory + L"PDFW_SampleBody_2_1.pdf";
1082  errStatus = PdfwSampleBody_2_1( pdfFileName );
1083 
1084  pdfFileName = outputDirectory + L"PDFW_SampleWireBody_2_2.pdf";
1085  errStatus = PdfwSampleWireBody_2_2( pdfFileName );
1086 
1087  pdfFileName = outputDirectory + L"PDFW_SampleBodyVisibility_2_3.pdf";
1088  errStatus = PdfwSampleBodyVisibility_2_3( pdfFileName );
1089 
1090  pdfFileName = outputDirectory + L"PDFW_SampleAssembly_3_1.pdf";
1091  errStatus = PdfwSampleAssembly_3_1( pdfFileName );
1092 
1093  pdfFileName = outputDirectory + L"PDFW_SamplePartInstances_3_2.pdf";
1094  errStatus = PdfwSamplePartInstances_3_2( pdfFileName );
1095 
1096  pdfFileName = outputDirectory + L"PDFW_SampleAsmInstances_3_3.pdf";
1097  errStatus = PdfwSampleAsmInstances_3_3( pdfFileName );
1098 
1099  pdfFileName = outputDirectory + L"PDFW_SampleInstancesColors_3_4.pdf";
1100  errStatus = PdfwSampleInstancesColors_3_4( pdfFileName );
1101 
1102  pdfFileName = outputDirectory + L"PDFW_SampleInstancesVisibility_3_5.pdf";
1103  errStatus = PdfwSampleInstancesVisibility_3_5( pdfFileName );
1104 
1105  pdfFileName = outputDirectory + L"PDFW_SampleMetadatas_4_1.pdf";
1106  errStatus = PdfwSampleMetadatas_4_1( pdfFileName );
1107 
1108  pdfFileName = outputDirectory + L"PDFW_SampleDocumentProperties_4_2.pdf";
1109  errStatus = PdfwSampleDocumentProperties_4_2( pdfFileName );
1110 
1111  pdfFileName = outputDirectory + L"PDFW_SampleSimplePMI_5_1.pdf";
1112  errStatus = PdfwSampleSimplePMI_5_1( pdfFileName );
1113 
1114  pdfFileName = outputDirectory + L"PDFW_SampleSimpleModelview_5_2.pdf";
1115  errStatus = PdfwSampleSimpleModelview_5_2( pdfFileName );
1116 
1117  pdfFileName = outputDirectory + L"PDFW_Sample_MV_association_5_3.pdf";
1118  errStatus = PdfwSample_MV_association_5_3( pdfFileName );
1119 
1120  pdfFileName = outputDirectory + L"PDFW_SamplePMI_Geom_association_5_4.pdf";
1121  errStatus = PdfwSamplePMI_Geom_association_5_4( pdfFileName );
1122 
1123  pdfFileName = outputDirectory + L"PDFW_SampleModelview_sections_5_5.pdf";
1124  errStatus = PdfwSampleModelview_section_5_5( pdfFileName );
1125 
1126  pdfFileName = outputDirectory + L"PDFW_SamplePMI_PMI_association_5_6.pdf";
1127  errStatus = PdfwSamplePMI_PMI_association_5_6( pdfFileName );
1128 
1129  pdfFileName = outputDirectory + L"PDFW_SampleAxis_References_5_7.pdf";
1130  errStatus = PdfwSampleAxis_References_5_7( pdfFileName );
1131 
1132  pdfFileName = outputDirectory + L"PDFW_SampleCloudPoint_6_1.pdf";
1133  errStatus = PdfwSampleCloudPoint_6_1( pdfFileName );
1134 
1135  pdfFileName = outputDirectory + L"PDFW_SampleBillboard_7_1.pdf";
1136 
1137  errStatus = PdfwSampleBillboard_7_1( pdfFileName, imageDirectory );
1138 
1139  pdfFileName = outputDirectory + L"PDFW_SampleSecuredPdf_8_1.pdf";
1140  errStatus = PdfwSampleSecuredPdf_8_1( pdfFileName );
1141 
1142  pdfFileName = outputDirectory + L"PDFW_SampleLayoutMultipleViews_9_1.pdf";
1143  errStatus = PdfwSampleLayoutMultipleViews_9_1( pdfFileName );
1144 
1145  std::cout << "Pdf Write end" << std::endl;
1146 
1147  return errStatus;
1148 }

◆ PdfwSample_MV_association_5_3()

Dtk_ErrorStatus PdfwSample_MV_association_5_3 ( const Dtk_string &  inOutputFileName)
604 {//! \image html pdfw_samples_PDFWSample_MV_association_MyView1.png
605  //! \image html pdfw_samples_PDFWSample_MV_association_PMIView.png
606 
607  Pdfw::WriteOptions options;
608  Dtk_ID cylID, datumID;
609 
610  options.CreateDefaultView = DTK_FALSE; // no default view needed
611  // First we initialize writing with name of files
612  CHECK_OK( Pdfw::InitWrite( inOutputFileName, "", NULL, options ) );
613 
614  Dtk_BodyPtr cylinder = sampleWriter::CreateCyl( 100, 150 ); // Create a Cylinder radius=100, height=150 (with a green face)
615  cylinder->info()->SetName( "Body" );
616  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( cylinder ), cylID ) ); // Add the body
617 
618  Dtk_FdtPtr pmi = sampleWriter::CreateFdtDatum(); // Create an FDT (PMI)
619  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( pmi ), datumID ) ); // Add the PMI
620 
621 
623 
624  Dtk_tab<Dtk_ID> tabNodeIDs;
625  tabNodeIDs.push_back( cylID );
626  CHECK_OK( Pdfw::CreateModelDisplayWithVisibleNodes( mv, tabNodeIDs ) ); // create the model display with visible nodes
627 
628  Dtk_ModelDisplayPtr mv2 = Dtk_ModelDisplay::Create( mv->GetCamera(), NULL, 0 );// create desactivated model display
629  mv2->info() = Dtk_Info::Create();
630  mv2->info()->SetName( "PMIView" );
631  tabNodeIDs.clear();
632  tabNodeIDs.push_back( cylID );
633  tabNodeIDs.push_back( datumID );
634  CHECK_OK( Pdfw::CreateModelDisplayWithVisibleNodes( mv2, tabNodeIDs ) ); // create the model display with visible nodes
635 
636  CHECK_OK( Pdfw::EndWrite() ); // Write final file and free memory allocated
637  std::cout << "=> " << inOutputFileName.c_str() << std::endl;
638  return dtkNoError;
639 }

◆ PdfwSampleAsmInstances_3_3()

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

◆ PdfwSampleAssembly_3_1()

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

◆ PdfwSampleAxis_References_5_7()

Dtk_ErrorStatus PdfwSampleAxis_References_5_7 ( const Dtk_string &  inOutputFileName)
764 {//! \image html pdfw_samples_PDFWSampleAxis_References.png
765  Pdfw::WriteOptions options;
766  Dtk_ID axisSysID, planeID, axisID;
767  Dtk_tab<Dtk_ID> tabNodeIDs;
768 
769  // First we initialize writing with name of files
770  CHECK_OK( Pdfw::InitWrite( inOutputFileName, "", NULL, options ) );
771 
774  tabNodeIDs.push_back( axisSysID );
775 
777  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( refplane ), planeID ) );
778  tabNodeIDs.push_back( planeID );
779 
782  tabNodeIDs.push_back( axisID );
783 
784  CHECK_OK( Pdfw::EndWrite() ); // Write final file and free memory allocated
785  std::cout << "=> " << inOutputFileName.c_str() << std::endl;
786  return dtkNoError;
787 }

◆ PdfwSampleBillboard_7_1()

Dtk_ErrorStatus PdfwSampleBillboard_7_1 ( const Dtk_string &  inOutputFileName,
const Dtk_string &  inImageDirectory 
)
849 {//! \image html pdfw_samples_PDFWSampleBillboard.png
850  Pdfw::WriteOptions options;
851  Dtk_ID meshID;
852  Dtk_LeaderPtr emptyLeader;
853 
854  // First we initialize writing with name of files
855  CHECK_OK( Pdfw::InitWrite( inOutputFileName, "", NULL, options ) );
856  Dtk_MeshPtr meshCube = sampleWriter::CreateMeshCube(); // create a simple red cube
857 
858  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( meshCube ), meshID ) ); // write the cube
859 
860  // create a leader without terminator
861  Dtk_tab<Dtk_pnt> leaderPoints;
862  Dtk_pnt dtkLeaderEnd( 1., -1., 1. ), pictureOrigin( 2., -2, 2. );
863  leaderPoints.push_back( dtkLeaderEnd );
864  leaderPoints.push_back( pictureOrigin );
865  Dtk_LeaderPtr leader = Dtk_Leader::Create( 0, 0, dtkLeaderEnd, Dtk_Leader::TerminatorTypeNone, leaderPoints );
866 
867  // write parallel to screen image with leader
868  CHECK_OK( Pdfw::WriteParallelToScreenPicture( inImageDirectory + "logodtk.bmp", 20, 20, DTK_ANCHOR_TOP_RIGHT, false, true, Dtk_transfo(), leader ) );
869  // write pin to screen image
870  CHECK_OK( Pdfw::WritePinToScreenPicture( inImageDirectory + "logodtk.bmp", 20, 20, Dtk_pnt( 1., 100. ), DTK_ANCHOR_BOTTOM_LEFT, true, emptyLeader ) );
871 
872  CHECK_OK( Pdfw::EndWrite() ); // Write final file and free memory allocated
873  std::cout << "=> " << inOutputFileName.c_str() << std::endl;
874  return dtkNoError;
875 }

◆ PdfwSampleBody_2_1()

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

◆ PdfwSampleBodyVisibility_2_3()

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

◆ PdfwSampleCloudPoint_6_1()

Dtk_ErrorStatus PdfwSampleCloudPoint_6_1 ( const Dtk_string &  inOutputFileName)
793 {//! \image html pdfw_samples_PDFWSampleCloudPoint.png
794  Pdfw::WriteOptions options;
795  Dtk_tab<Dtk_pnt> tabPoints;
796  Dtk_Size_t i, j;
797  Dtk_transfo transfo;
798  Dtk_ID pointID;
799  Dtk_Double64 xPos = 0., yPos = 0., offset = 1.;
800  Dtk_Size_t numPointX = 200, numPointY = 200;
801  Dtk_tab<Dtk_RGB> tabColors;
802  Dtk_tab<Dtk_dir> tabNormals;
803 
804  options.CreateDefaultView = DTK_FALSE; // no default view needed
805  // First we initialize writing with name of files
806  CHECK_OK( Pdfw::InitWrite( inOutputFileName, "", NULL, options ) );
807 
808  // generating cloud point
809 
810  for( i = 0; i < numPointX; i++ )
811  {
812  for( j = 0; j < numPointY; j++ )
813  {
814  tabPoints.push_back( Dtk_pnt( xPos, yPos, 0. ) );
815  tabColors.push_back( Dtk_RGB( ( int )( std::rand() / double( RAND_MAX ) * 255 ),
816  ( int )( std::rand() / double( RAND_MAX ) * 255 ),
817  ( int )( std::rand() / double( RAND_MAX ) * 255 ) ) );
818  yPos += offset;
819  }
820  yPos = 0.;
821  xPos += offset;
822  }
823 
824 
825  CHECK_OK( Pdfw::WriteColoredPoints( tabPoints, tabNormals, tabColors, pointID ) ); // write the cloud point
826 
827  Dtk_pnt from( 300, 300, 300 );
828  Dtk_pnt to( numPointX / 2., numPointY / 2., 0 );
829  Dtk_dir up( 0., 1., 0. );
830  Dtk_CameraPtr cam = Dtk_Camera::Create( from, to, 200, 200, up );
831  Dtk_ModelDisplayPtr mv1 = Dtk_ModelDisplay::Create( cam, NULL, 1 ); // create activated view
832 
833  mv1->info() = Dtk_Info::Create();
834  mv1->info()->SetName( "MainView" );
835  Dtk_tab<Dtk_ID>tabNodeIDs;
836  CHECK_OK( Pdfw::CreateModelDisplayWithVisibleNodes( mv1, tabNodeIDs ) ); // Add ModelDisplay
837 
838  CHECK_OK( Pdfw::EndWrite() ); // Write final file and free memory allocated
839  std::cout << "=> " << inOutputFileName.c_str() << std::endl;
840  return dtkNoError;
841 }

◆ PdfwSampleDocumentProperties_4_2()

Dtk_ErrorStatus PdfwSampleDocumentProperties_4_2 ( const Dtk_string &  inOutputFileName)
504 {//! \image html pdfw_samples_PDFWSampleDocumentProperties.png
505  //! \image html pdfw_samples_PDFWSampleDocumentProperties_4_2_Custom.png
506  Pdfw::WriteOptions options;
507  Pdfw::PdfDocumentProperties docProperties;
508  Dtk_tab<Dtk_MetaDataPtr> metadatas;
509  Dtk_string application, pdfProducer, title, author, subject, keywords;
510 
511  // First we initialize writing with name of files
512  CHECK_OK( Pdfw::InitWrite( inOutputFileName, "", NULL, options ) );
513 
514  // We fill Pdfw::PdfDocumentProperties with information we want
515  title = inOutputFileName.filename();
516  docProperties.SetTitle( title ); // title
517 
518  author = "user";
519  docProperties.SetAuthor( author ); // author
520 
521  subject = "Datakit PDF SDK demo";
522  docProperties.SetSubject( subject ); // subject
523 
524  keywords = "Datakit;SDK;Demo";
525  docProperties.SetKeywords( keywords ); // keywords
526 
527 
528  application = "LibPdfWriteSample";
529  docProperties.SetApplication( application ); // application
530 
531  pdfProducer = "DATAKIT API Version " + Dtk_API::GetAPI()->GetVersion();
532  docProperties.SetPDFProducer( pdfProducer ); // producer
533 
534  metadatas.push_back( Dtk_MetaData::CreateMetaData( Dtk_MetaData::TypeFileProperty, "PartName", "SampleDocumentProperties_4_2" ) ); // custom metadata
535 
536  CHECK_OK( Pdfw::AddDocumentProperties( docProperties, metadatas ) ); // We add properties to the document
537 
538  CHECK_OK( Pdfw::EndWrite() ); // Write final file and free memory allocated
539  std::cout << "=> " << inOutputFileName.c_str() << std::endl;
540  return dtkNoError;
541 }

◆ PdfwSampleInstancesColors_3_4()

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

◆ PdfwSampleInstancesVisibility_3_5()

Dtk_ErrorStatus PdfwSampleInstancesVisibility_3_5 ( const Dtk_string &  inOutputFileName)
432 {//! \image html pdfw_samples_PDFWSampleInstancesVisibility.png
433  Dtk_dir X( 1, 0, 0 );
434  Dtk_dir Y( 0, 1, 0 );
435  Dtk_dir Z( 0, 0, 1 );
436  Pdfw::WriteOptions options;
437  Dtk_ID axleNodeID, axleID, wheelsNodeID, wheelNodeID, wheelID;
438  Dtk_InfoPtr info;
439 
440  // First we initialize writing with name of files
441  CHECK_OK( Pdfw::InitWrite( inOutputFileName, "", NULL, options ) );
442 
443  Dtk_string nodeName = "Axle";
444  CHECK_OK( Pdfw::InitNode( nodeName, Dtk_transfo(), info, axleNodeID ) ); // open Axle node
445  Dtk_BodyPtr axle = sampleWriter::CreateCyl( 0.2, 5 );
446  axle->info()->SetName( "axle" );
447  CHECK_OK( Pdfw::WriteBodyAndMesh( axle, Dtk_MeshPtr(), axleID ) ); // write the body
448  CHECK_OK( Pdfw::EndNode() ); // close Axle
449 
450  nodeName = "Wheels";
451  CHECK_OK( Pdfw::InitNode( nodeName, Dtk_transfo(), info, wheelsNodeID ) ); // open Wheels node
452  nodeName = "Wheel1";
453  CHECK_OK( Pdfw::InitNode( nodeName, Dtk_transfo( X, Y, Z, Dtk_pnt( 0, 0, 5 ) ), info, wheelNodeID ) ); // open Wheel1 node
454  Pdfw::StorePrototype( wheelNodeID ); // Store Wheel node ID for future re-instanciation
455  Dtk_BodyPtr wheel = sampleWriter::CreateCyl( 1, 1 );
456  wheel->info()->SetName( "wheel" );
457  CHECK_OK( Pdfw::WriteBodyAndMesh( wheel, Dtk_MeshPtr(), wheelID ) ); // write the body
458  CHECK_OK( Pdfw::EndNode() ); // close Wheel1
459 
460  Dtk_InfoPtr wheelInfo = Dtk_Info::Create();
461  wheelInfo->SetBlankedStatus( 1 );
462  nodeName = "Wheel2";
463  CHECK_OK( Pdfw::InitNode( nodeName, Dtk_transfo( X, -Y, -Z, Dtk_pnt() ), wheelInfo, wheelsNodeID ) ); // open invisible Wheel2
464  Pdfw::ReinstanciatePrototype( wheelNodeID ); // Re-instanciating Wheel node
465  CHECK_OK( Pdfw::EndNode() ); // close Wheel2
466 
467  CHECK_OK( Pdfw::EndNode() ); // close Wheels
468 
469  CHECK_OK( Pdfw::EndWrite() ); // Write final file and free memory allocated
470  std::cout << "=> " << inOutputFileName.c_str() << std::endl;
471  return dtkNoError;
472 }

◆ PdfwSampleLayoutMultipleViews_9_1()

Dtk_ErrorStatus PdfwSampleLayoutMultipleViews_9_1 ( const Dtk_string &  inOutputFileName)
1006 {//! \image html pdfw_samples_PDFWSampleLayoutMultipleViews.png
1007  Pdfw::WriteOptions options;
1008  Dtk_string artworkName, nodeName;
1009  Dtk_UInt32 artworkIndex = 0;
1010  Dtk_Double64 annotBBox[ 4 ];
1011  Dtk_transfo transfo;
1012  // We set the options of Writer
1014  options.CreateDefaultView = DTK_FALSE;
1015  options.ShowToolbar = DTK_FALSE;
1016  options.ConvertRenderInfos = DTK_TRUE;
1017 
1018  // First we initialize writing with name of files
1019  CHECK_OK( Pdfw::InitWrite( inOutputFileName, "", NULL, options ) );
1020 
1021  // We open a new grey page
1022  CHECK_OK( Pdfw::Layout::InitPage( Dtk_RGB( 200, 200, 200 ) ) );
1023 
1024  // Let's initialise the artwork
1025  artworkName = "myArtwork";
1026  CHECK_OK( Pdfw::Layout::Init3DArtwork( artworkName, &options ) );
1027 
1028  // add the render
1029  Dtk_RenderInfosPtr renderInfos = NULL;
1030  //RenderInfos Sample
1031  Dtk_MeshPtr meshCube = sampleWriter::CreateMeshCube(); // create a simple red cube
1032 
1033  // assigning faces colors
1034  AssignFacesColors( meshCube );
1035 
1036  // let's write the mesh cube
1038 
1039  // end of artwork
1040  CHECK_OK( Pdfw::Layout::End3DArtwork( artworkIndex ) );
1041 
1042  // create the wiews
1043  PdfwCreateViews();
1044 
1045  // create the annotations
1046  PdfwCreate3DAnnotations( annotBBox, artworkIndex );
1047 
1048  // close the page
1050  // Finally closing pdf file
1051  CHECK_OK( Pdfw::EndWrite() );
1052 
1053  std::cout << "=> " << inOutputFileName.c_str() << std::endl;
1054  return dtkNoError;
1055 }

◆ PdfwSampleMeshes_1_2()

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

◆ PdfwSampleMetadatas_4_1()

Dtk_ErrorStatus PdfwSampleMetadatas_4_1 ( const Dtk_string &  inOutputFileName)
478 {//! \image html pdfw_samples_PDFWSampleMetadatas.png
479  Pdfw::WriteOptions options;
480  Dtk_ID axleID;
481  // First we initialize writing with name of files
482  CHECK_OK( Pdfw::InitWrite( inOutputFileName, "", NULL, options ) );
483 
484  Dtk_string nodeName = "Metadata";
485  CHECK_OK( Pdfw::InitNode( nodeName ) ); // Metadata creation
486 
487  Dtk_tab<Dtk_MetaDataPtr> tabMetadata;
488  tabMetadata.push_back( Dtk_MetaData::CreateMetaData( Dtk_MetaData::TypeProperty, "MyTitle", "MyValue" ) );
489  CHECK_OK( Pdfw::AddNodeMetadata( tabMetadata ) ); // Adding metadata to node
490  Dtk_BodyPtr axle = sampleWriter::CreateCyl( 0.2, 5 );
491  axle->info()->SetName( "axle" );
492  CHECK_OK( Pdfw::WriteBodyAndMesh( axle, Dtk_MeshPtr(), axleID ) ); // write the body
493 
494  CHECK_OK( Pdfw::EndNode() ); // close Metadata
495  CHECK_OK( Pdfw::EndWrite() ); // Write final file and free memory allocated
496  std::cout << "=> " << inOutputFileName.c_str() << std::endl;
497  return dtkNoError;
498 }

◆ PdfwSampleModelview_section_5_5()

Dtk_ErrorStatus PdfwSampleModelview_section_5_5 ( const Dtk_string &  inOutputFileName)
677 {//! \image html pdfw_samples_PDFWSampleModelview_sectionMyView1.png
678  //! \image html pdfw_samples_PDFWSampleModelview_sectionMySectionView.png
679  Pdfw::WriteOptions options;
680  Dtk_ID bodyID, datumID, curveID;
681 
682  options.CreateDefaultView = DTK_FALSE; // no default view needed
683  // setting cross section graphic properties
684  options.CrossSection.CuttingPlaneColor = Dtk_RGB( 255, 255, 255 );
685  options.CrossSection.CuttingPlaneOpacity = 0.9;
686  options.CrossSection.IntersectionColor = Dtk_RGB( 155, 255, 0 );;
687  options.CrossSection.AddSectionCap = false;
688  // First we initialize writing with name of files
689  CHECK_OK( Pdfw::InitWrite( inOutputFileName, "", NULL, options ) );
690 
691  Dtk_BodyPtr cylinder = sampleWriter::CreateCyl( 100, 150 ); // Create a Cylinder radius=100, height=150 (with a green face)
692  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( cylinder ), bodyID ) ); // Add the body
693 
694  Dtk_FdtPtr pmi = sampleWriter::CreateFdtDatum(); // Create an FDT (PMI)
695  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( pmi ), datumID ) ); // Add the PMI
696 
697  Dtk_ModelDisplayPtr mv1 = sampleWriter::CreateModelDisplayActivated(); // create first activated view
699  Dtk_tab<Dtk_ID>tabNodeIDs;
700  tabNodeIDs.push_back( bodyID );
701  tabNodeIDs.push_back( datumID );
702  CHECK_OK( Pdfw::CreateModelDisplayWithVisibleNodes( mv1, tabNodeIDs ) ); // Add ModelDisplay
703 
704  CHECK_OK( Pdfw::CreateModelDisplayWithVisibleNodes( mv2, tabNodeIDs ) ); // Add ModelDisplay
705 
706  CHECK_OK( Pdfw::CreateNodeConnectorHighlight( datumID, bodyID, 1 ) ); // Connect datum PMI on body, on face index 1
707 
708  Dtk_EllipsePtr ellipse = Dtk_Ellipse::Create( Dtk_pnt(), Dtk_dir( 0., 0., 1. ), Dtk_dir( 1., 0., 0. ), 100 );
709  ellipse->info() = Dtk_Info::Create();
710  ellipse->info()->SetName( "Curve" );
711  ellipse->info()->SetBlankedStatus( DTK_TRUE );
712  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( ellipse ), curveID ) ); // Add the curve
713  //for curve
714  CHECK_OK( Pdfw::CreateNodeConnectorHighlight( datumID, curveID ) ); // Connect datum PMI on curve
715 
716  CHECK_OK( Pdfw::EndWrite() ); // Write final file and free memory allocated
717  std::cout << "=> " << inOutputFileName.c_str() << std::endl;
718  return dtkNoError;
719 }

◆ PdfwSampleOneMesh_1_1()

Dtk_ErrorStatus PdfwSampleOneMesh_1_1 ( const Dtk_string &  inOutputFileName)

PDF write sample entry point: orchestrates all PDF sample functions.

25 {//! \image html pdfw_samples_PDFWSampleOneMesh.png
26  Pdfw::WriteOptions options;
27  Dtk_ID meshID;
28  CHECK_OK( Pdfw::InitWrite( inOutputFileName, "", NULL, options ) );
29  Dtk_MeshPtr CubeMesh = sampleWriter::CreateMeshCube(); // create a simple red cube
30  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( CubeMesh ), meshID ) ); // write the cube
31 
32  CHECK_OK( Pdfw::EndWrite() ); // Write final file and free memory allocated
33  std::cout << "=> " << inOutputFileName.c_str() << std::endl;
34  return dtkNoError;
35 }

◆ PdfwSampleOneMeshRender_1_3()

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

◆ PdfwSamplePartInstances_3_2()

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

◆ PdfwSamplePMI_Geom_association_5_4()

Dtk_ErrorStatus PdfwSamplePMI_Geom_association_5_4 ( const Dtk_string &  inOutputFileName)
645 {//! \image html pdfw_samples_PDFWSamplePMI_Geom_association.png
646  Pdfw::WriteOptions options;
647  Dtk_ID bodyID, datumID;
648 
649  options.CreateDefaultView = DTK_FALSE; // no default view needed
650  // First we initialize writing with name of files
651  CHECK_OK( Pdfw::InitWrite( inOutputFileName, "", NULL, options ) );
652 
653  Dtk_BodyPtr cylinder = sampleWriter::CreateCyl( 100, 150 ); // Create a Cylinder radius=100, height=150 (with a green face)
654  cylinder->info()->SetName( "Body" );
655  CHECK_OK( Pdfw::WriteBodyAndMesh( cylinder, Dtk_MeshPtr(), bodyID ) ); // Add the body
656 
657  Dtk_FdtPtr pmi = sampleWriter::CreateFdtDatum(); // Create an FDT (PMI)
658  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( pmi ), datumID ) ); // Add the PMI
659  CHECK_OK( Pdfw::CreateNodeConnectorHighlight( datumID, bodyID, 1 ) ); // Connect datum PMI on body, on face index 1
660 
662  mv->info()->SetName( "myView" );
663  Dtk_tab<Dtk_ID>tabNodeIDs;
664  tabNodeIDs.push_back( bodyID );
665  tabNodeIDs.push_back( datumID );
666  CHECK_OK( Pdfw::CreateModelDisplayWithVisibleNodes( mv, tabNodeIDs ) ); // Add ModelDisplay with visible nodes
667 
668  CHECK_OK( Pdfw::EndWrite() ); // Write final file and free memory allocated
669  std::cout << "=> " << inOutputFileName.c_str() << std::endl;
670  return dtkNoError;
671 }

◆ PdfwSamplePMI_PMI_association_5_6()

Dtk_ErrorStatus PdfwSamplePMI_PMI_association_5_6 ( const Dtk_string &  inOutputFileName)
725 {//! \image html pdfw_samples_PDFWSamplePMI_PMI_association.png
726  Pdfw::WriteOptions options;
727  Dtk_ID bodyID, datumID;
728  Dtk_tab<Dtk_ID> tabPMIIDs;
729 
730  // First we initialize writing with name of files
731  options.CreateDefaultView = DTK_FALSE; // no default view needed
732  CHECK_OK( Pdfw::InitWrite( inOutputFileName, "", NULL, options ) );
733 
734  Dtk_BodyPtr cylinder = sampleWriter::CreateCyl( 100, 150 ); // Create a Cylinder radius=100, height=150 (with a green face)
735  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( cylinder ), bodyID ) ); // Add the body
736 
737  int pmiIdx;
738  for( pmiIdx = 0; pmiIdx < 10; pmiIdx++ ) // create 10 PMI
739  {
740  Dtk_FdtPtr pmi = sampleWriter::CreateFdtDatum(); // Create an FDT (PMI)
741  Shift( pmi, 15 * pmiIdx );
742  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( pmi ), datumID ) ); // Add the PMI
743  tabPMIIDs.push_back( datumID );
744  }
746  mv2->info()->SetName( "SecondView" );
747  Dtk_tab<Dtk_ID>tabNodeIDs;
748  tabNodeIDs.push_back( bodyID );
749  tabNodeIDs += tabPMIIDs;
750  CHECK_OK( Pdfw::CreateModelDisplayWithVisibleNodes( mv2, tabNodeIDs ) ); // Add ModelDisplay with visible nodes
751 
752  CHECK_OK( Pdfw::CreateNodeConnectorHighlight( tabNodeIDs[ 5 ], tabNodeIDs[ 7 ] ) ); // Connect datum PMI on body, on face index 1
753 
754  CHECK_OK( Pdfw::EndWrite() ); // Write final file and free memory allocated
755  std::cout << "=> " << inOutputFileName.c_str() << std::endl;
756  return dtkNoError;
757 }

◆ PdfwSampleSecuredPdf_8_1()

Dtk_ErrorStatus PdfwSampleSecuredPdf_8_1 ( const Dtk_string &  inOutputFileName)
882 {//! \image html pdfw_samples_PDFWSampleSecuredPdf.png
883  Pdfw::WriteOptions options;
884  Dtk_ID meshID;
885 
886  // setting protection password
887  options.OwnerPassword = "password";
888 
889  // First we initialize writing with name of files
890  CHECK_OK( Pdfw::InitWrite( inOutputFileName, "", NULL, options ) );
891  Dtk_MeshPtr meshCube = sampleWriter::CreateMeshCube(); // create a simple red cube
892 
893  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( meshCube ), meshID ) ); // write the cube
894 
895  CHECK_OK( Pdfw::EndWrite() ); // Write final file and free memory allocated
896  std::cout << "=> " << inOutputFileName.c_str() << std::endl;
897  return dtkNoError;
898 }

◆ PdfwSampleSimpleModelview_5_2()

Dtk_ErrorStatus PdfwSampleSimpleModelview_5_2 ( const Dtk_string &  inOutputFileName)
570 {//! \image html pdfw_samples_PDFWSampleSimpleModelviewMyView1.png
571  //! \image html pdfw_samples_PDFWSampleSimpleModelviewMyView2.png
572  Pdfw::WriteOptions options;
573  options.CreateDefaultView = DTK_FALSE; // no default view needed
574  // First we initialize writing with name of files
575  CHECK_OK( Pdfw::InitWrite( inOutputFileName, "", NULL, options ) );
576 
577 
578  Dtk_BodyPtr cylinder = sampleWriter::CreateCyl( 100, 150 ); // Create a Cylinder radius=100, height=150 (with a green face)
579  cylinder->info()->SetName( "Body" );
580  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( cylinder ) ) ); // Add the body
581 
582  Dtk_FdtPtr pmi = sampleWriter::CreateFdtDatum(); // Create an FDT (PMI)
583  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( pmi ) ) ); // Add the PMI
584 
585  Dtk_ModelDisplayPtr mvfit, mv2;
587  Dtk_tab<Dtk_ID> tabNodeIDs;
588  CHECK_OK( Pdfw::CreateModelDisplayWithVisibleNodes( mvfit, tabNodeIDs ) );
589 
592 
593  CHECK_OK( Pdfw::EndWrite() ); // Write final file and free memory allocated
594  std::cout << "=> " << inOutputFileName.c_str() << std::endl;
595  return dtkNoError;
596 }

◆ PdfwSampleSimplePMI_5_1()

Dtk_ErrorStatus PdfwSampleSimplePMI_5_1 ( const Dtk_string &  inOutputFileName)
548 {//! \image html pdfw_samples_PDFWSampleSimplePMI.png
549  Pdfw::WriteOptions options;
550  Dtk_ID axleID;
551  // First we initialize writing with name of files
552  CHECK_OK( Pdfw::InitWrite( inOutputFileName, "", NULL, options ) );
553 
554  Dtk_BodyPtr cylinder = sampleWriter::CreateCyl( 100, 150 ); // Create a Cylinder radius=1, height=2 (with a green face)
555  cylinder->info()->SetName( "Body" );
556  CHECK_OK( Pdfw::WriteBodyAndMesh( cylinder, Dtk_MeshPtr(), axleID ) ); // Add the body
557 
558  Dtk_FdtPtr pmi = sampleWriter::CreateFdtDatum(); // Create an FDT (PMI)
559  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( pmi ) ) ); // Add the PMI
560 
561  CHECK_OK( Pdfw::EndWrite() ); // Write final file and free memory allocated
562  std::cout << "=> " << inOutputFileName.c_str() << std::endl;
563  return dtkNoError;
564 }

◆ PdfwSampleWireBody_2_2()

Dtk_ErrorStatus PdfwSampleWireBody_2_2 ( const Dtk_string &  inOutputFileName)
140 {//! \image html pdfw_samples_PDFWSampleWireBody.png
141  Pdfw::WriteOptions options;
142  Dtk_ID bodyID;
143  // First we initialize writing with name of files
144  CHECK_OK( Pdfw::InitWrite( inOutputFileName, "", NULL, options ) );
145 
147  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( wire ), bodyID ) ); // write the body
148 
150  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( wire2 ), bodyID ) ); // write the body
151 
152  CHECK_OK( Pdfw::EndWrite() ); // Write final file and free memory allocated
153  std::cout << "=> " << inOutputFileName.c_str() << std::endl;
154  return dtkNoError;
155 }

◆ Shift()

template<typename T >
void Shift ( T &  inoutMesh,
double  inShiftAmount 
)
42 {
43  Dtk_transfo translation;
44  translation.addTranslate( Dtk_dir( inShiftAmount, 0, 0 ) );
45  inoutMesh->Transform( translation );
46 }
sampleWriter::CreateAxis
Dtk_BodyPtr CreateAxis()
Creates a reference body (infinite + reference flags) containing a single named axis line with metada...
Definition: testcreatecube.cpp:1568
Dtk_Info::Create
static Dtk_SmartPtr< Dtk_Info > Create()
Calls default constructor to allocate a new object.
PdfwSampleSecuredPdf_8_1
Dtk_ErrorStatus PdfwSampleSecuredPdf_8_1(const Dtk_string &inOutputFileName)
Definition: testlibpdfwrite.cpp:881
Dtk_ModelDisplay::Create
static Dtk_ModelDisplayPtr Create(const Dtk_CameraPtr &inCamera, const Dtk_EntityPtr &inClippingEntity, const Dtk_bool inIsActivated)
Calls full featured constructor to allocate a new object.
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:688
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.
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:477
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:763
Pdfw::WriteOptions::PointSize
Dtk_Double64 PointSize
Size of points.
Definition: pdfw.hpp:163
Pdfw::WriteOptions::Layout
LayoutOptions Layout
Definition: pdfw.hpp:193
PdfwSampleLayoutMultipleViews_9_1
Dtk_ErrorStatus PdfwSampleLayoutMultipleViews_9_1(const Dtk_string &inOutputFileName)
Definition: testlibpdfwrite.cpp:1005
sampleWriter::CreateCyl
Dtk_BodyPtr CreateCyl(double radius, double height)
Creates a BRep cylinder body with the given radius and height using analytical cylindrical and planar...
Definition: testcreatecube.cpp:1770
sampleWriter::CreateMeshCubeVertexColor
Dtk_MeshPtr CreateMeshCubeVertexColor()
Creates a unit cube mesh with per-vertex color data (red, green, blue, white cycling per face).
Definition: testcreatemesh.cpp:300
sampleWriter::CreateModelDisplayWithSection
Dtk_ModelDisplayPtr CreateModelDisplayWithSection()
Creates a deactivated model display "MySectionView" with a section cut plane applied.
Definition: testcreatefdt.cpp:349
sampleWriter::CreateMeshPoints
Dtk_MeshPtr CreateMeshPoints()
Points mesh sample.
Definition: testcreatemesh.cpp:440
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:726
Pdfw::PdfDocumentProperties::SetKeywords
void SetKeywords(const Dtk_string &inString)
Add Keywords in Document Catalog Metadata.
sampleWriter::CreateInfinitePlane
Dtk_BodyPtr CreateInfinitePlane()
Creates a reference body flagged as an infinite plane (InfiniteGeometryFlag + RefEntityFlag),...
Definition: testcreatecube.cpp:1511
PdfwSamplePartInstances_3_2
Dtk_ErrorStatus PdfwSamplePartInstances_3_2(const Dtk_string &inOutputFileName)
Definition: testlibpdfwrite.cpp:234
PdfwCreate3DAnnotations
Dtk_ErrorStatus PdfwCreate3DAnnotations(Dtk_Double64 outAnnotBBox[4], const Dtk_UInt32 &inArtworkIndex)
Definition: testlibpdfwrite.cpp:952
Dtk_UInt32
uint32_t Dtk_UInt32
Definition: define.h:687
Dtk_string
This is a high level string class.
Definition: dtk_string.hpp:53
Pdfw::Layout::GetCurrentPageWidth
Dtk_Double64 GetCurrentPageWidth()
Gets current page width.
DTK_ANCHOR_BOTTOM_LEFT
@ DTK_ANCHOR_BOTTOM_LEFT
Definition: util_draw_dtk.hpp:99
Dtk_Size_t
size_t Dtk_Size_t
Definition: define.h:711
Pdfw::Layout::GetCurrentPageHeight
Dtk_Double64 GetCurrentPageHeight()
Gets current page height.
Dtk_MetaData::TypeFileProperty
@ TypeFileProperty
Definition: dtk_metadata.hpp:30
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()
Creates a named axis system with a custom orientation matrix, red color, layer 123,...
Definition: testcreatecube.cpp:1541
DTK_FALSE
#define DTK_FALSE
Definition: define.h:727
PdfwSampleModelview_section_5_5
Dtk_ErrorStatus PdfwSampleModelview_section_5_5(const Dtk_string &inOutputFileName)
Definition: testlibpdfwrite.cpp:676
PdfwCreateViews
Dtk_ErrorStatus PdfwCreateViews()
Definition: testlibpdfwrite.cpp:903
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:848
Pdfw::keepsubtransparency
@ keepsubtransparency
Definition: pdfw.hpp:16
Dtk_Double64
double Dtk_Double64
Definition: define.h:698
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:431
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:389
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)
PDF write sample entry point: orchestrates all PDF sample functions.
Definition: testlibpdfwrite.cpp:24
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:21
PdfwSampleCloudPoint_6_1
Dtk_ErrorStatus PdfwSampleCloudPoint_6_1(const Dtk_string &inOutputFileName)
Definition: testlibpdfwrite.cpp:792
DTK_ANCHOR_TOP_RIGHT
@ DTK_ANCHOR_TOP_RIGHT
Definition: util_draw_dtk.hpp:95
sampleWriter::CreateFdtDatum
Dtk_FdtPtr CreateFdtDatum()
Creates simple Datum.
Definition: testcreatefdt.cpp:14
Pdfw::EndNode
DtkErrorStatus EndNode()
End the node.
Shift
void Shift(T &inoutMesh, double inShiftAmount)
Definition: testlibpdfwrite.cpp:41
Dtk_MetaData::TypeProperty
@ TypeProperty
Definition: dtk_metadata.hpp:29
PdfwSampleBodyVisibility_2_3
Dtk_ErrorStatus PdfwSampleBodyVisibility_2_3(const Dtk_string &inOutputFileName)
Definition: testlibpdfwrite.cpp:161
PdfwSampleMeshes_1_2
Dtk_ErrorStatus PdfwSampleMeshes_1_2(const Dtk_string &inOutputFileName)
Definition: testlibpdfwrite.cpp:48
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:8
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
AssignFacesColors
void AssignFacesColors(Dtk_MeshPtr &inoutMeshCube)
Definition: testlibpdfwrite.cpp:993
PdfwSampleInstancesColors_3_4
Dtk_ErrorStatus PdfwSampleInstancesColors_3_4(const Dtk_string &inOutputFileName)
Definition: testlibpdfwrite.cpp:333
PdfwSampleAssembly_3_1
Dtk_ErrorStatus PdfwSampleAssembly_3_1(const Dtk_string &inOutputFileName)
Definition: testlibpdfwrite.cpp:193
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:547
Pdfw::keepsubcolor
@ keepsubcolor
Definition: pdfw.hpp:15
Dtk_pnt
This is a mathematical point class.
Definition: dtk_pnt.hpp:20
PdfwSamplePMI_Geom_association_5_4
Dtk_ErrorStatus PdfwSamplePMI_Geom_association_5_4(const Dtk_string &inOutputFileName)
Definition: testlibpdfwrite.cpp:644
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:278
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:601
PdfwSampleDocumentProperties_4_2
Dtk_ErrorStatus PdfwSampleDocumentProperties_4_2(const Dtk_string &inOutputFileName)
Definition: testlibpdfwrite.cpp:503
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()
Calls default constructor to allocate a new object.
Dtk_Camera::Create
static Dtk_CameraPtr Create()
Calls default constructor to allocate a new object.
sampleWriter::CreateModelDisplayActivated
Dtk_ModelDisplayPtr CreateModelDisplayActivated()
Creates an activated (visible) model display "MyView1" with a perspective camera.
Definition: testcreatefdt.cpp:321
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:84
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.
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:724
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:139
sampleWriter::CreateCurves
Dtk_BodyPtr CreateCurves()
Creates a wireframe body containing a circle, ellipse, line, and NURBS curve, each with a distinct co...
Definition: testcreatecube.cpp:1368
PdfwSampleSimpleModelview_5_2
Dtk_ErrorStatus PdfwSampleSimpleModelview_5_2(const Dtk_string &inOutputFileName)
Definition: testlibpdfwrite.cpp:569
sampleWriter::CreateCurvesStyle
Dtk_BodyPtr CreateCurvesStyle()
Creates a wireframe body demonstrating curve display styles: thick circle (4 mm), dashed blue circle,...
Definition: testcreatecube.cpp:1447
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:151
Dtk_tab::push_back
void push_back(const T &x)
Inserts an element at the end of the array.
Definition: util_stl_dtk.hpp:416
PdfwSampleOneMeshRender_1_3
Dtk_ErrorStatus PdfwSampleOneMeshRender_1_3(const Dtk_string &inOutputFileName, const Dtk_string &inImageDirectory)
Definition: testlibpdfwrite.cpp:103
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:352
PdfwSampleBody_2_1
Dtk_ErrorStatus PdfwSampleBody_2_1(const Dtk_string &inOutputFileName)
Definition: testlibpdfwrite.cpp:122
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_Ellipse::Create
static Dtk_EllipsePtr Create(const Dtk_Ellipse &in)
Calls copy constructor to allocate a new object.
Dtk_RGB
Definition: dtk_rgb.hpp:8
Dtk_Info::SetColor
Dtk_ErrorStatus SetColor(const int &R, const int &G, const int &B)
Dtk_dir
This is a mathematical direction class.
Definition: dtk_dir.hpp:14
Pdfw::CreateNodeConnectorHighlight
Dtk_ErrorStatus CreateNodeConnectorHighlight(const Dtk_ID &inPointingNodeID, const Dtk_ID &inPointedNodeID, const Dtk_UInt32 &inFaceIndex=-1, Dtk_Int32 inReasonLink=0, const Dtk_NodeConnectorPtr &inNodeConnect=NULL)
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:1854
sampleWriter::CreateModelDisplayDesactivated
Dtk_ModelDisplayPtr CreateModelDisplayDesactivated()
Creates a deactivated (hidden) model display "MyView2" with an orthographic camera.
Definition: testcreatefdt.cpp:335
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