Browse Source

Merge remote-tracking branch 'origin/yigit' into efe

old
Efe Aydın 6 years ago
parent
commit
fd804091c9
48 changed files with 272458 additions and 609 deletions
  1. +1
    -8
      MyCity/app/src/main/java/gq/yigit/mycity/MainActivity.java
  2. +196
    -51
      MyCity/app/src/main/java/gq/yigit/mycity/MainFragment.java
  3. +0
    -109
      MyCity/app/src/main/java/gq/yigit/mycity/navigation/MapsFragment.java
  4. +13
    -8
      MyCity/app/src/main/java/gq/yigit/mycity/navigation/TransitFragment.java
  5. +1
    -1
      MyCity/app/src/main/java/gq/yigit/mycity/votesFragment/MyVotesRecyclerViewAdapter.java
  6. +36
    -0
      MyCity/app/src/main/res/drawable-v21/megaphone.xml
  7. +1
    -1
      MyCity/app/src/main/res/drawable/circle_shape.xml
  8. +7
    -0
      MyCity/app/src/main/res/layout/fragment_layout.xml
  9. +54
    -9
      MyCity/app/src/main/res/layout/fragment_main.xml
  10. +1
    -1
      MyCity/app/src/main/res/layout/fragment_votes_list.xml
  11. +3
    -4
      MyCity/app/src/main/res/layout/rate_spinner_layout.xml
  12. +2
    -1
      MyCity/app/src/main/res/layout/transit_item.xml
  13. +3
    -2
      MyCity/app/src/main/res/layout/votes_list_item.xml
  14. +0
    -4
      MyCity/app/src/main/res/menu/activity_main_drawer.xml
  15. +1
    -1
      MyCity/app/src/main/res/values/strings.xml
  16. +9
    -0
      bus_stop/bus_stop.iml
  17. +173
    -0
      bus_stop/main.py
  18. +4
    -0
      bus_stop/main.py.err.log
  19. +338
    -0
      bus_stop/times.json
  20. +55
    -0
      client_side/interface/UserData/denunciation_map.html
  21. +0
    -31
      client_side/interface/UserData/index.html
  22. +0
    -4
      client_side/interface/UserData/index.js
  23. +0
    -333
      client_side/interface/UserData/package-lock.json
  24. +49
    -0
      client_side/interface/UserData/qr_info.html
  25. +24
    -14
      client_side/modules/qr/user_data.py
  26. +1
    -0
      server_side/.gitignore
  27. +5
    -1
      server_side/api/app.py
  28. BIN
      server_side/api/images/muhtarlik.jpg
  29. BIN
      server_side/api/images/park.jpg
  30. BIN
      server_side/api/modules/__pycache__/announcements.cpython-37.pyc
  31. BIN
      server_side/api/modules/__pycache__/bus_stops.cpython-37.pyc
  32. BIN
      server_side/api/modules/__pycache__/navigation.cpython-37.pyc
  33. BIN
      server_side/api/modules/__pycache__/user_info.cpython-37.pyc
  34. +196
    -0
      server_side/api/modules/alternateSolution1.py
  35. +17
    -0
      server_side/api/modules/announcements.py
  36. +17
    -0
      server_side/api/modules/bus_stops.py
  37. +208390
    -0
      server_side/api/modules/data.json
  38. +10
    -0
      server_side/api/modules/databases/announcements.json
  39. +108
    -0
      server_side/api/modules/databases/bus.json
  40. +6
    -0
      server_side/api/modules/databases/bus_locations.json
  41. +2
    -2
      server_side/api/modules/databases/denunciations.json
  42. +1
    -1
      server_side/api/modules/databases/users.json
  43. +17
    -18
      server_side/api/modules/databases/votings.json
  44. +119
    -0
      server_side/api/modules/detectSpot.py
  45. +1
    -2
      server_side/api/modules/navigation.py
  46. +28
    -0
      server_side/api/modules/smart_parking.py
  47. +62568
    -0
      server_side/api/modules/timely.json
  48. +1
    -3
      server_side/api/modules/user_info.py

+ 1
- 8
MyCity/app/src/main/java/gq/yigit/mycity/MainActivity.java View File

@ -26,7 +26,6 @@ import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import gq.yigit.mycity.navigation.MapsFragment;
import gq.yigit.mycity.navigation.TransitFragment;
import gq.yigit.mycity.tools.*;
import gq.yigit.mycity.tools.WebRequest.responseListener;
@ -49,7 +48,6 @@ public class MainActivity extends AppCompatActivity
OnListFragmentInteractionListener,
MainFragment.OnFragmentInteractionListener,
RateFragment.OnFragmentInteractionListener,
MapsFragment.OnFragmentInteractionListener,
UtilityMain.OnFragmentInteractionListener,
TransitFragment.OnFragmentInteractionListener,
OnFragmentInteractionListener,
@ -176,12 +174,7 @@ public class MainActivity extends AppCompatActivity
fragmentTransaction.replace(R.id.app_bar_main, fragment);
fragmentTransaction.commit();
fragmentTransaction.addToBackStack(null);
} else if (id == R.id.navigation) {
MapsFragment fragment = new MapsFragment();
fragmentTransaction.replace(R.id.app_bar_main, fragment);
fragmentTransaction.commit();
fragmentTransaction.addToBackStack(null);
} else if (id == R.id.rating) {
} else if (id == R.id.rating) {
RateFragment fragment = new RateFragment();
fragmentTransaction.replace(R.id.app_bar_main, fragment);
fragmentTransaction.commit();


+ 196
- 51
MyCity/app/src/main/java/gq/yigit/mycity/MainFragment.java View File

@ -1,73 +1,85 @@
package gq.yigit.mycity;
import android.content.Context;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import gq.yigit.mycity.tools.FileActions;
import gq.yigit.mycity.tools.ImageDownload;
import gq.yigit.mycity.tools.WebRequest;
import gq.yigit.mycity.votesFragment.MyVotesRecyclerViewAdapter;
import gq.yigit.mycity.votesFragment.VotesContent;
import gq.yigit.mycity.votesFragment.VotesFragment;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* A simple {@link Fragment} subclass.
* Activities that contain this fragment must implement the
* {@link MainFragment.OnFragmentInteractionListener} interface
* to handle interaction events.
* Use the {@link MainFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class MainFragment extends Fragment {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;
private OnFragmentInteractionListener mListener;
public class MainFragment extends Fragment implements WebRequest.responseListener, ImageDownload.imageListener {
private TextView temp_text;
private TextView humi_text;
private TextView pres_text;
private ImageView weather_img;
private RecyclerView recyclerView;
private String key = "d6907927a2b9224a0b60d0565c207377";
private String url;
private OnFragmentInteractionListener mListener;
private OnRecyclerViewInteractionListener recyclerViewInteractionListener;
public MainFragment() {
// Required empty public constructor
}
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment MainFragment.
*/
// TODO: Rename and change types and number of parameters
}
public static MainFragment newInstance(String param1, String param2) {
MainFragment fragment = new MainFragment();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_main, container, false);
View rootView = inflater.inflate(R.layout.fragment_main, container, false);
temp_text = rootView.findViewById(R.id.temp_text);
humi_text = rootView.findViewById(R.id.humidity);
pres_text = rootView.findViewById(R.id.pressure);
weather_img = rootView.findViewById(R.id.forecast_img);
recyclerView = rootView.findViewById(R.id.anouncements);
HashMap<String,String> params = new HashMap<>();
params.put("q","Ankara,tr");
params.put("appid",key);
FileActions file_manager = new FileActions();
url = file_manager.readFromFile(getContext(),"server.config").trim();
WebRequest request = new WebRequest("https://api.openweathermap.org/data/2.5/weather",true,params,0);
request.addListener(this);
request.execute();
return rootView;
}
// TODO: Rename method, update argument and hook method into UI event
public void onButtonPressed(Uri uri) {
if (mListener != null) {
mListener.onFragmentInteraction(uri);
@ -91,18 +103,151 @@ public class MainFragment extends Fragment {
mListener = null;
}
/**
* This interface must be implemented by activities that contain this
* fragment to allow an interaction in this fragment to be communicated
* to the activity and potentially other fragments contained in that
* activity.
* <p>
* See the Android Training lesson <a href=
* "http://developer.android.com/training/basics/fragments/communicating.html"
* >Communicating with Other Fragments</a> for more information.
*/
public interface OnFragmentInteractionListener {
// TODO: Update argument type and name
void onFragmentInteraction(Uri uri);
}
@Override
public void receivedResponse(boolean success, String response,int id){
if(id == 0) {
try {
JSONObject weatherdata = new JSONObject(response).getJSONArray("weather").getJSONObject(0);
JSONObject temp = new JSONObject(response).getJSONObject("main");
temp_text.setText((int)(Float.parseFloat(temp.getString("temp")) - 272.15) + " °C");
humi_text.setText("Humidity: %" + temp.getString("humidity"));
pres_text.setText("Pressure: " + temp.getString("pressure") + "hpa");
ImageDownload imageDownload = new ImageDownload();
imageDownload.addListener(this);
imageDownload.execute(String.format("http://openweathermap.org/img/w/%s.png", weatherdata.getString("icon")));
} catch (JSONException e) {
Log.e("[ERROR]", "Cannot process weather data");
}
}if(id == 1) {
try {
JSONArray announcements = new JSONArray(response);
for(int i = 0; i< announcements.length();i++){
JSONObject obj = announcements.getJSONObject(i);
AnnounceContent.addItem(new AnnounceContent.AnnounceItem(
String.valueOf(i),
obj.getString("text1"),
obj.getString("text2")
));
}
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
recyclerView.setAdapter(new AnnouncementAdapter(AnnounceContent.ITEMS, recyclerViewInteractionListener));
} catch (JSONException e) {
Log.e("[ERROR]", "Cannot process weather data");
}
}
}
@Override
public void imageDownloaded(Bitmap img) {
weather_img.setImageBitmap(Bitmap.createScaledBitmap(img,100,100,true));
WebRequest request = new WebRequest(url + "/announcements",true,new HashMap<String, String>(),1);
request.addListener(this);
request.execute();
}
public interface OnRecyclerViewInteractionListener {
void OnRecyclerViewInteraction(AnnounceContent.AnnounceItem item);
}
}
class AnnounceContent {
public static final List<AnnounceItem> ITEMS = new ArrayList<>();
public static final Map<String, AnnounceItem> ITEM_MAP = new HashMap<>();
public static void addItem(AnnounceItem item) {
ITEMS.add(item);
ITEM_MAP.put(item.id, item);
}
public static class AnnounceItem {
public final String id;
public final String name;
public final String details;
public AnnounceItem(String id, String name, String details) {
this.id = id;
this.name = name;
this.details = details;
}
@Override
public String toString() {
return name;
}
}
}
class AnnouncementAdapter extends RecyclerView.Adapter<AnnouncementAdapter.ViewHolder> {
private final List<AnnounceContent.AnnounceItem> mValues;
private final MainFragment.OnRecyclerViewInteractionListener mListener;
public AnnouncementAdapter(List<AnnounceContent.AnnounceItem> items, MainFragment.OnRecyclerViewInteractionListener listener) {
mValues = items;
mListener = listener;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.votes_list_item, parent, false);
return new AnnouncementAdapter.ViewHolder(view);
}
@Override
public void onBindViewHolder(final AnnouncementAdapter.ViewHolder holder, int position) {
holder.mItem = mValues.get(position);
holder.mIdView.setText(mValues.get(position).name);
holder.mContentView.setText(mValues.get(position).details);
holder.mView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (null != mListener) {
mListener.OnRecyclerViewInteraction(holder.mItem);
}
}
});
}
@Override
public int getItemCount() {
return mValues.size();
}
public class ViewHolder extends RecyclerView.ViewHolder {
public final View mView;
public final TextView mIdView;
public final TextView mContentView;
public AnnounceContent.AnnounceItem mItem;
public ViewHolder(View view) {
super(view);
mView = view;
mIdView = (TextView) view.findViewById(R.id.item_number);
mContentView = (TextView) view.findViewById(R.id.content);
}
@Override
public String toString() {
return super.toString() + " '" + mContentView.getText() + "'";
}
}
}

