graph legend
This commit is contained in:
		
							parent
							
								
									ce3edbb69d
								
							
						
					
					
						commit
						c995e1f0c0
					
				| 
						 | 
					@ -211,7 +211,7 @@
 | 
				
			||||||
                </child>
 | 
					                </child>
 | 
				
			||||||
                <child>
 | 
					                <child>
 | 
				
			||||||
                  <object class="GtkButton" id="attack_detection">
 | 
					                  <object class="GtkButton" id="attack_detection">
 | 
				
			||||||
                    <property name="label" translatable="yes">Attack Detection</property>
 | 
					                    <property name="label" translatable="yes">Event Detection</property>
 | 
				
			||||||
                    <property name="visible">True</property>
 | 
					                    <property name="visible">True</property>
 | 
				
			||||||
                    <property name="can-focus">True</property>
 | 
					                    <property name="can-focus">True</property>
 | 
				
			||||||
                    <property name="receives-default">True</property>
 | 
					                    <property name="receives-default">True</property>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -898,39 +898,7 @@
 | 
				
			||||||
                          </packing>
 | 
					                          </packing>
 | 
				
			||||||
                        </child>
 | 
					                        </child>
 | 
				
			||||||
                        <child>
 | 
					                        <child>
 | 
				
			||||||
                          <!-- n-columns=2 n-rows=1 -->
 | 
					                          <placeholder/>
 | 
				
			||||||
                          <object class="GtkGrid">
 | 
					 | 
				
			||||||
                            <property name="visible">True</property>
 | 
					 | 
				
			||||||
                            <property name="can-focus">False</property>
 | 
					 | 
				
			||||||
                            <child>
 | 
					 | 
				
			||||||
                              <object class="GtkColorButton">
 | 
					 | 
				
			||||||
                                <property name="visible">True</property>
 | 
					 | 
				
			||||||
                                <property name="can-focus">True</property>
 | 
					 | 
				
			||||||
                                <property name="receives-default">True</property>
 | 
					 | 
				
			||||||
                                <property name="rgba">rgb(253,0,0)</property>
 | 
					 | 
				
			||||||
                              </object>
 | 
					 | 
				
			||||||
                              <packing>
 | 
					 | 
				
			||||||
                                <property name="left-attach">0</property>
 | 
					 | 
				
			||||||
                                <property name="top-attach">0</property>
 | 
					 | 
				
			||||||
                              </packing>
 | 
					 | 
				
			||||||
                            </child>
 | 
					 | 
				
			||||||
                            <child>
 | 
					 | 
				
			||||||
                              <object class="GtkLabel">
 | 
					 | 
				
			||||||
                                <property name="visible">True</property>
 | 
					 | 
				
			||||||
                                <property name="can-focus">False</property>
 | 
					 | 
				
			||||||
                                <property name="label" translatable="yes">IITdh</property>
 | 
					 | 
				
			||||||
                              </object>
 | 
					 | 
				
			||||||
                              <packing>
 | 
					 | 
				
			||||||
                                <property name="left-attach">1</property>
 | 
					 | 
				
			||||||
                                <property name="top-attach">0</property>
 | 
					 | 
				
			||||||
                              </packing>
 | 
					 | 
				
			||||||
                            </child>
 | 
					 | 
				
			||||||
                          </object>
 | 
					 | 
				
			||||||
                          <packing>
 | 
					 | 
				
			||||||
                            <property name="expand">False</property>
 | 
					 | 
				
			||||||
                            <property name="fill">True</property>
 | 
					 | 
				
			||||||
                            <property name="position">1</property>
 | 
					 | 
				
			||||||
                          </packing>
 | 
					 | 
				
			||||||
                        </child>
 | 
					                        </child>
 | 
				
			||||||
                      </object>
 | 
					                      </object>
 | 
				
			||||||
                    </child>
 | 
					                    </child>
 | 
				
			||||||
