2025.6.1
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/***********************************************************************************************************************
|
||||
*
|
||||
* Copyright (c) 2010 - 2022 by Tech Soft 3D, Inc.
|
||||
* Copyright (c) 2010 - 2025 by Tech Soft 3D, Inc.
|
||||
* The information contained herein is confidential and proprietary to Tech Soft 3D, Inc., and considered a trade secret
|
||||
* as defined under civil and criminal statutes. Tech Soft 3D shall pursue its civil and criminal remedies in the event
|
||||
* of unauthorized use or misappropriation of its trade secrets. Use of this information by anyone other than authorized
|
||||
@@ -18,6 +18,7 @@ Demonstrates how to create a table in which the table data is linked to the mode
|
||||
#define INITIALIZE_A3D_API
|
||||
#define HOOPS_PRODUCT_PUBLISH_ADVANCED
|
||||
#include <A3DSDKIncludes.h>
|
||||
#include <hoops_license.h>
|
||||
#include "../common.hpp"
|
||||
#include "../CommonInit.h"
|
||||
|
||||
@@ -272,7 +273,7 @@ A3DStatus Create3DAnnot(A3DPDFDocument* pDoc,
|
||||
A3DStatus AddViewCarousel(A3DPDFDocument* pDoc, A3DPDFPage* pPage,
|
||||
int iLeftCarou,
|
||||
int iBottomCarou,
|
||||
int iHeigthCarousel,
|
||||
int iHeightCarousel,
|
||||
int iWidthCarouButtonPrevNext,
|
||||
int iWidthCarouButton,
|
||||
int iHorizMargin,
|
||||
@@ -354,7 +355,7 @@ A3DStatus AddViewCarousel(A3DPDFDocument* pDoc, A3DPDFPage* pPage,
|
||||
// buttons insertions
|
||||
// coordinates are from bottom left of the page
|
||||
|
||||
int iTopCarou = iBottomCarou+iHeigthCarousel;
|
||||
int iTopCarou = iBottomCarou+iHeightCarousel;
|
||||
sPos.m_iLeft = iLeftCarou; // lower left x
|
||||
sPos.m_iBottom = iBottomCarou; // lower left y
|
||||
sPos.m_iRight = sPos.m_iLeft+iWidthCarouButtonPrevNext; // upper right x
|
||||
@@ -536,13 +537,203 @@ A3DStatus AddScrollTable(A3DPDFDocument* pDoc, A3DPDFPage* pPage,
|
||||
}
|
||||
|
||||
|
||||
//######################################################################################################################
|
||||
// Sample code to set properties for Highlighting or Selecting 3d nodes via datamodel
|
||||
A3DStatus Set3dNodesSceneProperties(A3DPDFDocument* pDoc, const int iPageIndex,
|
||||
const std::string& sJS3DNodesManager,
|
||||
A3DPDFEWidgetTargetBehaviour eBehaviourOnTarget)
|
||||
{
|
||||
// Hard-coded values for properties. Putting it as a document javascript sets it once and for all
|
||||
// this javascript code can also be used to be set on a UI and executed at runtime depending on end-user choice
|
||||
std::ostringstream osJsOnDoc;
|
||||
if (eBehaviourOnTarget == kA3DPDFDataSelect)
|
||||
{
|
||||
osJsOnDoc << "\n\
|
||||
// following property is to enable the zoom on 'select' behaviour (when the user clicks the associated item in source widget, then the node is selected then zoomed) \n\
|
||||
" << sJS3DNodesManager << ".getSelectProperties().setZoomingToNodes(true);\n\
|
||||
";
|
||||
}
|
||||
else
|
||||
{
|
||||
osJsOnDoc << "\n\
|
||||
" << sJS3DNodesManager << ".getHighlightProperties().setHighlightMode(_TS3D_HIGHLIGHTED_MESHES_MODE.COLORED_OPACIFIED_OTHERSTRANSPARENTS);\n\
|
||||
//following properties could also be set \n\
|
||||
//" << sJS3DNodesManager << ".getHighlightProperties().setBlinking(true);\n\
|
||||
//" << sJS3DNodesManager << ".getHighlightProperties().setLevelOpacity(0.8);\n\
|
||||
//" << sJS3DNodesManager << ".getHighlightProperties().setHighlightColor(0.5, 0, 1);\n\
|
||||
// following property is to enable the zoom on 'highlight' behaviour (when the user clicks the associated item in source widget, then the nodes are highlighted then zoomed) \n\
|
||||
//" << sJS3DNodesManager << ".getHighlightProperties().setZoomingToNodes(true);\n\
|
||||
";
|
||||
}
|
||||
const std::string sJSScript = "NodeSceneManager" + std::to_string(iPageIndex);
|
||||
CHECK_RET(A3DPDFDocumentAddJavascriptFromString(pDoc, sJSScript.c_str(), osJsOnDoc.str().c_str()));
|
||||
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
|
||||
//######################################################################################################################
|
||||
// Sample code to define an example of UI to set properties for Highlight 3d nodes
|
||||
A3DStatus AddUIFor3dNodesHighlightProperties(A3DPDFDocument* pDoc, A3DPDFPage* pPage, const int iPageIndex,
|
||||
A3DPDFScrollTable* pWidgetForRect, const std::string& sJS3DNodesManager)
|
||||
{
|
||||
A3DPDFGraphicRectangleData sGraphRectData;
|
||||
A3D_INITIALIZE_DATA(A3DPDFGraphicRectangleData, sGraphRectData);
|
||||
//rectangle values obtained after a first launch building a widget and getting the values with following line
|
||||
CHECK_RET(A3DPDFWidgetGetPosition(pWidgetForRect, &sGraphRectData.m_sRectangleData));
|
||||
A3DPDFRectData sPos;
|
||||
A3D_INITIALIZE_DATA(A3DPDFRectData, sPos);
|
||||
// position of the checkbox is below the widget
|
||||
sPos.m_iLeft = (int)sGraphRectData.m_sRectangleData.m_dLeft;
|
||||
sPos.m_iTop = (int)sGraphRectData.m_sRectangleData.m_dBottom - 10;
|
||||
sPos.m_iBottom = sPos.m_iTop - 16;
|
||||
sPos.m_iRight = sPos.m_iLeft + 340;
|
||||
|
||||
// drop down list for list of modes
|
||||
A3DPDFDropDownList* pDropDownList = NULL;
|
||||
A3DPDFDropDownListData sDropDownListData;
|
||||
A3D_INITIALIZE_DATA(A3DPDFDropDownListData, sDropDownListData);
|
||||
const std::string sDropDownListName = "dropdownlistHighlightingModes" + std::to_string(iPageIndex);
|
||||
sDropDownListData.m_pcName = const_cast<A3DUTF8Char*>(sDropDownListName.c_str());
|
||||
sDropDownListData.m_pcTooltip = const_cast<A3DUTF8Char*>("Select a highlight mode");
|
||||
sDropDownListData.m_bHasBorder = true; // border color black by default
|
||||
sDropDownListData.m_pcFontName = const_cast<A3DUTF8Char*>("Helv");
|
||||
sDropDownListData.m_iFontSize = 10;
|
||||
sDropDownListData.m_bCommitImmediate = true;
|
||||
CHECK_RET(A3DPDFDropDownListCreate(pDoc, &sDropDownListData, &pDropDownList));
|
||||
CHECK_RET(A3DPDFPageInsertDropDownList(pPage, pDropDownList, &sPos));
|
||||
const std::string sJS = "setNodesHighlightMode(" + sJS3DNodesManager + ");";
|
||||
CHECK_RET(A3DPDFPageFieldSetActionJavascript(pPage, static_cast<const char*>(sDropDownListName.c_str()), kA3DPDFEventFieldKeyStroke, sJS.c_str()));
|
||||
|
||||
// store javascript functions on the document. these functions can be used by javascript stored on the fields.
|
||||
std::ostringstream osJsOnDoc;
|
||||
osJsOnDoc << "\n\
|
||||
function setNodesHighlightMode(nodesManager) \n\
|
||||
{\n\
|
||||
if ( !event.willCommit && (event.changeEx != \"\") )\n\
|
||||
{\n\
|
||||
nodesManager.getHighlightProperties().setHighlightMode(Number(event.changeEx)); // event.changeEx is export value \n\
|
||||
//following lines recolor the 3d scene with new highlight mode\n\
|
||||
nodesManager.refreshHighlight(); \n\
|
||||
}\n\
|
||||
}\n\
|
||||
\n\
|
||||
// Fill the dropdown list with different highlight modes\n\
|
||||
// Note that some modes with transparency have more meaningful for workflows that highlight only faces on a solid\n\
|
||||
var bisdirty = this.dirty; \n\
|
||||
var arHModes = []; \n\
|
||||
var i=0; \n\
|
||||
arHModes[i] = []; // 2 values: [0] for the text in the list, [1] for the export value\n\
|
||||
arHModes[i][0] = \"Highlight mode: ISOLATED_NOTCOLORED_OPACIFIED\"; \n\
|
||||
arHModes[i][1] = _TS3D_HIGHLIGHTED_MESHES_MODE.ISOLATED_NOTCOLORED_OPACIFIED; \n\
|
||||
arHModes[++i] = []; \n\
|
||||
arHModes[i][0] = \"Highlight mode: ISOLATED_COLORED_TRANSPARENT\"; \n\
|
||||
arHModes[i][1] = _TS3D_HIGHLIGHTED_MESHES_MODE.ISOLATED_COLORED_TRANSPARENT; \n\
|
||||
arHModes[++i] = []; \n\
|
||||
arHModes[i][0] = \"Highlight mode: COLORED_OPACIFIED_OTHERSOPACIFIED\"; \n\
|
||||
arHModes[i][1] = _TS3D_HIGHLIGHTED_MESHES_MODE.COLORED_OPACIFIED_OTHERSOPACIFIED; \n\
|
||||
arHModes[++i] = []; \n\
|
||||
arHModes[i][0] = \"Highlight mode: COLORED_OPACIFIED_OTHERSTRANSPARENTS\"; \n\
|
||||
arHModes[i][1] = _TS3D_HIGHLIGHTED_MESHES_MODE.COLORED_OPACIFIED_OTHERSTRANSPARENTS \n\
|
||||
arHModes[++i] = []; \n\
|
||||
arHModes[i][0] = \"Highlight mode: COLORED_TRANSPARENT_OTHERSTRANSPARENTS\"; \n\
|
||||
arHModes[i][1] = _TS3D_HIGHLIGHTED_MESHES_MODE.COLORED_TRANSPARENT_OTHERSTRANSPARENTS; \n\
|
||||
var dropdownlistHighlightingModes = this.getField(\"" << sDropDownListName << "\");\n\
|
||||
dropdownlistHighlightingModes.setItems(arHModes);\n\
|
||||
dropdownlistHighlightingModes.currentValueIndices = 3; // default mode is COLORED_OPACIFIED_OTHERSTRANSPARENTS\n\
|
||||
this.dirty = bisdirty; \n\
|
||||
";
|
||||
CHECK_RET(A3DPDFDocumentAddJavascriptFromString(pDoc, sDropDownListName.c_str(), osJsOnDoc.str().c_str()));
|
||||
|
||||
// create checkbox for blinking mode
|
||||
A3DPDFCheckBox* pCheckBox = NULL;
|
||||
A3DPDFCheckBoxData sCheckBoxData;
|
||||
A3D_INITIALIZE_DATA(A3DPDFCheckBoxData, sCheckBoxData);
|
||||
const std::string sCheckBoxName = "chboxBlinkMode" + std::to_string(iPageIndex);
|
||||
sCheckBoxData.m_pcName = const_cast<A3DUTF8Char*>(sCheckBoxName.c_str());
|
||||
sCheckBoxData.m_pcTooltip = const_cast<A3DUTF8Char*>("enable/disable blinking mode");
|
||||
sCheckBoxData.m_bHasBorder = TRUE;
|
||||
sCheckBoxData.m_bIsCheckedByDefault = FALSE;
|
||||
int iCheckBoxSize = 10;
|
||||
CHECK_RET(A3DPDFCheckBoxCreate(pDoc, &sCheckBoxData, &pCheckBox));
|
||||
sPos.m_iRight = sPos.m_iLeft + iCheckBoxSize;
|
||||
sPos.m_iTop = sPos.m_iBottom;
|
||||
sPos.m_iBottom = sPos.m_iTop - iCheckBoxSize;
|
||||
CHECK_RET(A3DPDFPageInsertCheckBox(pPage, pCheckBox, &sPos));
|
||||
std::ostringstream osJsChbox;
|
||||
osJsChbox << "\n\
|
||||
if (this.getField(\"" << sCheckBoxName << "\").value == \"Off\") \n\
|
||||
" << sJS3DNodesManager << ".getHighlightProperties().setBlinking(true); \n\
|
||||
else\n\
|
||||
" << sJS3DNodesManager << ".getHighlightProperties().setBlinking(false); \n";
|
||||
CHECK_RET(A3DPDFPageFieldSetActionJavascript(pPage, sCheckBoxName.c_str(), kA3DPDFEventFieldKeyStroke, osJsChbox.str().c_str()));
|
||||
|
||||
A3DPDFTextField* pText = NULL;
|
||||
A3DPDFTextFieldData sTextFieldData;
|
||||
A3D_INITIALIZE_DATA(A3DPDFTextFieldData, sTextFieldData);
|
||||
const std::string sTextFieldName = "titBlinkMode" + std::to_string(iPageIndex);
|
||||
sTextFieldData.m_pcName = const_cast<A3DUTF8Char*>(sTextFieldName.c_str());
|
||||
sTextFieldData.m_pcDefaultValue = const_cast<A3DUTF8Char*>("Blinking Mode");
|
||||
sTextFieldData.m_iFontSize = 8;
|
||||
sTextFieldData.m_eTextAlignment = kA3DPDFLeft;
|
||||
CHECK_RET(A3DPDFTextFieldCreate(pDoc, &sTextFieldData, &pText));
|
||||
sPos.m_iLeft = sPos.m_iRight + 2;
|
||||
sPos.m_iRight = sPos.m_iLeft + 250;
|
||||
CHECK_RET(A3DPDFPageInsertTextField(pPage, pText, &sPos));
|
||||
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
//######################################################################################################################
|
||||
// Sample code to define an example of UI to set zoom properties for 3d nodes scene
|
||||
A3DStatus AddUIFor3dNodesZoomProperties(A3DPDFDocument* pDoc, A3DPDFPage* pPage, const int iPageIndex,
|
||||
A3DPDFScrollTable* pWidgetForRect, A3DPDF3DNodeScene* p3DNodeScene, A3DPDFEWidgetTargetBehaviour eBehaviourOnTarget)
|
||||
{
|
||||
A3DPDFGraphicRectangleData sGraphRectData;
|
||||
A3D_INITIALIZE_DATA(A3DPDFGraphicRectangleData, sGraphRectData);
|
||||
//rectangle values obtained after a first launch building a widget and getting the values with following line
|
||||
CHECK_RET(A3DPDFWidgetGetPosition(pWidgetForRect, &sGraphRectData.m_sRectangleData));
|
||||
A3DPDFRectData sPos;
|
||||
A3D_INITIALIZE_DATA(A3DPDFRectData, sPos);
|
||||
// position of the checkbox is above the widget
|
||||
sPos.m_iLeft = (int)sGraphRectData.m_sRectangleData.m_dLeft;
|
||||
sPos.m_iTop = (int)sGraphRectData.m_sRectangleData.m_dTop + 10;
|
||||
sPos.m_iBottom = sPos.m_iTop - 16;
|
||||
sPos.m_iRight = sPos.m_iLeft + 340;
|
||||
|
||||
// create checkbox dedicated to control zoom mode on 3d nodes scene
|
||||
A3DPDFCheckBoxData sCheckBoxData;
|
||||
A3D_INITIALIZE_DATA(A3DPDFCheckBoxData, sCheckBoxData);
|
||||
//sCheckBoxData.m_eFormField = kA3DPDFHidden;
|
||||
sCheckBoxData.m_bIsCheckedByDefault = FALSE;
|
||||
sCheckBoxData.m_bHasBorder = TRUE;
|
||||
A3DPDFRectData sCBPos;
|
||||
A3D_INITIALIZE_DATA(A3DPDFRectData, sCBPos);
|
||||
sCBPos.m_iLeft = 20; // lower left x
|
||||
sCBPos.m_iRight = 30; // upper right x
|
||||
sCBPos.m_iTop = 290; // upper right y
|
||||
sCBPos.m_iBottom = 280; // lower left y
|
||||
A3DPDFCheckBox* pCheckBox = NULL;
|
||||
const std::string sCheckBoxName = "chboxZoomMode" + std::to_string(iPageIndex);
|
||||
sCheckBoxData.m_pcName = const_cast<A3DUTF8Char*>(sCheckBoxName.c_str());
|
||||
sCheckBoxData.m_pcTooltip = const_cast<A3DUTF8Char*>("enable/disable zoom at selection");
|
||||
CHECK_RET(A3DPDFCheckBoxCreate(pDoc, &sCheckBoxData, &pCheckBox));
|
||||
CHECK_RET(A3DPDFPageInsertCheckBox(pPage, pCheckBox, &sCBPos));
|
||||
// this makes the check box field be the selector to enable the zoom in the 3D nodes scene on the chosen behaviour
|
||||
// if the user checks the checkbox, a zoom is performed when a node is highlighted or selected (depending on eBehaviourOnTarget) by datamodel on the 3D nodes scene.
|
||||
// the zoom is disabled with the checkbox unchecked.
|
||||
CHECK_RET(A3DPDFCheckBoxSetForZoomOnBehaviour(pCheckBox, p3DNodeScene, eBehaviourOnTarget));
|
||||
|
||||
return A3D_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
A3DStatus stBuildDocument(A3DPDFDocument* pDoc)
|
||||
{
|
||||
A3DStatus iRet = A3D_SUCCESS;
|
||||
|
||||
A3DPDFPage* pPage = NULL;
|
||||
int indexpage = 0;
|
||||
int iPageIndex = 0;
|
||||
std::string sSuffixFields;
|
||||
|
||||
// populating the document metadata
|
||||
@@ -583,6 +774,11 @@ A3DStatus stBuildDocument(A3DPDFDocument* pDoc)
|
||||
A3DPDF3DNodeScene* p3DNodeScene = NULL;
|
||||
CHECK_RET(A3DPDF3DAnnotGet3DNodeScene( p3DAnnot, &p3DNodeScene));
|
||||
|
||||
// get the variable name to be used in javascript to control 3D nodes scene options (optionnal)
|
||||
A3DUTF8Char* pcJS3DNodesManager = NULL;
|
||||
CHECK_RET(A3DPDF3DNodeSceneGetJavascriptManagerName(p3DNodeScene, &pcJS3DNodesManager));
|
||||
const std::string sJS3DNodesManager = (pcJS3DNodesManager != NULL) ? pcJS3DNodesManager : "";
|
||||
A3DPDF3DNodeSceneGetJavascriptManagerName(nullptr, &pcJS3DNodesManager); // free memory
|
||||
|
||||
// create Scroll table on the page
|
||||
A3DPDFScrollTable* pScrollTableBom = NULL;
|
||||
@@ -617,6 +813,7 @@ A3DStatus stBuildDocument(A3DPDFDocument* pDoc)
|
||||
aeTypes,
|
||||
&pScrollTableBom));
|
||||
|
||||
|
||||
// get existing widgets on template page
|
||||
|
||||
A3DPDFTextField* pTextTitle = NULL;
|
||||
@@ -712,17 +909,17 @@ A3DStatus stBuildDocument(A3DPDFDocument* pDoc)
|
||||
// if Bom is populated coming from a selection in filter dropdown list, only resulting elements of the filter are displayed in Bom
|
||||
CHECK_RET(A3DPDFWidgetSetTargetBehaviour( pDropDownListFilter, pScrollTableBom, kA3DPDFDataIsolate ));
|
||||
|
||||
// Select a BOM item -> only associated Manufacturers are displayed in Manufacturers list
|
||||
// selection of a row in Bom -> only associated Manufacturers are displayed in Manufacturers list
|
||||
CHECK_RET(A3DPDFWidgetSetTargetBehaviour( pScrollTableBom, pListManufacturers, kA3DPDFDataIsolate ));
|
||||
|
||||
// selection of a row in Bom -> 2 column values are displayed in 2 text field
|
||||
// selection of a row in Bom -> 2 column values are displayed in two text fields
|
||||
CHECK_RET(A3DPDFWidgetSetTargetBehaviour(pScrollTableBom, pTextColNumArt, kA3DPDFDataIsolate));
|
||||
CHECK_RET(A3DPDFWidgetSetTargetBehaviour(pScrollTableBom, pTextColNamePart, kA3DPDFDataIsolate));
|
||||
|
||||
// selection of a row in Bom -> the associated elements of widget (=3d nodes) are highlighted
|
||||
// selection of a row in Bom -> the associated elements of 3d widget (=3d nodes) are highlighted
|
||||
CHECK_RET(A3DPDFWidgetSetTargetBehaviour( pScrollTableBom, p3DNodeScene, kA3DPDFDataHighlight ));
|
||||
|
||||
// select a node in 3D annot -> the elements of BOM (=scroll table rows) are selected (i.e. acts as if the user clicked on the BOM row)
|
||||
// select a node in 3D scene -> the elements of Bom (=scroll table rows) are selected (i.e. acts as if the user clicked on the Bom row)
|
||||
CHECK_RET(A3DPDFWidgetSetTargetBehaviour( p3DNodeScene, pScrollTableBom, kA3DPDFDataSelect ));
|
||||
|
||||
// TextInstance is populated coming from a selection in 3D
|
||||
@@ -739,7 +936,7 @@ A3DStatus stBuildDocument(A3DPDFDocument* pDoc)
|
||||
A3DRWParamsPrcWriteHelperFree(pPRCWriteHelper);
|
||||
}
|
||||
|
||||
indexpage++;
|
||||
iPageIndex++;
|
||||
}
|
||||
|
||||
// create page idx+1 from template file. we force the fields renaming to avoid duplicated names.
|
||||
@@ -765,6 +962,13 @@ A3DStatus stBuildDocument(A3DPDFDocument* pDoc)
|
||||
// get widget for list nodes
|
||||
A3DPDF3DNodeScene* p3DNodeScene = NULL;
|
||||
CHECK_RET(A3DPDF3DAnnotGet3DNodeScene( p3DAnnot, &p3DNodeScene));
|
||||
|
||||
// get the variable name to be used in javascript to control 3D nodes scene options (optionnal)
|
||||
A3DUTF8Char* pcJS3DNodesManager = NULL;
|
||||
CHECK_RET(A3DPDF3DNodeSceneGetJavascriptManagerName(p3DNodeScene, &pcJS3DNodesManager));
|
||||
const std::string sJS3DNodesManager = (pcJS3DNodesManager != NULL) ? pcJS3DNodesManager : "";
|
||||
A3DPDF3DNodeSceneGetJavascriptManagerName(nullptr, &pcJS3DNodesManager); // free memory
|
||||
|
||||
// get widget for list views
|
||||
A3DPDF3DViewList* p3DViewList = NULL;
|
||||
CHECK_RET(A3DPDF3DAnnotGet3DViewList( p3DAnnot, &p3DViewList));
|
||||
@@ -784,7 +988,7 @@ A3DStatus stBuildDocument(A3DPDFDocument* pDoc)
|
||||
CHECK_RET(AddViewCarousel(pDoc, pPage,
|
||||
30, // iLeftCarou
|
||||
340, // iBottomCarou
|
||||
108, // iHeigthCarousel
|
||||
108, // iHeightCarousel
|
||||
22, // iWidthCarouButtonPrevNext
|
||||
145, // iWidthCarouButton
|
||||
2, // iHorizMargin
|
||||
@@ -808,6 +1012,7 @@ A3DStatus stBuildDocument(A3DPDFDocument* pDoc)
|
||||
aeTypes.push_back(kA3DPDFTextContent);
|
||||
aeTypes.push_back(kA3DPDFTextContent);
|
||||
aeTypes.push_back(kA3DPDFTextContent);
|
||||
|
||||
CHECK_RET(AddScrollTable(pDoc, pPage,
|
||||
20, 270, // iPosLeft, iPosTop
|
||||
15, //iSliderWidth
|
||||
@@ -818,6 +1023,7 @@ A3DStatus stBuildDocument(A3DPDFDocument* pDoc)
|
||||
aRowHeader,
|
||||
aeTypes,
|
||||
&pScrollTablePmis));
|
||||
|
||||
|
||||
// get existing widgets on template page
|
||||
|
||||
@@ -905,14 +1111,35 @@ A3DStatus stBuildDocument(A3DPDFDocument* pDoc)
|
||||
|
||||
// selection of a row in list ViewNames -> the associated elements of widget (=3d view) is selected
|
||||
CHECK_RET(A3DPDFWidgetSetTargetBehaviour(pListViewNames, p3DViewList, kA3DPDFDataSelect));
|
||||
// and conversely so that we can see the item selected in the listbox if the selction is done by view list or caroussel
|
||||
// and conversely so that we can see the item selected in the listbox if the selection is done by view list or caroussel
|
||||
CHECK_RET(A3DPDFWidgetSetTargetBehaviour(p3DViewList, pListViewNames, kA3DPDFDataSelect));
|
||||
|
||||
// selection of a row in Pmis -> the associated elements of widget (=3d nodes) are selected
|
||||
// selection of a row in scrolltable Pmis -> the associated elements of 3d widget (=3d nodes) are selected
|
||||
// (also note that if m_bActivatePMICrossHighlight is set on 3d Artwork, the selection of a pmi node highlights the associated faces)
|
||||
CHECK_RET(A3DPDFWidgetSetTargetBehaviour( pScrollTablePmis, p3DNodeScene, kA3DPDFDataSelect ));
|
||||
//... and conversely, select a node in 3d -> associated element in scroll table is highlighted
|
||||
CHECK_RET(A3DPDFWidgetSetTargetBehaviour(p3DNodeScene, pScrollTablePmis, kA3DPDFDataHighlight));
|
||||
|
||||
// --- Define properties on 3d nodes scene target of other widget
|
||||
// Note that this is sample code for demo purpose ; it might not be set as-is in a real workflow.
|
||||
// Implementors must decide which behaviour is the best for their workflow
|
||||
bool bDemoProperties = false;
|
||||
if (bDemoProperties)
|
||||
{
|
||||
// First possibility to set properties on 3d node scene is to use javascript code at document level.
|
||||
// Next line is an example for that.
|
||||
//Set3dNodesSceneProperties(pDoc, iPageIndex, sJS3DNodesManager, kA3DPDFDataSelect);
|
||||
|
||||
// Another possibility to set properties on 3d node scene is to add a UI so that end-user can control it.
|
||||
// Next line is an example, that sets the zoom at selection property.
|
||||
// (note that the scrolltable widget is provided just to position the UI)
|
||||
AddUIFor3dNodesZoomProperties(pDoc, pPage, iPageIndex, pScrollTablePmis, p3DNodeScene, kA3DPDFDataSelect);
|
||||
|
||||
// Another possibility to set properties on 3d node scene is to use the API, this doesn't require to write UI and javascript code.
|
||||
// if the boolean is true, a zoom is performed when a node is selected by datamodel on the 3D nodes scene.
|
||||
//CHECK_RET(A3DPDF3DNodeSceneSetZoomOnBehaviour(p3DNodeScene, kA3DPDFDataSelect, TRUE));
|
||||
}
|
||||
|
||||
// select a view in 3D annot view list -> the elements of PMIs are filtered
|
||||
CHECK_RET(A3DPDFWidgetSetTargetBehaviour( p3DViewList, pScrollTablePmis, kA3DPDFDataIsolate ));
|
||||
// select a view in 3D annot view list -> the elements of texts for columns are filtered
|
||||
@@ -924,14 +1151,12 @@ A3DStatus stBuildDocument(A3DPDFDocument* pDoc)
|
||||
// select a view in carousel -> the 3D annot view list is selected
|
||||
CHECK_RET(A3DPDFWidgetSetTargetBehaviour( pViewCarousel, p3DViewList, kA3DPDFDataSelect ));
|
||||
|
||||
|
||||
// activate a specific view when the file is opened + all actions on cascading widgets
|
||||
// NULL should be specified on the widget source to select a row at init time
|
||||
CHECK_RET(A3DPDFWidgetSetTargetBehaviour(NULL, p3DViewList, kA3DPDFDataSelect));
|
||||
// This forces the selection on table at init time
|
||||
CHECK_RET(A3DPDFDataTableSetInitIndex(pDataTable_3DViews, 1));
|
||||
|
||||
|
||||
// cleanup 3D modelfile
|
||||
CHECK_RET(A3DAsmModelFileDelete(pModelFile));
|
||||
// Free the A3DRWParamsPrcWriteHelper object at the end
|
||||
@@ -939,7 +1164,7 @@ A3DStatus stBuildDocument(A3DPDFDocument* pDoc)
|
||||
A3DRWParamsPrcWriteHelperFree(pPRCWriteHelper);
|
||||
}
|
||||
|
||||
indexpage++;
|
||||
iPageIndex++;
|
||||
}
|
||||
|
||||
// create page idx+1 from template file. we force the fields renaming to avoid duplicated names.
|
||||
@@ -964,8 +1189,13 @@ A3DStatus stBuildDocument(A3DPDFDocument* pDoc)
|
||||
|
||||
// get widget for list nodes
|
||||
A3DPDF3DNodeScene* p3DNodeScene = NULL;
|
||||
CHECK_RET(A3DPDF3DAnnotGet3DNodeScene( p3DAnnot, &p3DNodeScene));
|
||||
CHECK_RET(A3DPDF3DAnnotGet3DNodeScene(p3DAnnot, &p3DNodeScene));
|
||||
|
||||
// get the variable name to be used in javascript to control 3D nodes scene options (optionnal)
|
||||
A3DUTF8Char* pcJS3DNodesManager = NULL;
|
||||
CHECK_RET(A3DPDF3DNodeSceneGetJavascriptManagerName(p3DNodeScene, &pcJS3DNodesManager));
|
||||
const std::string sJS3DNodesManager = (pcJS3DNodesManager != NULL) ? pcJS3DNodesManager : "";
|
||||
A3DPDF3DNodeSceneGetJavascriptManagerName(nullptr, &pcJS3DNodesManager); // free memory
|
||||
|
||||
// create Scroll table on the page
|
||||
A3DPDFScrollTable* pScrollTableBom = NULL;
|
||||
@@ -983,7 +1213,6 @@ A3DStatus stBuildDocument(A3DPDFDocument* pDoc)
|
||||
aeTypes.push_back(kA3DPDFTextContent);
|
||||
aeTypes.push_back(kA3DPDFTextContent);
|
||||
|
||||
|
||||
CHECK_RET(AddScrollTable(pDoc, pPage,
|
||||
20, 632, // iPosLeft, iPosTop
|
||||
15, //iSliderWidth
|
||||
@@ -995,6 +1224,7 @@ A3DStatus stBuildDocument(A3DPDFDocument* pDoc)
|
||||
aeTypes,
|
||||
&pScrollTableBom));
|
||||
|
||||
|
||||
// get existing widgets on template page
|
||||
|
||||
A3DPDFTextField* pTextTitle = NULL;
|
||||
@@ -1062,10 +1292,34 @@ A3DStatus stBuildDocument(A3DPDFDocument* pDoc)
|
||||
CHECK_RET(A3DPDFWidgetSetTargetBehaviour(pScrollTableBom, pTextCol1, kA3DPDFDataIsolate));
|
||||
CHECK_RET(A3DPDFWidgetSetTargetBehaviour(pScrollTableBom, pButIcon, kA3DPDFDataIsolate));
|
||||
|
||||
// selection of a row in Bom -> the associated elements of widget (=3d nodes) are highlighted
|
||||
CHECK_RET(A3DPDFWidgetSetTargetBehaviour( pScrollTableBom, p3DNodeScene, kA3DPDFDataHighlight ));
|
||||
// selection of a row in Bom -> the associated elements of 3d widget (=3d nodes) are highlighted
|
||||
CHECK_RET(A3DPDFWidgetSetTargetBehaviour( pScrollTableBom, p3DNodeScene, kA3DPDFDataHighlight));
|
||||
|
||||
// select a node in 3D annot -> the elements of BOM (=scroll table rows) are selected (i.e. acts as if the user clicked on the BOM row)
|
||||
// --- Define properties on 3d nodes scene target of other widget
|
||||
// Note that this is sample code for demo purpose ; it might not be set as-is in a real workflow.
|
||||
// Implementors must decide which behaviour is the best for their workflow
|
||||
bool bDemoProperties = true;
|
||||
if (bDemoProperties)
|
||||
{
|
||||
// First possibility to set properties on 3d node scene is to use javascript code at document level.
|
||||
// Next line is an example for that.
|
||||
//Set3dNodesSceneProperties(pDoc, iPageIndex, sJS3DNodesManager, kA3DPDFDataHighlight);
|
||||
|
||||
// Another possibility to set properties on 3d node scene is to add a UI so that end-user can control it.
|
||||
// Next line is an example, that sets highlight properties.
|
||||
// (note that the scrolltable widget is provided just to position the UI)
|
||||
AddUIFor3dNodesHighlightProperties(pDoc, pPage, iPageIndex, pScrollTableBom, sJS3DNodesManager);
|
||||
|
||||
// This code would be to define UI that sets the zoom at highlight property.
|
||||
// (note that the scrolltable widget is provided just to position the UI)
|
||||
//AddUIFor3dNodesZoomProperties(pDoc, pPage, iPageIndex, pScrollTableBom, p3DNodeScene, kA3DPDFDataHighlight);
|
||||
|
||||
// Third possibility to set properties on 3d node scene is to use the API, which doesn't need to write UI and javascript code.
|
||||
// if the boolean is true, a zoom is performed when nodes are highlighted by datamodel on the 3D nodes scene.
|
||||
//CHECK_RET(A3DPDF3DNodeSceneSetZoomOnBehaviour(p3DNodeScene, kA3DPDFDataHighlight, TRUE));
|
||||
}
|
||||
|
||||
// select a node in 3D annot -> the elements of Bom (=scroll table rows) are selected (i.e. acts as if the user clicked on the Bom row)
|
||||
CHECK_RET(A3DPDFWidgetSetTargetBehaviour( p3DNodeScene, pScrollTableBom, kA3DPDFDataSelect ));
|
||||
|
||||
// TextInstance is populated coming from a selection in 3D
|
||||
@@ -1079,7 +1333,7 @@ A3DStatus stBuildDocument(A3DPDFDocument* pDoc)
|
||||
A3DRWParamsPrcWriteHelperFree(pPRCWriteHelper);
|
||||
}
|
||||
|
||||
indexpage++;
|
||||
iPageIndex++;
|
||||
}
|
||||
|
||||
// end document
|
||||
@@ -1130,7 +1384,7 @@ int main(int, A3DUTF8Char**)
|
||||
#endif
|
||||
|
||||
// init A3DLIB library - automatically handled init/terminate
|
||||
A3DSDKHOOPSPublishLoader sHoopsPublishLoader(_T(HOOPS_BINARY_DIRECTORY));
|
||||
A3DSDKHOOPSPublishLoader sHoopsPublishLoader(_T(HOOPS_BINARY_DIRECTORY), HOOPS_LICENSE);
|
||||
CHECK_RET(sHoopsPublishLoader.m_eSDKStatus);
|
||||
CHECK_RET(A3DDllSetCallbacksMemory(CheckMalloc, CheckFree));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user