Ejemplo n.º 1
0
  void OBDepictPrivate::DrawRingBond(OBAtom *beginAtom, OBAtom *endAtom, const vector3 &center, int order)
  {
    if (order != 2) {
      DrawSimpleBond(beginAtom, endAtom, order);
      return;
    } 
   
    vector3 begin = beginAtom->GetVector();
    vector3 end = endAtom->GetVector();

    vector3 vb = (end - begin).normalize();
    vector3 orthogonalLine = cross(vb, VZ)/*.normalize()*/;
    vector3 spacing = orthogonalLine * bondSpacing * 1.2;
    vector3 offset = vb * bondSpacing;
    if ((begin + spacing - center).length() > (begin - spacing - center).length())
      spacing *= -1.0;

    vector3 vbb = end - begin;
    if (HasLabel(beginAtom))
      begin += 0.26 * vbb;
    if (HasLabel(endAtom))
      end -= 0.26 * vbb;
    painter->DrawLine(begin.x(), begin.y(), end.x(), end.y());

    if (HasLabel(beginAtom))
      begin -= 0.10 * vbb;
    if (HasLabel(endAtom))
      end += 0.10 * vbb;
    painter->DrawLine(begin.x() + spacing.x() + offset.x(), begin.y() + spacing.y() + offset.y(), 
                      end.x() + spacing.x() - offset.x(), end.y() + spacing.y() - offset.y());
  }
Ejemplo n.º 2
0
  void OBDepictPrivate::DrawSimpleBond(OBAtom *beginAtom, OBAtom *endAtom, int order)
  {
    vector3 begin = beginAtom->GetVector();
    vector3 end = endAtom->GetVector();
    vector3 vb = end - begin;

    if (HasLabel(beginAtom))
      begin += 0.26 * vb;
    if (HasLabel(endAtom))
      end -= 0.26 * vb;

    if (order == 1) {
      painter->DrawLine(begin.x(), begin.y(), end.x(), end.y());
    } else if (order == 2) {
      vector3 orthogonalLine = cross(end - begin, VZ).normalize();
      vector3 offset = orthogonalLine * 0.5 * bondSpacing;
      painter->DrawLine(begin.x() + offset.x(), begin.y() + offset.y(), 
                        end.x() + offset.x(), end.y() + offset.y());
      painter->DrawLine(begin.x() - offset.x(), begin.y() - offset.y(), 
                        end.x() - offset.x(), end.y() - offset.y());
    } else if (order == 3) {
      vector3 orthogonalLine = cross(end - begin, VZ).normalize();
      vector3 offset = orthogonalLine * 0.7 * bondSpacing;
      painter->DrawLine(begin.x(), begin.y(), end.x(), end.y());
      painter->DrawLine(begin.x() + offset.x(), begin.y() + offset.y(), 
                        end.x() + offset.x(), end.y() + offset.y());
      painter->DrawLine(begin.x() - offset.x(), begin.y() - offset.y(), 
                        end.x() - offset.x(), end.y() - offset.y());
    }
  }
Ejemplo n.º 3
0
  void OBDepictPrivate::DrawHash(OBAtom *beginAtom, OBAtom *endAtom)
  {
    vector3 begin = beginAtom->GetVector();
    vector3 end = endAtom->GetVector();
    vector3 vb = end - begin;

    if (HasLabel(beginAtom))
      begin += 0.26 * vb;
    if (HasLabel(endAtom))
      end -= 0.26 * vb;

    vector3 orthogonalLine = cross(vb, VZ);
    orthogonalLine.normalize();
    orthogonalLine *= 0.5 * bondWidth;

    double lines[7] = { 0.10, 0.20, 0.30, 0.40, 0.50, 0.60, 0.70 };

    for (int k = 0; k < 7; ++k) {
      double w = lines[k];
      painter->DrawLine(end.x() - vb.x() * w + orthogonalLine.x() * w, 
                        end.y() - vb.y() * w + orthogonalLine.y() * w, 
                        end.x() - vb.x() * w - orthogonalLine.x() * w, 
                        end.y() - vb.y() * w - orthogonalLine.y() * w);
    }
  } 
Ejemplo n.º 4
0
void KVTensP::Fill(KVNucleus* c)
{
   //Add the particle's contribution to the momentum tensor.
   //
   //This particle will be rejected if:
   //(1) it has Z < Zmin
   //(2) it does not belong to the group defined with SetPartGroup**
   //
   // **if no group defined, only Z>=Zmin condition is used.
   //
   //This uses the 3 cartesian components of the particle's velocity vector
   //with a weight equal to the particle's A.
   //
   //By default the velocity vector in the default (laboratory) frame is used.
   //To calculate in another frame, use KVVarGlob::SetFrame() before
   //calculation begins

   Bool_t ok = (HasLabel() ? (c->BelongsToGroup(GetPartGroup())) : kTRUE);

   //check Z of particle
   if ((c->GetZ() >= GetZmin()) && ok) {
      Double_t poids = (Double_t) c->GetA();
      tenseurP->Fill(c->GetFrame(fFrame.Data())->GetV(), poids);
   }
}
Ejemplo n.º 5
0
  void OBDepictPrivate::DrawWedge(OBAtom *beginAtom, OBAtom *endAtom)
  {
    vector3 begin = beginAtom->GetVector();
    vector3 end = endAtom->GetVector();
    vector3 vb = end - begin;

    if (HasLabel(beginAtom))
      begin += 0.33 * vb;
    if (HasLabel(endAtom))
      end -= 0.33 * vb;

    vector3 orthogonalLine = cross(vb, VZ);
    orthogonalLine.normalize();
    orthogonalLine *= 0.5 * bondWidth;
    std::vector<std::pair<double,double> > points;

    points.push_back(std::pair<double,double>(end.x(), end.y()));
    points.push_back(std::pair<double,double>(begin.x() + orthogonalLine.x(), 
                                              begin.y() + orthogonalLine.y()));
    points.push_back(std::pair<double,double>(begin.x() - orthogonalLine.x(), 
                                              begin.y() - orthogonalLine.y()));
    painter->DrawPolygon(points);
  }
Ejemplo n.º 6
0
BOOL FLabels::AddLabel(const tchar* pszLabel)
{
	FString NewLabel = pszLabel; 
	NewLabel.Replace('\'', ' ');
	NewLabel.Replace('\"', ' ');
	NewLabel.Replace(',', ' '); 
	NewLabel.Replace(';', ' '); 
	NewLabel.Trim(); 
	if (NewLabel.GetLength() > 0 && !HasLabel(NewLabel))
	{
		m_Labels.Add(FLabelItem(NewLabel));
		BuildLabelStr(); 
		return TRUE; 
	}
	return FALSE; 
}