示例#1
0
void ObjectEditor::openObject(const QString &patch){
    camera->Off();
    QUrl createname=QFileDialog::getOpenFileUrl(SpaceEngineEvents,"Select opened object",QUrl::fromLocalFile(patch),OBJECTS_FILTERS);
    camera->On();
    if(createname.isEmpty())
        return;
    QString tempPatch= createname.path();
#ifdef Q_OS_WIN
    tempPatch=tempPatch.right(tempPatch.size()-1);
#endif
    if(ObjectRender!=NULL){
        removeObject(ObjectRender);
        ObjectRender=NULL;
        VBoxWidget->setEnabled(false);
    }
    if(patchTypes(tempPatch)){
        addObject(ObjectRender,this->getMapsList()->front());
        ObjectName->setText(ObjectRender->getName());
        VBoxWidget->setEnabled(true);
        sizeX->setMaximum(10000);
        sizeY->setMaximum(10000);
        sizeX->setValue(ObjectRender->getW());
        sizeY->setValue(ObjectRender->getH());
        updateAnimationsList();
    }else{
        QMessageBox::information(this->getMain(),"Open Error","this file type is not suported");
    }
    //typeChanged(ObjectRender->getEObjectNameClass());
}
void thermalBaffleFvPatchScalarField::createPatchMesh()
{

    const fvMesh& thisMesh = patch().boundaryMesh().mesh();

    word regionName = dict_.lookup("regionName");

    List<polyPatch*> regionPatches(3);
    List<word> patchNames(regionPatches.size());
    List<word> patchTypes(regionPatches.size());
    List<dictionary> dicts(regionPatches.size());

    patchNames[bottomPatchID] = word("bottom");
    patchNames[sidePatchID] = word("side");
    patchNames[topPatchID] = word("top");

    patchTypes[bottomPatchID] = mappedWallPolyPatch::typeName;
    patchTypes[topPatchID] = mappedWallPolyPatch::typeName;

    if (readBool(dict_.lookup("columnCells")))
    {
        patchTypes[sidePatchID] = emptyPolyPatch::typeName;
    }
    else
    {
        patchTypes[sidePatchID] = polyPatch::typeName;
    }

    const mappedPatchBase& mpp =
        refCast<const mappedPatchBase>(patch().patch());

    const word coupleGroup(mpp.coupleGroup());

    wordList inGroups(1);
    inGroups[0] = coupleGroup;

    dicts[bottomPatchID].add("coupleGroup", coupleGroup);
    dicts[bottomPatchID].add("inGroups", inGroups);
    dicts[bottomPatchID].add("sampleMode", mpp.sampleModeNames_[mpp.mode()]);

    const label sepPos = coupleGroup.find('_');

    const word coupleGroupSlave = coupleGroup(0, sepPos) + "_slave";

    inGroups[0] = coupleGroupSlave;
    dicts[topPatchID].add("coupleGroup", coupleGroupSlave);
    dicts[topPatchID].add("inGroups", inGroups);
    dicts[topPatchID].add("sampleMode", mpp.sampleModeNames_[mpp.mode()]);


    forAll (regionPatches, patchI)
    {
        dictionary&  patchDict = dicts[patchI];
        patchDict.set("nFaces", 0);
        patchDict.set("startFace", 0);

        regionPatches[patchI] = polyPatch::New
        (
            patchTypes[patchI],
            patchNames[patchI],
            dicts[patchI],
            patchI,
            thisMesh.boundaryMesh()
        ).ptr();
    }