Exemplo n.º 1
0
/*-------------------------------------------------------------------*
 |  dxfFindNextTableType                                             |
 |  Inputs:                                                          |
 |      HDXF hDxf = handle to the openning DXF file structure        |
 |  Output: TableType Code else TAB_NOTSET                           |
 *-------------------------------------------------------------------*/
DWORD dxfFindNextTableType( HDXF hDxf )
{
	PDXF	pDxf;
	DWORD	result;

	// Initialize pDxf ------------------
	if((pDxf = InitilizePDXF(hDxf))==NULL)
		return FALSE;

	// Check if current section is TABLES
	if(pDxf->Read.CurrentSection!=SEC_TABLES)
	{
		// Current section is not TABLES
		GlobalUnlock(hDxf);
		return FALSE;
	}

	// Find TableType Name
	if(FindParamFromDxfFile(pDxf, 0, "TABLE"))
	{
		// Read TableType Name
		ReadTableTypeName(pDxf);
		result = pDxf->Read.CurrentTableType;
	}
	else
		result = TAB_NOTSET;

	// UnInitilize hDxf -----------------
	UnInitilizePDXF(hDxf);

	return result;
}
Exemplo n.º 2
0
/*-------------------------------------------------------------------*
 |  dxfFindBlockHeader                                               |
 |  Inputs:                                                          |
 |      HDXF hDxf = handle to the openning DXF file structure        |
 |      PDXFBLOCKHEADER pBlockHeader =                               |
 |                           pointer to blockheader structure        |
 |  Output: TRUE if everything is ok                                 |
 *-------------------------------------------------------------------*/
BOOL dxfFindBlockHeader( HDXF hDxf, PDXFBLOCKHEADER pBlockHeader )
{
	PDXF	pDxf;

	// Initialize pDxf ------------------
	if((pDxf = InitilizePDXF(hDxf))==NULL)
		return FALSE;

	// Check if current section is BLOCKS
	if(pDxf->Read.CurrentSection!=SEC_BLOCKS)
	{
		// Current section is not BLOCKS
		GlobalUnlock(hDxf);
		return FALSE;
	}

	dxfStorePos(pDxf);
	if(FindParamFromDxfFile(pDxf, 0, "BLOCK"))
		ReadBlockHeader(pDxf, pBlockHeader);
	else
	{
		// Can not read block header
		dxfRestorePos(pDxf);
		GlobalUnlock(hDxf);
		return FALSE;
	}
	
	// UnInitilize hDxf -----------------
	return UnInitilizePDXF(hDxf);
}
Exemplo n.º 3
0
/*-------------------------------------------------------------------*
 |  dxfReadTableType                                                 |
 |  Inputs:                                                          |
 |      HDXF hDxf = handle to the openning DXF file structure        |
 |      LPVOID pTableType = pointer to table type structure          |
 |  Output: TableType Code else TAB_NOTSET                           |
 *-------------------------------------------------------------------*/
DWORD dxfReadTableType( HDXF hDxf, LPVOID pTableType )
{
	PDXF	pDxf;
	int		GCode;
	char	strValue[2048];
	DWORD	result;

	// Initialize pDxf ------------------
	if((pDxf = InitilizePDXF(hDxf))==NULL)
		return FALSE;

	// Check if current section is TABLES
	if(pDxf->Read.CurrentSection!=SEC_TABLES)
	{
		// Current section is not TABLES
		GlobalUnlock(hDxf);
		return TAB_NOTSET;
	}

	// Looking for next table type if CurrentTableType==TAB_NOTSET
	if(pDxf->Read.CurrentTableType==TAB_NOTSET)
	{
		if(dxfFindNextTableType(hDxf)==TAB_NOTSET)
		{
			pDxf->Read.CurrentSection = SEC_NOTSET;
			GlobalUnlock(hDxf);
			return TAB_NOTSET;
		}
	}

	// Read current table type data
	result = TAB_NOTSET;
	switch(pDxf->Read.CurrentTableType)
	{
	case TAB_DIMSTYLE:
		if(!FindParamFromDxfFile(pDxf, 0, "DIMSTYLE"))
			break;
		else
		{
			if(ReadDimStyleData(pDxf, (PDXFDIMSTYLE)pTableType))
				result = TAB_DIMSTYLE;
		}
		break;

	case TAB_LAYER:
		if(!FindParamFromDxfFile(pDxf, 0, "LAYER"))
			break;
		else
		{
			if(ReadLayerData(pDxf, (PDXFLAYER)pTableType))
				result = TAB_LAYER;
		}
		break;

	case TAB_LTYPE:
		if(!FindParamFromDxfFile(pDxf, 0, "LTYPE"))
			break;
		else
		{
			if(ReadLTypeData(pDxf, (PDXFLTYPE)pTableType))
				result = TAB_LTYPE;
		}
		break;

	case TAB_STYLE:
		if(!dxfFindParam( hDxf, 0, "STYLE" ))
			break;
		else
		{
			if(ReadStyleData(pDxf, (PDXFSTYLE)pTableType))
				result = TAB_STYLE;
		}
		break;
	}

	dxfStorePos(pDxf);
	dxfReadParam(hDxf, GCode, strValue);

	if((GCode==0) && (strcmp(strValue, "ENDTAB")==0))
	{
		pDxf->Read.CurrentTableType = TAB_NOTSET;

//		while(dxfReadTableTypeName(hDxf)==TAB_NOTSET)
//		{
			dxfStorePos(pDxf);
			dxfReadParam(hDxf, GCode, strValue);
			if((GCode==0) && (strcmp(strValue, "ENDSEC")==0))
			{
				pDxf->Read.CurrentSection = SEC_NOTSET; // Tables section has been finished
//				break;
			}
			else
				dxfRestorePos(pDxf);
//		}
	}
	else
		dxfRestorePos(pDxf);

	// UnInitilize hDxf -----------------
	UnInitilizePDXF(hDxf);

	return result;
}