DATAKIT API  V2025.2
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)
990 {
991  for( Dtk_Size_t i = 1; i < 6; i++ )
992  meshCube->get_mesh_face( i )->info() = Dtk_Info::create();
993  meshCube->get_mesh_face( 1 )->info()->SetColor( Dtk_RGB( 0, 255, 0 ) );
994  meshCube->get_mesh_face( 2 )->info()->SetColor( Dtk_RGB( 0, 0, 255 ) );
995  meshCube->get_mesh_face( 3 )->info()->SetColor( Dtk_RGB( 255, 255, 0 ) );
996  meshCube->get_mesh_face( 4 )->info()->SetColor( Dtk_RGB( 255, 0, 255 ) );
997  meshCube->get_mesh_face( 5 )->info()->SetColor( Dtk_RGB( 0, 255, 255 ) );
998 }

◆ PdfwCreate3DAnnotations()

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

◆ PdfwCreateViews()

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

◆ PdfWriteSample()

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

◆ PdfwSample_MV_association_5_3()

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

◆ PdfwSampleAsmInstances_3_3()

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

◆ PdfwSampleAssembly_3_1()

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

◆ PdfwSampleAxis_References_5_7()

Dtk_ErrorStatus PdfwSampleAxis_References_5_7 ( const Dtk_string inOutputFileName)
760 {
761  Pdfw::WriteOptions options;
762  Dtk_ID axisSysID, planeID, axisID;
763  Dtk_tab<Dtk_ID> tabNodeIDs;
764 
765  // First we initialize writing with name of files
766  CHECK_OK( Pdfw::InitWrite( inOutputFileName, "", NULL, options ) );
767 
770  tabNodeIDs.push_back( axisSysID );
771 
773  CHECK_OK( Pdfw::WriteEntity( Dtk_EntityPtr::DtkDynamicCast( refplane ), planeID ) );
774  tabNodeIDs.push_back( planeID );
775 
778  tabNodeIDs.push_back( axisID );
779 
780  CHECK_OK( Pdfw::EndWrite() ); // Write final file and free memory allocated
781  cout << "=> " << inOutputFileName.c_str() << endl;
782  return dtkNoError;
783 }

◆ PdfwSampleBillboard_7_1()

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

◆ PdfwSampleBody_2_1()

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

◆ PdfwSampleBodyVisibility_2_3()

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

◆ PdfwSampleCloudPoint_6_1()

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

◆ PdfwSampleDocumentProperties_4_2()

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

◆ PdfwSampleInstancesColors_3_4()

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

◆ PdfwSampleInstancesVisibility_3_5()

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

◆ PdfwSampleLayoutMultipleViews_9_1()

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

◆ PdfwSampleMeshes_1_2()

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

◆ PdfwSampleMetadatas_4_1()

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

◆ PdfwSampleModelview_section_5_5()

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

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

◆ PdfwSamplePartInstances_3_2()

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

◆ PdfwSamplePMI_Geom_association_5_4()

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

◆ PdfwSamplePMI_PMI_association_5_6()

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

◆ PdfwSampleSecuredPdf_8_1()

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

◆ PdfwSampleSimpleModelview_5_2()

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

◆ PdfwSampleSimplePMI_5_1()

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

◆ PdfwSampleWireBody_2_2()

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

◆ Shift()

template<typename T >
void Shift ( T &  mesh,
double  sh 
)
40 {
41  Dtk_transfo t;
42  t.addTranslate( Dtk_dir( sh, 0, 0 ) );
43  mesh->Transform( t );
44 }
sampleWriter::CreateAxis
Dtk_BodyPtr CreateAxis()
Definition: testcreatecube.cpp:1492
PdfwSampleSecuredPdf_8_1
Dtk_ErrorStatus PdfwSampleSecuredPdf_8_1(const Dtk_string &inOutputFileName)
Definition: testlibpdfwrite.cpp:877
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:39
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:475
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:759
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:232
AssignFacesColors
void AssignFacesColors(Dtk_MeshPtr &meshCube)
Definition: testlibpdfwrite.cpp:989
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:1001
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:672
PdfwCreateViews
Dtk_ErrorStatus PdfwCreateViews()
Definition: testlibpdfwrite.cpp:899
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:844
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:429
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:788
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:159
PdfwSampleMeshes_1_2
Dtk_ErrorStatus PdfwSampleMeshes_1_2(const Dtk_string &inOutputFileName)
Definition: testlibpdfwrite.cpp:46
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:331
PdfwSampleAssembly_3_1
Dtk_ErrorStatus PdfwSampleAssembly_3_1(const Dtk_string &inOutputFileName)
Definition: testlibpdfwrite.cpp:191
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:545
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:640
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:276
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:599
PdfwSampleDocumentProperties_4_2
Dtk_ErrorStatus PdfwSampleDocumentProperties_4_2(const Dtk_string &inOutputFileName)
Definition: testlibpdfwrite.cpp:501
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:948
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:720
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:137
sampleWriter::CreateCurves
Dtk_BodyPtr CreateCurves()
Definition: testcreatecube.cpp:1292
PdfwSampleSimpleModelview_5_2
Dtk_ErrorStatus PdfwSampleSimpleModelview_5_2(const Dtk_string &inOutputFileName)
Definition: testlibpdfwrite.cpp:567
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:417
PdfwSampleOneMeshRender_1_3
Dtk_ErrorStatus PdfwSampleOneMeshRender_1_3(const Dtk_string &inOutputFileName, const Dtk_string &inImageDirectory)
Definition: testlibpdfwrite.cpp:101
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:353
PdfwSampleBody_2_1
Dtk_ErrorStatus PdfwSampleBody_2_1(const Dtk_string &inOutputFileName)
Definition: testlibpdfwrite.cpp:120
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