⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wksheet.h

📁 图像处理的压缩算法
💻 H
📖 第 1 页 / 共 5 页
字号:
		A Column
	Example: 
		Worksheet wks("Data1");
		ASSERT(wks.Columns("A").IsValid());
*/	
	Column	Columns(LPCSTR lpcszName);	
	
	/**
	Remarks: 
		Used to apply designation pattern to entire worksheet
	
	Parameters:	
		lpcszDesignations - designation pattern 
			Possible values for designations:
			'X' - X column
			'Y' - Y column
			'Z' - Z column
			'E' - Y error column
			'L' - label column
			'M' - X error column
			'N' - ignore column
		
		bRepeat	- repeat pattern. Defines how the pattern is applied 
		if number of columns in worksheet is larger then length of pattern.
		Possible values:
			TRUE - repeat entire pattern
			FALSE - set designations for the rest of columns to be the last one deifined by pattern
		
	Example: 
		// the following code will set column designations in worksheet "Data1"		// 1st column - X
		// 2nd column - Y
		// 3rd column - label
		// 4th column - Y
		// 5rd column - label
		// pattern will repeat if worksheet contains more than 5 columns
		Worksheet wks("Data1");
		wks.SetColDesignations("XYLYL");
	
	Return:
		TRUE for success. Otherwise FALSE;
	*/
	BOOL	SetColDesignations(LPCSTR lpcszDesignations, BOOL bRepeat = TRUE);
	
#ifdef 	 _CURVE_BASE
	/**
	*/
	curvebase&	GetCurve(int nColx, int nColY);
	/**
	*/
	curvebase&	GetCurve(int nColy);
#endif// _CURVE_BASE
	/**
	Remarks: 
		Gets column designations for entire worksheet in form of string
		Possible values for designations:
			'X' - X column
			'Y' - Y column
			'Z' - Z column
			'E' - Y error column
			'L' - label column
			'M' - X error column
			'N' - ignore column
			
	Example:
		Worksheet wks("Data1");
		string strDesignations = wks.GetColDesignations();
		
	Return:
		column designations for entire worksheet in form of string
	*/
	string	GetColDesignations();
	
	/**
	/**
	Remarks: 
		Gets column designations for entire worksheet in form of string
		Possible values for designations:
			'X' - X column
			'Y' - Y column
			'Z' - Z column
			'E' - Y error column
			'L' - label column
			'M' - X error column
			'N' - ignore column
			
	Example:
		Worksheet wks("Data1");
		string strDesignations;
		wks.GetColDesignations(strDesignations);
		
	Return:
		void
	*/
	void	GetColDesignations(string& strDesignations);
	
	/**
	Remarks: 
			sets the column formats in the specified worksheet.
	Example:
		// the following code will set column format in worksheet "Data1"
		// 1st column - Numeric (0)
		// 2nd column - Text	(1)
		// 3rd column - Time	(2)
		// 4th column - Date	(3)
		// 5th column - Text and Numeric (9)
		Worksheet wks("Data1");
		string strFormats="01239";
		wks.SetColFormats(strFormats);
	*/
	BOOL	SetColFormats(LPCSTR lpcszFormats, BOOL bRepeat = TRUE);
	
	/**
	Remarks:
		  	gets the column formats of all the columns in the worksheet
	Example:
		Worksheet wks("Data1");
		string strFormats;
		strFormats=wks.GetColFormats();
	Return:
		A string containing all the column formats. 
		Example: "99"
		1st column - Text & Numeric (9)
		2nd column - Text & Numeric	(9)
	*/
	string	GetColFormats();
	
	/**
	
	Remarks:
		  	gets the column formats of all the columns in the worksheet. Same as GetColFormats() except that thi s
		  	method takes in a reference to a string as a parameter and returns nothing. 

	Example:
		Worksheet wks("Data1");
		string strFormats;
		wks.GetColFormats(strFormats);
		
	Return:
		void
	*/
	void	GetColFormats(string& strFormats);
	/**#
	Remarks:
       Sort the specified columns in a worksheet in ascending or descending order based on the
       values in the specified column number. All column and row numbers are 0 based offsets. 
   Example:
   		This example sorts column B in a worksheet in descending order, and missing values are 
   		treated as smallest. For this example to run, a worksheet with the name "Data1" should
   		exist in the project.
   		
   		void test_Worksheet_Sort()
		{
				Worksheet wksMy("Data1");
				if (wksMy.Sort(1,SORT_DESCENDING))
					out_str("Sort successful!");
				else
					out_str("Sort error!");
		}
   Parameters:
       wByColNum=Input column number containing values to sort worksheet by
       wOrder=Input sort order, possible values are SORT_ASCENDING or SORT_DESCENDING
       bMissingValuesSmall=Input flag specifies whether missing values are considered to be the smallest
                           or largest possible value
       iFromRow=Input first row number to sort
       iFromCol=Input first column number to sort
       iToRow=Input last row number to sort, default -1 sorts to last row
       iToCol=Input last column number to sort, default -1 sorts to last column
   Return:
       Returns TRUE on successful exit and FALSE on error.
   SeeAlso:
       Curve::Sort, vectorbase::Sort, vectorbase::Rank
	*/
	BOOL Sort(int wByColNum = 0,
		BOOL wOrder = SORT_ASCENDING,
        BOOL bMissingValuesSmall = TRUE,
        int iFromRow = 0,
        int iFromCol = 0,
        int iToRow = -1,
        int iToCol = -1
        ); // Sort the specified columns in a worksheet

	/**#
		   Perform a nested sort of the specified columns in a worksheet in ascending or descending
		   order based on the values in the specified column numbers. All column and row numbers are
		   0 based offsets. 
	   Example:
	   		For this example to run, a worksheet with the name "Data1" should exist in the project.
	   		
	   		void test_Worksheet_Sort() 
			{
					Worksheet wksMy("Data1");
					vector<int> vCol = {0,1,2};
					vector<int> vSort={SORT_ASCENDING, SORT_DESCENDING, SORT_DESCENDING};
					
					if (wksMy.Sort(vCol, vSort)) 
						out_str("Sort successful!");
					else
						out_str("Sort error!");
			}

	   Parameters:
		   vSortByCols=Input column numbers containing values to sort worksheet by, first element contains
					   column number of primary sort key, etc.
		   vOrder=Input sort orders, possible values are SORT_ASCENDING or SORT_DESCENDING, first element
				  contains sort order of primary sort key, etc.
		   bMissingValuesSmall=Input flag specifies whether missing values are considered to be the smallest
							   or largest possible value
		   iFromRow=Input first row number to sort
		   iFromCol=Input first column number to sort
		   iToRow=Input last row number to sort, default -1 sorts to last row
		   iToCol=Input last column number to sort, default -1 sorts to last column
	   Return:
		   Returns TRUE on successful exit and FALSE on error.
	   SeeAlso:
		   Curve::Sort, vectorbase::Sort, vectorbase::Rank
	*/
	BOOL Sort(const vector<int>& vSortByCols,
         const vector<BOOL>& vOrder,
         BOOL bMissingValuesSmall = TRUE,
         int iFromRow = 0,
         int iFromCol = 0,
         int iToRow = -1,
         int iToCol = -1
        ); // Perform a nested sort of the specified columns in a worksheet 

