Exemple #1
0
void GridPlot::drawEnrichment(const Plotlet& pl, Enrichment& p)
{
    switch(p.type())
    {
        case Enrichment::USERENRICHMENT:
        {
            p.assign(*this);
            UserEnrichment* ue = (UserEnrichment*)&p;
            ue->drawBegin();
            ue->draw();
            ue->drawEnd();
        }
        break;
    case Enrichment::VERTEXENRICHMENT:
    {
        p.assign(*this);
        VertexEnrichment* ve = (VertexEnrichment*)&p;
        ve->drawBegin();
        const GridData& data = dynamic_cast<const GridData&>(*pl.data);
        int step = resolution();
        for (int i = 0; i <= data.columns() - step; i += step)
            for (int j = 0; j <= data.rows() - step; j += step)
                ve->draw(data.vertices[i][j]);
        ve->drawEnd();
    }
        break;
    case Enrichment::EDGEENRICHMENT:
        break;
    default:
        break; //todo
    }
}
void SurfacePlot::createEnrichment(Enrichment& p)
{
	if (!actualData_p)
    return;
  
  //todo future work
  if (p.type() != Enrichment::VERTEXENRICHMENT)
    return;
  
  p.assign(*this);
	p.drawBegin();

  VertexEnrichment* ve = (VertexEnrichment*)&p; 
  if (actualData_p->datatype == Qwt3D::POLYGON)
  {	
    for (unsigned i = 0; i != actualDataC_->normals.size(); ++i) 
	    ve->draw(actualDataC_->nodes[i]);
  }
  else if (actualData_p->datatype == Qwt3D::GRID)
 	{
    int step = resolution();
    for (int i = 0; i <= actualDataG_->columns() - step; i += step) 
      for (int j = 0; j <= actualDataG_->rows() - step; j += step) 
  			ve->draw(Triple(actualDataG_->vertices[i][j][0],
										              actualDataG_->vertices[i][j][1],
                                  actualDataG_->vertices[i][j][2]));
  }
  p.drawEnd(); 
}
Exemple #3
0
void Curve::createEnrichment(Enrichment& p)
{
    if (!actualData_p)	return;

    //todo future work
    if (p.type() != Enrichment::VERTEXENRICHMENT)	return;

    p.assign(*this);
    p.drawBegin();

    int step = resolution();

    VertexEnrichment* ve = (VertexEnrichment*)&p;
    if (actualData_p->datatype == Qwt3D::POLYGON) {
        unsigned int size = actualDataC_->nodes.size();
        for (unsigned i = 0; i < size; i += step)
            ve->draw(actualDataC_->nodes[i]);
    } else if (actualData_p->datatype == Qwt3D::GRID) {
        unsigned int cols = actualDataG_->columns();
        unsigned int rows = actualDataG_->rows();
        for (unsigned int i = 0; i <= cols - step; i += step) {
            for (unsigned int j = 0; j <= rows - step; j += step) {
                double *v = actualDataG_->vertices[i][j];
                ve->draw(Triple(v[0], v[1], v[2]));
            }
        }
    }

    p.drawEnd();
}