+ 0
- 109
MyCity/app/src/main/java/gq/yigit/mycity/navigation/MapsFragment.java View File

@ -1,109 +0,0 @@
package gq.yigit.mycity.navigation;
import android.content.Context;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import gq.yigit.mycity.R;
/**
* A simple {@link Fragment} subclass.
* Activities that contain this fragment must implement the
* {@link MapsFragment.OnFragmentInteractionListener} interface
* to handle interaction events.
* Use the {@link MapsFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class MapsFragment extends Fragment {
// TODO: Rename parameter arguments, choose names that match
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
private static final String ARG_PARAM1 = "param1";
private static final String ARG_PARAM2 = "param2";
// TODO: Rename and change types of parameters
private String mParam1;
private String mParam2;
private OnFragmentInteractionListener mListener;
public MapsFragment() {
// Required empty public constructor
}
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param param1 Parameter 1.
* @param param2 Parameter 2.
* @return A new instance of fragment MapsFragment.
*/
// TODO: Rename and change types and number of parameters
public static MapsFragment newInstance(String param1, String param2) {
MapsFragment fragment = new MapsFragment();
Bundle args = new Bundle();
args.putString(ARG_PARAM1, param1);
args.putString(ARG_PARAM2, param2);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
mParam1 = getArguments().getString(ARG_PARAM1);
mParam2 = getArguments().getString(ARG_PARAM2);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_maps, container, false);
}
// TODO: Rename method, update argument and hook method into UI event
public void onButtonPressed(Uri uri) {
if (mListener != null) {
mListener.onFragmentInteraction(uri);
}
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
if (context instanceof OnFragmentInteractionListener) {
mListener = (OnFragmentInteractionListener) context;
} else {
throw new RuntimeException(context.toString()
+ " must implement OnFragmentInteractionListener");
}
}
@Override
public void onDetach() {
super.onDetach();
mListener = null;
}
/**
* This interface must be implemented by activities that contain this
* fragment to allow an interaction in this fragment to be communicated
* to the activity and potentially other fragments contained in that
* activity.
* <p>
* See the Android Training lesson <a href=
* "http://developer.android.com/training/basics/fragments/communicating.html"
* >Communicating with Other Fragments</a> for more information.
*/
public interface OnFragmentInteractionListener {
// TODO: Update argument type and name
void onFragmentInteraction(Uri uri);
}
}

+ 13
- 8
MyCity/app/src/main/java/gq/yigit/mycity/navigation/TransitFragment.java View File

