XMap AppMapServer::getMap(double longitude, double latitude)
{
    Coordinate<double> coord;
    coord.latitude = latitude;
    coord.longitude = longitude;
    return XMap(coord);
}
void ClusterView2D::draw() {
/*
	glClearColor( 0, 0, 0, 1 );
	glClear( GL_COLOR_BUFFER_BIT );
	glMatrixMode( GL_PROJECTION );
	glLoadIdentity();
	glMatrixMode( GL_MODELVIEW );
	glLoadIdentity();
	glOrtho( 0, 1, 0, 1, -1, 1 );

	glShadeModel( GL_SMOOTH );
	glBegin( GL_QUADS );
		glColor3f( 1, 0, 0 );
		glVertex3f( 0, 0, 0 );
		glColor3f( 0, 1, 0 );
		glVertex3f( 0, 1, 0 );
		glColor3f( 0, 0, 1 );
		glVertex3f( 1, 1, 1 );
		glColor3f( 1, 1, 1 );
		glVertex3f( 1, 0, 0 );
	glEnd();
	glFlush();
*/

	glViewport(0, 0, w(), h());
	glMatrixMode( GL_PROJECTION );
	glLoadIdentity();
	
	

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glClearColor(1.0,1.0,1.0,1.0);
/*
	glPushMatrix();
	glColor4f(1.0, 0.0, 0.0, 1);
	glBegin(GL_LINE_LOOP);
		glVertex3f( -1, -1, 0 );
		glVertex3f( -1, 0, 0 );
		glVertex3f( 0, 0, 0 );
		glVertex3f( 0, -1, 0 );
	glEnd();
	glPopMatrix();
*/
	glPushMatrix();
	glTranslatef(-1, -1, 0);
	glScalef(2, 2, 1);
	

	glLineWidth(1);
    glShadeModel(GL_SMOOTH);  // Because each line is the same color.

    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);

#ifdef CHANGES
	if(!m_bClear){
#endif
	for(int i = 0; i < m_total_size; i++){
		float* data = m_dataPts[i];
		//int clusterid = m_clusterPts[i];
		if(m_bshowall || clusterid == m_selcluster){
			glBegin(GL_LINE_STRIP);
			//ColorCluster(clusterid);
			int cl_ind = 0;
			for (int j = 0; j < m_dim; j++){
				int clusterid = m_cluster[cl_ind][i];
				ColorCluster(clusterid);

				float x = XMap(j)/(m_percentWidth*(float)w());//COLOR_CHOOSER_WIDTH;
				float y = (0.1*(m_percentHeight*(float)h()) + YMap(data[j]))/(m_percentHeight*(float)h());//COLOR_CHOOSER_HEIGHT;
				glVertex2f( x,y);

				if(j != 0 && (j % m_ts_chunk == 0))
					cl_ind++;
			}
			glEnd();
			glFlush();
		}
	}
#ifdef CHANGES
	}
#endif	

	glDisable(GL_BLEND);
    glLineWidth(7);
    
    glShadeModel(GL_SMOOTH);
    glDisable(GL_LINE_SMOOTH);
	glPopMatrix();

	glFlush();

	
}
Exemple #3
0
void ClusterView2D::draw() {
	float x,y;
/*
	glClearColor( 0, 0, 0, 1 );
	glClear( GL_COLOR_BUFFER_BIT );
	glMatrixMode( GL_PROJECTION );
	glLoadIdentity();
	glMatrixMode( GL_MODELVIEW );
	glLoadIdentity();
	glOrtho( 0, 1, 0, 1, -1, 1 );

	glShadeModel( GL_SMOOTH );
	glBegin( GL_QUADS );
		glColor3f( 1, 0, 0 );
		glVertex3f( 0, 0, 0 );
		glColor3f( 0, 1, 0 );
		glVertex3f( 0, 1, 0 );
		glColor3f( 0, 0, 1 );
		glVertex3f( 1, 1, 1 );
		glColor3f( 1, 1, 1 );
		glVertex3f( 1, 0, 0 );
	glEnd();
	glFlush();
*/

	glViewport(0, 0, w(), h());
	glMatrixMode( GL_PROJECTION );
	glLoadIdentity();
	
	

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glClearColor(1.0,1.0,1.0,1.0);
/*
	glPushMatrix();
	glColor4f(1.0, 0.0, 0.0, 1);
	glBegin(GL_LINE_LOOP);
		glVertex3f( -1, -1, 0 );
		glVertex3f( -1, 0, 0 );
		glVertex3f( 0, 0, 0 );
		glVertex3f( 0, -1, 0 );
	glEnd();
	glPopMatrix();
*/
	glPushMatrix();
	glTranslatef(-1, -1, 0);
	glScalef(2, 2, 1);
	
	//glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);    // Use The Good Calculations
	//glEnable(GL_LINE_SMOOTH);            // Enable Anti-Aliasing
	glLineWidth(1);
    glShadeModel(GL_SMOOTH);  // Because each line is the same color.

    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);

	int cl_ind;
#ifdef CHANGES
	if(!m_bClear){
#endif
	for(int i = 0; i < m_total_size; i++){
		float* data = m_dataPts[i];
		//glBegin(GL_LINE_STRIP);
		cl_ind = 0;
		glBegin(GL_LINE_STRIP);
		float alpha = (float)(rand()%100) / 1000.0;
		//int clusterid = m_cluster[cl_ind][i];
		while(cl_ind*m_ts_chunk < m_dim){
			int clusterid = m_cluster[cl_ind][i];
			if(m_bshowall || clusterid == m_selcluster){

				
				ColorCluster(clusterid,alpha);
				for (int j = (m_ts_chunk * cl_ind); j < (m_ts_chunk * (cl_ind+1)); j++){
					glBegin(GL_LINES);
						x = XMap(j);///(m_percentWidth*(float)w());//COLOR_CHOOSER_WIDTH;
						y = (/*0.1*(m_percentHeight*(float)h()) + */YMap((data[j]-m_datamin)/(m_datamax-m_datamin)));///(m_percentHeight*(float)h());//COLOR_CHOOSER_HEIGHT;
						glVertex2f( x,y);
					
						if(j + 1 != m_dim){
							x = XMap(j+1);///(m_percentWidth*(float)w());//COLOR_CHOOSER_WIDTH;
							y = (/*0.1*(m_percentHeight*(float)h()) + */YMap((data[j+1]-m_datamin)/(m_datamax-m_datamin)));///(m_percentHeight*(float)h());//COLOR_CHOOSER_HEIGHT;
							glVertex2f( x,y);
						}
					glEnd();
					//glFlush();
				}
				
			}
			cl_ind++;
		}
		//glEnd();
		//glFlush();

	}

	glLineWidth(2.0);
	glColor3f(0.0f,0.0f,0.0f);
	cl_ind = 0;
	
	for (int j = 0; j < m_nClusters; j++){
		if(m_bshowall || m_selcluster == j){
			glBegin(GL_LINE_STRIP);
			cl_ind = 0;
			while(cl_ind*m_ts_chunk < m_dim){
				int ind = m_ts_chunk * cl_ind;
				for (int d = cl_ind*m_ts_chunk; d < (cl_ind+1)*m_ts_chunk; d++) {
					//glBegin(GL_LINES);
					float x = XMap(d);///(m_percentWidth*(float)w());//COLOR_CHOOSER_WIDTH;
					int index = d % m_ts_chunk;
					float y = (/*0.1*(m_percentHeight*(float)h()) + */YMap((m_ctrs[cl_ind][j][index]-m_datamin)/(m_datamax-m_datamin)));///(m_percentHeight*(float)h());//COLOR_CHOOSER_HEIGHT;
					glVertex2f( x,y);
					/*
					if(d+1 < m_dim){
						x = XMap(d+1)/(m_percentWidth*(float)w());//COLOR_CHOOSER_WIDTH;
						index = (d+1) % m_ts_chunk;
						y = (0.1*(m_percentHeight*(float)h()) + YMap((m_ctrs[cl_ind][j][index]-m_datamin)/(m_datamax-m_datamin)))/(m_percentHeight*(float)h());//COLOR_CHOOSER_HEIGHT;
						glVertex2f( x,y);
					}
					*/
					ind++;
					//glEnd();
				}
				cl_ind++;
			}
			glEnd();
			glFlush();
		}
	}
	

#ifdef CHANGES
	}
#endif	

	glDisable(GL_BLEND);
    glLineWidth(7);
    
    glShadeModel(GL_SMOOTH);
    glDisable(GL_LINE_SMOOTH);
	glPopMatrix();

	glFlush();

	
}