Beispiel #1
0
void wavePlotter::draw (VectorXf &data)
{
	int temp_index = -1;
	startStyle();		
			ofBeginShape();
			for (int i=0; i<width; i++)
			{
				int index = (int) ofMap(i, 0, width, data_start_index, data_end_index);
				if (temp_index == index) {continue;}
				float ty =  ofMap(data(index), lowRange, highRange, height, 0, false);
				
				temp_index = index;
				//cout << "Index is: " << index << ", ty is: " << endl;
				ofVertex(i, ty);
			}
			/*
			for (int i = 0; i < DATA_SIZE; i++)
			{
				float tx =  ofMap(i, 0, DATA_SIZE, 0, width, true);
				float ty =  ofMap(data[i], lowRange, highRange, height, 0, false);
				
				ofVertex(tx, ty);
			}
			*/
			ofEndShape(false);
	endStyle();
}
 void KmlGenerator::putStationStyle() {
     startStyle("StationStyle");
     putLabelStyle(ColorRGBA(0x00,0x00,0x00,0x00), NORMAL, 0.0f); //invisible labels
     putIconStyle(stationIconHref, Offset(), 0.25f, 0.0f);        //custom icon
     endStyle();
     skipLine();
 }
Beispiel #3
0
// <?> how to overload method to avoid code duplication in this particular case when dealing with pointer - casting would not work
void wavePlotter::draw (short * data)
{
	int temp_index;
	startStyle();		
			ofBeginShape();
			for (int i=0; i<width; i++)
			{
				int index = (int) ofMap(i, 0, width, data_start_index, data_end_index);
				if (temp_index == index) {continue;}
				temp_index = index;
				float ty =  ofMap(data[index], lowRange, highRange, height, 0, false);
				ofVertex(i, ty);
			}
			/*
			for (int i = 0; i < DATA_SIZE; i++)
			{
				float tx =  ofMap(i, 0, DATA_SIZE, 0, width, true);
				float ty =  ofMap(data[i], lowRange, highRange, height, 0, false);
				
				ofVertex(tx, ty);
			}
			*/
			ofEndShape(false);
	endStyle();
}
void PHISHtmlGeneric::richTextLayouted() const
{
    _out+=_indent+"<div class=\"phi_"+QByteArray::number( PHI::RICH_TEXT )+"\""
        +id()+title()+startStyle()+colorStyle()+outlineColorStyle()+fontStyle()
        +alignmentStyle()+effectStyle()+"\">\n";
    _out+=_it->valueData()+'\n';
    _out+=_indent+"</div>\n";
}
void PHISHtmlGeneric::richText() const
{
    //return createGraphicsImage( GTRichText );
    _out+=_indent+"<div class=\"phi_"+QByteArray::number( PHI::TEXT )+"\""
       +id()+title()+startStyle()+colorStyle()+outlineColorStyle()+fontStyle()
       +alignmentStyle()+effectStyle()+"\">\n";
    _out+=_it->valueData()+'\n';
    _out+=_indent+"</div>\n";
}
void PHISHtmlGeneric::label() const
{
    _out+=_indent+"<div "+id()+startStyle()+effectStyle()+"\">\n";
    _out+=_indent+"\t<table cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" "
        +"id=\""+_it->id()+"_phitbl\"><tr><td style=\""+alignmentStyle()
        +colorStyle()+outlineColorStyle()+fontStyle()+heightStyle();
    _out+="overflow:visible;white-space:nowrap;\" onmouseover=\"this.style.cursor='default';\">";
        //" onmouseout=\"this.style.cursor='auto';\">";
    _out+=_it->valueData();
    _out+="</td></tr></table>\n"+_indent+"</div>\n";
}
void PHISHtmlWebKit532::imageButton() const
{
    _out+=_indent+"<button type=\"button\" class=\"phibuttontext\""
        +name()+disabled()+title()+accessKey()+tabIndex()
        +onClickUrl()+startStyle( adjustButtonSize() )+effectStyle();
    _out+="padding:0px;-webkit-appearance:button;\">\n";
    QByteArray url;
    if ( _it->imageId().startsWith( QLatin1String( "phi" ) ) )
        url="/phi.phis?phiimg="+_it->imageIdData()+"&amp;phitmp=1";
    else url="/phi.phis?phiimg="+_it->imageIdData();
    QByteArray style=" style=\"position:relative;vertical-align:middle;";
    _out+='\t';
    imageSource( url, style, _it->id()+"_phiimg", _it->toolTipData() );
    _out+=_indent+"\t<span style=\""+colorStyle()+fontStyle()
        +"\">"+_it->valueData()+"</span>\n";
    _out+=_indent+"</button>\n";
}
void PHISHtmlWebKit532::selectBox() const
{
    QByteArray font=fontStyle();
    if ( font.isNull() && _isMacOSX ) {
        QFont f=_p->font();
        font.reserve( 200 );
        font+="font-family:'"+f.family().toUtf8();
        if ( !f.lastResortFamily().isEmpty() ) font+="','"+f.lastResortFamily().toUtf8();
        font+="';";
        if ( f.pointSize() > -1 ) font+="font-size:"+QByteArray::number( f.pointSize()+1 )+"pt;";
    }
    _out+=_indent+"<select class=\"phitext\"";
    _out+=name()+title()+disabled()+accessKey()+tabIndex()
        +startStyle( adjustSelectSize() )+effectStyle()
        +font+colorStyle()+"\">\n";
    _out+=selectOptions();
    _out+=_indent+"</select>\n";
}
    void KmlGenerator::putIsoLineStyles() {

        std::map<std::string, bool> styles;

        for (const auto &interpIsolines : isolines) {
            for(const auto &temporalIsolines : interpIsolines.second) {
                for(const auto &isoline : temporalIsolines) {
                    std::string styleName = "IsoLine_" + isoline.lines.color.toHexString();
                    if(styles.find(styleName) == styles.end()) {
                        startStyle(styleName);
                        putLineStyle(isoline.lines.color, NORMAL, 2u);
                        endStyle();
                        styles.emplace(styleName, true);
                    }
                }
            }
        }
        skipLine();
    }
    void KmlGenerator::putIsoContourStyles() {

        std::map<std::string, bool> styles;

        for (const auto &interpIsocontours : isocontours) {
            for(const auto &temporalIsocontours : interpIsocontours.second) {
                for(const auto &isocontour : temporalIsocontours) {
                    std::string styleName = "IsoContour_" + isocontour.color.toHexString();
                    if(styles.find(styleName) == styles.end()) {
                        startStyle(styleName);
                        putPolyStyle(isocontour.color, NORMAL, true, true);
                        putLineStyle(ColorRGBA::black, NORMAL, 1u);
                        endStyle();
                        styles.emplace(styleName, true);
                    }
                }
            }
        }

        skipLine();
    }