@ -3,6 +3,7 @@ package gq.yigit.mycity.navigation;
import android.content.Context;
import android.content.Intent;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.net.Uri;
import android.os.Bundle;
@ -17,6 +18,7 @@ import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.libraries.places.api.Places;
@ -100,17 +102,14 @@ public class TransitFragment extends Fragment implements WebRequest.responseList
place_name = rootView.findViewById(R.id.place_name);
recyclerView = rootView.findViewById(R.id.route_view);
try {
LocationManager locationManager = (LocationManager)
getContext().getSystemService(cntxt.LOCATION_SERVICE);
Location loc = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
longitude = String.valueOf((double)loc.getLongitude());
latitude = String.valueOf(loc.getLatitude());
latitude = "39.9127897";
longitude = "32.8073577";
}catch (SecurityException e){
Log.e("[ERROR]","An error occured with location permissions");
}
return rootView;
}
public void onButtonPressed(Uri uri) {
if (mListener != null) {
mListener.onFragmentInteraction(uri);
@ -181,8 +180,8 @@ public class TransitFragment extends Fragment implements WebRequest.responseList
JSONObject route = new JSONObject(routes.getString(i));
TransitContent.addItem(new TransitContent.TransitItem(
route.getString("name"),
(new JSONArray(route.getString("stops")).getString(0)),
(new JSONArray(route.getString("stops")).getString(1)),
(new JSONArray(route.getString("names")).getString(0)),
(new JSONArray(route.getString("names")).getString(1)),
(new JSONArray(route.getString("time")).getString(0)),
(new JSONArray(route.getString("time")).getString(1)),
"bus"
@ -209,6 +208,12 @@ class TransitContent {
ITEMS.add(item);
ITEM_MAP.put(item.endTime, item);
}
public static void resetItems(){
final List<TransitItem> ITEMS = new ArrayList<TransitItem>();
final Map<String, TransitItem> ITEM_MAP = new HashMap<String, TransitItem>();
}
public static class TransitItem {


+ 1
- 1
MyCity/app/src/main/java/gq/yigit/mycity/votesFragment/MyVotesRecyclerViewAdapter.java View File

@ -26,7 +26,7 @@ public class MyVotesRecyclerViewAdapter extends RecyclerView.Adapter<MyVotesRecy
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.fragment_votes, parent, false);
.inflate(R.layout.votes_list_item, parent, false);
return new ViewHolder(view);
}


+ 36
- 0
MyCity/app/src/main/res/drawable-v21/megaphone.xml View File

@ -0,0 +1,36 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt"
android:viewportWidth="512"
android:viewportHeight="512"
android:width="512dp"
android:height="512dp">
<path
android:pathData="M134.05 319.086l128.178 41.525c14.158 4.587 21.917 19.782 17.331 33.94l0 0c-4.587 14.158 -19.782 21.917 -33.94 17.331L117.44 370.357c-14.158 -4.587 -21.917 -19.782 -17.331 -33.94l0 0C104.696 322.258 119.891 314.499 134.05 319.086z"
android:fillColor="#A4C2F7" />
<path
android:pathData="M35.93 179.649c-4.758 0.03 -9.421 1.335 -13.503 3.781c-1.386 -0.82 -2.842 -1.517 -4.35 -2.081c0.694 1.315 1.107 2.76 1.212 4.243c-3.504 2.738 -6.28 6.296 -8.081 10.362c-0.364 0.07 -0.732 0.12 -1.101 0.149c-0.379 -0.052 -0.754 -0.128 -1.123 -0.228v126.208c0.901 -0.333 1.847 -0.526 2.807 -0.572c1.078 0.011 2.146 0.203 3.161 0.566c1.503 1.91 3.256 3.609 5.211 5.053c0.324 0.742 0.567 1.517 0.722 2.311c0.526 -0.263 1.008 -0.594 1.514 -0.888c4.088 2.458 8.762 3.77 13.532 3.798c14.864 -0.044 26.904 -12.083 26.947 -26.947v-98.807C62.833 191.732 50.794 179.693 35.93 179.649z"
android:fillColor="#A4C2F7" />
<path
android:pathData="M467.088 35.93L467.088 35.93c19.844 0 35.93 16.086 35.93 35.93V440.14c0 19.844 -16.086 35.93 -35.93 35.93l0 0c-19.844 0 -35.93 -16.086 -35.93 -35.93V71.86C431.158 52.016 447.244 35.93 467.088 35.93z"
android:fillColor="#7FACFA" />
<path
android:pathData="M452.597 38.298c-0.498 4.606 -4.458 8.052 -9.088 7.91c-1.155 -0.024 -2.296 -0.256 -3.368 -0.684v421.504c0.207 -0.011 0.348 -0.114 0.561 -0.114c4.541 -0.15 8.456 3.169 9.052 7.673c15.487 -4.307 26.233 -18.372 26.317 -34.447V71.86C476.001 56.875 466.649 43.503 452.597 38.298z"
android:fillColor="#A4C2F7" />
<path
android:pathData="M431.158 413.193L242.526 296.421 242.526 215.579 431.158 98.807Z"
android:fillColor="#A4C2F7" />
<path
android:pathData="M404.211 404.211L62.877 296.421 62.877 215.579 404.211 107.789Z"
android:fillColor="#E3E7F2" />
<path
android:pathData="M467.088 485.053c-24.792 -0.029 -44.883 -20.12 -44.912 -44.912V71.86c0 -24.804 20.108 -44.912 44.912 -44.912C491.892 26.947 512 47.055 512 71.86V440.14C511.971 464.933 491.88 485.024 467.088 485.053zM467.088 44.912c-14.876 0.016 -26.931 12.071 -26.947 26.947V440.14c0 14.883 12.065 26.947 26.947 26.947c14.883 0 26.947 -12.065 26.947 -26.947V71.86C494.019 56.984 481.964 44.929 467.088 44.912z"
android:fillColor="#428DFF" />
<path
android:pathData="M431.158 422.175c-0.92 0 -1.834 -0.142 -2.711 -0.421L60.167 304.982c-3.733 -1.182 -6.271 -4.646 -6.272 -8.561v-80.842c0.001 -3.916 2.539 -7.38 6.272 -8.561L428.447 90.246c2.729 -0.864 5.707 -0.376 8.017 1.316c2.31 1.691 3.675 4.383 3.676 7.246v314.386C440.139 418.153 436.118 422.174 431.158 422.175L431.158 422.175zM71.86 289.842l350.316 111.079V111.079L71.86 222.158V289.842z"
android:fillColor="#428DFF" />
<path
android:pathData="M253.903 422.184c-3.753 -0.002 -7.483 -0.594 -11.053 -1.754l-128.175 -41.526c-18.848 -6.15 -29.177 -26.381 -23.105 -45.254c6.146 -18.847 26.374 -29.177 45.246 -23.105l128.193 41.526c16.781 5.489 27.091 22.352 24.329 39.79C286.576 409.299 271.559 422.15 253.903 422.184zM125.772 326.763c-7.794 0.002 -14.702 5.019 -17.114 12.43c-3.003 9.433 2.15 19.525 11.553 22.623l128.184 41.526l0 0c9.436 3.046 19.557 -2.128 22.612 -11.562c3.055 -9.434 -2.111 -19.559 -11.542 -22.622l-128.184 -41.526C129.501 327.057 127.643 326.764 125.772 326.763L125.772 326.763z"
android:fillColor="#428DFF" />
<path
android:pathData="M35.93 341.333c-19.835 -0.02 -35.91 -16.095 -35.93 -35.93v-98.807c0 -19.843 16.086 -35.93 35.93 -35.93s35.93 16.086 35.93 35.93v98.807C71.84 325.239 55.765 341.314 35.93 341.333zM35.93 188.632c-9.916 0.013 -17.952 8.049 -17.965 17.965v98.807c0 9.922 8.043 17.965 17.965 17.965s17.965 -8.043 17.965 -17.965v-98.807C53.882 196.68 45.846 188.644 35.93 188.632z"
android:fillColor="#428DFF" />
</vector>

+ 1
- 1
MyCity/app/src/main/res/drawable/circle_shape.xml View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:innerRadius="0dp"
android:innerRadius="5dp"
android:shape="ring"
android:thicknessRatio="1.9"
android:useLevel="false" >


+ 7
- 0
MyCity/app/src/main/res/layout/fragment_layout.xml View File

@ -0,0 +1,7 @@
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/map"
tools:context=".MapsActivity"
android:name="com.google.android.gms.maps.SupportMapFragment" />

+ 54
- 9
MyCity/app/src/main/res/layout/fragment_main.xml View File

@ -1,13 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainFragment">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainFragment"
android:orientation="vertical"
android:layout_marginTop="@dimen/fragment_margin">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:layout_marginLeft="25dp">
<TextView
android:text="Ankara,Çankaya"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:id="@+id/city_name" android:textSize="20sp"
android:layout_marginBottom="14dp" android:textColor="@android:color/black"/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="150dp"
android:layout_height="50dp" app:srcCompat="@mipmap/ic_launcher" android:id="@+id/forecast_img"
android:layout_weight="1"/>
<TextView
android:text="20 °C"
android:layout_width="200dp"
android:layout_height="wrap_content" android:id="@+id/temp_text" android:layout_weight="1"
android:textSize="35sp" android:textColor="#000000" android:layout_marginLeft="5dp"/>
<LinearLayout
android:orientation="vertical"
android:layout_width="310dp"
android:layout_height="match_parent" android:layout_weight="1"
android:layout_marginLeft="12dp">
<TextView
android:text="TextView"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:id="@+id/humidity" android:textColor="#000000"/>
<TextView
android:text="TextView"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:id="@+id/pressure" android:textColor="#000000"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<TextView
android:text="Announcements:"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/hello_blank_fragment"/>
</FrameLayout>
android:layout_height="wrap_content" android:id="@+id/announcement_title" android:textSize="24sp"
android:textColor="#000000" android:layout_marginBottom="15dp" android:layout_marginLeft="7dp"/>
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent" android:id="@+id/anouncements" android:layout_marginLeft="14dp"/>
</LinearLayout>

+ 1
- 1
MyCity/app/src/main/res/layout/fragment_votes_list.xml View File

@ -12,7 +12,7 @@
android:layout_marginRight="16dp"
app:layoutManager="LinearLayoutManager"
tools:context=".votesFragment.VotesFragment"
tools:listitem="@layout/fragment_votes"
tools:listitem="@layout/votes_list_item"
android:divider="@android:color/transparent"
android:dividerHeight="100.0sp"
android:clipChildren="false" android:clipToPadding="false" android:scrollbars="vertical"/>

+ 3
- 4
MyCity/app/src/main/res/layout/rate_spinner_layout.xml View File

@ -4,10 +4,9 @@
android:layout_height="wrap_content">
<ImageView
android:layout_width="115dp"
android:layout_height="wrap_content" app:srcCompat="@mipmap/ic_launcher" android:id="@+id/rate_item_img"
android:layout_weight="1"
android:layout_marginRight="5dp"/>
android:layout_width="150dp"
android:layout_height="50dp" app:srcCompat="@mipmap/ic_launcher" android:id="@+id/rate_item_img"
android:layout_weight="1"/>
<TextView
android:text="TextView"
android:layout_width="match_parent"


+ 2
- 1
MyCity/app/src/main/res/layout/transit_item.xml View File

@ -3,7 +3,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
android:orientation="horizontal"
android:layout_marginBottom="5dp">
<LinearLayout
android:orientation="vertical"


MyCity/app/src/main/res/layout/fragment_votes.xml → MyCity/app/src/main/res/layout/votes_list_item.xml View File


+ 0
- 4
MyCity/app/src/main/res/menu/activity_main_drawer.xml View File

@ -9,10 +9,6 @@
android:id="@+id/transit"
android:icon="@drawable/subway"
android:title="Public Transit"/>
<item
android:id="@+id/navigation"
android:icon="@drawable/navigation"
android:title="Navigation"/>
<item
android:id="@+id/parking"
android:icon="@drawable/parking"


+ 1
- 1
MyCity/app/src/main/res/values/strings.xml View File

@ -1,5 +1,5 @@
<resources>
<string name="app_name">MyCity</string>
<string name="app_name">CitizenView</string>
<string name="navigation_drawer_open">Open navigation drawer</string>
<string name="navigation_drawer_close">Close navigation drawer</string>
<string name="nav_header_title">Android Studio</string>


+ 9
- 0
bus_stop/bus_stop.iml View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

+ 173
- 0
bus_stop/main.py View File

@ -0,0 +1,173 @@
#!/usr/bin/env python3
'''Hello to the world from ev3dev.org'''
import os
import sys
import time
import json
import datetime
import urllib3
import requests
from ev3dev2.motor import LargeMotor, OUTPUT_A, OUTPUT_B, SpeedPercent, MoveTank
from ev3dev2.sensor import INPUT_1,INPUT_2
from ev3dev2.sensor.lego import TouchSensor
from ev3dev2.sensor.lego import UltrasonicSensor
from ev3dev2.sound import Sound
from ev3dev2.button import Button
ON = True
OFF = False
def debug_print(*args, **kwargs):
print(*args, **kwargs, file=sys.stderr)
def reset_console():
print('\x1Bc', end='')
def set_cursor(state):
if state:
print('\x1B[?25h', end='')
else:
print('\x1B[?25l', end='')
def set_font(name):
'''Sets the console font
A full list of fonts can be found with `ls /usr/share/consolefonts`
'''
os.system('setfont ' + name)
def raise_ramp():
print("Raising ramp")
def get_closest_time(times, time):
closest = 0
times = [datetime.datetime.strptime(i,"%H:%M") for i in times]
time = datetime.datetime.strptime(time,"%H:%M")
for i in times:
if i.hour < time.hour or (i.hour == time.hour and i.minute < time.minute):
continue
else:
if closest == 0:
closest = i
continue
if abs(i.hour - time.hour) < abs(closest.hour - time.hour):
closest = i
continue
elif abs(i.hour - time.hour) == abs(closest.hour - time.hour):
if i.minute - time.minute < closest.minute - time.minute:
closest = i
return closest.strftime("%H:%M")
def time_diff(t1, t2):
time1 = datetime.datetime.strptime(t1, "%H:%M")
time2 = datetime.datetime.strptime(t2, "%H:%M")
response = ""
if abs(time2.hour - time1.hour) < 10:
response += "0"
if time2.minute - time1.minute >= 0:
response += str(abs(time2.hour - time1.hour))
else:
response += str(abs(time2.hour - time1.hour) - 1)
response += ":"
if abs(time2.minute - time1.minute) < 10:
response += "0"
response += str(abs(time2.minute - time1.minute))
return response
def raise_ramp(motor1):
motor1.on_for_rotations(SpeedPercent(75), 5)
def main():
start = time.time()
file = open("times.json","r")
time_data = json.loads(file.read())
stop_data = [i for i in time_data.keys()]
debug_print(stop_data)
file.close()
time_start = "10:02"
debug_print('Started Code')
reset_console()
set_cursor(OFF)
set_font('Lat15-Terminus24x12')
alarms = [0,0,0]
stop = "11222"
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
print('AKILLI DURAK')
sound = Sound()
us = UltrasonicSensor(INPUT_2)
us.MODE_US_DIST_CM
btn = Button()
m1 = LargeMotor(OUTPUT_A)
ts = TouchSensor(INPUT_1)
while 1:
if us.distance_centimeters < 15:
sound.speak("Please select a stop")
i = 0
reset_console()
print(stop_data[i%len(stop_data)])
while not btn.enter:
if btn.up:
i += 1
reset_console()
print(stop_data[i%len(stop_data)])
time.sleep(0.1)
if btn.down:
i -= 1
reset_console()
print(stop_data[i%len(stop_data)])
time.sleep(0.1)
closest = datetime.datetime.strptime(time_diff(time_start,get_closest_time(time_data[stop_data[i%len(stop_data)]]["weekday"][:],time_start)),"%H:%M")
difference = datetime.timedelta(hours=closest.hour,minutes=closest.minute).total_seconds()+start
if not difference in alarms:
alarms[i%len(stop_data)] = difference
r = requests.get("https://192.168.44.50:5000/bus?line={}&stop={}".format(stop_data[i%len(stop_data)],stop), verify=False)
print(difference-time.time())
time.sleep(1)
reset_console()
print("AKILLI DURAK")
for i in range(len(alarms)):
if alarms[i] == 0:
continue
else:
if alarms[i]-time.time()<0:
reset_console()
print("Bus no {} has arrived".format(stop_data[i%len(stop_data)]))
sound.speak("Bus no {} has arrived".format(stop_data[i%len(stop_data)]))
sound.speak("Would you like a ramp?")
waiter = time.time()
pressed = True
while time.time()-waiter < 10 and pressed:
if ts.is_pressed:
pressed = False
raise_ramp(m1)
reset_console()
print("AKILLI DURAK")
alarms[i] = 0
if __name__ == '__main__':
main()

+ 4
- 0
bus_stop/main.py.err.log View File

@ -0,0 +1,4 @@
Traceback (most recent call last):
File "/home/robot/bus_stop/main.py", line 9, in <module>
import urllib3
ImportError: No module named 'urllib3'

+ 338
- 0
bus_stop/times.json View File

@ -0,0 +1,338 @@
{
"188-5": {
"saturday": [],
"weekday": [
"06:20",
"06:35",
"06:35",
"06:50",
"06:50",
"07:05",
"07:17",
"07:20",
"07:29",
"07:35",
"07:41",
"07:50",
"07:53",
"08:05",
"08:05",
"08:20",
"08:20",
"08:35",
"08:35",
"08:50",
"08:50",
"09:05",
"09:05",
"09:25",
"09:25",
"09:45",
"09:45",
"10:05",
"10:05",
"10:25",
"10:25",
"10:45",
"10:45",
"11:05",
"11:05",
"11:25",
"11:25",
"11:45",
"11:45",
"12:05",
"12:05",
"12:25",
"12:25",
"12:45",
"12:45",
"13:05",
"13:05",
"13:25",
"13:25",
"13:45",
"13:45",
"14:05",
"14:05",
"14:25",
"14:25",
"14:45",
"14:45",
"15:05",
"15:05",
"15:25",
"15:25",
"15:45",
"15:45",
"16:05",
"16:05",
"16:25",
"16:25",
"16:45",
"16:45",
"17:05",
"17:05",
"17:25",
"17:25",
"17:45",
"17:45",
"18:05",
"18:05",
"18:25",
"18:25",
"18:45",
"18:45",
"19:05",
"19:05",
"19:35",
"19:35",
"20:05",
"20:05",
"20:35",
"20:35",
"21:05",
"21:05",
"21:35",
"21:35",
"22:05",
"22:05"
]
},
"173-1": {
"saturday": [
"06:49",
"07:19",
"07:49",
"08:20",
"08:50",
"09:19",
"10:19",
"11:20",
"12:19",
"13:18",
"14:18",
"15:19",
"15:49",
"16:19",
"16:49",
"17:19",
"17:49",
"18:24",
"19:03",
"20:03",
"21:05",
"22:05"
],
"weekday": [
"06:29",
"06:49",
"07:09",
"07:29",
"07:49",
"08:10",
"08:35",
"09:14",
"09:54",
"10:34",
"11:15",
"11:55",
"12:35",
"13:14",
"13:54",
"14:34",
"14:54",
"15:14",
"15:34",
"15:54",
"16:14",
"16:34",
"16:54",
"17:15",
"17:35",
"17:55",
"18:15",
"18:35",
"19:03",
"19:33",
"20:03",
"21:05",
"22:05"
]
},
"185-3": {
"saturday": [
"05:55",
"06:04",
"06:13",
"06:22",
"06:31",
"06:39",
"06:47",
"06:55",
"06:56",
"07:03",
"07:05",
"07:11",
"07:14",
"07:19",
"07:23",
"07:27",
"07:33",
"07:36",
"07:43",
"07:53",
"08:03",
"08:13",
"08:23",
"08:33",
"08:43",
"08:53",
"09:02",
"09:11",
"09:20",
"09:29",
"09:38",
"09:47",
"09:56",
"10:05",
"10:14",
"10:23",
"10:32",
"10:41",
"10:50",
"10:59",
"11:08",
"11:17",
"11:26",
"11:35",
"11:45",
"11:55",
"12:05",
"12:15",
"12:25",
"12:35",
"12:45",
"12:55",
"13:05",
"13:15",
"13:25",
"13:35",
"13:45",
"13:55",
"14:05",
"14:15",
"14:25",
"14:35",
"14:45",
"14:55",
"15:05",
"15:15",
"15:25",
"15:35",
"15:45",
"15:55",
"16:05",
"16:15",
"16:25",
"16:35",
"16:45",
"16:55",
"17:05",
"17:15",
"17:25",
"17:35",
"17:45",
"17:55",
"18:05",
"18:15",
"18:25",
"18:35",
"18:45",
"18:55",
"19:05",
"19:15",
"19:25",
"19:35",
"19:45",
"19:55",
"20:01",
"20:06",
"20:11",
"20:17",
"20:21",
"20:28",
"20:31",
"20:39",
"20:46",
"20:51",
"21:03",
"21:15",
"21:16",
"21:29",
"21:44",
"22:03",
"22:26"
],
"weekday": [
"05:51",
"06:00",
"06:09",
"06:18",
"06:27",
"06:36",
"06:44",
"06:50",
"06:52",
"06:59",
"07:00",
"07:07",
"07:08",
"07:14",
"07:17",
"07:21",
"07:26",
"07:28",
"07:36",
"07:46",
"07:56",
"08:06",
"08:16",
"08:26",
"08:36",
"08:46",
"08:55",
"09:05",
"09:15",
"09:25",
"09:35",
"09:44",
"09:53",
"10:03",
"10:12",
"10:21",
"10:30",
"10:39",
"10:48",
"10:57",
"11:06",
"11:15",
"11:24",
"11:34",
"11:43",
"11:52",
"12:01",
"12:10",
"12:19",
"12:28",
"12:37",
"12:46",
"12:55",
"13:05",
"13:15",
"13:25",
"13:35",
"13:45",
"13:55",
"14:05"
]}}

+ 55
- 0
client_side/interface/UserData/denunciation_map.html View File

@ -0,0 +1,55 @@
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<title>Denunction Map</title>
<meta name="viewport" content="initial-scale=1.0">
<meta charset="utf-8">
<style>
#map {
height: 100%;
}
html, body {
height: 100%;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div id="map"></div>
<script>
var map;
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
center: {lat: 39.92, lng: 32.85},
zoom: 13
});
}
</script>
<script>
var markers = [];
setInterval(function() {
for (var i = 0; i < markers.length; i++) {
markers[i].setMap(null);
}
$.get("https://127.0.0.1:5000/denunciations", function(data, status){
if (status == "success") {
data.forEach(function(element) {
var marker = new google.maps.Marker({
position: { lat: element["location"]["latitude"], lng: element["location"]["longitude"]},
map: map,
label: element["priority"].toString(),
title: element["info"]
});
markers.push(marker);
});
}
});
}, 5000);
</script>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBuOC03IHPA_6TPnfk18b0SAgD1uge4-dk&callback=initMap"
async defer></script>
</body>
</html>

