示例#1
0
/**
 * @brief Reads the given file and calls the appropriate functions in
 * the given creation interface for every entity found in the file.
 *
 * @param file Input
 *		Path and name of file to read
 * @param creationInterface
 *		Pointer to the class which takes care of the entities in the file.
 *
 * @retval true If \p file could be opened.
 * @retval false If \p file could not be opened.
 */
bool DL_Jww::in(const string& file, DL_CreationInterface* creationInterface) {
	//JWWファイル読み取り
	string ofile("");
	JWWDocument* jwdoc = new JWWDocument((std::string&)file, ofile);
	if(!jwdoc->Read())
		return false;
	//DXF変数設定
	creationInterface->setVariableString("$DWGCODEPAGE", "SJIS", 7);
	creationInterface->setVariableString("$TEXTSTYLE", "japanese", 7);
	//線分データ
	for( unsigned int i = 0; i < jwdoc->vSen.size(); i++ )
		CreateSen(creationInterface, jwdoc->vSen[i]);
	//円弧データ
	for( unsigned int i = 0; i < jwdoc->vEnko.size(); i++ )
		CreateEnko(creationInterface, jwdoc->vEnko[i]);
	//点データ
	for( unsigned int i = 0; i < jwdoc->vTen.size(); i++ )
		CreateTen(creationInterface, jwdoc->vTen[i]);
	//文字データ
	for( unsigned int i = 0; i < jwdoc->vMoji.size(); i++ )
		CreateMoji(creationInterface, jwdoc->vMoji[i]);
	//寸法
    for(unsigned int i=0 ; i < jwdoc->vSunpou.size(); i++ )
		CreateSunpou(creationInterface, jwdoc->vSunpou[i]);
	//ソリッド
    for(unsigned int i=0 ; i < jwdoc->vSolid.size(); i++ )
		CreateSolid(creationInterface, jwdoc->vSolid[i]);
	//部品
    for(unsigned int i=0 ; i < jwdoc->vBlock.size(); i++)
		CreateBlock(creationInterface, jwdoc->vBlock[i]);
	delete jwdoc;

	return true;
}
示例#2
0
void Draw_Dxf::addSolid(const DL_SolidData& data)
{
    RGBA color = RGBA(150,150,150);
    Shape* p = CreateSolid(_painter,RGBA(255,255,255),(FLOAT)data.x[0],(FLOAT)data.y[0],(FLOAT)data.x[1],(FLOAT)data.y[1],(FLOAT)data.x[2],(FLOAT)data.y[2],(FLOAT)data.x[3],(FLOAT)data.y[3]);
    p->regen();

    TCHAR* layerName;

    if(_isBlockOpen) _block->insert(p);
    else {

        switch(_entityType) {
        case NONE :
            for(UINT i=0; i<_layers->size(); i++) {
                layerName = _layers->at(i)->getName();
                if(0 == _tcscmp(layerName,String2TCHAR(attributes.getLayer()))) {
                    _layers->at(i)->insert(p);
                    _layers->at(i)->getFillColor(color);
                    break;
                }
            }
            break;
        }
    }

    INT32 clValue = attributes.getColor();
    if(clValue != 256) color = CL2RGBA(clValue);
    p->setFillColor(color);

}