#if _OC_VER > 0x0703	
	/**#
		Remarks: 
			Provides categorical information for the worksheet
		Example: 
			int r1 = 0;
			int r2 = -1;
			Matrix<ushort> mEntries("Entries");
			vector<ushort> vRowMap;
			vector<ushort> vCols = { 1, 3, 4 };
			Worksheet wks("ByColumn");
			Dataset<ushort> vRM("data1_b");
			wks.MakeGroupEntriesAndRowMap( r1, r2, mEntries, vRM, vCols );
		Parameters: 
			vCols = input, an array of column indices in the worksheet (if the array is empty, do nothing and return FALSE).
			r1 = input, begining row number to be considered in the worksheet
			r2 = input, ending row number to be considered in the worksheet (r2 = -1 to consider the whole worksheet from r1 on).
			mEntries = output, a matrix with the number of columns equal to the size of vCols; each column corresponds to one column in vCols. 
				The number of rows of the matrix is equal to m_0*m_1*m_2*...*m_(n-1), 
				where n is the size of vCols, while m_i is the size of the categorical map  
				for the column vCols[i]. The values on each column of the matrix are all possible combinations of 
				indices 0, 1, ...,m_i - 1, in a nested way, the first column changes the slowest, etc.
			vRowMap = output, a vector of the size r2 - r1 (+ 1 if r2 is included), which maps every row of worksheet 
				in the range r1->r2 to rows of the matrix considered as bins 
				(so that the first row in the vector, corresponding to r1 row in the worksheet, 
				maps to the first row of the matrix, etc.).
		Return: 
			Returns TRUE on successful exit and FALSE on error.
		SeeAlso:
		   ExtractOneGroup
	*/
	BOOL MakeGroupEntriesAndRowMap(int r1, int r2, matrix<ushort> &mEntries, vector<ushort> &vRowMap, const vector<ushort> &vCols);

	
	/**#
		Remarks: 
			Vector extraction from a column with grouping information 
		Input:
			nCol = the column index
			vRowMap = The output map from the the method MakeGroupEntriesAndRowMap() (see #4139).
			r1Map = It must match r1 passed to MakeGroupEntriesAndRowMap().
			r1, and r2 = the row bounds (or r2=-1 to consider the whole column from r1 to the end);  
				r1 must be >= r1Map, and r2 must be less or equal r2 passed to MakeGroupEntriesAndRowMap().
			nGroupIndex = the values inside vRowMap to be used when creating v.
		
		Output:
			v - the vector which will receive the values from the group
		SeeAlso:
			MakeGroupEntriesAndRowMap
	*/
	BOOL ExtractOneGroup(vector &v, int nCol, const vector<ushort>& vRowMap, int r1Map, int r1, int r2, ushort nGroupIndex);

	/**#
	Input:
		nBegin = beginning of the range
		nEnd = end of the range. if nEnd is -1 then analize to last column of worksheet
	Returns:
		TRUE if there is write protected column within the range between nBegin and nEnd. FALSE otherwise
	SeeAlso:
		Column::IsWriteProtected()	
	*/
	BOOL	IsWriteProtected(int nBegin = 0, int nEnd = -1);

	/**
  			Find column in worksheet by searching for column label string
  		Parameters:
			 lpcszColLabel = string to search for
			 nColBegin = Column index (0 offset) to start searching
			 bCaseSensitive = TRUE if case sensitive
			 bFullMatch = FALSE if only match substring
		Example:
			void show_wks_labels()
			{
				Worksheet wks("data1");
				
				BOOL bOK = wks.Columns(0).SetLabel("AA");
				bOK = wks.Columns(1).SetLabel("aa");
				wks.ShowLabels();
				Column col = wks.FindCol("aa");
				string strLabel = col.GetLabel()
			}
	*/
	Column FindCol(LPCSTR lpcszColLabel, int nColBegin = 0, BOOL bCaseSensitive = TRUE, BOOL bFullMatch = TRUE);

	/**
	Parameters:
		nNumRows = number of rows in worksheet, use -1 to keep current settings
		nNumCols = number of columns, use -1 to keep current settings
		bClearData = decide if existing data in worksheet should be cleared. If True, then all data in worksheet is reset to missing values and each column is reset to upper index = 0, 
		if FALSE, then no action is taken on both the data and the upper index on each column, and newly added columns will be in default state
	Example:
		// the following code will reset the active worksheet with 1000 enumerated cols
		Worksheet wks = Project.ActiveLayer();
		if(wks)
		{
			wks.SetSize(-1,0);// del all columns
			wks.SetSize(1000,3000); //make a worksheet with 3000 cols with 1000 rows each
		}

		//a function to clear worksheet
		void clear_active_worksheet()
		{
 			Worksheet wks = Project.ActiveLayer();
			if(wks)
				wks.SetSize(-1, -1, TRUE);
		}
	Remarks:
		If nNumCols is larger then the current number of columns in the worksheet, then new columns will be added using enumerated column names which is faster then calling AddCol.
		Also, Origin does not support small number of rows in worksheet display, so setting a value of nNumRows smaller then the height of the display will be ignored.
	*/
	BOOL SetSize(int nNumRows, int nNumCols, BOOL bClearData = FALSE);