+ 0
- 31
client_side/interface/UserData/index.html View File

@ -1,31 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>UserInterface</title>
<link rel="stylesheet" href="style.css">
<script src="socket.io/dist/socket.io.js"></script>
<script src = "index.js"></script>
</head>
<body>
<div id = "basics">
<span class="inline"><img src="https://proxy.duckduckgo.com/iu/?u=https%3A%2F%2Ftse4.mm.bing.net%2Fth%3Fid%3DOIP.ELnJq_JhiyfewhCMKOkNfwHaHa%26pid%3DApi&f=1" id="userpic" alt=""></span>
<span class="inline">
<table>
<tr>
<td class="table-header"><solid>Name:</solid></td>
<td id = "name"></td>
<td class="table-header"><solid>TC:</solid></td>
<td id = "tc"></td>
<td class="table-header"><solid>Status:</solid></td>
<td id = "status"></td>
</tr>
<tr>
<td class="table-header"><solid>Health info:</solid></td>
<td id = "health"></td>
</tr>
</table>
</span>
</div>
</body>
</html>

+ 0
- 4
client_side/interface/UserData/index.js View File

@ -1,4 +0,0 @@
var exampleSocket = new WebSocket("ws://localhost:3000", "protocolOne");
exampleSocket.onmessage = function (event) {
console.log(event.data);
}

