void
GuitarChordSelectorDialog::slotEditFingering()
{
    Guitar::Chord newChord = m_chord;
    GuitarChordEditorDialog* chordEditorDialog = new GuitarChordEditorDialog(newChord, m_chordMap, this);
    
    if (chordEditorDialog->exec() == QDialog::Accepted) {

// RG_DEBUG << "GuitarChordSelectorDialog::slotEditFingering() - "
//   "current map state :";
// m_chordMap.debugDump();

        m_chordMap.substitute(m_chord, newChord);

// RG_DEBUG << "GuitarChordSelectorDialog::slotEditFingering() - "
//   "new map state :";
// m_chordMap.debugDump();

        setChord(newChord);
    }
    
    delete chordEditorDialog;

    refresh();    
}
Beispiel #2
0
void tPropSurface::clear(void)
{
  setElementLocked

  setPitch(NULL);
  setChord(NULL);
  setSkew(NULL);
  setMaxThick(NULL);
  setRake(NULL);
  setThickness(NULL);
  setCamber(NULL);

  fDiameter = 1.;
  fhubDiameter = 0.2;
  fScale = 1.;
  fZ = 1;
  fRoundedTip = true;
  fautoRoundTE = true;
  frotationDirection = true;

  radialVar->setFullString("r=1*(r0^3-2*r0^2+r0)+0.05*(r0^3-r0^2)-2*r0^3+3*r0^2");
  peripherVar->setFullString("t=0.2*(t0^3-2*t0^2+t0)+0.05*(t0^3-t0^2)-2*t0^3+3*t0^2");

}
Beispiel #3
0
bool tPropSurface::openPff(QString fileName, tLayer* hostingLayer)
{
  setElementLocked
  clear();
  int i;
  bool ok[3];
  tReal SIscale = 0.001;  // Konvertierung von mm in m
  tList<tElement*> sectionL, radialsL, radialsSS, radialsPS,
                   pitchL, skewL, rakeL, wakeL, chordL,
                   camberL, camberCurveL, thickL, thickCurveL, maxThickL,
                   pointL, shapeL;
  tReal rR, chord, pitch, distLE, rake, thickMax, thick, camber,
        t, xSS, xPS;
  tVector xx;
  tCSpline *pitchC, *chordC, *rakeC, *skewC, *maxThickC;
  tCLoft *thickS, *camberS;

  tPoint *point;
  tCSpline *cspl;

  QString line;
  QStringList Vector;
  QFile pff(fileName);
  QFileInfo pffInfo(pff);

  fpffFileName = fileName;

  if (!pff.open(QIODevice::ReadOnly | QIODevice::Text)) {
    invalidate(this);
    return false;
  } else {
// pff-Daten einlesen
    char dbg[500];
    strcpy(dbg,fileName.toLatin1().data());
    QTextStream in(&pff);
    do {
      line = in.readLine();
      strcpy(dbg,line.toLatin1().data());
    } while (!line.contains("PropDiameter", Qt::CaseInsensitive));

    Vector =  in.readLine().split(QRegExp("\\s+"),QString::SkipEmptyParts);
    fScale = Vector[2].toFloat();
    if (fScale <= 0.){
      fScale = 1.;
    }
    fDiameter = fabs(Vector[0].toFloat()*SIscale);
    if (fDiameter == 0.){
      fDiameter = 1.;
    }
    fhubDiameter = fabs(Vector[1].toFloat()*SIscale)/fDiameter;
    for (i=0;i<3;i++){
      in.readLine();
    }
    Vector =  in.readLine().split(QRegExp("\\s+"),QString::SkipEmptyParts);
    fZ = Vector[0].toInt();
    if (Vector[4].toInt() == 1){      //Drehsinn
      frotationDirection = true;  //rechts drehend
    } else {
      frotationDirection = false; //links drehend
    }
    line = in.readLine();
    sectionL.clear();
    while (line.contains("r/R")){
      Vector = in.readLine().split(QRegExp("\\s+"),QString::SkipEmptyParts);
      rR = Vector[0].toFloat();
//      r = rR*fDiameter/2.;
//      r = Vector[1].toFloat()*fScale;
      chord = Vector[2].toFloat()*SIscale;
      in.readLine();
      Vector = in.readLine().split(QRegExp("\\s+"),QString::SkipEmptyParts);
      pitch = Vector[0].toFloat()*SIscale;
      distLE = Vector[1].toFloat()*SIscale;
      rake = Vector[4].toFloat()*SIscale;
      in.readLine();
      line = in.readLine();

      t = -1.;

      thickMax = 0.;
      thickL.clear();
      camberL.clear();
      while (!line.contains("*")){
        Vector = line.split(QRegExp("\\s+"), QString::SkipEmptyParts);
        if (Vector.count() > 2 && Vector[0].toFloat()-t>1e-7){
          t = Vector[0].toFloat(ok);
          xSS = Vector[1].toFloat(ok+1)*SIscale;  //Punkt auf der Saugseite
          xPS = Vector[2].toFloat(ok+2)*SIscale;  //Punkt auf der Druckseite
          if (ok[0] && ok[1] && ok[2]){
            thick = fabs(xSS-xPS);
            thickMax = max(thick,thickMax);
            if (thickL.count() == 0){
              thickL.append(new tPoint(NULL,tVector(rR,t,0.))); // Die Eintrittskante soll eine Dicke von 0 haben.
            } else {
//              thickL.append(new tPoint(NULL,tVector(rR,t,0.)));
              thickL.append(new tPoint(NULL,tVector(rR,t,thick)));
            }
            camber = (xSS+xPS)*0.5;
//            camberL.append(new tPoint(NULL,tVector(rR,t,sin(t*M_PI)*0.01)));
//            camberL.append(new tPoint(NULL,tVector(rR,t,camber/fDiameter*10.)));
            camberL.append(new tPoint(NULL,tVector(rR,t,camber/fDiameter)));
          }
        }
        line = in.readLine();
      }
      thickL.reverse();
      for (i=thickL.count()-2;i>=0;i--){
        xx = ((tPoint*)(thickL.at(i)))->vector();
        xx.z *= -1;
        thickL.append(new tPoint(this, xx));
      }
      thickL.reverse();
      if (thickMax != 0){
        for (i=0;i<thickL.count();i++){
          point = dynamic_cast<tPoint*>(thickL.at(i));
          if (point){
            xx = point->vector();
            xx.z /= thickMax;
            point->setVector(xx);
          }
        }
      }

      if (thickMax > 0){
        cspl = new tCSpline(NULL,&thickL);
        cspl->setCSplineType(jrCSLengthBased);
        thickCurveL.append(cspl);
      } else {
        for (i=0;i<thickL.count();i++){
          thickL.at(i)->releaseOwner(this);
        }
      }

      cspl = new tCSpline(NULL,&camberL);
      cspl->setCSplineType(jrCSLengthBased);
      camberCurveL.append(cspl);

      pitchL.append(new tPoint(NULL, tVector(rR,pitch/fDiameter,0.)));
      chordL.append(new tPoint(NULL, tVector(rR,chord/fDiameter,0.)));
      rakeL.append(new tPoint(NULL, tVector(rR,rake/fDiameter,0.)));
      skewL.append(new tPoint(NULL, tVector(rR,
                                            cos(atan(pitch/fDiameter/M_PI))*(chord/2.-distLE)/(M_PI*rR*fDiameter)*(float)fZ,
                                            0.)));
      maxThickL.append(new tPoint(NULL, tVector(rR,thickMax/fDiameter,0.)));
    }
    // pff-Daten einlesen beendet.

    // Basiskurven erzeugen;

    if (hostingLayer){
      pitchC = hostingLayer->addCSpline();
      chordC = hostingLayer->addCSpline();
      skewC = hostingLayer->addCSpline();
      rakeC = hostingLayer->addCSpline();
      maxThickC = hostingLayer->addCSpline();
      thickS = hostingLayer->addCLoft();
      camberS = hostingLayer->addCLoft();

      pitchC->intrface()->setVisibility(false);
      chordC->intrface()->setVisibility(false);
      skewC->intrface()->setVisibility(false);
      maxThickC->intrface()->setVisibility(false);
      rakeC->intrface()->setVisibility(false);
      thickS->intrface()->setVisibility(false);
      camberS->intrface()->setVisibility(false);

    } else {
      pitchC = new tCSpline(NULL);
      chordC = new tCSpline(NULL);
      skewC = new tCSpline(NULL);
      maxThickC = new tCSpline(NULL);
      rakeC = new tCSpline(NULL);
      thickS = new tCLoft(NULL);
      camberS = new tCLoft(NULL);
    }

    pitchC->intrface()->setName(intrface()->name() + ".pitch");
    chordC->intrface()->setName(intrface()->name() + ".chord");
    skewC->intrface()->setName(intrface()->name() + ".skew");
    maxThickC->intrface()->setName(intrface()->name() + ".maximumThickness");
    rakeC->intrface()->setName(intrface()->name() + ".rake");
    thickS->intrface()->setName(intrface()->name() + ".thickness");
    camberS->intrface()->setName(intrface()->name() + ".camber");

    setPitch(pitchC);
    setChord(chordC);
    setSkew(skewC);
    setMaxThick(maxThickC);
    setRake(rakeC);
    setThickness(thickS);
    setCamber(camberS);

    // pitch ist nicht lengthbased
    chordC->setCSplineType(jrCSLengthBased);
    skewC->setCSplineType(jrCSLengthBased);
    maxThickC->setCSplineType(jrCSLengthBased);
    rakeC->setCSplineType(jrCSLengthBased);



//    chordC->insertList(0,&chordL);
    if (fRoundedTip){
      tList<tElement*> list;
      list = chordL;
      chordL.clear();
      for (i=list.count()-1; i>=0; i--){

        xx = ((tPoint*)list.at(i))->vector();
        chordL.prepend(new tPoint(NULL, xx));
        if (fRoundedTip == true){
          // chordSpiegeln:
          xx.y *= -1;
          chordL.append(new tPoint(NULL, xx));
        }
      }
    }
    chordC->insertList(0,&chordL);

    pitchC->insertList(0,&pitchL);
    rakeC->insertList(0,&rakeL);
    skewC->insertList(0,&skewL);
    maxThickC->insertList(0,&maxThickL);



    camberS->insertList(0,&camberCurveL);
    camberS->setUDiv(camberCurveL.count());
    camberS->setURes(20);

    thickS->insertList(0,&thickCurveL);
    thickS->setUDiv(thickCurveL.count());
    thickS->setURes(20);


    invalidate(this);
    return true;
  }
}