void PHISHtmlWebKit532::button() const
{
    static QByteArray type=QByteArray::fromRawData( "-webkit-appearance:button;", 26 );
    _out+=_indent+"<input type=\"button\" class=\"phibuttontext\""+name()
        +title()+disabled()+value()+accessKey()+tabIndex()+onClickUrl()
        +startStyle( adjustButtonSize() )+colorStyle();
    if ( _isMacOSX ) {
        if ( _it->height()>35. ) _out+=type;
        QByteArray font=fontStyle();
        if ( font.isNull() ) {
            QFont f=_p->font();
            font.reserve( 200 );
            font+="font-family:'"+f.family().toUtf8();
            if ( !f.lastResortFamily().isEmpty() ) font+="','"+f.lastResortFamily().toUtf8();
            font+="';";
            if ( f.pointSize() > -1 ) font+="font-size:"+QByteArray::number( f.pointSize()+1 )+"pt;";
        }
        _out+=font;
    } else _out+=fontStyle();
    _out+=effectStyle()+_endtag;
}
void PHISHtmlGeneric::menuLink() const
{
    _out+=_indent+"<div "+id()+title()+onClickUrl()+startStyle()+effectStyle()+"\">\n";
    _out+=_indent+"\t<table cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" "
        +"id=\""+_it->id()+"_phitbl\"><tr><td style=\""+alignmentStyle()
        +colorStyle()+outlineColorStyle()+fontStyle()+heightStyle()
        +"overflow:visible;white-space:nowrap;\"";
    if ( _it->rolloverTextColor().isValid() || _it->rolloverBackgroundColor().isValid() ) {
        _out+=" onmouseover=\"this.style.cursor='default';";
        if ( _it->rolloverTextColor().isValid() )
            _out+="this.style.color='"+_it->rolloverTextColor().name().toLatin1()+"';";
        if ( _it->rolloverBackgroundColor().isValid() )
            _out+="this.style.backgroundColor='"+_it->rolloverBackgroundColor().name().toLatin1()+"';";
        _out+='"';
        QColor tc=_it->color().isValid() ? _it->color() : _p->palette().color( QPalette::WindowText );
        _out+=" onmouseout=\"this.style.color='"+tc.name().toLatin1()+"';";
        if ( _it->outlineColor().isValid() )
            _out+="this.style.backgroundColor='"+_it->outlineColor().name().toLatin1()+"';";
        _out+='"';
    }
    _out+='>'+_it->valueData();
    _out+="</td></tr></table>\n"+_indent+"</div>\n";
}