+ 0
- 333
client_side/interface/UserData/package-lock.json View File

@ -1,333 +0,0 @@
{
"requires": true,
"lockfileVersion": 1,
"dependencies": {
"accepts": {
"version": "1.3.5",
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.5.tgz",
"integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=",
"requires": {
"mime-types": "2.1.23",
"negotiator": "0.6.1"
}
},
"after": {
"version": "0.8.2",
"resolved": "https://registry.npmjs.org/after/-/after-0.8.2.tgz",
"integrity": "sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8="
},
"arraybuffer.slice": {
"version": "0.0.7",
"resolved": "https://registry.npmjs.org/arraybuffer.slice/-/arraybuffer.slice-0.0.7.tgz",
"integrity": "sha512-wGUIVQXuehL5TCqQun8OW81jGzAWycqzFF8lFp+GOM5BXLYj3bKNsYC4daB7n6XjCqxQA/qgTJ+8ANR3acjrog=="
},
"async-limiter": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz",
"integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg=="
},
"backo2": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz",
"integrity": "sha1-MasayLEpNjRj41s+u2n038+6eUc="
},
"base64-arraybuffer": {
"version": "0.1.5",
"resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.5.tgz",
"integrity": "sha1-c5JncZI7Whl0etZmqlzUv5xunOg="
},
"base64id": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/base64id/-/base64id-1.0.0.tgz",
"integrity": "sha1-R2iMuZu2gE8OBtPnY7HDLlfY5rY="
},
"better-assert": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/better-assert/-/better-assert-1.0.2.tgz",
"integrity": "sha1-QIZrnhueC1W0gYlDEeaPr/rrxSI=",
"requires": {
"callsite": "1.0.0"
}
},
"blob": {
"version": "0.0.5",
"resolved": "https://registry.npmjs.org/blob/-/blob-0.0.5.tgz",
"integrity": "sha512-gaqbzQPqOoamawKg0LGVd7SzLgXS+JH61oWprSLH+P+abTczqJbhTR8CmJ2u9/bUYNmHTGJx/UEmn6doAvvuig=="
},
"callsite": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/callsite/-/callsite-1.0.0.tgz",
"integrity": "sha1-KAOY5dZkvXQDi28JBRU+borxvCA="
},
"component-bind": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/component-bind/-/component-bind-1.0.0.tgz",
"integrity": "sha1-AMYIq33Nk4l8AAllGx06jh5zu9E="
},
"component-emitter": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz",
"integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY="
},
"component-inherit": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/component-inherit/-/component-inherit-0.0.3.tgz",
"integrity": "sha1-ZF/ErfWLcrZJ1crmUTVhnbJv8UM="
},
"cookie": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz",
"integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s="
},
"debug": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz",
"integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==",
"requires": {
"ms": "2.1.1"
}
},
"engine.io": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/engine.io/-/engine.io-3.3.2.tgz",
"integrity": "sha512-AsaA9KG7cWPXWHp5FvHdDWY3AMWeZ8x+2pUVLcn71qE5AtAzgGbxuclOytygskw8XGmiQafTmnI9Bix3uihu2w==",
"requires": {
"accepts": "1.3.5",
"base64id": "1.0.0",
"cookie": "0.3.1",
"debug": "3.1.0",
"engine.io-parser": "2.1.3",
"ws": "6.1.4"
},
"dependencies": {
"debug": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"requires": {
"ms": "2.0.0"
}
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
}
}
},
"engine.io-client": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-3.3.2.tgz",
"integrity": "sha512-y0CPINnhMvPuwtqXfsGuWE8BB66+B6wTtCofQDRecMQPYX3MYUZXFNKDhdrSe3EVjgOu4V3rxdeqN/Tr91IgbQ==",
"requires": {
"component-emitter": "1.2.1",
"component-inherit": "0.0.3",
"debug": "3.1.0",
"engine.io-parser": "2.1.3",
"has-cors": "1.1.0",
"indexof": "0.0.1",
"parseqs": "0.0.5",
"parseuri": "0.0.5",
"ws": "6.1.4",
"xmlhttprequest-ssl": "1.5.5",
"yeast": "0.1.2"
},
"dependencies": {
"debug": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"requires": {
"ms": "2.0.0"
}
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
}
}
},
"engine.io-parser": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-2.1.3.tgz",
"integrity": "sha512-6HXPre2O4Houl7c4g7Ic/XzPnHBvaEmN90vtRO9uLmwtRqQmTOw0QMevL1TOfL2Cpu1VzsaTmMotQgMdkzGkVA==",
"requires": {
"after": "0.8.2",
"arraybuffer.slice": "0.0.7",
"base64-arraybuffer": "0.1.5",
"blob": "0.0.5",
"has-binary2": "1.0.3"
}
},
"has-binary2": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/has-binary2/-/has-binary2-1.0.3.tgz",
"integrity": "sha512-G1LWKhDSvhGeAQ8mPVQlqNcOB2sJdwATtZKl2pDKKHfpf/rYj24lkinxf69blJbnsvtqqNU+L3SL50vzZhXOnw==",
"requires": {
"isarray": "2.0.1"
}
},
"has-cors": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/has-cors/-/has-cors-1.1.0.tgz",
"integrity": "sha1-XkdHk/fqmEPRu5nCPu9J/xJv/zk="
},
"indexof": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz",
"integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10="
},
"isarray": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.1.tgz",
"integrity": "sha1-o32U7ZzaLVmGXJ92/llu4fM4dB4="
},
"mime-db": {
"version": "1.39.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.39.0.tgz",
"integrity": "sha512-DTsrw/iWVvwHH+9Otxccdyy0Tgiil6TWK/xhfARJZF/QFhwOgZgOIvA2/VIGpM8U7Q8z5nDmdDWC6tuVMJNibw=="
},
"mime-types": {
"version": "2.1.23",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.23.tgz",
"integrity": "sha512-ROk/m+gMVSrRxTkMlaQOvFmFmYDc7sZgrjjM76abqmd2Cc5fCV7jAMA5XUccEtJ3cYiYdgixUVI+fApc2LkXlw==",
"requires": {
"mime-db": "1.39.0"
}
},
"ms": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
"integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg=="
},
"negotiator": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz",
"integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk="
},
"object-component": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/object-component/-/object-component-0.0.3.tgz",
"integrity": "sha1-8MaapQ78lbhmwYb0AKM3acsvEpE="
},
"parseqs": {
"version": "0.0.5",
"resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.5.tgz",
"integrity": "sha1-1SCKNzjkZ2bikbouoXNoSSGouJ0=",
"requires": {
"better-assert": "1.0.2"
}
},
"parseuri": {
"version": "0.0.5",
"resolved": "https://registry.npmjs.org/parseuri/-/parseuri-0.0.5.tgz",
"integrity": "sha1-gCBKUNTbt3m/3G6+J3jZDkvOMgo=",
"requires": {
"better-assert": "1.0.2"
}
},
"socket.io": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/socket.io/-/socket.io-2.2.0.tgz",
"integrity": "sha512-wxXrIuZ8AILcn+f1B4ez4hJTPG24iNgxBBDaJfT6MsyOhVYiTXWexGoPkd87ktJG8kQEcL/NBvRi64+9k4Kc0w==",
"requires": {
"debug": "4.1.1",
"engine.io": "3.3.2",
"has-binary2": "1.0.3",
"socket.io-adapter": "1.1.1",
"socket.io-client": "2.2.0",
"socket.io-parser": "3.3.0"
}
},
"socket.io-adapter": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-1.1.1.tgz",
"integrity": "sha1-KoBeihTWNyEk3ZFZrUUC+MsH8Gs="
},
"socket.io-client": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/socket.io-client/-/socket.io-client-2.2.0.tgz",
"integrity": "sha512-56ZrkTDbdTLmBIyfFYesgOxsjcLnwAKoN4CiPyTVkMQj3zTUh0QAx3GbvIvLpFEOvQWu92yyWICxB0u7wkVbYA==",
"requires": {
"backo2": "1.0.2",
"base64-arraybuffer": "0.1.5",
"component-bind": "1.0.0",
"component-emitter": "1.2.1",
"debug": "3.1.0",
"engine.io-client": "3.3.2",
"has-binary2": "1.0.3",
"has-cors": "1.1.0",
"indexof": "0.0.1",
"object-component": "0.0.3",
"parseqs": "0.0.5",
"parseuri": "0.0.5",
"socket.io-parser": "3.3.0",
"to-array": "0.1.4"
},
"dependencies": {
"debug": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"requires": {
"ms": "2.0.0"
}
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
}
}
},
"socket.io-parser": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.3.0.tgz",
"integrity": "sha512-hczmV6bDgdaEbVqhAeVMM/jfUfzuEZHsQg6eOmLgJht6G3mPKMxYm75w2+qhAQZ+4X+1+ATZ+QFKeOZD5riHng==",
"requires": {
"component-emitter": "1.2.1",
"debug": "3.1.0",
"isarray": "2.0.1"
},
"dependencies": {
"debug": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"requires": {
"ms": "2.0.0"
}
},
"ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
}
}
},
"to-array": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/to-array/-/to-array-0.1.4.tgz",
"integrity": "sha1-F+bBH3PdTz10zaek/zI46a2b+JA="
},
"ws": {
"version": "6.1.4",
"resolved": "https://registry.npmjs.org/ws/-/ws-6.1.4.tgz",
"integrity": "sha512-eqZfL+NE/YQc1/ZynhojeV8q+H050oR8AZ2uIev7RU10svA9ZnJUddHcOUZTJLinZ9yEfdA2kSATS2qZK5fhJA==",
"requires": {
"async-limiter": "1.0.0"
}
},
"xmlhttprequest-ssl": {
"version": "1.5.5",
"resolved": "https://registry.npmjs.org/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.5.tgz",
"integrity": "sha1-wodrBhaKrcQOV9l+gRkayPQ5iz4="
},
"yeast": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz",
"integrity": "sha1-AI4G2AlDIMNy28L47XagymyKxBk="
}
}
}

+ 49
- 0
client_side/interface/UserData/qr_info.html View File

@ -0,0 +1,49 @@
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<meta charset="UTF-8">
<title>UserInterface</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div id = "basics">
<span class="inline"><img src="https://proxy.duckduckgo.com/iu/?u=https%3A%2F%2Ftse4.mm.bing.net%2Fth%3Fid%3DOIP.ELnJq_JhiyfewhCMKOkNfwHaHa%26pid%3DApi&f=1" id="userpic" alt=""></span>
<br>
<span class="inline">
<table>
<tr>
<td class="table-header"><solid>Name:</solid></td>
<td id = "name"></td>
<td class="table-header"><solid>TC:</solid></td>
<td id = "tc"></td>
</tr>
<tr>
<td class="table-header"><solid>Phone Number:</solid></td>
<td id = "number"></td>
<td class="table-header"><solid>E-Mail:</solid></td>
<td id = "email"></td>
</tr>
<tr>
<td class="table-header"><solid>Health info:</solid></td>
<td id = "health"></td>
</tr>
</table>
</span>
<script>
setInterval(function() {
$.get("http://127.0.0.1:3000/get", function(data, status){
if (status == "success") {
document.getElementById("userpic").src = "https://0.0.0.0:5000" + data["avatar"];
document.getElementById("name").innerHTML = data["realname"];
document.getElementById("tc").innerHTML = data["TC"];
document.getElementById("health").innerHTML = data["health"].join(", ");
document.getElementById("number").innerHTML = data["tel"];
document.getElementById("email").innerHTML = data["email"];
}
});
}, 2000);
</script>
</div>
</body>
</html>

+ 24
- 14
client_side/modules/qr/user_data.py View File

@ -1,6 +1,15 @@
from flask import Flask, jsonify, request, abort
from multiprocessing import Process
import requests
import reader
import json
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
app = Flask(__name__)
user = {}
class Reader():
def __init__(self):
@ -8,23 +17,24 @@ class Reader():
p1 = Process(target=read.detect)
p1.start()
def received(self,data):
print(data)
qr_reader = Reader()
while 1:
continue
def received(self, data):
r = requests.get('https://0.0.0.0:5000/users/{}'.format(data), verify=False)
requests.get('http://0.0.0.0:3000/set', data={'data': r.text})
qr_reader = Reader()
@app.route('/set')
def set_data():
global user
user = json.loads(request.form['data'])
return ''
@app.route('/get')
def get_qr():
if user == {}:
abort(404)
return jsonify(user)
app.run(host='0.0.0.0', port=3000)

+ 1
- 0
server_side/.gitignore View File

@ -68,4 +68,5 @@ fabric.properties
# Editor-based Rest Client
.idea/httpRequests
Ambulans/*

+ 5
- 1
server_side/api/app.py View File

@ -1,7 +1,7 @@
from flask import Flask, send_from_directory
from flask_restful import Api
from api.modules import user_info, voting_system, rating_system, utility, denunciation, navigation
from api.modules import user_info, voting_system, rating_system, utility, denunciation, navigation, bus_stops, announcements
app = Flask(__name__)
api = Api(app)
@ -34,4 +34,8 @@ if __name__ == '__main__':
api.add_resource(navigation.Transit, '/transit', '/transit/')
api.add_resource(bus_stops.Bus, '/bus', '/bus/')
api.add_resource(announcements.Announcement, '/announcements', '/announcements/')
app.run(host='0.0.0.0', port=5000, ssl_context=context)

BIN
server_side/api/images/muhtarlik.jpg View File

Before After
Width: 600  |  Height: 400  |  Size: 117 KiB

BIN
server_side/api/images/park.jpg View File

Before After
Width: 1024  |  Height: 675  |  Size: 202 KiB

BIN
server_side/api/modules/__pycache__/announcements.cpython-37.pyc View File


BIN
server_side/api/modules/__pycache__/bus_stops.cpython-37.pyc View File


BIN
server_side/api/modules/__pycache__/navigation.cpython-37.pyc View File


BIN
server_side/api/modules/__pycache__/user_info.cpython-37.pyc View File


+ 196
- 0
server_side/api/modules/alternateSolution1.py View File

@ -0,0 +1,196 @@
import xml.etree.ElementTree as ET
import cv2
import numpy as np
import os
import json
from pysolar.solar import *
from datetime import datetime
def timeAverage():
data_file = open("data.json","r")
time_file = open("timely.json","w")
averages = json.loads(data_file.read())
timely = {}
altitudes = {}
for key in averages:
date = key[37:-13]
time = key[49:-4].replace("_",":")
averages[key]["time"]=time
averages[key]["date"]=date
data_file.close()
data_file = open("data.json","w")
data_file.write(json.dumps(averages))
for key in averages:
time = datetime.strptime(averages[key]["date"] + " " + averages[key]["time"] + " -0300","%Y-%m-%d %H:%M:%S %z")
altitude = int(get_altitude(-25.4269081,-49.3318036,time))
altitudes[averages[key]["date"] + " " + averages[key]["time"] ] = altitude
if not (altitude in timely):
timely[altitude] = {}
for spot in averages[key]:
if(spot == "time" or spot == "date"):
continue
if not spot in timely[altitude]:
timely[altitude][spot]=[]
timely[altitude][spot].append({"r":averages[key][spot]["r"],"b":averages[key][spot]["b"],"g":averages[key][spot]["g"]})
print(altitudes)
for key in timely:
for id in timely[key]:
total = {"r":0,"g":0,"b":0}
for i in range(len(timely[key][id])):
for color in total:
total[color] += timely[key][id][i][color]
for color in total:
total[color] = total[color] / len(timely[key][id])
timely[key][id] = total
print(timely)
timely_json = json.dumps(timely)
time_file.write(timely_json)
data_file.close()
time_file.close()
def generateData(locations,image,show,averages):
loc_images = {}
average_values = {}
average_total=[0,0,0]
for col in range(len(image)):
for pix in range(len(image[col])):
if (image[col][pix] == [255,255,255]).all():
image[col][pix] == [255,255,254]
for i in locations:
temp = locations[i]
pts = np.array([[int(temp[0]['x']),int(temp[0]['y'])],
[int(temp[1]['x']),int(temp[1]['y'])],
[int(temp[2]['x']),int(temp[2]['y'])],
[int(temp[3]['x']),int(temp[3]['y'])]])
rect = cv2.boundingRect(pts)
x,y,w,h = rect
croped = image[y:y+h, x:x+w].copy()
pts = pts - pts.min(axis=0)
mask = np.zeros(croped.shape[:2], np.uint8)
cv2.drawContours(mask, [pts], -1, (255, 255, 255), -1, cv2.LINE_AA)
dst = cv2.bitwise_and(croped, croped, mask=mask)
bg = np.ones_like(croped, np.uint8)*255
cv2.bitwise_not(bg,bg, mask=mask)
dst2 = bg+ dst
split_len = len(dst2)//3
splitted = [dst2[:split_len,:],dst2[split_len:split_len*2,:],dst2[split_len*2:,:]]
loc_images[i]=[dst2]
for lot in loc_images:
average_values[lot] = []
for i in range(1):
diff_pix = 0
reps = 0
avg_rgb = [0,0,0]
rgb = ["b","g","r"]
for col in loc_images[lot][i]:
for pix in col:
if (pix == [255,255,255]).all():
continue
different = False
print("[",end="")
for j in range(3):
print(abs(int(averages[lot][rgb[i]]-pix[i])) , end=",")
if abs(averages[lot][rgb[i]]-pix[i]) > 59:
different = True
reps += 1
diff_pix += different
print("]",end=" ")
print("")
print("\n\n")
average_values[lot] = (diff_pix/reps)*100
if lot in show:
cv2.imshow("a" , loc_images[lot][0])
cv2.waitKey(0)
return average_values
def findSpot(img_loc,locations):
empty = []
timely_values = time_file = open("timely.json","r")
timely_averages = json.loads(timely_values.read())
img = cv2.imread(img_loc)
date = img_loc[37:-13]
time = img_loc[49:-4]
time = time.replace("_",":")
time = datetime.strptime(date + " " + time + " -0300","%Y-%m-%d %H:%M:%S %z")
altitude = int(get_altitude(-25.4269081,-49.3318036,time))
base_value = timely_averages[str(altitude)]
print(altitude)
averages = generateData(locations,img,[],base_value)
for i in averages:
print(i + " " + str(averages[i]))
for i in locations:
if(averages[i] > 32):
color=[0,0,255]
empty.append(i)
else:
color=[0,255,0]
corners = [[],[]]
for j in range(0,4):
val2 = j+1
if(val2 == 4):
val2 = 0
pt1 = (int(locations[i][j]["x"]),int(locations[i][j]["y"]))
pt2 = (int(locations[i][val2]["x"]),int(locations[i][val2]["y"]))
cv2.line(img,pt1,pt2,color)
corners[0].append(int(locations[i][j]["x"]))
corners[1].append(int(locations[i][j]["y"]))
x1=min(corners[0][0],corners[0][1],corners[0][2],corners[0][3]);
x2=max(corners[0][0],corners[0][1],corners[0][2],corners[0][3]);
y1=min(corners[1][0],corners[1][1],corners[1][2],corners[1][3]);
y2=max(corners[1][0],corners[1][1],corners[1][2],corners[1][3]);
pt = (int((x1+x2)/2),int((y1+y2)/2))
cv2.putText(img,str(i), pt, cv2.FONT_HERSHEY_SIMPLEX, 0.5, 255)
cv2.imshow("Parking Lot",img)
cv2.waitKey(0)
return empty
location_file = open("locations.json","r")
location_json = json.loads(location_file.read())
empty_locs = findSpot('./PKLot/PKLot/PUCPR/Sunny/2012-09-11/2012-09-11_18_08_41.jpg',location_json)
closest = 1000
for i in empty_locs:
print (location_json[i][4])
if location_json[i][4] < closest:
closest = int(i)
print("The closest spot is " + str(closest))
print("done")

+ 17
- 0
server_side/api/modules/announcements.py View File

@ -0,0 +1,17 @@
from flask import Flask, request
from flask_restful import Resource, Api
import json
app = Flask(__name__)
api = Api(app)
buses = {}
with open("modules/databases/announcements.json","r") as f:
announcements = json.loads(f.read())
class Announcement(Resource):
def get(self):
return announcements

+ 17
- 0
server_side/api/modules/bus_stops.py View File

@ -0,0 +1,17 @@
from flask import Flask, request
from flask_restful import Resource, Api, abort
app = Flask(__name__)
api = Api(app)
buses = {}
class Bus(Resource):
def get(self):
args = request.args
if not args["line"] in buses:
buses[args["line"]] = []
if not args["stop"] in buses[args["line"]]:
buses[args["line"]].append(args["stop"])
return "OK"

+ 208390
- 0
server_side/api/modules/data.json
File diff suppressed because it is too large
View File


+ 10
- 0
server_side/api/modules/databases/announcements.json View File

@ -0,0 +1,10 @@
[
{
"text1": "Yeni park",
"text2": "Çankaya 100.Yıl mahallesinde yeni park"
},
{
"text1": "Muhtarlık Seçimleri",
"text2": "Muhtarlı seçimleri 11.05.2019 tarihinde yapılacak"
}
]

+ 108
- 0
server_side/api/modules/databases/bus.json View File

@ -6,12 +6,24 @@
"location": "\u00dd\u00fe\u00e7i Bloklar\u00fd Mh.1516.Cd.\u00c7ankaya",
"name": "MUHTARLIK"
},
"10871": {
"lat": "39.910909",
"lng": "32.8145",
"location": "K\u00fdz\u00fdl\u00fdrmak Mh.Mevlana Blv.\u00c7ankaya",
"name": "UFUK \u00dcN\u00ddVERS\u00ddTES\u00dd HASTANES\u00dd"
},
"11222": {
"lat": "39.846263",
"lng": "32.828952",
"location": "Oran Mh.Z\u00fclf\u00fc Ti\u00f0rel Cd.\u00c7ankaya",
"name": "PANORA AVM"
},
"13250": {
"lat": "39.824533",
"lng": "32.775541",
"location": "Ta\u00fep\u00fdnar Mh.Mh.Ankara TED Koleji G\u00f6lba\u00fe\u00fd",
"name": "OPTOWN KONUTLARI"
},
"40064": {
"lat": "39.9835",
"lng": "32.875418",
@ -58834,6 +58846,32 @@
]
},
"10871": {
"saturday": [
{
"dakika": "10",
"detay": "",
"saat": "08",
"tur": "CUMARTES\u00dd"
},
{
"dakika": "07",
"detay": "",
"saat": "11",
"tur": "CUMARTES\u00dd"
},
{
"dakika": "51",
"detay": "",
"saat": "15",
"tur": "CUMARTES\u00dd"
},
{
"dakika": "53",
"detay": "",
"saat": "17",
"tur": "CUMARTES\u00dd"
}
],
"weekday": [
{
"dakika": "11",
@ -58916,6 +58954,34 @@
"tur": "HAFTA \u00dd\u00c7\u00dd"
}
]
},
"13250": {
"saturday": [
{
"dakika": "47",
"detay": "",
"saat": "08",
"tur": "CUMARTES\u00dd"
},
{
"dakika": "34",
"detay": "",
"saat": "11",
"tur": "CUMARTES\u00dd"
},
{
"dakika": "22",
"detay": "",
"saat": "16",
"tur": "CUMARTES\u00dd"
},
{
"dakika": "23",
"detay": "",
"saat": "18",
"tur": "CUMARTES\u00dd"
}
]
}
},
"197": {
@ -58942,6 +59008,26 @@
]
},
"10871": {
"saturday": [
{
"dakika": "37",
"detay": "",
"saat": "20",
"tur": "CUMARTES\u00dd"
},
{
"dakika": "37",
"detay": "",
"saat": "21",
"tur": "CUMARTES\u00dd"
},
{
"dakika": "36",
"detay": "",
"saat": "22",
"tur": "CUMARTES\u00dd"
}
],
"weekday": [
{
"dakika": "37",
@ -59006,6 +59092,28 @@
"tur": "HAFTA \u00dd\u00c7\u00dd"
}
]
},
"13250": {
"saturday": [
{
"dakika": "52",
"detay": "",
"saat": "20",
"tur": "CUMARTES\u00dd"
},
{
"dakika": "54",
"detay": "",
"saat": "21",
"tur": "CUMARTES\u00dd"
},
{
"dakika": "52",
"detay": "",
"saat": "22",
"tur": "CUMARTES\u00dd"
}
]
}
},
"411-3": {


+ 6
- 0
server_side/api/modules/databases/bus_locations.json View File

@ -0,0 +1,6 @@
{
"bus_1": {
"latitude": 39.9404,
"longitude": 32.9101
}
}

+ 2
- 2
server_side/api/modules/databases/denunciations.json View File

@ -15,8 +15,8 @@
"info": "Vandalism",
"priority": "3",
"location": {
"latitude": "35.3",
"longitude": "37.7"
"latitude": 39.95,
"longitude": 32.87
}
}
]

+ 1
- 1
server_side/api/modules/databases/users.json View File

@ -2,7 +2,7 @@
"efe": {
"id": "9vard12ty0ad2yvwp3q53rsf3h43r2vq",
"realname": "Efe Aydın",
"avatar": "/img/user1.png",
"avatar": "/img/9vard12ty0ad2yvwp3q53rsf3h43r2vq.png",
"password": "827ccb0eea8a706c4c34a16891f84e7b",
"email": "efeaydin@mycity.com",
"TC": "11111111111",


+ 17
- 18
server_side/api/modules/databases/votings.json View File

@ -1,43 +1,42 @@
[
{
"id": 1,
"name": "Test Voting",
"desc": "Sample voting description",
"img": "/img/voting.jpg",
"name": "Muhtarl\u0131k Se\u00e7imi",
"desc": "Emek Mahallesi Muhtarl\u0131k Se\u00e7imi",
"img": "/img/muhtarlik.jpg",
"voters": [
"9vard12ty0ad2yvwp3q53rsf3h43r2vq"
],
"votes": {
"1": {
"name": "Sample Vote 1",
"desc": "Sample description",
"votes": 3
"name": "Efe Ayd\u0131n",
"desc": "Mahallenizin gen\u00e7 muhtar aday\u0131...",
"votes": 4
},
"2": {
"name": "Sample Vote 2",
"desc": "Sample description",
"votes": 0
"name": "Zeynep T\u00fcfek\u00e7i",
"desc": "Tecr\u00fcbe ve bilgi sahibi muhtar...",
"votes": 5
}
}
},
{
"id": 2,
"name": "wooting",
"desc": "wooting desc",
"img": "/img/voting.jpg",
"name": "Park Ad\u0131 Oylamas\u0131",
"desc": "Mahallemizin yeni park\u0131n\u0131n ad\u0131",
"img": "/img/park.jpg",
"voters": [
"9vard12ty0ad2yvwp3q53rsf3h43r2vq"
],
"votes": {
"1": {
"name": "woote 1",
"desc": "woote desc",
"votes": 3
"name": "Mutlu Park",
"desc": "Mutlu park, mutlu isimlerle olur.",
"votes": 4
},
"2": {
"id": 1,
"name": "woote 2",
"desc": "woote 3",
"name": "Yi\u011fit \u00c7olako\u011flu Park\u0131",
"desc": "Mahallemizin say\u0131n destek\u00e7isinin ad\u0131",
"votes": 0
}
}


+ 119
- 0
server_side/api/modules/detectSpot.py View File

@ -0,0 +1,119 @@
import cv2
import numpy as np
import json
from matplotlib import pyplot as plt
import cv2
import numpy as np
import json
import os
from matplotlib import pyplot as plt
import xml.etree.ElementTree as ET
import cv2
import numpy as np
import os
import json
from pysolar.solar import *
from datetime import datetime
def calcAvg(img,locations_xml):
locations_extracted = []
loc_images = {}
average_values = {}
for i in range( len( locations_xml ) ):
try:
locations_extracted.append([])
for j in range(4):
locations_extracted[i].append(locations_xml[i][1][j].attrib)
locations_extracted[i].append(locations_xml[i].attrib['occupied'])
locations_extracted[i].append(locations_xml[i].attrib['id'])
except Exception:
print("xml corrupt!")
return {}
for col in range(len(img)):
for pix in range(len(img[col])):
if (img[col][pix] == [255,255,255]).all():
img[col][pix] == [255,255,254]
for i in range(len(locations_extracted)):
temp = locations_extracted[i]
pts = np.array([[int(temp[0]['x']),int(temp[0]['y'])],
[int(temp[1]['x']),int(temp[1]['y'])],
[int(temp[2]['x']),int(temp[2]['y'])],
[int(temp[3]['x']),int(temp[3]['y'])]])
rect = cv2.boundingRect(pts)
x,y,w,h = rect
croped = img[y:y+h, x:x+w].copy()
pts = pts - pts.min(axis=0)
mask = np.zeros(croped.shape[:2], np.uint8)
cv2.drawContours(mask, [pts], -1, (255, 255, 255), -1, cv2.LINE_AA)
dst = cv2.bitwise_and(croped, croped, mask=mask)
bg = np.ones_like(croped, np.uint8)*255
cv2.bitwise_not(bg,bg, mask=mask)
dst2 = bg+ dst
blurred = cv2.GaussianBlur(dst2,(5,5),3)
edges = cv2.Canny(blurred,100,100)
if not temp[4] in loc_images:
loc_images[temp[4]] = {}
loc_images[temp[4]][temp[5]] = edges
for state in loc_images:
average_values[state] = {}
for lot in loc_images[state]:
reps = 0
for col in loc_images[state][lot]:
for pix in col:
if(pix == 255):
reps += 1
average_values[state][lot] = reps
print (average_values)
return average_values
def generateAvg():
dates = os.listdir('./PKLot/PKLot/PUCPR/Sunny')
imgs = []
averages={}
back_file = open("backup.json","w")
back_file.write("{")
for i in range(len(dates)):
imgs.append(os.listdir(os.path.join('./PKLot/PKLot/PUCPR/Sunny',dates[i])))
for i in range(len(imgs)):
for j in range(len(imgs[i])):
if(imgs[i][j][-4:] == ".jpg"):
try:
img_location = os.path.join('./PKLot/PKLot/PUCPR/Sunny',dates[i],imgs[i][j])
locs = ET.parse(img_location[:-4] + ".xml").getroot()
print(img_location,end=" ")
average = calcAvg(cv2.imread(img_location),locs)
if not(average == {}):
averages[img_location] = average
back_file.write("'"+img_location + "':" + str(average))
except Exception:
continue
back_file.write("}")
js = json.dumps(averages)
print(js)
fp = open('data.json', 'w')
fp.write(js)
fp.close()
generateAvg()

+ 1
- 2
server_side/api/modules/navigation.py View File

@ -159,8 +159,7 @@ class Transit(Resource):
& set([x for n in stops_arr["dest"] for x in stops_arr["dest"][n]])))}
travel = {"routes":[], "total":[]}
# time_cur = datetime.datetime.today().time()
time_cur = datetime.datetime.strptime("13:00", "%H:%M")
time_cur = datetime.datetime.today().time()
if len(one_bus) > 0:
for i in one_bus:


+ 28
- 0
server_side/api/modules/smart_parking.py View File

@ -0,0 +1,28 @@
import os
import copy
import json
from flask import Flask, request
from flask_restful import Resource, Api, abort
app = Flask(__name__)
api = Api(app)
class Empty(Resource):
def get(self):
try:
rating = copy.deepcopy(ratings[rating_id - 1])
del rating['rates']
return rating
except:
abort(404, error="Rating {} doesn't exist".format(rating_id))

+ 62568
- 0
server_side/api/modules/timely.json
File diff suppressed because it is too large
View File


+ 1
- 3
server_side/api/modules/user_info.py View File

@ -3,8 +3,6 @@ import copy
import json
import base64
from api.modules import utils
from flask import Flask, request
@ -53,7 +51,7 @@ class Users(Resource):
class User(Resource):
def get(self, user_id):
try:
user = utils.find_by_id( users.values(), user_id )
user = copy.deepcopy(utils.find_by_id( users.values(), user_id ))
if not user:
raise Exception('User not found!')
del user['password']


Loading…
Cancel
Save