| 
						 | 
					@ -968,39 +936,7 @@
 | 
				
			||||||
                          </packing>
 | 
					                          </packing>
 | 
				
			||||||
                        </child>
 | 
					                        </child>
 | 
				
			||||||
                        <child>
 | 
					                        <child>
 | 
				
			||||||
                          <!-- n-columns=2 n-rows=1 -->
 | 
					                          <placeholder/>
 | 
				
			||||||
                          <object class="GtkGrid">
 | 
					 | 
				
			||||||
                            <property name="visible">True</property>
 | 
					 | 
				
			||||||
                            <property name="can-focus">False</property>
 | 
					 | 
				
			||||||
                            <child>
 | 
					 | 
				
			||||||
                              <object class="GtkColorButton">
 | 
					 | 
				
			||||||
                                <property name="visible">True</property>
 | 
					 | 
				
			||||||
                                <property name="can-focus">True</property>
 | 
					 | 
				
			||||||
                                <property name="receives-default">True</property>
 | 
					 | 
				
			||||||
                                <property name="rgba">rgb(253,0,0)</property>
 | 
					 | 
				
			||||||
                              </object>
 | 
					 | 
				
			||||||
                              <packing>
 | 
					 | 
				
			||||||
                                <property name="left-attach">0</property>
 | 
					 | 
				
			||||||
                                <property name="top-attach">0</property>
 | 
					 | 
				
			||||||
                              </packing>
 | 
					 | 
				
			||||||
                            </child>
 | 
					 | 
				
			||||||
                            <child>
 | 
					 | 
				
			||||||
                              <object class="GtkLabel">
 | 
					 | 
				
			||||||
                                <property name="visible">True</property>
 | 
					 | 
				
			||||||
                                <property name="can-focus">False</property>
 | 
					 | 
				
			||||||
                                <property name="label" translatable="yes">IITdh</property>
 | 
					 | 
				
			||||||
                              </object>
 | 
					 | 
				
			||||||
                              <packing>
 | 
					 | 
				
			||||||
                                <property name="left-attach">1</property>
 | 
					 | 
				
			||||||
                                <property name="top-attach">0</property>
 | 
					 | 
				
			||||||
                              </packing>
 | 
					 | 
				
			||||||
                            </child>
 | 
					 | 
				
			||||||
                          </object>
 | 
					 | 
				
			||||||
                          <packing>
 | 
					 | 
				
			||||||
                            <property name="expand">False</property>
 | 
					 | 
				
			||||||
                            <property name="fill">True</property>
 | 
					 | 
				
			||||||
                            <property name="position">1</property>
 | 
					 | 
				
			||||||
                          </packing>
 | 
					 | 
				
			||||||
                        </child>
 | 
					                        </child>
 | 
				
			||||||
                        <child>
 | 
					                        <child>
 | 
				
			||||||
                          <placeholder/>
 | 
					                          <placeholder/>
 | 
				
			||||||
