interactability

This commit is contained in:
karthikmurakonda 2022-10-29 23:53:32 +05:30
parent b727c9bd5a
commit 9f9530a065
5 changed files with 240 additions and 35 deletions

View File

@ -296,18 +296,6 @@
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLayout" id="map_layout">
<property name="width-request">600</property>
<property name="height-request">500</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLayout" id="graph_layoutvol">
<property name="height-request">150</property>
@ -324,6 +312,7 @@
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-top">16</property>
<child>
<object class="GtkBox" id="mlad">
<property name="can-focus">False</property>
@ -929,7 +918,7 @@
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">RSS</property>
<property name="label" translatable="yes">IITdh</property>
</object>
<packing>
<property name="left-attach">1</property>
@ -944,7 +933,39 @@
</packing>
</child>
<child>
<placeholder/>
<!-- n-columns=2 n-rows=1 -->
<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(0,255,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">dharwad</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">2</property>
</packing>
</child>
<child>
<placeholder/>
@ -1005,7 +1026,7 @@
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">RSS</property>
<property name="label" translatable="yes">IITdh</property>
</object>
<packing>
<property name="left-attach">1</property>
@ -1020,7 +1041,39 @@
</packing>
</child>
<child>
<placeholder/>
<!-- n-columns=2 n-rows=1 -->
<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(0,255,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">dharwad</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">2</property>
</packing>
</child>
<child>
<placeholder/>
@ -1081,7 +1134,7 @@
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">RSS</property>
<property name="label" translatable="yes">IITdh</property>
</object>
<packing>
<property name="left-attach">1</property>
@ -1096,7 +1149,39 @@
</packing>
</child>
<child>
<placeholder/>
<!-- n-columns=2 n-rows=1 -->
<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(0,255,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">dharwad</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">2</property>
</packing>
</child>
<child>
<placeholder/>
@ -1111,6 +1196,59 @@
<property name="top-attach">3</property>
</packing>
</child>
<child>
<!-- n-columns=1 n-rows=3 -->
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkLayout" id="map_layout">
<property name="width-request">600</property>
<property name="height-request">500</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="maplabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="xpad">3</property>
<property name="ypad">3</property>
<property name="label" translatable="yes">Voltage Magnitude</property>
<attributes>
<attribute name="scale" value="2"/>
</attributes>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="graphlabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Voltage Magnitude</property>
<attributes>
<attribute name="scale" value="2"/>
</attributes>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>

View File

@ -296,18 +296,6 @@
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLayout" id="map_layout">
<property name="width-request">600</property>
<property name="height-request">500</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLayout" id="graph_layoutvol">
<property name="height-request">150</property>
@ -324,6 +312,7 @@
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-top">16</property>
<child>
<object class="GtkBox" id="mlad">
<property name="can-focus">False</property>
@ -495,7 +484,8 @@
<object class="GtkLabel" id="legend_label1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">&gt;6900V</property>
<property name="label" translatable="yes">&gt;65600V or
&lt; 65300</property>
</object>
<packing>
<property name="left-attach">1</property>
@ -530,8 +520,8 @@
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">&lt;6800V
&lt;6300V</property>
<property name="label" translatable="yes">&lt;65600V
&gt;65300V</property>
</object>
<packing>
<property name="left-attach">1</property>
@ -761,6 +751,7 @@
<object class="GtkLabel" id="legend_label3">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">&gt; 0.5</property>
</object>
<packing>
<property name="left-attach">1</property>
@ -795,7 +786,7 @@
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Normal</property>
<property name="label" translatable="yes">&lt; 0.5</property>
</object>
<packing>
<property name="left-attach">1</property>
@ -1109,6 +1100,59 @@
<property name="top-attach">3</property>
</packing>
</child>
<child>
<!-- n-columns=1 n-rows=3 -->
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkLayout" id="map_layout">
<property name="width-request">600</property>
<property name="height-request">500</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="maplabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="xpad">3</property>
<property name="ypad">3</property>
<property name="label" translatable="yes">Voltage Magnitude</property>
<attributes>
<attribute name="scale" value="2"/>
</attributes>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="graphlabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Voltage Magnitude</property>
<attributes>
<attribute name="scale" value="2"/>
</attributes>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>

View File

@ -39,6 +39,8 @@ struct _UtData
GtkWidget *swfreq;
GtkWidget *swdfreq;
GtkWidget *swad;
GtkWidget *maplabel;
GtkWidget *graphlabel;
};
UtData *utdata;

View File

@ -145,7 +145,11 @@ gboolean update_images(gpointer* pars){
vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map,lat, lon, parameters->g_green_image);
}
}else if (algorithm==1 && dimmension == 0){
if(!kmeans(df)){
vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map,lat, lon, parameters->g_red_image);
}else{
vis_ptr->last_image = osm_gps_map_image_add(parameters->util_map,lat, lon, parameters->g_green_image);
}
}else if (algorithm==1 && dimmension == 1){
}else if (algorithm==1 && dimmension == 2){

View File

@ -138,6 +138,10 @@ void on_voltage_clicked(GtkButton *but, gpointer udata)
gtk_widget_show(utdata->ml_vol);
gtk_widget_show(utdata->graph_layoutvol);
gtk_widget_show(utdata->swvol);
gtk_widget_show(utdata->graphlabel);
gtk_label_set_label(utdata->maplabel, "Voltage Magnitude");
gtk_label_set_label(utdata->graphlabel, "Voltage Magnitude");
gtk_widget_hide(utdata->ml_freq);
gtk_widget_hide(utdata->ml_dfreq);
@ -166,6 +170,10 @@ void on_frequency_clicked(GtkButton *but, gpointer udata)
gtk_widget_show(utdata->ml_freq);
gtk_widget_show(utdata->graph_layoutfreq);
gtk_widget_show(utdata->swfreq);
gtk_widget_show(utdata->graphlabel);
gtk_label_set_label(utdata->maplabel, "Frequency");
gtk_label_set_label(utdata->graphlabel, "Frequency");
gtk_widget_hide(utdata->ml_vol);
gtk_widget_hide(utdata->ml_dfreq);
@ -196,6 +204,10 @@ void on_dfreq_clicked(GtkButton *but, gpointer udata)
gtk_widget_show(utdata->ml_dfreq);
gtk_widget_show(utdata->graph_layoutdfreq);
gtk_widget_show(utdata->swdfreq);
gtk_widget_show(utdata->graphlabel);
gtk_label_set_label(utdata->maplabel, "Frequency Rate");
gtk_label_set_label(utdata->graphlabel, "Frequency Rate");
gtk_widget_hide(utdata->ml_vol);
gtk_widget_hide(utdata->ml_freq);
@ -233,6 +245,8 @@ void on_attack_detection_clicked(GtkButton *but, gpointer udata)
gtk_widget_show(utdata->dimm_label);
gtk_widget_show(utdata->ml_ad);
gtk_label_set_label(utdata->maplabel, "Attack Detection");
gtk_widget_hide(utdata->ml_vol);
gtk_widget_hide(utdata->ml_freq);
gtk_widget_hide(utdata->ml_dfreq);
@ -242,6 +256,7 @@ void on_attack_detection_clicked(GtkButton *but, gpointer udata)
gtk_widget_hide(utdata->graph_layoutdfreq);
gtk_widget_hide(utdata->graph_layoutfreq);
gtk_widget_hide(utdata->graph_layoutvol);
gtk_widget_hide(utdata->graphlabel);
printf("Attack Detection\n");
}
@ -305,6 +320,8 @@ void utility_tools(GtkButton *but, gpointer udata)
utdata->swvol = GTK_WIDGET(gtk_builder_get_object(builder, "swvol"));
utdata->swfreq = GTK_WIDGET(gtk_builder_get_object(builder, "swfreq"));
utdata->swdfreq = GTK_WIDGET(gtk_builder_get_object(builder, "swdfreq"));
utdata->maplabel = GTK_WIDGET(gtk_builder_get_object(builder, "maplabel"));
utdata->graphlabel = GTK_WIDGET(gtk_builder_get_object(builder, "graphlabel"));
gtk_widget_set_sensitive(utdata->voltage, FALSE);
gtk_widget_set_visible(utdata->algorithm, FALSE);