/// /// show(): Generates the SVG drawing output file for each pedigree. /// void DrawingCanvas::show(const char* filename){ // If label and/or icon legends are present // readjust the x and y extents: if(_labelSet->getNumberOfLabels() != 0 || _iconLegendFlag){ _xMinimum -= _labelLegend.getWidth(); double height = _labelLegend.getHeight(); if(_iconLegendFlag) height += _iconLegend.getHeight(); if(height > getYRange()) { _yMaximum += (height - getYRange()); } } // // Only set the header now because at this point the // true x and y extents (width and height) are known: _setHeader(); // // Add the legends: // _drawLegends(); std::ofstream svgfile(filename); if(svgfile.is_open()){ svgfile << _header.str() << std::endl; ///////////////////////////////////////////////////// // // 2009.05.21.ET: // Dump the bottommost layer (for curved connectors) // ///////////////////////////////////////////////////// svgfile << " <g id=\"bottomLayer" << "\" class=\"layer\" >\n"; svgfile << _bottomLayer.str() << std::endl; svgfile << " </g>\n"; for(unsigned i=0;i<_layers.size();i++){ svgfile << _layers[i] << std::endl; } svgfile << _body.str() << std::endl; svgfile << _footer.str() << std::endl; svgfile.close(); }else{ std::cout << "Unable to open file " << filename << std::endl; } }
/// /// show(): Generates the SVG drawing output file for each pedigree. /// void DrawingCanvas::show(const char* filename){ // DEBUG: //std::cout << _header << std::endl; // Show the layers before the body //for(unsigned i=0;i<_layers.size();i++) // std::cout << _layers[i] << std::endl; //std::cout << _body << std::endl; //std::cout << _footer << std::endl; // Write to file with name : pedigree_id+".xml" // If label and/or icon legends are present // readjust the x and y extents: if(_labelSet->getNumberOfLabels() != 0 || _iconLegendFlag){ _xMinimum -= _labelLegend.getWidth(); double height = _labelLegend.getHeight(); if(_iconLegendFlag) height += _iconLegend.getHeight(); if(height > getYRange()) { _yMaximum += (height - getYRange()); } } // // Only set the header now because at this point the // true x and y extents (width and height) are known: _setHeader(); // // Add the legends: // _drawLegends(); std::ofstream svgfile(filename); if(svgfile.is_open()){ svgfile << _header.str() << std::endl; for(unsigned i=0;i<_layers.size();i++){ svgfile << _layers[i] << std::endl; } svgfile << _body.str() << std::endl; svgfile << _footer.str() << std::endl; svgfile.close(); }else{ std::cout << "Unable to open file " << filename << std::endl; } }
void CorrelationTimeArcGrbcat::initiate() { TRACE("X: range = " << getXRange() << ", points = " << getXPoints() << ", delta = " << getXDelta()); TRACE("Y: range = " << getYRange() << ", points = " << getYPoints() << ", delta = " << getYDelta()); _histData.resize(getYPoints(), std::vector<std::size_t>(getXPoints(), 0)); _histModel.resize(getYPoints(), std::vector<std::size_t>(getXPoints(), 0)); _cf.resize(getYPoints(), std::vector<type::Float>(getXPoints(), 0.0)); }
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> void Graph::getBounds(Range &x, Range &y) const { x = getXRange(); y = getYRange(); }
// //_setHeader: // void DrawingCanvas::_setHeader(){ std::stringstream width,height; width << _media.getWidth(); height << _media.getHeight(); // // Only print the xml declaration if the // document is not an embeddable fragment: // if( DrawingMetrics::getEmbeddedState()==false ){ _header << "<?xml version=\"1.0\" standalone=\"no\"?>\n"; } _header << " <svg version=\"1.1\" id=\"svgDC\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" "; // // Viewbox only: // //_header << " viewBox=\"0,0," + width.str() + "," + height.str() + "\" onload=\"init()\" >\n"; // // Based on media width and height only: // //_header << " width=\"" + width.str() + "\" height=\"" + height.str() + "\""; // // Based on actual x and y extents: // _header << " width=\""; _header << getXRange(); _header << "\" height=\""; _header << getYRange(); _header << "\" "; _header << " onload=\"init()\" >\n"; // // Start of <defs> section: // _header << " <defs>\n"; // // Append the CSS: // _setCSS(); // // Append the Javascript // _setJavascript(); // // Append any SVG definitions: // _setSVGDefinitions(); // // End defs section: // _header << " </defs>\n"; // Set up the group tag for the whole document _header << " <g class=\"pedigree\" transform=\"translate(" << getXMinimum()*-1 << ")\">\n"; }
void MSAEditorConsensusArea::paintFullConsensus(QPainter &p) { p.fillRect(QRect(0, 0, ui->seqArea->getXByColumnNum(ui->editor->getAlignmentLen()), getYRange(MSAEditorConsElement_RULER).startPos), Qt::white); drawConsensus(p, 0, ui->editor->getAlignmentLen() - 1, true); drawHistogram(p, 0, ui->editor->getAlignmentLen() - 1); }
void MSAEditorConsensusArea::paintFullConsensus(QPixmap &pixmap) { pixmap = QPixmap(ui->seqArea->getXByColumnNum(ui->editor->getAlignmentLen()), getYRange(MSAEditorConsElement_RULER).startPos); QPainter p(&pixmap); paintFullConsensus(p); }
paintFullConsensus(p); } void MSAEditorConsensusArea::paintFullConsensus(QPainter &p) { p.fillRect(QRect(0, 0, ui->seqArea->getXByColumnNum(ui->editor->getAlignmentLen()), getYRange(MSAEditorConsElement_RULER).startPos), Qt::white); drawConsensus(p, 0, ui->editor->getAlignmentLen() - 1, true); drawHistogram(p, 0, ui->editor->getAlignmentLen() - 1); } void MSAEditorConsensusArea::paintConsenusPart(QPixmap &pixmap, const U2Region ®ion, const QList<qint64> &seqIdx) { CHECK(!region.isEmpty(), ); CHECK(!seqIdx.isEmpty(), ); CHECK(!ui->seqArea->isAlignmentEmpty(), ); CHECK(editor->getColumnWidth() * region.length < 32768, ); pixmap = QPixmap(editor->getColumnWidth() * region.length, getYRange(MSAEditorConsElement_RULER).startPos); QPainter p(&pixmap); paintConsenusPart(p, region, seqIdx); } void MSAEditorConsensusArea::paintConsenusPart(QPainter &p, const U2Region ®ion, const QList<qint64> &seqIdx) { CHECK(!region.isEmpty(), ); CHECK(!seqIdx.isEmpty(), ); CHECK(!ui->seqArea->isAlignmentEmpty(), ); p.fillRect(QRect(0, 0, editor->getColumnWidth() * region.length, getYRange(MSAEditorConsElement_RULER).startPos), Qt::white); //draw consensus p.setPen(Qt::black); QFont f = ui->editor->getFont();