| 
						 | 
					@ -1044,39 +980,7 @@
 | 
				
			||||||
                          </packing>
 | 
					                          </packing>
 | 
				
			||||||
                        </child>
 | 
					                        </child>
 | 
				
			||||||
                        <child>
 | 
					                        <child>
 | 
				
			||||||
                          <!-- n-columns=2 n-rows=1 -->
 | 
					                          <placeholder/>
 | 
				
			||||||
                          <object class="GtkGrid">
 | 
					 | 
				
			||||||
                            <property name="visible">True</property>
 | 
					 | 
				
			||||||
                            <property name="can-focus">False</property>
 | 
					 | 
				
			||||||
                            <child>
 | 
					 | 
				
			||||||
                              <object class="GtkColorButton">
 | 
					 | 
				
			||||||
                                <property name="visible">True</property>
 | 
					 | 
				
			||||||
                                <property name="can-focus">True</property>
 | 
					 | 
				
			||||||
                                <property name="receives-default">True</property>
 | 
					 | 
				
			||||||
                                <property name="rgba">rgb(253,0,0)</property>
 | 
					 | 
				
			||||||
                              </object>
 | 
					 | 
				
			||||||
                              <packing>
 | 
					 | 
				
			||||||
                                <property name="left-attach">0</property>
 | 
					 | 
				
			||||||
                                <property name="top-attach">0</property>
 | 
					 | 
				
			||||||
                              </packing>
 | 
					 | 
				
			||||||
                            </child>
 | 
					 | 
				
			||||||
                            <child>
 | 
					 | 
				
			||||||
                              <object class="GtkLabel">
 | 
					 | 
				
			||||||
                                <property name="visible">True</property>
 | 
					 | 
				
			||||||
                                <property name="can-focus">False</property>
 | 
					 | 
				
			||||||
                                <property name="label" translatable="yes">IITdh</property>
 | 
					 | 
				
			||||||
                              </object>
 | 
					 | 
				
			||||||
                              <packing>
 | 
					 | 
				
			||||||
                                <property name="left-attach">1</property>
 | 
					 | 
				
			||||||
                                <property name="top-attach">0</property>
 | 
					 | 
				
			||||||
                              </packing>
 | 
					 | 
				
			||||||
                            </child>
 | 
					 | 
				
			||||||
                          </object>
 | 
					 | 
				
			||||||
                          <packing>
 | 
					 | 
				
			||||||
                            <property name="expand">False</property>
 | 
					 | 
				
			||||||
                            <property name="fill">True</property>
 | 
					 | 
				
			||||||
                            <property name="position">1</property>
 | 
					 | 
				
			||||||
                          </packing>
 | 
					 | 
				
			||||||
                        </child>
 | 
					                        </child>
 | 
				
			||||||
                        <child>
 | 
					                        <child>
 | 
				
			||||||
                          <placeholder/>
 | 
					                          <placeholder/>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -33,10 +33,6 @@ gboolean update_images(gpointer* pars){
 | 
				
			||||||
        pthread_mutex_unlock(&mutex_on_TSB);
 | 
					        pthread_mutex_unlock(&mutex_on_TSB);
 | 
				
			||||||
        return TRUE;
 | 
					        return TRUE;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    //int freq = to_intconvertor(df->dpmu[0]->freq);
 | 
					 | 
				
			||||||
	//gboolean green =attack_detect(df);
 | 
					 | 
				
			||||||
    //printf("map_vis A: %Lf, B: %Lf,C: %Lf\n",A,B,C);
 | 
					 | 
				
			||||||
    //gboolean green = kmeans(df);
 | 
					 | 
				
			||||||
   
 | 
					   
 | 
				
			||||||
    int i = 0, k = 0;
 | 
					    int i = 0, k = 0;
 | 
				
			||||||
    float freq,vol_magnitude,angle, dfreq;
 | 
					    float freq,vol_magnitude,angle, dfreq;
 | 
				
			||||||
| 
						 | 
					@ -45,17 +41,12 @@ gboolean update_images(gpointer* pars){
 | 
				
			||||||
        float lat;
 | 
					        float lat;
 | 
				
			||||||
        float lon;
 | 
					        float lon;
 | 
				
			||||||
        loops++;
 | 
					        loops++;
 | 
				
			||||||
        // printf("loops: %d\n", loops);
 | 
					 | 
				
			||||||
        
 | 
					 | 
				
			||||||
        id = to_intconvertor(df->idcode);
 | 
					        id = to_intconvertor(df->idcode);
 | 
				
			||||||
        // printf("id = %d\n",id);
 | 
					 | 
				
			||||||
        pthread_mutex_lock(&mutex_cfg);
 | 
					        pthread_mutex_lock(&mutex_cfg);
 | 
				
			||||||
        temp_cfg = cfgfirst;
 | 
					        temp_cfg = cfgfirst;
 | 
				
			||||||
        // Check for the IDCODE in Configuration Frame
 | 
					 | 
				
			||||||
        while(temp_cfg != NULL){
 | 
					        while(temp_cfg != NULL){
 | 
				
			||||||
            if(id == to_intconvertor(temp_cfg->idcode)){
 | 
					            if(id == to_intconvertor(temp_cfg->idcode)){
 | 
				
			||||||
                cfg_match = 1;
 | 
					                cfg_match = 1;
 | 
				
			||||||
                // printf("Matched - id : %d\n",id);
 | 
					 | 
				
			||||||
                freq_fmt = temp_cfg->pmu[0]->fmt->freq;
 | 
					                freq_fmt = temp_cfg->pmu[0]->fmt->freq;
 | 
				
			||||||
                anal_fmt = temp_cfg->pmu[0]->fmt->analog;
 | 
					                anal_fmt = temp_cfg->pmu[0]->fmt->analog;
 | 
				
			||||||
                phas_fmt = temp_cfg->pmu[0]->fmt->phasor;
 | 
					                phas_fmt = temp_cfg->pmu[0]->fmt->phasor;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -351,6 +351,7 @@ void utility_tools(GtkButton *but, gpointer udata)
 | 
				
			||||||
    dimmension = 0;
 | 
					    dimmension = 0;
 | 
				
			||||||
    myParameters parameters = {utdata->util_map, g_red_image, g_green_image, g_grey_image, g_last_image};
 | 
					    myParameters parameters = {utdata->util_map, g_red_image, g_green_image, g_grey_image, g_last_image};
 | 
				
			||||||
    gpointer data = (gpointer)¶meters;
 | 
					    gpointer data = (gpointer)¶meters;
 | 
				
			||||||
 | 
					    struct cfg_frame* temp_cfg = cfgfirst;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    gtk_widget_set_size_request(GTK_WIDGET(utdata->util_map), 600, 500);
 | 
					    gtk_widget_set_size_request(GTK_WIDGET(utdata->util_map), 600, 500);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -391,11 +392,26 @@ void utility_tools(GtkButton *but, gpointer udata)
 | 
				
			||||||
    int index = 0;
 | 
					    int index = 0;
 | 
				
			||||||
    while (llptr != NULL)
 | 
					    while (llptr != NULL)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        printf("\ncat\n");
 | 
					 | 
				
			||||||
        temp_visptr->id = llptr->pmuid;
 | 
					        temp_visptr->id = llptr->pmuid;
 | 
				
			||||||
        temp_visptr->lat = llptr->latitude;
 | 
					        temp_visptr->lat = llptr->latitude;
 | 
				
			||||||
        temp_visptr->lon = llptr->longitude;
 | 
					        temp_visptr->lon = llptr->longitude;
 | 
				
			||||||
        temp_visptr->last_image = osm_gps_map_image_add(utdata->util_map, llptr->latitude, llptr->longitude, g_grey_image); // TODO: change the image
 | 
					        temp_visptr->last_image = osm_gps_map_image_add(utdata->util_map, llptr->latitude, llptr->longitude, g_grey_image);
 | 
				
			||||||
 | 
					        // declare tooltip
 | 
				
			||||||
 | 
					        gchar *tooltiptext;
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // iterate through the cfg frame and find the corresponding cfg frame
 | 
				
			||||||
 | 
					        while (temp_cfg != NULL)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            tooltiptext = g_strdup_printf("unknown");
 | 
				
			||||||
 | 
					            if ( to_intconvertor(temp_cfg->idcode) == llptr->pmuid)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                // set the tooltip text
 | 
				
			||||||
 | 
					                tooltiptext = cfgfirst->pmu[0]->stn;
 | 
				
			||||||
 | 
					                break;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            temp_cfg = temp_cfg->cfgnext;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        temp_visptr->serie_freq = live_chart_serie_new(llptr->ip, (LiveChartSerieRenderer*)live_chart_line_new(live_chart_values_new(10000)));
 | 
					        temp_visptr->serie_freq = live_chart_serie_new(llptr->ip, (LiveChartSerieRenderer*)live_chart_line_new(live_chart_values_new(10000)));
 | 
				
			||||||
        GdkRGBA color = getIndexColor(index);
 | 
					        GdkRGBA color = getIndexColor(index);
 | 
				
			||||||
| 
						 | 
					@ -415,6 +431,7 @@ void utility_tools(GtkButton *but, gpointer udata)
 | 
				
			||||||
        GtkWidget *color_button = gtk_color_button_new_with_rgba(&color);
 | 
					        GtkWidget *color_button = gtk_color_button_new_with_rgba(&color);
 | 
				
			||||||
        gtk_grid_attach(GTK_GRID(grid), color_button, 0, 0, 1, 1);
 | 
					        gtk_grid_attach(GTK_GRID(grid), color_button, 0, 0, 1, 1);
 | 
				
			||||||
        gchar *label_text = g_strdup_printf("%d", llptr->pmuid);
 | 
					        gchar *label_text = g_strdup_printf("%d", llptr->pmuid);
 | 
				
			||||||
 | 
					        gtk_widget_set_tooltip_text(grid, tooltiptext);
 | 
				
			||||||
        gtk_grid_attach(GTK_GRID(grid), gtk_label_new(label_text), 1, 0, 1, 1);
 | 
					        gtk_grid_attach(GTK_GRID(grid), gtk_label_new(label_text), 1, 0, 1, 1);
 | 
				
			||||||
        // TODO: customise the line color
 | 
					        // TODO: customise the line color
 | 
				
			||||||
        gtk_box_pack_start(GTK_BOX(utdata->gl1), grid, FALSE, FALSE, 0);
 | 
					        gtk_box_pack_start(GTK_BOX(utdata->gl1), grid, FALSE, FALSE, 0);
 | 
				
			||||||
| 
						 | 
					@ -422,11 +439,13 @@ void utility_tools(GtkButton *but, gpointer udata)
 | 
				
			||||||
        GtkWidget *color_button2 = gtk_color_button_new_with_rgba(&color);
 | 
					        GtkWidget *color_button2 = gtk_color_button_new_with_rgba(&color);
 | 
				
			||||||
        gtk_grid_attach(GTK_GRID(grid2), color_button2, 0, 0, 1, 1);
 | 
					        gtk_grid_attach(GTK_GRID(grid2), color_button2, 0, 0, 1, 1);
 | 
				
			||||||
        gtk_grid_attach(GTK_GRID(grid2), gtk_label_new(label_text), 1, 0, 1, 1);
 | 
					        gtk_grid_attach(GTK_GRID(grid2), gtk_label_new(label_text), 1, 0, 1, 1);
 | 
				
			||||||
 | 
					        gtk_widget_set_tooltip_text(color_button2, tooltiptext);
 | 
				
			||||||
        gtk_box_pack_start(GTK_BOX(utdata->gl2), grid2, FALSE, FALSE, 0);
 | 
					        gtk_box_pack_start(GTK_BOX(utdata->gl2), grid2, FALSE, FALSE, 0);
 | 
				
			||||||
        GtkWidget *grid3 = gtk_grid_new();
 | 
					        GtkWidget *grid3 = gtk_grid_new();
 | 
				
			||||||
        GtkWidget *color_button3 = gtk_color_button_new_with_rgba(&color);
 | 
					        GtkWidget *color_button3 = gtk_color_button_new_with_rgba(&color);
 | 
				
			||||||
        gtk_grid_attach(GTK_GRID(grid3), color_button3, 0, 0, 1, 1);
 | 
					        gtk_grid_attach(GTK_GRID(grid3), color_button3, 0, 0, 1, 1);
 | 
				
			||||||
        gtk_grid_attach(GTK_GRID(grid3), gtk_label_new(label_text), 1, 0, 1, 1);
 | 
					        gtk_grid_attach(GTK_GRID(grid3), gtk_label_new(label_text), 1, 0, 1, 1);
 | 
				
			||||||
 | 
					        gtk_widget_set_tooltip_text(grid3, tooltiptext);
 | 
				
			||||||
        gtk_box_pack_start(GTK_BOX(utdata->gl3), grid3, FALSE, FALSE, 0);
 | 
					        gtk_box_pack_start(GTK_BOX(utdata->gl3), grid3, FALSE, FALSE, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        temp_visptr->next = (struct vis_data *)malloc(sizeof(struct vis_data));
 | 
					        temp_visptr->next = (struct vis_data *)malloc(sizeof(struct vis_data));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue