Browse Source

changed map_code

pull/7/head
karthikmv 2 years ago
parent
commit
c6926c8baa
  1. 9
      iPDC/align_sort.c
  2. BIN
      iPDC/green.png
  3. 13
      iPDC/ipdcGui.c
  4. 8
      iPDC/new_pmu_or_pdc.c
  5. 19
      iPDC/parser.c
  6. BIN
      iPDC/poi.png
  7. BIN
      iPDC/red.png
  8. 30
      iPDC/utility_tools.c
  9. 7
      iPDC/utility_tools.h
  10. 1662
      resources/align_sort.c
  11. 106
      resources/align_sort.h
  12. 724
      resources/applications.c
  13. 47
      resources/applications.h
  14. 769
      test-examples/examples/Makefile
  15. 17
      test-examples/examples/README
  16. 42
      test-examples/examples/editable_track.c
  17. 7
      test-examples/examples/env.sh
  18. 450
      test-examples/examples/mapviewer.c
  19. 34
      test-examples/examples/mapviewer.js
  20. 299
      test-examples/examples/mapviewer.py
  21. BIN
      test-examples/examples/poi.png
  22. 47
      test-examples/examples/polygon.c

9
iPDC/align_sort.c

@ -296,22 +296,17 @@ void assign_df_to_TSB(struct data_frame *df,int index) {
void dispatch(int index) {
int size,flag = 0;
int size;
sort_data_inside_TSB(index);
dataframe = NULL;
pthread_mutex_lock(&mutex_Upper_Layer_Details);
struct Upper_Layer_Details *temp_pdc = ULfirst;
size = create_dataframe(index);
while(temp_pdc != NULL ) {
if((temp_pdc->UL_upper_pdc_cfgsent == 1) && (temp_pdc->UL_data_transmission_off == 0)) {
if(flag == 0) {
size = create_dataframe(index);
flag = 1;
}
if(temp_pdc->config_change == 1) {
dataframe[14] = 0x04;

BIN
iPDC/green.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

13
iPDC/ipdcGui.c

@ -2182,12 +2182,13 @@ void ipdc_setup_fileSelector (GtkWidget *widget, gpointer udata)
NULL);
res = gtk_dialog_run(GTK_DIALOG(ipdc_setup_window));
printf("res = %d", res);
if(res == GTK_RESPONSE_ACCEPT)
{
char *filename;
filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(ipdc_setup_window));
strcpy(ipdcFilePath, filename);
g_print("File selected: %s\n", filename);
view_setup_file(filename);
g_free(filename);
}
@ -2224,7 +2225,7 @@ void view_setup_file (char *filename)
gtk_widget_destroy(ipdc_setup_window);
fp1 = fopen(s, "rb");
fp1 = fopen(filename, "rb");
if (fp1 == NULL)
{
@ -2279,7 +2280,7 @@ void view_setup_file (char *filename)
fclose (fp1);
/* Open the iPDC Setup File in read mode */
fp1 = fopen(s, "rb");
fp1 = fopen(filename, "rb");
/* If its available, then create a new dialog window for displaying the iPDC details. */
setup_display_window = gtk_dialog_new ();
@ -2296,7 +2297,7 @@ void view_setup_file (char *filename)
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
/* The dialog window is created with a vbox packed into it */
gtk_box_pack_start (GTK_BOX (GTK_DIALOG(setup_display_window)), scrolled_window, TRUE, TRUE, 0);
gtk_box_pack_start (gtk_dialog_get_content_area(setup_display_window), scrolled_window, TRUE, TRUE, 0);
gtk_widget_show (scrolled_window);
/* Create a table of ? by 2 squares */
@ -2543,8 +2544,8 @@ void view_setup_file (char *filename)
/* This makes it so the ok_button is the default. */
gtk_widget_set_can_default (cancel_button, TRUE);
gtk_widget_set_can_default (apply_button, TRUE);
gtk_box_pack_start (gtk_dialog_get_action_area, apply_button, TRUE, TRUE, 0);
gtk_box_pack_start (gtk_dialog_get_action_area, cancel_button, TRUE, TRUE, 0);
gtk_box_pack_start (gtk_dialog_get_action_area(setup_display_window), apply_button, TRUE, TRUE, 0);
gtk_box_pack_start (gtk_dialog_get_action_area(setup_display_window), cancel_button, TRUE, TRUE, 0);
/* This grabs this button to be the default button. Simply hitting the "Enter" key will cause this button to activate. */
gtk_widget_grab_default (cancel_button);

8
iPDC/new_pmu_or_pdc.c

@ -319,10 +319,10 @@ void* connect_pmu_tcp(void *temp) {
continue;
}
if (sendto(DB_sockfd,tcp_BUF, MAXBUFLEN-1, 0,
(struct sockaddr *)&DB_Server_addr,sizeof(DB_Server_addr)) == -1) {
perror("sendto");
}
// if (sendto(DB_sockfd,tcp_BUF, MAXBUFLEN-1, 0,
// (struct sockaddr *)&DB_Server_addr,sizeof(DB_Server_addr)) == -1) {
// perror("sendto");
// }
tcp_BUF[bytes_read] = '\0';
PMU_process_TCP(tcp_BUF,tcp_sockfd);

19
iPDC/parser.c

@ -60,7 +60,7 @@
#include "align_sort.h"
#include "connections.h"
#include "recreate.h"
#include "utility_tools.h"
/* ---------------------------------------------------------------------------- */
/* FUNCTION cfgparser(): */
@ -1269,6 +1269,23 @@ int dataparser(unsigned char data[]) {
//No match for configuration frame
printf("Configuration is not fresent for received data frame!\n");
}
printf("freq = %d\n",to_intconvertor(df->dpmu[0]->freq));
// temp code
int freq = to_intconvertor(df->dpmu[0]->freq);
if(util_map != NULL){
g_red_image = gdk_pixbuf_new_from_file_at_size ("red.png", 24,24,NULL);
g_green_image = gdk_pixbuf_new_from_file_at_size ("green.png", 24,24,NULL);
if(g_last_image != 0){
osm_gps_map_image_remove(util_map, g_last_image);
}
if (freq > 300){
g_last_image = osm_gps_map_image_add(util_map,15.518597, 74.925584, g_green_image);
}else{
g_last_image = osm_gps_map_image_add(util_map,15.518597, 74.925584, g_green_image);
}
gtk_widget_show_all(GTK_WIDGET(util_map));
}
if((config_change == 14) ||(config_change == 10))
return config_change;

BIN
iPDC/poi.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
iPDC/red.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

30
iPDC/utility_tools.c

@ -1,8 +1,18 @@
#include<gtk/gtk.h>
#include "osm-gps-map.h"
#include "utility_tools.h"
#define UI_fILE "./utility_tools.ui"
// void change_image(OsmGpsMap *map, float lat, float lon, OsmGpsMapImage *image)
// {
// if (g_last_image)
// osm_gps_map_image_remove(map, g_last_image);
// osm_gps_map_image_add(map, lat, lon, image);
// }
void utility_tools(GtkButton *but, gpointer udata)
{
GtkBuilder *builder;
@ -13,16 +23,24 @@ void utility_tools(GtkButton *but, gpointer udata)
g_warning("%s", error->message);
g_free(error);
}
GtkWidget *window = GTK_WIDGET(gtk_builder_get_object(builder, "util_window"));
window = GTK_WIDGET(gtk_builder_get_object(builder, "util_window"));
GtkContainer *map_container = GTK_CONTAINER(gtk_builder_get_object(builder, "map_layout"));
OsmGpsMap *map = g_object_new (OSM_TYPE_GPS_MAP,
"map-source", OSM_GPS_MAP_SOURCE_OPENSTREETMAP,
util_map = g_object_new (OSM_TYPE_GPS_MAP,
"map-source", OSM_GPS_MAP_SOURCE_GOOGLE_HYBRID,
"tile-cache", "/tmp/",
NULL);
gtk_widget_set_size_request(GTK_WIDGET(map), 800, 600);
osm_gps_map_set_center_and_zoom (util_map, 15.4589, 75.0078, 10);
g_red_image = gdk_pixbuf_new_from_file_at_size ("red.png", 24,24,NULL);
g_green_image = gdk_pixbuf_new_from_file_at_size ("green.png", 24,24,NULL);
// g_last_image = osm_gps_map_image_add(util_map,15.4589, 75.0078, g_red_image);
// g_last_image = osm_gps_map_image_add(util_map,15.518597, 74.925584, g_green_image);
gtk_widget_set_size_request(GTK_WIDGET(util_map), 600, 500);
gtk_container_add(map_container, GTK_WIDGET(map));
gtk_container_add(map_container, GTK_WIDGET(util_map));
gtk_widget_show_all(window);
gtk_main();

7
iPDC/utility_tools.h

@ -1,4 +1,5 @@
#include<gtk/gtk.h>
#include "osm-gps-map.h"
/* Convenience macros for obtaining objects from UI file */
#define CH_GET_OBJECT(builder, name, type, data) \
@ -6,4 +7,10 @@
#define CH_GET_WIDGET(builder, name, data) \
CH_GET_OBJECT(builder, name, GTK_WIDGET, data)
OsmGpsMap *util_map;
GtkWidget *window;
static GdkPixbuf *g_red_image = NULL;
static GdkPixbuf *g_green_image = NULL;
static OsmGpsMapImage *g_last_image = NULL;
void utility_tools(GtkButton *but, gpointer udata);

1662
resources/align_sort.c

File diff suppressed because it is too large

106
resources/align_sort.h

@ -0,0 +1,106 @@
/* -----------------------------------------------------------------------------
* align_sort.h
*
* iPDC - Phasor Data Concentrator
*
* Copyright (C) 2011-2012 Nitesh Pandit
* Copyright (C) 2011-2012 Kedar V. Khandeparkar
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Authors:
* Nitesh Pandit <panditnitesh@gmail.com>
* Kedar V. Khandeparkar <kedar.khandeparkar@gmail.com>
*
* ----------------------------------------------------------------------------- */
#define MAXTSB 5
#define OLDFRAMECOUNT 5
/* ---------------------------------------------------------------- */
/* global variable */
/* ---------------------------------------------------------------- */
int front = -1;
int rear=-1;
int Tsb_Count = 0;
/* ---------------------------------------------------------------- */
/* global Data Structure */
/* ---------------------------------------------------------------- */
/* Data Structure for Time Stamp Buffer */
struct TimeStampBuffer {
char *soc;
char *fracsec;
int count; // Current index
int num; // Total Number of PMUs
int counter; // Timer that will be initially set to 0
int ready_to_send;
struct pmupdc_id_list *idlist;
struct data_frame *first_data_frame;
}TSB[MAXTSB];
struct pmupdc_id_list {
char *idcode;
int num_pmu;
struct pmupdc_id_list *nextid;
};
// Kedar K on 8/6/2013
struct oldDataFramesTimeStampList
{
unsigned int soc;
unsigned int fracsec;
}ODFT[OLDFRAMECOUNT];
int old_df_front = -1;
int old_df_rear = -1;
/* ---------------------------------------------------------------- */
/* Function prototypes */
/* ---------------------------------------------------------------- */
void time_align(struct data_frame *df);
void assign_df_to_TSB(struct data_frame *df,int index);
void dispatch(int index);
void clear_TSB(int index);
int create_dataframe(int index);
void checkForMissingFrames(ENTRY*);
int create_cfgframe();
void sort_data_inside_TSB(int index);
struct data_frame* generate_dummy_dataframe(unsigned char *);
void adjustOldFrameCount(int index);
void intermediate_dispatch(int xx);
int matchDataFrameTimeToTSBTime(unsigned int df_soc,unsigned int df_fracsec);
void attacheEachDataFrame(struct data_frame *temp_df,int z);
/**************************************** End of File *******************************************************/

724
resources/applications.c

@ -0,0 +1,724 @@
/* -----------------------------------------------------------------------------
* applications.c
*
* iPDC - Phasor Data Concentrator
*
* Copyright (C) 2011-2012 Nitesh Pandit
* Copyright (C) 2011-2012 Kedar V. Khandeparkar
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Authors:
* Kedar V. Khandeparkar <kedar.khandeparkar@gmail.com>
*
* ----------------------------------------------------------------------------- */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h> /* fabs */
#include "parser.h"
#include "global.h"
#include "dallocate.h"
#include "applications.h"
/* ---------------------------------------------------------------------------- */
/* FUNCTION averageFrequency(): */
/* Computes average of frequency from all PMUs */
/* ---------------------------------------------------------------------------- */
float averageFrequency(struct data_frame *df) {
//struct data_frame *df = TSB[index].first_data_frame;
struct cfg_frame *temp_cfg = cfgfirst;
struct data_frame *temp_df;
float tempFreq = 0,avgFrequency;
int noOfPMU,i,j,count = 0;
pthread_mutex_lock(&mutex_cfg);
while(temp_cfg != NULL){
noOfPMU = to_intconvertor(temp_cfg->num_pmu);
count += noOfPMU;
temp_cfg = temp_cfg->cfgnext;
}
for(i = 0;i<(count*10-100);i++) {
temp_df = df;
temp_cfg = cfgfirst;
//printf("count = %d\n",count);
while(temp_cfg != NULL){
noOfPMU = to_intconvertor(temp_cfg->num_pmu);
if(temp_df != NULL) {
for(j = 0;j < noOfPMU; j++) {
//printf("a\n");
if(temp_cfg->pmu[j]->fmt->freq == '1') {
tempFreq += decode_ieee_single(temp_df->dpmu[j]->freq);
} else {
tempFreq += to_intconvertor(temp_df->dpmu[j]->freq);
}
}
temp_df = temp_df->dnext;
}
temp_cfg = temp_cfg->cfgnext;
}
}
pthread_mutex_unlock(&mutex_cfg);
avgFrequency = tempFreq/count;
return avgFrequency;
}
/* ---------------------------------------------------------------------------- */
/* FUNCTION frequencyInstability(): */
/* Computes weighted average of frequency from some PMUs */
/* ---------------------------------------------------------------------------- */
/*int frequencyInstability(struct data_frame *df) {
//struct data_frame *df = TSB[index].first_data_frame;
struct cfg_frame *temp_cfg = cfgfirst;
float tempFreq = 0,tempFc=0,totalFreq =0,totalHi=0;
float timeDiff = 20*1e-3;
float deltaFreq = 0;
int noOfPMUs = 0,totalPMUs=0,j;
while(temp_cfg != NULL){
totalPMUs += to_intconvertor(temp_cfg->num_pmu);
temp_cfg = temp_cfg->cfgnext;
}
int generatorPMUs = (totalPMUs*ratio) + 2; // Considered 1/5*noofPMUs+2 frequencies
int x = 0,*Hi;
Hi = randomGenerator(minHi,maxHi,generatorPMUs);
temp_cfg = cfgfirst;
while(temp_cfg != NULL) {
noOfPMUs = to_intconvertor(temp_cfg->num_pmu);
if(df != NULL) {
for(j=0;j<noOfPMUs;j++) {
if(temp_cfg->pmu[j]->fmt->freq == '1') {
if(x == generatorPMUs)
break;
tempFreq = decode_ieee_single(df->dpmu[j]->freq);
totalFreq += Hi[x]*tempFreq; // Sum of Hi*fi (numerator)
totalHi += Hi[x]; // Sum of Hi (denominator)
x++;
} else {
if(x == generatorPMUs)
break;
tempFreq = to_intconvertor(df->dpmu[j]->freq);
totalFreq += Hi[x]*tempFreq; // Sum of Hi*fi (numerator)
totalHi += Hi[x]; // Sum of Hi (denominator)
x++;
}
}
df = df->dnext;
}
temp_cfg = temp_cfg->cfgnext;
}
free(Hi);
if(fc == 0) {
fc = totalFreq/totalHi;
return 0;
} else {
tempFc = totalFreq/totalHi;
deltaFreq = fabs(fc-tempFc)/timeDiff;
/// Need to check deltaFreq < Threshold
fc = tempFc;
if(deltaFreq>delFThreshold)
return 1;
else return 0;
}
}
*/
/* ---------------------------------------------------------------------------- */
/* FUNCTION angleInstability(): */
/* Computes angular deviations from center of inertia */
/* ---------------------------------------------------------------------------- */
/*int angleInstability(struct data_frame *df) {
//struct data_frame *df = TSB[index].first_data_frame
struct cfg_frame *temp_cfg = cfgfirst;
float totalPi,totalTheta,localAreaPi,*localAreaTheta;
int totalPMUs,noOfPMU,noOfAreas,noOfPMUsInOneArea,tempTotalPMUs,*localAreaPowerSchedule,*individualPowerSchedule;
noOfPMUsInOneArea = 5;
totalPi= totalTheta =localAreaPi = 0;
while(temp_cfg != NULL){
totalPMUs += to_intconvertor(temp_cfg->num_pmu);
temp_cfg = temp_cfg->cfgnext;
}
tempTotalPMUs = totalPMUs;
float tt;
tt = (float)(totalPMUs*ratio)+2; // Number of areas eg 200*1/5+2 = 42
noOfAreas = nearbyint(tt/noOfPMUsInOneArea); // 42/5 = 8.4
int tt1 = (int)(noOfAreas); // 8
int rem = nearbyint(tt%noOfPMUsInOneArea);
if(fabs(tt-tt1) >0) { //8.4 - 8 =0.4
noOfAreas++; // noOfAreas = 9
}
localAreaTheta = malloc((noOfAreas + 1)*sizeof(float));
localAreaPowerSchedule = malloc((noOfAreas + 1)*sizeof(int));
individualPowerSchedule = randomGenerator(minPi,maxPi,tt);
temp_cfg = cfgfirst;
float tempAreaAngle,tempAreaPower;
unsigned int phnmr,noOfPMUs,pType;
int x,y,z,i,j; // x to track no of areas and y to track no of generators in those areas z for individual generator schedule
i = j = x = y = z = 0;
tempAreaPower = tempAreaAngle = 0;
unsigned char *d,*fp_left,*fp_right,*fx_left,*fx_right,*phasorType,polar;
fp_left = malloc(5*sizeof(unsigned char));
fp_right = malloc(5*sizeof(unsigned char));
fx_left = malloc(3*sizeof(unsigned char));
fx_right = malloc(3*sizeof(unsigned char));
phasorType = malloc(1*sizeof(unsigned char));
while(temp_cfg != NULL) { // Main Loop starts
if(df != NULL) {
noOfPMUs = to_intconvertor(temp_cfg->num_pmu);
for(j = 0;j < noOfPMUs;j++) {
phnmr = to_intconvertor(temp_cfg->pmu[j]->phnmr);
if(phnmr != 0) {
if(temp_cfg->pmu[j]->fmt->phasor == 1) { // Floating
for(i = 0;i<phnmr;i++) {
copy_cbyc (phasorType,(unsigned char *)temp_cfg->pmu[j]->phunit[i],1);
pType = to_intconvertor1(phasorType);
if((pType == 0)&&(i%3 ==0)) { // pTYpe = 0 indicates V and only phase I is chosen with the assumption that 3 phase data is sent
d = df->dpmu[j]->phasors[i];
polar = temp_cfg->pmu[j]->fmt->polar;
tempAreaAngle += (getVoltagePhasorAngle(1,fp_left,fp_right,d,polar,temp_cfg,i,j)) * individualPowerSchedule[z]; // 1 -> floating pt
tempAreaPower += individualPowerSchedule[z];
z++;
y++;
if(y == rem && (x == noOfAreas - 1)) {
localAreaTheta[x] = tempAreaAngle/tempAreaPower;
x++;
break;
} else if(y == noOfPMUsInOneArea) {
localAreaTheta[x] = tempAreaAngle/tempAreaPower;
y = 0;
x++;
}
}
}
} else { // fixed point
for(i = 0;i < phnmr; i++){
copy_cbyc (phasorType,(unsigned char *)temp_cfg->pmu[j]->phunit[i],1);
pType = to_intconvertor1(phasorType);
if((pType == 0)&&(i%3 ==0)) {
d = df->dpmu[j]->phasors[i];
polar = temp_cfg->pmu[j]->fmt->polar;
tempAreaAngle += getVoltagePhasorAngle(0,fp_left,fp_right,d,polar,temp_cfg,i,j)* individualPowerSchedule[z]; // 0 -> fixed pt
tempAreaPower += individualPowerSchedule[z];
z++;
y++;
if(y == rem && (x == noOfAreas - 1)) {
localAreaTheta[x] = tempAreaAngle/tempAreaPower;
localAreaPowerSchedule[x] = tempAreaPower;
x++;
break;
} else if(y == noOfPMUsInOneArea) {
localAreaTheta[x] = tempAreaAngle/tempAreaPower;
localAreaPowerSchedule[x] = tempAreaPower;
y = 0;
x++;
}
}
}
}
}
} // if df ends
df = df->dnext;
}
temp_cfg = temp_cfg->cfgnext;
} // Main loop ends
float centerAngle,totalPower;
centerAngle = totalPower = 0;
for (i = 0;i<noOfAreas;i++) {
centerAngle += localAreaTheta[i]*localAreaPowerSchedule[i];
totalPower += localAreaPowerSchedule[i];
}
centerAngle = centerAngle/totalPower;
char *violation = malloc(noOfAreas*sizeof(char));
for (i = 0;i<noOfAreas;i++)
{
if(fabs(centerAngle - localAreaTheta[i]) > angleThreshold)
violation[i] = '1';
else
violation[i] = '0';
}
free(violation);
free(localAreaTheta);
free(localAreaPowerSchedule);
free(individualPowerSchedule);
free(fp_right);
free(fp_left);
free(fx_right);
free(fx_left);
}
*/
/* ---------------------------------------------------------------------------- */
/* FUNCTION voltagePhasorAggregation(): */
/* Computes voltage phasor phasorAggregation */
/* ---------------------------------------------------------------------------- */
/*float voltagePhasorAggregation(struct data_frame *df) {
//struct data_frame *df = TSB[index].first_data_frame;
struct cfg_frame *temp_cfg = cfgfirst;
int i,j,noOfPMUs,totalPMUs;
totalPMUs = i = j = 0;
while(temp_cfg != NULL){
totalPMUs += to_intconvertor(temp_cfg->num_pmu);
temp_cfg = temp_cfg->cfgnext;
}
int generatorPMUs = (totalPMUs*ratio) + 4;
temp_cfg = cfgfirst;
unsigned int phnmr;
char polar;
float avgVoltageMagnitude = 0;
unsigned char *d;
int x = 0;
unsigned char *fp_left,*fp_right,*fx_left,*fx_right,*phasorType;
fp_left = malloc(5*sizeof(unsigned char));
fp_right = malloc(5*sizeof(unsigned char));
fx_left = malloc(3*sizeof(unsigned char));
fx_right = malloc(3*sizeof(unsigned char));
phasorType = malloc(1*sizeof(unsigned char));
int pType;
while(temp_cfg != NULL){ // Main Loop starts
if(df != NULL) {
noOfPMUs = to_intconvertor(temp_cfg->num_pmu);
for(j=0;j<noOfPMUs;j++) {
phnmr = to_intconvertor(temp_cfg->pmu[j]->phnmr);
if(phnmr != 0) {
if(temp_cfg->pmu[j]->fmt->phasor == 1) { // Floating
for(i = 0;i<phnmr;i++) {
copy_cbyc (phasorType,(unsigned char *)temp_cfg->pmu[j]->phunit[i],1);
pType = to_intconvertor1(phasorType);
if((pType == 0) && (i%3 == 0)) {
d = df->dpmu[j]->phasors[i];
polar = temp_cfg->pmu[j]->fmt->polar;
avgVoltageMagnitude += getPhasorVolageMagnitude(1,fp_left,fp_right,d,polar,temp_cfg,i,j); // 1 -> floating pt
}
}
x++;
if(x == generatorPMUs)
break;
} else { // fixed point
for(i = 0;i < phnmr; i++){
copy_cbyc (phasorType,(unsigned char *)temp_cfg->pmu[j]->phunit[i],1);
pType = to_intconvertor1(phasorType);
if((pType == 0) && (i%3 == 0)) {
d = df->dpmu[j]->phasors[i];
polar = temp_cfg->pmu[j]->fmt->polar;
avgVoltageMagnitude += getPhasorVolageMagnitude(0,fp_left,fp_right,d,polar,temp_cfg,i,j); // 0 -> fixed pt
}
}
x++;
if(x == generatorPMUs)
break;
}
}
}
df = df->dnext;
}
temp_cfg = temp_cfg->cfgnext;
} // Main loop ends
free(fp_right);
free(fp_left);
free(fx_right);
free(fx_left);
return avgVoltageMagnitude;
}
*/
/* ---------------------------------------------------------------------------- */
/* FUNCTION randomGenerator(): */
/* num random numbers array generated between min to max */
/* ---------------------------------------------------------------------------- */
int * randomGenerator(int max,int min,int num) {
int c =0,n,*coeff;
coeff = malloc((num+1)*sizeof(int));
while(1) {
n = rand()%max + min;
if(n>=min && n<= max) {
coeff[c] = n;
c++;
if(c == num)
break;
}
}
return coeff;
}
/* ---------------------------------------------------------------------------- */
/* FUNCTION getVoltagePhasorAngle(): */
/* get the phase angle */
/* ---------------------------------------------------------------------------- */
/*float getVoltagePhasorAngle(int format,char left[],char right[],unsigned char *d,char polar,struct cfg_frame *temp_cfg,int i,int j) {
float fp_r,fp_i,fp_angle;
unsigned int f_r,f_i;
if(format == 1) { // format indicates fixed or floating point
memset(left,'\0',5);
memset(right,'\0',5);
//d = df->dpmu[j]->phasors[i];
copy_cbyc (left,d,4);
left[4] = '\0';
d += 4;
copy_cbyc(right,d,4);
right[4] = '\0';
d += 4;
fp_r = decode_ieee_single(left);
fp_i = decode_ieee_single(right);
if(polar == '1') { // POLAR
fp_angle = fp_i;
} else { // rectangular
fp_angle = atan2f(fp_i, fp_r);
}
} else {
memset(left,'\0',3);
memset(right,'\0',3);
copy_cbyc (left,d,2);
left[2] = '\0';
d += 2;
copy_cbyc(right,d,2);
right[2] = '\0';
d += 2;
f_r = to_intconvertor(left);
f_i = to_intconvertor(right);
if(polar == '1') { // POLAR
fp_angle = f_i*1e-4; // Angle is in 10^4 radians
} else // RECTANGULAR
{
unsigned char *s = (unsigned char *)temp_cfg->pmu[j]->phunit[i];
s++;
unsigned char *buf = malloc(4*sizeof(unsigned char));
copy_cbyc (buf,(unsigned char *)s,3);
buf[3] = '\0';
unsigned long int l_phunit;
l_phunit = to_long_int_convertor1(buf);
l_phunit = l_phunit * 1e-5;
fp_r = l_phunit *f_r;
fp_i = l_phunit *f_i;
fp_angle = atan2f(fp_i, fp_r);
free(buf);
}
}
return fp_angle;
}
*/
/* ---------------------------------------------------------------------------- */
/* FUNCTION getPhasorVolageMagnitude(): */
/* get the phasor volage magnitude */
/* ---------------------------------------------------------------------------- */
/*float getPhasorVolageMagnitude(int format,char left[],char right[],unsigned char *d,char polar,struct cfg_frame *temp_cfg,int i,int j) {
float fp_r,fp_i,fp_magnitude;
unsigned int f_r,f_i;
if(format == 1) { // format indicates fixed or floating point
memset(left,'\0',5);
memset(right,'\0',5);
//d = df->dpmu[j]->phasors[i];
copy_cbyc (left,d,4);
left[4] = '\0';
d += 4;
copy_cbyc(right,d,4);
right[4] = '\0';
d += 4;
fp_r = decode_ieee_single(left);
fp_i = decode_ieee_single(right);
if(polar == '1') { // POLAR
fp_magnitude = fp_r;
} else { // rectangular
fp_magnitude = sqrt(fp_i*fp_i + fp_r*fp_r);
}
} else {
memset(left,'\0',3);
memset(right,'\0',3);
copy_cbyc (left,d,2);
left[2] = '\0';
d += 2;
copy_cbyc(right,d,2);
right[2] = '\0';
d += 2;
f_r = to_intconvertor(left);
f_i = to_intconvertor(right);
unsigned char *s = (unsigned char *)temp_cfg->pmu[j]->phunit[i];
s++;
unsigned char *buf = malloc(4*sizeof(unsigned char));
copy_cbyc (buf,(unsigned char *)s,3);
buf[3] = '\0';
unsigned long int l_phunit;
l_phunit = to_long_int_convertor1(buf);
l_phunit = l_phunit * 1e-5;
free(buf);
if(polar == '1') { // POLAR
fp_magnitude = f_r*l_phunit;
} else // RECTANGULAR
{
fp_r = l_phunit *f_r;
fp_i = l_phunit *f_i;
fp_magnitude = sqrt(fp_i*fp_i + fp_r*fp_r);
}
}
return fp_magnitude;
}
*/
/* ---------------------------------------------------------------------------- */
/* FUNCTION outOfStepDetection(): */
/* angle deviations */
/* ---------------------------------------------------------------------------- */
/*float outOfStepDetection(struct data_frame *df) {
//struct data_frame *df = TSB[index].first_data_frame;
struct cfg_frame *temp_cfg = cfgfirst;
int i,j,noOfPMUs,totalPMUs;
totalPMUs = i = j = 0;
while(temp_cfg != NULL){
totalPMUs += to_intconvertor(temp_cfg->num_pmu);
temp_cfg = temp_cfg->cfgnext;
}
int generatorPMUs = (totalPMUs*ratio);
if(generatorPMUs%2 == 1)
generatorPMUs +=1;
temp_cfg = cfgfirst;
if(OOSTD == '0') {
delta = malloc((generatorPMUs+1)*sizeof(float));
if(delta == NULL)
printf("no memory for delta\n");
slipFreuency = malloc((generatorPMUs+1)*sizeof(float));
if(slipFreuency == NULL)
printf("no memory for slipFreuency\n");
OOSTD = '1';
}
unsigned int phnmr;
char polar;
float phasorAngle = 0;
unsigned char *d;
int x = 0;
unsigned char *fp_left,*fp_right,*fx_left,*fx_right,*phasorType;
fp_left = malloc(5*sizeof(unsigned char));
fp_right = malloc(5*sizeof(unsigned char));
fx_left = malloc(3*sizeof(unsigned char));
fx_right = malloc(3*sizeof(unsigned char));
phasorType = malloc(1*sizeof(unsigned char));
int pType;
while(temp_cfg != NULL){ // Main Loop starts
if(df != NULL) {
noOfPMUs = to_intconvertor(temp_cfg->num_pmu);
for(j=0;j<noOfPMUs;j++) {
phnmr = to_intconvertor(temp_cfg->pmu[j]->phnmr);
if(phnmr != 0) {
if(temp_cfg->pmu[j]->fmt->phasor == 1) { // Floating
for(i = 0;i<phnmr;i++) {
copy_cbyc (phasorType,(unsigned char *)temp_cfg->pmu[j]->phunit[i],1);
pType = to_intconvertor1(phasorType);
if((pType == 0) && (i%3 == 0)) {
d = df->dpmu[j]->phasors[i];
polar = temp_cfg->pmu[j]->fmt->polar;
phasorAngle = getVoltagePhasorAngle(1,fp_left,fp_right,d,polar,temp_cfg,i,j); // 1 -> floating pt
}
}
x++;
if(x == generatorPMUs)
break;
} else { // fixed point
for(i = 0;i < phnmr; i++){
copy_cbyc (phasorType,(unsigned char *)temp_cfg->pmu[j]->phunit[i],1);
pType = to_intconvertor1(phasorType);
if((pType == 0) && (i%3 == 0)) {
d = df->dpmu[j]->phasors[i];
polar = temp_cfg->pmu[j]->fmt->polar;
phasorAngle = getVoltagePhasorAngle(0,fp_left,fp_right,d,polar,temp_cfg,i,j); // 0 -> fixed pt
}
}
x++;
if(x == generatorPMUs)
break;
}
}
}
df = df->dnext;
}
temp_cfg = temp_cfg->cfgnext;
} // Main loop ends
free(fp_right);
free(fp_left);
free(fx_right);
free(fx_left);
return 0;
}*/

47
resources/applications.h

@ -0,0 +1,47 @@
/* -----------------------------------------------------------------------------
* applications.h
*
* iPDC - Phasor Data Concentrator
*
* Copyright (C) 2011-2012 Nitesh Pandit
* Copyright (C) 2011-2012 Kedar V. Khandeparkar
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Authors:
* Kedar V. Khandeparkar <kedar.khandeparkar@gmail.com>
*
* ----------------------------------------------------------------------------- */
int minHi = 3,maxHi = 5;
int minPi = 100,maxPi = 500;
float fc = 0;
float delFThreshold = 0.3;
int angleThreshold = 20;
float ratio = 1/5;
float *delta,*slipFreuency;
char OOSTD = '0';
//delta = 0;
//slipFreuency = 0;
float averageFrequency(struct data_frame *df);
int frequencyInstability(struct data_frame *df);
int angleInstability(struct data_frame *df);
float voltagePhasorAggregation(struct data_frame *df);
float outOfStepDetection(struct data_frame *df);
int * randomGenerator(int max,int min,int num);
float getVoltagePhasorAngle(int format,char left[],char right[],unsigned char *d,char polar,struct cfg_frame *temp_cfg,int i,int j);
float getPhasorVolageMagnitude(int format,char left[],char right[],unsigned char *d,char polar,struct cfg_frame *temp_cfg,int i,int j);

769
test-examples/examples/Makefile

@ -0,0 +1,769 @@
# Makefile.in generated by automake 1.16.5 from Makefile.am.
# examples/Makefile. Generated from Makefile.in by configure.
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/osm-gps-map
pkgincludedir = $(includedir)/osm-gps-map
pkglibdir = $(libdir)/osm-gps-map
pkglibexecdir = $(libexecdir)/osm-gps-map
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = x86_64-pc-linux-gnu
host_triplet = x86_64-pc-linux-gnu
noinst_PROGRAMS = mapviewer$(EXEEXT) polygon$(EXEEXT) \
editable_track$(EXEEXT)
subdir = examples
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/ax_is_release.m4 \
$(top_srcdir)/m4/ax_require_defined.m4 \
$(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/introspection.m4 \
$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
PROGRAMS = $(noinst_PROGRAMS)
am_editable_track_OBJECTS = editable_track-editable_track.$(OBJEXT)
editable_track_OBJECTS = $(am_editable_track_OBJECTS)
am__DEPENDENCIES_1 =
am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
editable_track_DEPENDENCIES = $(am__DEPENDENCIES_2) \
$(am__DEPENDENCIES_1) $(top_builddir)/src/libosmgpsmap-1.0.la
AM_V_lt = $(am__v_lt_$(V))
am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
am__v_lt_0 = --silent
am__v_lt_1 =
editable_track_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
$(editable_track_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o \
$@
am_mapviewer_OBJECTS = mapviewer-mapviewer.$(OBJEXT)
mapviewer_OBJECTS = $(am_mapviewer_OBJECTS)
mapviewer_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \
$(top_builddir)/src/libosmgpsmap-1.0.la
mapviewer_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(mapviewer_CFLAGS) \
$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
am_polygon_OBJECTS = polygon-polygon.$(OBJEXT)
polygon_OBJECTS = $(am_polygon_OBJECTS)
polygon_DEPENDENCIES = $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \
$(top_builddir)/src/libosmgpsmap-1.0.la
polygon_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(polygon_CFLAGS) \
$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_P = $(am__v_P_$(V))
am__v_P_ = $(am__v_P_$(AM_DEFAULT_VERBOSITY))
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_$(V))
am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_$(V))
am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
am__v_at_0 = @
am__v_at_1 =
DEFAULT_INCLUDES = -I. -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__maybe_remake_depfiles = depfiles
am__depfiles_remade = ./$(DEPDIR)/editable_track-editable_track.Po \
./$(DEPDIR)/mapviewer-mapviewer.Po \
./$(DEPDIR)/polygon-polygon.Po
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_$(V))
am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY))
am__v_CC_0 = @echo " CC " $@;
am__v_CC_1 =
CCLD = $(CC)
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_$(V))
am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY))
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
SOURCES = $(editable_track_SOURCES) $(mapviewer_SOURCES) \
$(polygon_SOURCES)
DIST_SOURCES = $(editable_track_SOURCES) $(mapviewer_SOURCES) \
$(polygon_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp README
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = ${SHELL} '/home/chasingcar/dev/osm-gps-map/missing' aclocal-1.16
AMTAR = $${TAR-tar}
AM_DEFAULT_VERBOSITY = 0
AR = ar
AS = as
AUTOCONF = ${SHELL} '/home/chasingcar/dev/osm-gps-map/missing' autoconf
AUTOHEADER = ${SHELL} '/home/chasingcar/dev/osm-gps-map/missing' autoheader
AUTOMAKE = ${SHELL} '/home/chasingcar/dev/osm-gps-map/missing' automake-1.16
AWK = mawk
CAIRO_CFLAGS = -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16
CAIRO_LIBS = -lcairo
CC = gcc
CCDEPMODE = depmode=gcc3
CFLAGS = -g -O2
CPPFLAGS =
CSCOPE = cscope
CTAGS = ctags
CYGPATH_W = echo
DEFS = -DHAVE_CONFIG_H
DEPDIR = .deps
DLLTOOL = dlltool
DSYMUTIL =
DUMPBIN =
ECHO_C =
ECHO_N = -n
ECHO_T =
EGREP = /usr/bin/grep -E
ETAGS = etags
EXEEXT =
FGREP = /usr/bin/grep -F
GLIB_CFLAGS = -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include
GLIB_LIBS = -lglib-2.0
GREP = /usr/bin/grep
GTHREAD_CFLAGS = -pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include
GTHREAD_LIBS = -lgthread-2.0 -pthread -lglib-2.0
GTKDOC_CHECK = gtkdoc-check.test
GTKDOC_CHECK_PATH = /usr/bin/gtkdoc-check
GTKDOC_DEPS_CFLAGS = -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include
GTKDOC_DEPS_LIBS = -lgobject-2.0 -lglib-2.0
GTKDOC_MKPDF = /usr/bin/gtkdoc-mkpdf
GTKDOC_REBASE = /usr/bin/gtkdoc-rebase
GTK_CFLAGS = -pthread -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/harfbuzz -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/x86_64-linux-gnu -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include
GTK_LIBS = -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0
HTML_DIR = ${datadir}/gtk-doc/html
INSTALL = /usr/bin/install -c
INSTALL_DATA = ${INSTALL} -m 644
INSTALL_PROGRAM = ${INSTALL}
INSTALL_SCRIPT = ${INSTALL}
INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
INTROSPECTION_CFLAGS = -I/usr/include/gobject-introspection-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include
INTROSPECTION_COMPILER = /usr/bin/g-ir-compiler
INTROSPECTION_GENERATE = /usr/bin/g-ir-generate
INTROSPECTION_GIRDIR = /usr/local/share/gir-1.0
INTROSPECTION_LIBS = -lgirepository-1.0 -lgobject-2.0 -lglib-2.0
INTROSPECTION_MAKEFILE = /usr/share/gobject-introspection-1.0/Makefile.introspection
INTROSPECTION_SCANNER = /usr/bin/g-ir-scanner
INTROSPECTION_TYPELIBDIR = /usr/local/lib/girepository-1.0
LD = /usr/bin/ld -m elf_x86_64
LDFLAGS =
LIBOBJS =
LIBS =
LIBTOOL = $(SHELL) $(top_builddir)/libtool
LIPO =
LN_S = ln -s
LTLIBOBJS =
LT_SYS_LIBRARY_PATH =
LT_VERSION_INFO = 2:1:1
MAKEINFO = ${SHELL} '/home/chasingcar/dev/osm-gps-map/missing' makeinfo
MANIFEST_TOOL = :
MKDIR_P = /usr/bin/mkdir -p
NM = /usr/bin/nm -B
NMEDIT =
OBJDUMP = objdump
OBJEXT = o
OTOOL =
OTOOL64 =
PACKAGE = osm-gps-map
PACKAGE_BUGREPORT = http://github.com/nzjrs/osm-gps-map/issues
PACKAGE_NAME = osm-gps-map
PACKAGE_STRING = osm-gps-map 1.2.1
PACKAGE_TARNAME = osm-gps-map
PACKAGE_URL =
PACKAGE_VERSION = 1.2.1
PATH_SEPARATOR = :
PKG_CONFIG = /usr/bin/pkg-config
PKG_CONFIG_LIBDIR =
PKG_CONFIG_PATH =
RANLIB = ranlib
SED = /usr/bin/sed
SET_MAKE =
SHELL = /bin/bash
SOUP24_CFLAGS = -pthread -I/usr/include/libsoup-2.4 -I/usr/include/libxml2 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include
SOUP24_LIBS = -lsoup-2.4 -Wl,--export-dynamic -lgmodule-2.0 -pthread -lgio-2.0 -lgobject-2.0 -lglib-2.0
STRIP = strip
VERSION = 1.2.1
_GI_EXP_DATADIR = /usr/local/share
_GI_EXP_LIBDIR = /usr/local/lib
abs_builddir = /home/chasingcar/dev/osm-gps-map/examples
abs_srcdir = /home/chasingcar/dev/osm-gps-map/examples
abs_top_builddir = /home/chasingcar/dev/osm-gps-map
abs_top_srcdir = /home/chasingcar/dev/osm-gps-map
ac_ct_AR = ar
ac_ct_CC = gcc
ac_ct_DUMPBIN =
am__include = include
am__leading_dot = .
am__quote =
am__tar = $${TAR-tar} chof - "$$tardir"
am__untar = $${TAR-tar} xf -
bindir = ${exec_prefix}/bin
build = x86_64-pc-linux-gnu
build_alias =
build_cpu = x86_64
build_os = linux-gnu
build_vendor = pc
builddir = .
datadir = ${datarootdir}
datarootdir = ${prefix}/share
docdir = ${datarootdir}/doc/${PACKAGE_TARNAME}
dvidir = ${docdir}
exec_prefix = ${prefix}
host = x86_64-pc-linux-gnu
host_alias =
host_cpu = x86_64
host_os = linux-gnu
host_vendor = pc
htmldir = ${docdir}
includedir = ${prefix}/include
infodir = ${datarootdir}/info
install_sh = ${SHELL} /home/chasingcar/dev/osm-gps-map/install-sh
libdir = ${exec_prefix}/lib
libexecdir = ${exec_prefix}/libexec
localedir = ${datarootdir}/locale
localstatedir = ${prefix}/var
mandir = ${datarootdir}/man
mkdir_p = $(MKDIR_P)
oldincludedir = /usr/include
pdfdir = ${docdir}
prefix = /usr/local
program_transform_name = s,x,x,
psdir = ${docdir}
runstatedir = ${localstatedir}/run
sbindir = ${exec_prefix}/sbin
sharedstatedir = ${prefix}/com
srcdir = .
sysconfdir = ${prefix}/etc
target_alias =
top_build_prefix = ../
top_builddir = ..
top_srcdir = ..
OSMGPSMAP_CFLAGS = \
$(GLIB_CFLAGS) \
$(GTK_CFLAGS) \
$(CAIRO_CFLAGS) \
$(SOUP24_CFLAGS)
OSMGPSMAP_LIBS = \
$(GLIB_LIBS) \
$(GTK_LIBS) \
$(CAIRO_LIBS) \
$(SOUP24_LIBS)
mapviewer_SOURCES = \
mapviewer.c
mapviewer_CFLAGS = \
-I$(top_srcdir)/src \
$(WARN_CFLAGS) \
$(DISABLE_DEPRECATED) \
$(OSMGPSMAP_CFLAGS) \
$(GTHREAD_CFLAGS)
mapviewer_LDADD = \
$(OSMGPSMAP_LIBS) \
$(GTHREAD_LIBS) \
$(top_builddir)/src/libosmgpsmap-1.0.la
polygon_SOURCES = \
polygon.c
polygon_CFLAGS = \
-I$(top_srcdir)/src \
$(WARN_CFLAGS) \
$(DISABLE_DEPRECATED) \
$(OSMGPSMAP_CFLAGS) \
$(GTHREAD_CFLAGS)
polygon_LDADD = \
$(OSMGPSMAP_LIBS) \
$(GTHREAD_LIBS) \
$(top_builddir)/src/libosmgpsmap-1.0.la
editable_track_SOURCES = \
editable_track.c
editable_track_CFLAGS = \
-I$(top_srcdir)/src \
$(WARN_CFLAGS) \
$(DISABLE_DEPRECATED) \
$(OSMGPSMAP_CFLAGS) \
$(GTHREAD_CFLAGS)
editable_track_LDADD = \
$(OSMGPSMAP_LIBS) \
$(GTHREAD_LIBS) \
$(top_builddir)/src/libosmgpsmap-1.0.la
EXTRA_DIST = poi.png mapviewer.ui mapviewer.js README
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign examples/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign examples/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
clean-noinstPROGRAMS:
@list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
echo " rm -f" $$list; \
rm -f $$list || exit $$?; \
test -n "$(EXEEXT)" || exit 0; \
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
editable_track$(EXEEXT): $(editable_track_OBJECTS) $(editable_track_DEPENDENCIES) $(EXTRA_editable_track_DEPENDENCIES)
@rm -f editable_track$(EXEEXT)
$(AM_V_CCLD)$(editable_track_LINK) $(editable_track_OBJECTS) $(editable_track_LDADD) $(LIBS)
mapviewer$(EXEEXT): $(mapviewer_OBJECTS) $(mapviewer_DEPENDENCIES) $(EXTRA_mapviewer_DEPENDENCIES)
@rm -f mapviewer$(EXEEXT)
$(AM_V_CCLD)$(mapviewer_LINK) $(mapviewer_OBJECTS) $(mapviewer_LDADD) $(LIBS)
polygon$(EXEEXT): $(polygon_OBJECTS) $(polygon_DEPENDENCIES) $(EXTRA_polygon_DEPENDENCIES)
@rm -f polygon$(EXEEXT)
$(AM_V_CCLD)$(polygon_LINK) $(polygon_OBJECTS) $(polygon_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
include ./$(DEPDIR)/editable_track-editable_track.Po # am--include-marker
include ./$(DEPDIR)/mapviewer-mapviewer.Po # am--include-marker
include ./$(DEPDIR)/polygon-polygon.Po # am--include-marker
$(am__depfiles_remade):
@$(MKDIR_P) $(@D)
@echo '# dummy' >$@-t && $(am__mv) $@-t $@
am--depfiles: $(am__depfiles_remade)
.c.o:
$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
$(am__mv) $$depbase.Tpo $$depbase.Po
# $(AM_V_CC)source='$<' object='$@' libtool=no \
# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
# $(AM_V_CC_no)$(COMPILE) -c -o $@ $<
.c.obj:
$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
$(am__mv) $$depbase.Tpo $$depbase.Po
# $(AM_V_CC)source='$<' object='$@' libtool=no \
# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
# $(AM_V_CC_no)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.c.lo:
$(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
$(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
$(am__mv) $$depbase.Tpo $$depbase.Plo
# $(AM_V_CC)source='$<' object='$@' libtool=yes \
# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
# $(AM_V_CC_no)$(LTCOMPILE) -c -o $@ $<
editable_track-editable_track.o: editable_track.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(editable_track_CFLAGS) $(CFLAGS) -MT editable_track-editable_track.o -MD -MP -MF $(DEPDIR)/editable_track-editable_track.Tpo -c -o editable_track-editable_track.o `test -f 'editable_track.c' || echo '$(srcdir)/'`editable_track.c
$(AM_V_at)$(am__mv) $(DEPDIR)/editable_track-editable_track.Tpo $(DEPDIR)/editable_track-editable_track.Po
# $(AM_V_CC)source='editable_track.c' object='editable_track-editable_track.o' libtool=no \
# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
# $(AM_V_CC_no)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(editable_track_CFLAGS) $(CFLAGS) -c -o editable_track-editable_track.o `test -f 'editable_track.c' || echo '$(srcdir)/'`editable_track.c
editable_track-editable_track.obj: editable_track.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(editable_track_CFLAGS) $(CFLAGS) -MT editable_track-editable_track.obj -MD -MP -MF $(DEPDIR)/editable_track-editable_track.Tpo -c -o editable_track-editable_track.obj `if test -f 'editable_track.c'; then $(CYGPATH_W) 'editable_track.c'; else $(CYGPATH_W) '$(srcdir)/editable_track.c'; fi`
$(AM_V_at)$(am__mv) $(DEPDIR)/editable_track-editable_track.Tpo $(DEPDIR)/editable_track-editable_track.Po
# $(AM_V_CC)source='editable_track.c' object='editable_track-editable_track.obj' libtool=no \
# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
# $(AM_V_CC_no)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(editable_track_CFLAGS) $(CFLAGS) -c -o editable_track-editable_track.obj `if test -f 'editable_track.c'; then $(CYGPATH_W) 'editable_track.c'; else $(CYGPATH_W) '$(srcdir)/editable_track.c'; fi`
mapviewer-mapviewer.o: mapviewer.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mapviewer_CFLAGS) $(CFLAGS) -MT mapviewer-mapviewer.o -MD -MP -MF $(DEPDIR)/mapviewer-mapviewer.Tpo -c -o mapviewer-mapviewer.o `test -f 'mapviewer.c' || echo '$(srcdir)/'`mapviewer.c
$(AM_V_at)$(am__mv) $(DEPDIR)/mapviewer-mapviewer.Tpo $(DEPDIR)/mapviewer-mapviewer.Po
# $(AM_V_CC)source='mapviewer.c' object='mapviewer-mapviewer.o' libtool=no \
# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
# $(AM_V_CC_no)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mapviewer_CFLAGS) $(CFLAGS) -c -o mapviewer-mapviewer.o `test -f 'mapviewer.c' || echo '$(srcdir)/'`mapviewer.c
mapviewer-mapviewer.obj: mapviewer.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mapviewer_CFLAGS) $(CFLAGS) -MT mapviewer-mapviewer.obj -MD -MP -MF $(DEPDIR)/mapviewer-mapviewer.Tpo -c -o mapviewer-mapviewer.obj `if test -f 'mapviewer.c'; then $(CYGPATH_W) 'mapviewer.c'; else $(CYGPATH_W) '$(srcdir)/mapviewer.c'; fi`
$(AM_V_at)$(am__mv) $(DEPDIR)/mapviewer-mapviewer.Tpo $(DEPDIR)/mapviewer-mapviewer.Po
# $(AM_V_CC)source='mapviewer.c' object='mapviewer-mapviewer.obj' libtool=no \
# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
# $(AM_V_CC_no)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mapviewer_CFLAGS) $(CFLAGS) -c -o mapviewer-mapviewer.obj `if test -f 'mapviewer.c'; then $(CYGPATH_W) 'mapviewer.c'; else $(CYGPATH_W) '$(srcdir)/mapviewer.c'; fi`
polygon-polygon.o: polygon.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(polygon_CFLAGS) $(CFLAGS) -MT polygon-polygon.o -MD -MP -MF $(DEPDIR)/polygon-polygon.Tpo -c -o polygon-polygon.o `test -f 'polygon.c' || echo '$(srcdir)/'`polygon.c
$(AM_V_at)$(am__mv) $(DEPDIR)/polygon-polygon.Tpo $(DEPDIR)/polygon-polygon.Po
# $(AM_V_CC)source='polygon.c' object='polygon-polygon.o' libtool=no \
# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
# $(AM_V_CC_no)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(polygon_CFLAGS) $(CFLAGS) -c -o polygon-polygon.o `test -f 'polygon.c' || echo '$(srcdir)/'`polygon.c
polygon-polygon.obj: polygon.c
$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(polygon_CFLAGS) $(CFLAGS) -MT polygon-polygon.obj -MD -MP -MF $(DEPDIR)/polygon-polygon.Tpo -c -o polygon-polygon.obj `if test -f 'polygon.c'; then $(CYGPATH_W) 'polygon.c'; else $(CYGPATH_W) '$(srcdir)/polygon.c'; fi`
$(AM_V_at)$(am__mv) $(DEPDIR)/polygon-polygon.Tpo $(DEPDIR)/polygon-polygon.Po
# $(AM_V_CC)source='polygon.c' object='polygon-polygon.obj' libtool=no \
# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \
# $(AM_V_CC_no)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(polygon_CFLAGS) $(CFLAGS) -c -o polygon-polygon.obj `if test -f 'polygon.c'; then $(CYGPATH_W) 'polygon.c'; else $(CYGPATH_W) '$(srcdir)/polygon.c'; fi`
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-am
TAGS: tags
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: ctags-am
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscopelist: cscopelist-am
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) distdir-am
distdir-am: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS)
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
mostlyclean-am
distclean: distclean-am
-rm -f ./$(DEPDIR)/editable_track-editable_track.Po
-rm -f ./$(DEPDIR)/mapviewer-mapviewer.Po
-rm -f ./$(DEPDIR)/polygon-polygon.Po
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f ./$(DEPDIR)/editable_track-editable_track.Po
-rm -f ./$(DEPDIR)/mapviewer-mapviewer.Po
-rm -f ./$(DEPDIR)/polygon-polygon.Po
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am:
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
clean-generic clean-libtool clean-noinstPROGRAMS cscopelist-am \
ctags ctags-am distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags tags-am uninstall uninstall-am
.PRECIOUS: Makefile
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

17
test-examples/examples/README

@ -0,0 +1,17 @@
osm-gps-map example applications
* ./mapviewer
C based demo app with many options. See '--help' for a list. Note, this
must be executed from the examples directory so it can find the mapviewer.ui
file.
* ./polygon
This example demonstrates editable polygons. Vertex points can be dragged.
Clicking mid-points divides the line and creates another vertex.
* ./mapviewer.py
Python version of the C demo app, with examples showing how to do custom
layers.
* ./mapviewer.js
Javascript example using seed + gobject-introspection. If running uninstalled,
you probbably need to tell GObject introspection where to find the
bindings. Do the following from the example directory
# export LD_LIBRARY_PATH=../src/.libs/
# export GI_TYPELIB_PATH=../src/

42
test-examples/examples/editable_track.c

@ -0,0 +1,42 @@
#include <gtk/gtk.h>
#include "osm-gps-map.h"
int
main (int argc,
char *argv[])
{
OsmGpsMap *map;
GtkWidget *window;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Window");
g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
map = g_object_new (OSM_TYPE_GPS_MAP, NULL);
gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(map));
OsmGpsMapTrack* track = osm_gps_map_track_new();
OsmGpsMapPoint* p1, *p2;
p1 = osm_gps_map_point_new_radians(1.25663706, -0.488692191);
p2 = osm_gps_map_point_new_radians(1.06465084, -0.750491578);
osm_gps_map_track_add_point(track, p1);
osm_gps_map_track_add_point(track, p2);
g_object_set(track, "editable", TRUE, NULL);
osm_gps_map_track_add(map, track);
gtk_widget_show (GTK_WIDGET(map));
gtk_widget_show (window);
gtk_main ();
return 0;
}

7
test-examples/examples/env.sh

@ -0,0 +1,7 @@
#!/bin/sh
export LD_LIBRARY_PATH=../src/.libs/
export GI_TYPELIB_PATH=$GI_TYPELIB_PATH:../src/
export PYTHONPATH=../python/
$1

450
test-examples/examples/mapviewer.c

@ -0,0 +1,450 @@
/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 4 -*- */
/* vim:set et sw=4 ts=4 cino=t0,(0: */
/*
* main.c
* Copyright (C) John Stowers 2008 <john.stowers@gmail.com>
*
* This is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License
* as published by the Free Software Foundation; version 2.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include <stdlib.h>
#include <math.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include "osm-gps-map.h"
static OsmGpsMapSource_t opt_map_provider = OSM_GPS_MAP_SOURCE_OPENSTREETMAP;
static gboolean opt_friendly_cache = FALSE;
static gboolean opt_no_cache = FALSE;
static char *opt_cache_base_dir = NULL;
static gboolean opt_editable_tracks = FALSE;
static GOptionEntry entries[] =
{
{"friendly-cache", 'f', 0, G_OPTION_ARG_NONE, &opt_friendly_cache, "Store maps using friendly cache style (source name)", NULL},
{"no-cache", 'n', 0, G_OPTION_ARG_NONE, &opt_no_cache, "Disable cache", NULL},
{"cache-basedir", 'b', 0, G_OPTION_ARG_FILENAME, &opt_cache_base_dir, "Cache basedir", NULL},
{"map", 'm', 0, G_OPTION_ARG_INT, &opt_map_provider, "Map source", "N"},
{"editable-tracks", 'e', 0, G_OPTION_ARG_NONE, &opt_editable_tracks, "Make the tracks editable", NULL},
{NULL}};
#if !GTK_CHECK_VERSION(3, 22, 0)
// use --gtk-debug=updates instead on newer GTK
static gboolean opt_debug = FALSE;
static GOptionEntry debug_entries[] =
{
{"debug", 'd', 0, G_OPTION_ARG_NONE, &opt_debug, "Enable debugging", NULL},
{NULL}};
#endif
static GdkPixbuf *g_star_image = NULL;
static OsmGpsMapImage *g_last_image = NULL;
static gboolean
on_button_press_event(GtkWidget *widget, GdkEventButton *event, gpointer user_data)
{
OsmGpsMapPoint coord;
float lat, lon;
OsmGpsMap *map = OSM_GPS_MAP(widget);
OsmGpsMapTrack *othertrack = OSM_GPS_MAP_TRACK(user_data);
int left_button = (event->button == 1) && (event->state == 0);
int middle_button = (event->button == 2) || ((event->button == 1) && (event->state & GDK_SHIFT_MASK));
int right_button = (event->button == 3) || ((event->button == 1) && (event->state & GDK_CONTROL_MASK));
osm_gps_map_convert_screen_to_geographic(map, event->x, event->y, &coord);
osm_gps_map_point_get_degrees(&coord, &lat, &lon);
if (event->type == GDK_3BUTTON_PRESS)
{
if (middle_button)
{
if (g_last_image)
osm_gps_map_image_remove(map, g_last_image);
}
if (right_button)
{
osm_gps_map_track_remove(map, othertrack);
}
}
else if (event->type == GDK_2BUTTON_PRESS)
{
if (left_button)
{
osm_gps_map_gps_add(map,
lat,
lon,
g_random_double_range(0, 360));
}
if (middle_button)
{
g_last_image = osm_gps_map_image_add(map,
lat,
lon,
g_star_image);
}
if (right_button)
{
osm_gps_map_track_add_point(othertrack, &coord);
}
}
return FALSE;
}
static gboolean
on_map_changed_event(GtkWidget *widget, gpointer user_data)
{
float lat, lon;
GtkEntry *entry = GTK_ENTRY(user_data);
OsmGpsMap *map = OSM_GPS_MAP(widget);
g_object_get(map, "latitude", &lat, "longitude", &lon, NULL);
gchar *msg = g_strdup_printf("Map Centre: lattitude %f longitude %f", lat, lon);
gtk_entry_set_text(entry, msg);
g_free(msg);
return FALSE;
}
static gboolean
on_zoom_in_clicked_event(GtkWidget *widget, gpointer user_data)
{
int zoom;
OsmGpsMap *map = OSM_GPS_MAP(user_data);
g_object_get(map, "zoom", &zoom, NULL);
osm_gps_map_set_zoom(map, zoom + 1);
return FALSE;
}
static gboolean
on_zoom_out_clicked_event(GtkWidget *widget, gpointer user_data)
{
int zoom;
OsmGpsMap *map = OSM_GPS_MAP(user_data);
g_object_get(map, "zoom", &zoom, NULL);
osm_gps_map_set_zoom(map, zoom - 1);
return FALSE;
}
static gboolean
on_home_clicked_event(GtkWidget *widget, gpointer user_data)
{
OsmGpsMap *map = OSM_GPS_MAP(user_data);
osm_gps_map_set_center_and_zoom(map, -43.5326, 172.6362, 12);
return FALSE;
}
static gboolean
on_cache_clicked_event(GtkWidget *widget, gpointer user_data)
{
OsmGpsMap *map = OSM_GPS_MAP(user_data);
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
{
int zoom, max_zoom;
OsmGpsMapPoint pt1, pt2;
osm_gps_map_get_bbox(map, &pt1, &pt2);
g_object_get(map, "zoom", &zoom, "max-zoom", &max_zoom, NULL);
osm_gps_map_download_maps(map, &pt1, &pt2, zoom, max_zoom);
}
else
{
osm_gps_map_download_cancel_all(map);
}
return FALSE;
}
static void
on_tiles_queued_changed(OsmGpsMap *image, GParamSpec *pspec, gpointer user_data)
{
gchar *s;
int tiles;
GtkLabel *label = GTK_LABEL(user_data);
g_object_get(image, "tiles-queued", &tiles, NULL);
s = g_strdup_printf("%d", tiles);
gtk_label_set_text(label, s);
g_free(s);
}
static void
on_gps_alpha_changed(GtkAdjustment *adjustment, gpointer user_data)
{
OsmGpsMap *map = OSM_GPS_MAP(user_data);
OsmGpsMapTrack *track = osm_gps_map_gps_get_track(map);
float f = gtk_adjustment_get_value(adjustment);
g_object_set(track, "alpha", f, NULL);
}
static void
on_gps_width_changed(GtkAdjustment *adjustment, gpointer user_data)
{
OsmGpsMap *map = OSM_GPS_MAP(user_data);
OsmGpsMapTrack *track = osm_gps_map_gps_get_track(map);
float f = gtk_adjustment_get_value(adjustment);
g_object_set(track, "line-width", f, NULL);
}
static void
on_star_align_changed(GtkAdjustment *adjustment, gpointer user_data)
{
const char *propname = user_data;
float f = gtk_adjustment_get_value(adjustment);
if (g_last_image)
g_object_set(g_last_image, propname, f, NULL);
}
#if GTK_CHECK_VERSION(3, 4, 0)
static void
on_gps_color_changed(GtkColorChooser *widget, gpointer user_data)
{
GdkRGBA c;
OsmGpsMapTrack *track = OSM_GPS_MAP_TRACK(user_data);
gtk_color_chooser_get_rgba(widget, &c);
osm_gps_map_track_set_color(track, &c);
}
#else
static void
on_gps_color_changed(GtkColorButton *widget, gpointer user_data)
{
GdkRGBA c;
OsmGpsMapTrack *track = OSM_GPS_MAP_TRACK(user_data);
gtk_color_button_get_rgba(widget, &c);
osm_gps_map_track_set_color(track, &c);
}
#endif
static void
on_close(GtkWidget *widget, gpointer user_data)
{
gtk_widget_destroy(widget);
gtk_main_quit();
}
static void
usage(GOptionContext *context)
{
int i;
puts(g_option_context_get_help(context, TRUE, NULL));
printf("Valid map sources:\n");
for (i = OSM_GPS_MAP_SOURCE_NULL; i <= OSM_GPS_MAP_SOURCE_LAST; i++)
{
const char *name = osm_gps_map_source_get_friendly_name(i);
const char *uri = osm_gps_map_source_get_repo_uri(i);
if (uri != NULL)
printf("\t%d:\t%s\n", i, name);
}
}
int main(int argc, char **argv)
{
GtkBuilder *builder;
GtkWidget *widget;
GtkAccelGroup *ag;
OsmGpsMap *map;
OsmGpsMapLayer *osd;
OsmGpsMapTrack *rightclicktrack;
const char *repo_uri;
char *cachedir, *cachebasedir;
GError *error = NULL;
GOptionContext *context;
gtk_init(&argc, &argv);
context = g_option_context_new("- Map browser");
g_option_context_set_help_enabled(context, FALSE);
g_option_context_add_main_entries(context, entries, NULL);
#if !GTK_CHECK_VERSION(3, 22, 0)
g_option_context_add_main_entries(context, debug_entries, NULL);
#endif
if (!g_option_context_parse(context, &argc, &argv, &error))
{
usage(context);
return 1;
}
/* Only use the repo_uri to check if the user has supplied a
valid map source ID */
repo_uri = osm_gps_map_source_get_repo_uri(opt_map_provider);
if (repo_uri == NULL)
{
usage(context);
return 2;
}
cachebasedir = osm_gps_map_get_default_cache_directory();
if (opt_cache_base_dir && g_file_test(opt_cache_base_dir, G_FILE_TEST_IS_DIR))
{
cachedir = g_strdup(OSM_GPS_MAP_CACHE_AUTO);
cachebasedir = g_strdup(opt_cache_base_dir);
}
else if (opt_friendly_cache)
{
cachedir = g_strdup(OSM_GPS_MAP_CACHE_FRIENDLY);
}
else if (opt_no_cache)
{
cachedir = g_strdup(OSM_GPS_MAP_CACHE_DISABLED);
}
else
{
cachedir = g_strdup(OSM_GPS_MAP_CACHE_AUTO);
}
#if !GTK_CHECK_VERSION(3, 22, 0)
// use --gtk-debug=updates on newer gtk
if (opt_debug)
gdk_window_set_debug_updates(TRUE);
#endif
printf("Map Cache Dir: %s", cachedir);
printf("Map Provider: %s (%d)", osm_gps_map_source_get_friendly_name(opt_map_provider), opt_map_provider);
map = g_object_new(OSM_TYPE_GPS_MAP,
"map-source", opt_map_provider,
"tile-cache", cachedir,
"tile-cache-base", cachebasedir,
"proxy-uri", g_getenv("http_proxy"),
"user-agent", "mapviewer.c", // Always set user-agent, for better tile-usage compliance
NULL);
osd = g_object_new(OSM_TYPE_GPS_MAP_OSD,
"show-scale", TRUE,
"show-coordinates", TRUE,
"show-crosshair", TRUE,
"show-dpad", TRUE,
"show-zoom", TRUE,
"show-gps-in-dpad", TRUE,
"show-gps-in-zoom", FALSE,
"dpad-radius", 30,
NULL);
osm_gps_map_layer_add(OSM_GPS_MAP(map), osd);
g_object_unref(G_OBJECT(osd));
// Add a second track for right clicks
rightclicktrack = osm_gps_map_track_new();
if (opt_editable_tracks)
g_object_set(rightclicktrack, "editable", TRUE, NULL);
osm_gps_map_track_add(OSM_GPS_MAP(map), rightclicktrack);
g_free(cachedir);
g_free(cachebasedir);
// Enable keyboard navigation
osm_gps_map_set_keyboard_shortcut(map, OSM_GPS_MAP_KEY_FULLSCREEN, GDK_KEY_F11);
osm_gps_map_set_keyboard_shortcut(map, OSM_GPS_MAP_KEY_UP, GDK_KEY_Up);
osm_gps_map_set_keyboard_shortcut(map, OSM_GPS_MAP_KEY_DOWN, GDK_KEY_Down);
osm_gps_map_set_keyboard_shortcut(map, OSM_GPS_MAP_KEY_LEFT, GDK_KEY_Left);
osm_gps_map_set_keyboard_shortcut(map, OSM_GPS_MAP_KEY_RIGHT, GDK_KEY_Right);
// Build the UI
g_star_image = gdk_pixbuf_new_from_file_at_size("poi.png", 24, 24, NULL);
builder = gtk_builder_new();
gtk_builder_add_from_file(builder, "mapviewer.ui", &error);
if (error)
g_error("ERROR: %s\n", error->message);
gtk_box_pack_start(
GTK_BOX(gtk_builder_get_object(builder, "map_box")),
GTK_WIDGET(map), TRUE, TRUE, 0);
// Init values
float lw, a;
GdkRGBA c;
OsmGpsMapTrack *gpstrack = osm_gps_map_gps_get_track(map);
g_object_get(gpstrack, "line-width", &lw, "alpha", &a, NULL);
osm_gps_map_track_get_color(gpstrack, &c);
gtk_adjustment_set_value(
GTK_ADJUSTMENT(gtk_builder_get_object(builder, "gps_width_adjustment")),
lw);
gtk_adjustment_set_value(
GTK_ADJUSTMENT(gtk_builder_get_object(builder, "gps_alpha_adjustment")),
a);
gtk_adjustment_set_value(
GTK_ADJUSTMENT(gtk_builder_get_object(builder, "star_xalign_adjustment")),
0.5);
gtk_adjustment_set_value(
GTK_ADJUSTMENT(gtk_builder_get_object(builder, "star_yalign_adjustment")),
0.5);
#if GTK_CHECK_VERSION(3, 4, 0)
gtk_color_chooser_set_rgba(
GTK_COLOR_CHOOSER(gtk_builder_get_object(builder, "gps_colorbutton")),
&c);
#else
gtk_color_button_set_rgba(
GTK_COLOR_BUTTON(gtk_builder_get_object(builder, "gps_colorbutton")),
&c);
#endif
// Connect to signals
g_signal_connect(
gtk_builder_get_object(builder, "gps_colorbutton"), "color-set",
G_CALLBACK(on_gps_color_changed), (gpointer)gpstrack);
g_signal_connect(
gtk_builder_get_object(builder, "zoom_in_button"), "clicked",
G_CALLBACK(on_zoom_in_clicked_event), (gpointer)map);
g_signal_connect(
gtk_builder_get_object(builder, "zoom_out_button"), "clicked",
G_CALLBACK(on_zoom_out_clicked_event), (gpointer)map);
g_signal_connect(
gtk_builder_get_object(builder, "home_button"), "clicked",
G_CALLBACK(on_home_clicked_event), (gpointer)map);
g_signal_connect(
gtk_builder_get_object(builder, "cache_button"), "clicked",
G_CALLBACK(on_cache_clicked_event), (gpointer)map);
g_signal_connect(
gtk_builder_get_object(builder, "gps_alpha_adjustment"), "value-changed",
G_CALLBACK(on_gps_alpha_changed), (gpointer)map);
g_signal_connect(
gtk_builder_get_object(builder, "gps_width_adjustment"), "value-changed",
G_CALLBACK(on_gps_width_changed), (gpointer)map);
g_signal_connect(
gtk_builder_get_object(builder, "star_xalign_adjustment"), "value-changed",
G_CALLBACK(on_star_align_changed), (gpointer) "x-align");
g_signal_connect(
gtk_builder_get_object(builder, "star_yalign_adjustment"), "value-changed",
G_CALLBACK(on_star_align_changed), (gpointer) "y-align");
g_signal_connect(G_OBJECT(map), "button-press-event",
G_CALLBACK(on_button_press_event), (gpointer)rightclicktrack);
g_signal_connect(G_OBJECT(map), "changed",
G_CALLBACK(on_map_changed_event),
(gpointer)gtk_builder_get_object(builder, "text_entry"));
g_signal_connect(G_OBJECT(map), "notify::tiles-queued",
G_CALLBACK(on_tiles_queued_changed),
(gpointer)gtk_builder_get_object(builder, "cache_label"));
widget = GTK_WIDGET(gtk_builder_get_object(builder, "window1"));
g_signal_connect(widget, "destroy",
G_CALLBACK(on_close), (gpointer)map);
// Setup accelerators.
ag = gtk_accel_group_new();
gtk_accel_group_connect(ag, GDK_KEY_w, GDK_CONTROL_MASK, GTK_ACCEL_MASK,
g_cclosure_new(gtk_main_quit, NULL, NULL));
gtk_accel_group_connect(ag, GDK_KEY_q, GDK_CONTROL_MASK, GTK_ACCEL_MASK,
g_cclosure_new(gtk_main_quit, NULL, NULL));
gtk_window_add_accel_group(GTK_WINDOW(widget), ag);
gtk_widget_show_all(widget);
g_log_set_handler("OsmGpsMap", G_LOG_LEVEL_MASK, g_log_default_handler, NULL);
gtk_main();
return 0;
}

34
test-examples/examples/mapviewer.js

@ -0,0 +1,34 @@
#!/usr/bin/seed
// You probbably need to tell GObject introspection where to find the bindings
// export LD_LIBRARY_PATH=../src/.libs/
// export GI_TYPELIB_PATH=../src/
const Gtk = imports.gi.Gtk;
const Osm = imports.gi.OsmGpsMap;
Gtk.init(0, null);
var win = new Gtk.Window({ type: Gtk.WindowType.TOPLEVEL });
win.set_border_width(10);
win.set_default_size(400,400);
// ARRRGGGHHHHH GNOME
if (0)
// GJS makes me do this
win.connect("delete-event", Gtk.main_quit);
else
// Seed makes me do this
win.signal.delete_event.connect(Gtk.main_quit);
var map = new Osm.OsmGpsMap()
var osd = new Osm.Osd()
map.layer_add(osd)
win.add(map);
win.show_all();
Gtk.main();

299
test-examples/examples/mapviewer.py

@ -0,0 +1,299 @@
#!/usr/bin/env python3
"""
Copyright (C) Hadley Rich 2008 <hads@nice.net.nz>
based on main.c - with thanks to John Stowers
This is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>.
"""
import random
import gi
gi.require_version("Gdk", "3.0")
gi.require_version("Gtk", "3.0")
gi.require_version("OsmGpsMap", "1.0")
from gi.repository import (
Gdk,
GdkPixbuf,
GLib,
GObject,
Gtk,
OsmGpsMap as osmgpsmap,
) # noqa
print(f"using library: {osmgpsmap.__file__} (version {osmgpsmap._version})")
assert osmgpsmap._version == "1.0"
class DummyMapNoGpsPoint(osmgpsmap.Map):
def do_draw_gps_point(self, drawable):
pass
GObject.type_register(DummyMapNoGpsPoint)
class DummyLayer(GObject.GObject, osmgpsmap.MapLayer):
def __init__(self):
GObject.GObject.__init__(self)
def do_draw(self, gpsmap, gdkdrawable):
pass
def do_render(self, gpsmap):
pass
def do_busy(self):
return False
def do_button_press(self, gpsmap, gdkeventbutton):
return False
GObject.type_register(DummyLayer)
class UI(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self, type=Gtk.WindowType.TOPLEVEL)
self.set_default_size(500, 500)
self.connect("destroy", lambda x: Gtk.main_quit())
self.set_title("OpenStreetMap GPS Mapper")
self.vbox = Gtk.VBox(homogeneous=False, spacing=0)
self.add(self.vbox)
if 0:
self.osm = DummyMapNoGpsPoint()
else:
self.osm = osmgpsmap.Map()
self.osm.layer_add(
osmgpsmap.MapOsd(show_dpad=True,
show_zoom=True,
show_crosshair=True)
)
self.osm.set_property("map-source", osmgpsmap.MapSource_t.OPENSTREETMAP)
self.osm.layer_add(DummyLayer())
self.last_image = None
self.osm.connect("button_press_event", self.on_button_press)
self.osm.connect("changed", self.on_map_change)
# connect keyboard shortcuts
self.osm.set_keyboard_shortcut(
osmgpsmap.MapKey_t.FULLSCREEN, Gdk.keyval_from_name("F11")
)
self.osm.set_keyboard_shortcut(
osmgpsmap.MapKey_t.UP, Gdk.keyval_from_name("Up")
)
self.osm.set_keyboard_shortcut(
osmgpsmap.MapKey_t.DOWN, Gdk.keyval_from_name("Down")
)
self.osm.set_keyboard_shortcut(
osmgpsmap.MapKey_t.LEFT, Gdk.keyval_from_name("Left")
)
self.osm.set_keyboard_shortcut(
osmgpsmap.MapKey_t.RIGHT, Gdk.keyval_from_name("Right")
)
# connect to tooltip
self.osm.props.has_tooltip = True
self.osm.connect("query-tooltip", self.on_query_tooltip)
self.latlon_entry = Gtk.Entry()
zoom_in_button = Gtk.Button.new_from_icon_name("zoom-in",
Gtk.IconSize.BUTTON)
zoom_in_button.connect("clicked", self.zoom_in_clicked)
zoom_out_button = Gtk.Button.new_from_icon_name("zoom-out",
Gtk.IconSize.BUTTON)
zoom_out_button.connect("clicked", self.zoom_out_clicked)
home_button = Gtk.Button.new_from_icon_name("go-home",
Gtk.IconSize.BUTTON)
home_button.connect("clicked", self.home_clicked)
cache_button = Gtk.Button(label="Cache")
cache_button.connect("clicked", self.cache_clicked)
self.vbox.pack_start(self.osm, True, True, 0)
hbox = Gtk.HBox(homogeneous=False, spacing=0)
hbox.pack_start(zoom_in_button, False, True, 0)
hbox.pack_start(zoom_out_button, False, True, 0)
hbox.pack_start(home_button, False, True, 0)
hbox.pack_start(cache_button, False, True, 0)
# add ability to test custom map URIs
ex = Gtk.Expander(label="<b>Map Repository URI</b>")
ex.props.use_markup = True
vb = Gtk.VBox()
self.repouri_entry = Gtk.Entry()
self.repouri_entry.set_text(self.osm.props.repo_uri)
self.image_format_entry = Gtk.Entry()
self.image_format_entry.set_text(self.osm.props.image_format)
lbl = Gtk.Label(
label="""Enter an repository URL to fetch map tiles \
from in the box below. Special metacharacters may be included in this url
<i>Metacharacters:</i>
\t#X\tMax X location
\t#Y\tMax Y location
\t#Z\tMap zoom (0 = min zoom, fully zoomed out)
\t#S\tInverse zoom (max-zoom - #Z)
\t#Q\tQuadtree encoded tile (qrts)
\t#W\tQuadtree encoded tile (1234)
\t#U\tEncoding not implemeted
\t#R\tRandom integer, 0-4"""
)
lbl.props.xalign = 0
lbl.props.use_markup = True
lbl.props.wrap = True
ex.add(vb)
vb.pack_start(lbl, False, True, 0)
hb = Gtk.HBox()
hb.pack_start(Gtk.Label(label="URI: "), False, True, 0)
hb.pack_start(self.repouri_entry, True, True, 0)
vb.pack_start(hb, False, True, 0)
hb = Gtk.HBox()
hb.pack_start(Gtk.Label(label="Image Format: "), False, True, 0)
hb.pack_start(self.image_format_entry, True, True, 0)
vb.pack_start(hb, False, True, 0)
gobtn = Gtk.Button(label="Load Map URI")
gobtn.connect("clicked", self.load_map_clicked)
vb.pack_start(gobtn, False, True, 0)
self.show_tooltips = False
cb = Gtk.CheckButton(label="Show Location in Tooltips")
cb.props.active = self.show_tooltips
cb.connect("toggled", self.on_show_tooltips_toggled)
self.vbox.pack_end(cb, False, True, 0)
cb = Gtk.CheckButton(label="Disable Cache")
cb.props.active = False
cb.connect("toggled", self.disable_cache_toggled)
self.vbox.pack_end(cb, False, True, 0)
self.vbox.pack_end(ex, False, True, 0)
self.vbox.pack_end(self.latlon_entry, False, True, 0)
self.vbox.pack_end(hbox, False, True, 0)
GLib.timeout_add(500, self.print_tiles)
def disable_cache_toggled(self, btn):
if btn.props.active:
self.osm.props.tile_cache = osmgpsmap.MAP_CACHE_DISABLED
else:
self.osm.props.tile_cache = osmgpsmap.MAP_CACHE_AUTO
def on_show_tooltips_toggled(self, btn):
self.show_tooltips = btn.props.active
def load_map_clicked(self, button):
uri = self.repouri_entry.get_text()
format = self.image_format_entry.get_text()
if uri and format:
if self.osm:
# remove old map
self.vbox.remove(self.osm)
try:
self.osm = osmgpsmap.Map(repo_uri=uri, image_format=format)
except Exception as e:
print("ERROR:", e)
self.osm = osmgpsmap.Map()
self.vbox.pack_start(self.osm, True, True, 0)
self.osm.show()
def print_tiles(self):
if self.osm.props.tiles_queued != 0:
print(self.osm.props.tiles_queued, "tiles queued")
return True
def zoom_in_clicked(self, button):
self.osm.set_zoom(self.osm.props.zoom + 1)
def zoom_out_clicked(self, button):
self.osm.set_zoom(self.osm.props.zoom - 1)
def home_clicked(self, button):
self.osm.set_center_and_zoom(-44.39, 171.25, 12)
def on_query_tooltip(self, widget, x, y, keyboard_tip, tooltip, data=None):
if keyboard_tip:
return False
if self.show_tooltips:
p = osmgpsmap.point_new_degrees(0.0, 0.0)
self.osm.convert_screen_to_geographic(x, y, p)
lat, lon = p.get_degrees()
tooltip.set_markup(f"{lat:+.4f}, {lon:+.4f}")
return True
return False
def cache_clicked(self, button):
bbox = self.osm.get_bbox()
self.osm.download_maps(
*bbox,
zoom_start=self.osm.props.zoom,
zoom_end=self.osm.props.max_zoom
)
def on_map_change(self, osm):
self.latlon_entry.set_text(
f"Map Centre: latitude {self.osm.props.latitude} "
f"longitude {self.osm.props.longitude}"
)
def on_button_press(self, osm, event):
state = event.get_state()
lat, lon = self.osm.get_event_location(event).get_degrees()
left = event.button == 1 and state == 0
middle = event.button == 2 or (
event.button == 1 and state & Gdk.ModifierType.SHIFT_MASK
)
right = event.button == 3 or (
event.button == 1 and state & Gdk.ModifierType.CONTROL_MASK
)
# work around binding bug with invalid variable name
GDK_2BUTTON_PRESS = getattr(Gdk.EventType, "2BUTTON_PRESS")
GDK_3BUTTON_PRESS = getattr(Gdk.EventType, "3BUTTON_PRESS")
if event.type == GDK_3BUTTON_PRESS:
if middle:
if self.last_image is not None:
self.osm.image_remove(self.last_image)
self.last_image = None
elif event.type == GDK_2BUTTON_PRESS:
if left:
self.osm.gps_add(lat, lon, heading=random.random() * 360)
if middle:
pb = GdkPixbuf.Pixbuf.new_from_file_at_size("poi.png", 24, 24)
self.last_image = self.osm.image_add(lat, lon, pb)
if right:
pass
if __name__ == "__main__":
u = UI()
u.show_all()
Gtk.main()