#endif //#if _OC_VER > 0x0703
};

/** >Internal Origin Objects
		The MatrixLayer class provides methods and properties common to matrix layers
		in Origin matrix pages. An Origin matrix contains a number of matrix objects
		thus the MatrixLayer class contains a collection of all the matrix objects in
		the matrix layer. An Origin C MatrixLayer object is a wrapper object that is
		a reference to an internal Origin matrix layer object. Wrapper objects do not
		actually exist in Origin and merely refer to the internal Origin object.
		Consequently, multiple Origin C wrapper objects can refer to the same internal
		Origin object. The MatrixLayer class is derived from the Datasheet, Layer, and
		OriginObject classes from which it inherits methods and properties.
	Example:
		MatrixLayer ml = Project.ActiveLayer();
		if(ml)
		{
			Matrix mm(ml);// Get the active Matrix from a MatrixLayer
			printf("The active matrix is %d x %d\n",mm.GetNumRows(), mm.GetNumCols());
		}
*/ 
class MatrixLayer : public Datasheet 
{
	
public:
	
/**
	Remarks:
		Constructor for the MatrixLayer class
	Parameters:
		MatrixName = name of the matrix
	Return:
		none
	Example:
		MatrixLayer mm("Matrix1");
*/
	MatrixLayer(const char* MatrixName);
	/**
	Remarks:
		MatrixLayer is one of the wrapper objects that is a reference to the actual internal Origin object.
		You can construct a new MatrixLayer from another layer object. The MatrixLayer will become invalid if 
		the layer to construct with is actually not an object of Matrix class in Origin.
	
	
	Parameters: layer = the worksheet that is currently selected or active	
		
	Return: void
	
	Example:
		MatrixLayer mlay(Project.ActiveLayer());
		if(!mlay)
		{
			out_str("The active layer is not a matrix, or there is nothing in the project");
		}
		else
			printf("Matrix %s has %d columns\n",mlay.GetPage().GetName(),mlay.GetNumCols());
		

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -