Example #1
0
void HexBC::resetPatchColors()
{
    for(vtkIdType i=0; i<localPatches->GetNumberOfItems(); i++)
    {
        HexPatch *p =
            HexPatch::SafeDownCast(localPatches->GetItemAsObject(i));
        p->resetColor();
    }
}
Example #2
0
void HexBC::setPatchColors(double r, double g, double b)
{
    for(vtkIdType i=0; i<patchIds->GetNumberOfIds();i++)
    {
        HexPatch *p =
                HexPatch::SafeDownCast(globalPatches->GetItemAsObject(patchIds->GetId(i)));
        p->setColor(r,g,b);
    }
}
Example #3
0
void HexBC::resetPatchColors()
{
    for(vtkIdType i=0; i<patchIds->GetNumberOfIds();i++)
    {
        HexPatch *p = HexPatch::SafeDownCast(
                    globalPatches->GetItemAsObject(patchIds->GetId(i)));
        p->resetColor();

    }
}
Example #4
0
bool HexBC::insertPatchIfIdsExists(vtkSmartPointer<vtkIdList> ids)
{

    bool foundIt=false;
    for(vtkIdType i=0; i<globalPatches->GetNumberOfItems(); i++)
    {
        HexPatch * p = HexPatch::SafeDownCast(globalPatches->GetItemAsObject(i));
        if(p->equals(ids))
        {
            localPatches->AddItem(p);
            foundIt=true;
        }
    }

    return foundIt;
}
Example #5
0
bool HexBC::insertPatchIfIdsExists(vtkSmartPointer<vtkIdList> ids)
{

    bool foundIt=false;
    for(vtkIdType i=0;i<globalPatches->GetNumberOfItems();i++)
    {
        HexPatch * p = HexPatch::SafeDownCast(globalPatches->GetItemAsObject(i));
        if(p->equals(ids))
        {
//            std::cout << "patch exists " << i <<std::endl;
            patchIds->InsertUniqueId(i);
            foundIt=true;
        }
    }

//    for(vtkIdType i=0;i<allPatches->GetNumberOfItems();i++)
//    {

//        HexPatch * p = HexPatch::SafeDownCast(allPatches->GetItemAsObject(i));
//        bool idsInP[4];
//        //return true if all ids in ids exist in patch
//        for(vtkIdType j=0;j<ids->GetNumberOfIds();j++)
//        {
//            idsInP[j]=false;
//            for(vtkIdType k=0;p->vertIds->GetNumberOfIds();k++)
//            {
//                if(p->vertIds->GetId(k) == ids->GetId(j))
//                {

//                    idsInP[j]=true;
//                }
//            }

//        }
//        if(foundIt)
//        {
//            std::cout << "patches are equal, glbpatc" << i << std::endl;
//            patchIds->InsertNextId(i);
//        }
//    }
    return foundIt;
}
void EdgeSetTypeWidget::setSelectedPatch(vtkIdType selPatchId)
{
    double c[3];
    HexPatch * p = HexPatch::SafeDownCast(
        hexBlocker->patches->GetItemAsObject(selPatchId)
                );
    p->getCenter(c);
    p->resetColor();
    if(ui->useRadiusCheckBox->isChecked())
    {
        double R=ui->radiusLineEdit->text().toDouble();

        //check for sensible radius.
        if(R==0.0)
        {
            emit setStatusText(tr("Cannot use zero radius"));
            return;
        }
        double edgeLength = selectedEdge->getLength();
        if( -edgeLength/2.0 < R &&  R < edgeLength/2.0)
        {
            QString msg=QString(
  "The radius has to be larger than or equal to  half the edge length, i.e >= ");
            msg.append(QString::number(edgeLength/2.0));
            emit setStatusText(tr(msg));
            return;
        }
        selectedEdge->calcArcControlPointFromCenter(c,R);
    }
    else
    {
        selectedEdge->calcArcControlPointFromCenter(c);
    }
//    selectedEdge->getControlPoint(0,c);
    table->update();
    slotDataChanged();
}