BIN
test-examples/examples/poi.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

47
test-examples/examples/polygon.c

@ -0,0 +1,47 @@
#include <gtk/gtk.h>
#include "osm-gps-map.h"
int
main (int argc,
char *argv[])
{
OsmGpsMap *map;
OsmGpsMapPolygon* poly;
GtkWidget *window;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Window");
g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
map = g_object_new (OSM_TYPE_GPS_MAP, NULL);
gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(map));
poly = osm_gps_map_polygon_new();
OsmGpsMapTrack* polytrack = osm_gps_map_track_new();
OsmGpsMapPoint* p1, *p2, *p3;
p1 = osm_gps_map_point_new_radians(1.25663706, -0.488692191);
p2 = osm_gps_map_point_new_radians(1.06465084, -0.750491578);
p3 = osm_gps_map_point_new_radians(1.064650849, -0.191986218);
osm_gps_map_track_add_point(polytrack, p1);
osm_gps_map_track_add_point(polytrack, p2);
osm_gps_map_track_add_point(polytrack, p3);
g_object_set(poly, "track", polytrack, NULL);
g_object_set(poly, "editable", TRUE, NULL);
osm_gps_map_polygon_add(map, poly);
gtk_widget_show (GTK_WIDGET(map));
gtk_widget_show (window);
gtk_main ();
return 0;
}
Loading…
Cancel
Save