Get object format into Tree
Tree GetFormat( DWORD dwPropertiesFilter = FPB_ALL, DWORD dwObjFilter = FOB_ALL, BOOL bGetTagNames = TRUE, BOOL bRelative = FALSE, DWORD dwPropertiesFilter2 = FPBEX_ALL, DWORD dwObjFilter2 = FOB2_ALL, vector<int> * piaErrors = NULL, vector<string> * psaErrors = NULL )
A Tree object
EX1
// In this example, the format of a GraphLayer will be got and output to Output Window // The result will be also saved in an xml file void OriginObject_GetFormat_Ex1() { GraphPage gp; gp.Create("origin"); GraphLayer gl = Project.ActiveLayer(); // to get all objects' all properties of GraphLayer into Tree Tree trFormat; trFormat = gl.GetFormat(FPB_ALL , FOB_ALL, TRUE, TRUE); out_tree(trFormat); // output format tree string strSaveTo = GetAppPath(false) + "FormatTreeEx1.xml"; if(trFormat.Save(strSaveTo)) out_str("Format Tree xml file saved to "+strSaveTo); gp.Destroy(); }
EX2
//Get AXIS object's dimension properties. void OriginObject_GetFormat_Ex2() { GraphPage gp; gp.Create("origin"); GraphLayer gl = Project.ActiveLayer(); Tree trFormat; bool bRelative; //When bRelative is TRUE // 1. the struct in trFormat is Root.Axes // 2. Axes Node will include more nodes than when bRelative is FALSE bRelative = TRUE; trFormat = gl.GetFormat(FPB_DIMENSION, FOB_AXIS, TRUE, bRelative); printf("===AXIS format tree with bRelative is TRUE=== \n"); out_tree(trFormat); // output format tree string strSaveTo = GetAppPath(false) + "FormatTreeEx2Case1.xml"; if(trFormat.Save(strSaveTo)) out_str("Format Tree xml file saved to "+strSaveTo); //When bRelative is FALSE //the struct in trFormat is Root.Page.Layer.Axes bRelative = FALSE; trFormat = gl.GetFormat(FPB_DIMENSION, FOB_AXIS, TRUE, bRelative); printf("===AXIS format tree with bRelative is FALSE=== \n"); out_tree(trFormat); strSaveTo = GetAppPath(false) + "FormatTreeEx2Case1.xml"; if(trFormat.Save(strSaveTo)) out_str("Format Tree xml file saved to "+strSaveTo); }
EX3
//Get all objects' properties of Worksheet void OriginObject_GetFormat_Ex3() { WorksheetPage wp; wp.Create("Origin"); Worksheet wks = Project.ActiveLayer(); Tree trFormat; trFormat = wks.GetFormat(FPB_ALL, FOB_ALL, TRUE, TRUE); out_tree(trFormat); // output format tree string strSaveTo = GetAppPath(false) + "FormatTreeEx3.xml"; if(trFormat.Save(strSaveTo)) out_str("Format Tree xml file saved to "+strSaveTo); }
EX4
//Get all objects' properties of the Column void OriginObject_GetFormat_Ex4() { WorksheetPage wp; wp.Create("Origin"); Worksheet wks = Project.ActiveLayer(); Column col(wks, 1); Tree trFormat; bool bRelative = TRUE; printf("===Column format tree with bRelative is TRUE=== \n"); trFormat = col.GetFormat(FPB_ALL, FOB_ALL, TRUE, bRelative); out_tree(trFormat); // output format tree string strSaveTo = GetAppPath(false) + "FormatTreeEx4.xml"; if(trFormat.Save(strSaveTo)) out_str("Format Tree xml file saved to "+strSaveTo); }
Get object format into Tree
OriginObject::CopyFormat, OriginObject::ApplyFormat
origin.h