Ejemplo n.º 1
0
//--------------------------------------------------------------
void testApp::updateControls()
{
	
	//cout << panel.getValueS("model name") << endl;
	
	if( gmlLister->lister->selectedHasChanged() )
	{
		int which = gmlLister->selection;
		currentTagName = gmlLister->lister->getName( which );
		gmlLister->lister->clearChangedFlag();
		
		loadTag( currentTagName );
				
		string newFile = currentTagName;
		int pos = newFile.find_first_of(".gml");
		string mname = newFile.substr(0,pos);
		panel.setValueS("model name",mname);
	}
	
	panel.update();
	
	if(panel.getValueB("save_model"))
	{
		panel.setValueB("save_model",false);
		
		string modelName = "stl/"+panel.getValueS("model name")+".stl";
		cout << "write " << modelName << endl;
		model.write(modelName);
	}
	
	
	
	tag.lineScale = panel.getValueF("extrude_scale");
	tag.z_const = panel.getValueF("z_const");
	tag.minLen = panel.getValueF("min_extrude");
	tag.res = panel.getValueI("res");
	tag.minPtDist = panel.getValueF("min_point_dist");
	
	if(panel.getValueB("reload"))
	{
		panel.setValueB("reload",false);
		
		//string name = tag.tagname+".gml";
		loadTag( currentTagName );

	}
	
	if( panel.getValueB("default_position") )
	{
		panel.setValueB("default_position",false);
		tag.defaultPosition();
	}
	
	
	bUseSmoothing = panel.getValueB( "use_smoothing");
}
Ejemplo n.º 2
0
//--------------------------------------------------------------
void testApp::setup(){
	
	ofSetFrameRate(60);
	
	setupControls();
	
	//grafIo.loadTag("gml/hell-001.gml",&tag);
	
	bUseSmoothing = false;
	
	//int which = gmlLister->selection;
	currentTagName = gmlLister->lister->getName( 0 );
	loadTag( currentTagName);
	
	ofBackground(80,80,80);
	
	GLfloat LightAmbient[]= { 0.5f, 0.5f, 0.5f, 1.0f };
	GLfloat LightDiffuse[]= { 1.0f, 1.0f, 1.0f, 1.0f };
	GLfloat LightPosition[]= { 0.0f, 0.0f, 0.0f, 1.0f };
	
	glShadeModel(GL_SMOOTH);
	glLightfv(GL_LIGHT1, GL_AMBIENT, LightAmbient);
	glLightfv(GL_LIGHT1, GL_DIFFUSE, LightDiffuse);
	glLightfv(GL_LIGHT1, GL_POSITION,LightPosition);
	glEnable(GL_LIGHT1);
	
	
	
}
Ejemplo n.º 3
0
void Tag_Handler::removePointInComment(QString fileName, QPointF point)
{
    //load up the images tag
    loadTag(fileName);

    //get the current contents
    QString comment = QString::fromStdString((*exif_data)["Exif.Photo.UserComment"].toString());

    qreal x = point.x(), y = point.y();

    if(!comment.contains("("+QString::number(x) + "," + QString::number(y)+")"))
    {
        std::cout<<"Could not remove point ("<<x<<","<<y<<"), it doesnt exist!"<<std::endl;
    }
    else
    {
        comment.remove("("+QString::number(x) + "," + QString::number(y)+")");
        std::cout<<"Removing ("<<x<<","<<y<<")"<<std::endl;

        //set updated contents
        (*exif_data)["Exif.Photo.UserComment"]
              = comment.toStdString().c_str();

        //write back contents
        image->writeMetadata();
    }
}
Ejemplo n.º 4
0
QVector<QPointF> Tag_Handler::readPointsFromComment(QString fileName)
{
    //load up the images tag
    loadTag(fileName);

    //get the current contents
    QString comment = QString::fromStdString((*exif_data)["Exif.Photo.UserComment"].toString());

    int left_paren, comma, right_paren = 0;
    float temp_x, temp_y;
    QVector<QPointF> points;

    //while we are working from a valid left paren
    while((left_paren = comment.toStdString().find('(', right_paren)) != std::string::npos)
    {
        //find comma after left paren
        comma = comment.toStdString().find(',', left_paren);

        //find right paren after comma
        right_paren = comment.toStdString().find(')', comma);

        //grab x value out
        temp_x = atof(comment.toStdString().substr(left_paren+1, comma-1).c_str());

        //grab y value out
        temp_y = atof(comment.toStdString().substr(comma+1, right_paren-1).c_str());

        points.push_back(QPointF(temp_x,temp_y));

    }

    return points;
}
Ejemplo n.º 5
0
void Tag_Handler::clearComment(QString fileName)
{
    //load the file metadata
    loadTag(fileName);

    //reset the comment section
    (*exif_data)["Exif.Photo.UserComment"] = "";

    //write it back to tag
    image->writeMetadata();
}
Ejemplo n.º 6
0
void Tag_Handler::addPointToComment(QString fileName, QPointF point)
{
    //load up the images tag
    loadTag(fileName);

    //get the current contents
    QString comment = QString::fromStdString((*exif_data)["Exif.Photo.UserComment"].toString());

    //append the new point to current contents
    comment = comment + "(" + QString::number(point.x()) +"," + QString::number(point.y()) + ")";

    std::cout<<"Updating comment to: "<< qPrintable(comment);

    //set updated contents
    (*exif_data)["Exif.Photo.UserComment"]
          = comment.toStdString().c_str();

    //write back contents
    image->writeMetadata();
}
Ejemplo n.º 7
0
    void TagFactory::loadTagOrState( QTreeWidgetItem * item , int column )
    {
        Q_UNUSED( column );

        if ( m_itemToState.contains( item ) )
        {
            m_currentItemState = item;
            loadState( m_itemToState[item] );

            m_appareanceGroupBox->setEnabled( true );
            m_fontGroupBox->setEnabled( true );
        }
        else if ( m_itemToTag.contains( item ) )
        {
            m_currentItemTag = item;
            loadTag( m_itemToTag[item] );

            m_appareanceGroupBox->setEnabled( false );
            m_fontGroupBox->setEnabled( false );
        }
    }