| @@ -0,0 +1,115 @@ | ||
| /* | ||
| * Copyright 2010-2011 Vasily Romanikhin bac1ca89@gmail.com | ||
| * | ||
| * Redistribution and use in source and binary forms, with or without | ||
| * modification, are permitted provided that the following conditions | ||
| * are met: | ||
| * | ||
| * 1. Redistributions of source code must retain the above copyright | ||
| * notice, this list of conditions and the following disclaimer. | ||
| * 2. Redistributions in binary form must reproduce the above copyright | ||
| * notice, this list of conditions and the following disclaimer in the | ||
| * documentation and/or other materials provided with the distribution. | ||
| * | ||
| * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AS IS'' AND ANY EXPRESS OR | ||
| * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
| * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
| * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| * | ||
| * 3. The name of the author may not be used to endorse or promote | ||
| * products derived from this software without specific prior written | ||
| * permission. | ||
| * | ||
| * The advertising clause requiring mention in adverts must never be included. | ||
| */ | ||
|
|
||
| /*! --------------------------------------------------------------- | ||
| * PROJ: OSLL/geo2tag | ||
| * ---------------------------------------------------------------- */ | ||
|
|
||
| package ru.spb.osll.GDS; | ||
|
|
||
| import android.app.Service; | ||
| import android.content.Context; | ||
| import android.content.Intent; | ||
| import android.location.Location; | ||
| import android.location.LocationListener; | ||
| import android.location.LocationManager; | ||
| import android.os.Bundle; | ||
| import android.os.IBinder; | ||
| import android.util.Log; | ||
|
|
||
| public class LocationService extends Service { | ||
|
|
||
| public static String LOG = "GDS-LocationService"; | ||
|
|
||
| private LocationManager myLocationManager; | ||
|
|
||
| @Override | ||
| public void onCreate() { | ||
| super.onCreate(); | ||
| Log.v(LOG, "location service create"); | ||
|
|
||
| myLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); | ||
| myLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener); | ||
| } | ||
|
|
||
| @Override | ||
| public void onStart(Intent intent, int startId) { | ||
| super.onStart(intent, startId); | ||
| Log.v(LOG, "location service start"); | ||
| } | ||
|
|
||
| @Override | ||
| public void onDestroy() { | ||
| super.onDestroy(); | ||
| Log.v(LOG, "location service destroy"); | ||
| myLocationManager.removeUpdates(locationListener); | ||
| } | ||
|
|
||
| @Override | ||
| public IBinder onBind(Intent intent) { | ||
| return null; | ||
| } | ||
|
|
||
| private LocationListener locationListener = new LocationListener() { | ||
| public void onLocationChanged(Location location) { | ||
| if (location != null){ | ||
| Log.v(LOG, "onLocationChanged " + location.toString()); | ||
| } | ||
| } | ||
|
|
||
| public void onStatusChanged(String provider, int status, Bundle extras) { | ||
| Log.v(LOG, "onStatusChanged " + provider + " " + status + " " + extras); | ||
| } | ||
|
|
||
| public void onProviderEnabled(String provider) { | ||
| //Log.v(TrackerActivity.LOG, "onProviderEnabled " + provider); | ||
| } | ||
|
|
||
| public void onProviderDisabled(String provider) { | ||
| //Log.v(TrackerActivity.LOG, "onProviderDisabled " + provider); | ||
| } | ||
| }; | ||
|
|
||
| public static Location getLocation(Context context) { | ||
| Location location = null; | ||
| String provider = LocationManager.NETWORK_PROVIDER; | ||
| LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); | ||
|
|
||
| if (locationManager != null) { | ||
| if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { | ||
| provider = LocationManager.GPS_PROVIDER; | ||
| } | ||
| location = locationManager.getLastKnownLocation(provider); | ||
| } | ||
| return location; | ||
| } | ||
|
|
||
| } |
| @@ -0,0 +1,82 @@ | ||
| package ru.spb.osll.GDS; | ||
|
|
||
| import ru.spb.osll.GDS.events.EventsManager; | ||
| import ru.spb.osll.GDS.events.EventsReceiver; | ||
| import ru.spb.osll.GDS.preferences.Settings.IGDSSettings; | ||
| import ru.spb.osll.objects.Mark; | ||
| import android.content.IntentFilter; | ||
| import android.os.Bundle; | ||
| import android.util.Log; | ||
| import android.view.View; | ||
| import android.widget.Toast; | ||
|
|
||
| import com.google.android.maps.MapActivity; | ||
| import com.google.android.maps.MapView; | ||
|
|
||
| public class MapTabActivity extends MapActivity { | ||
|
|
||
| EventsManager m_eventsManager; | ||
| String m_authToken; | ||
| MapView m_mapView; | ||
|
|
||
| @Override | ||
| protected void onCreate(Bundle icicle) { | ||
| super.onCreate(icicle); | ||
| setContentView(R.layout.map_tab_view); | ||
|
|
||
| Bundle extras = getIntent().getExtras(); | ||
| if (extras != null) { | ||
| m_authToken = extras.getString(LoginActivity.AUTH_TOKEN); | ||
| } | ||
| if (m_authToken == null) { | ||
| Log.v(IGDSSettings.LOG, "problem with extracting data in MapTabActivity"); | ||
| Toast.makeText(this, "Can't create events tab", Toast.LENGTH_LONG).show(); | ||
| finish(); | ||
| return; | ||
| } | ||
|
|
||
| registerReceiver(m_eventsReceiver, new IntentFilter(EventsReceiver.ACTION_EVENTS)); | ||
|
|
||
| m_mapView = (MapView) findViewById(R.id.mapview); | ||
| m_mapView.setVisibility(View.GONE); | ||
| m_mapView.setBuiltInZoomControls(true); | ||
|
|
||
| m_eventsManager = new EventsManager(); | ||
| m_eventsManager.setData(m_authToken); | ||
| m_eventsManager.startEventsService(this); | ||
| } | ||
|
|
||
| @Override | ||
| protected void onDestroy() { | ||
| super.onDestroy(); | ||
| m_eventsManager.stopEventsService(this); | ||
| unregisterReceiver(m_eventsReceiver); | ||
| } | ||
|
|
||
| @Override | ||
| protected boolean isRouteDisplayed() { | ||
| return false; | ||
| } | ||
|
|
||
| private EventsReceiver m_eventsReceiver = new EventsReceiver() { | ||
| @Override | ||
| public void onEvents(final Mark[] marks) { | ||
| runOnUiThread(new Runnable() { | ||
| @Override | ||
| public void run() { | ||
| for (Mark mark : marks) { | ||
| Log.v(IGDSSettings.LOG, mark.toString()); | ||
| } | ||
| } | ||
| }); | ||
| } | ||
| @Override | ||
| public void onErrorOccured(String error) { | ||
| runOnUiThread(new Runnable() { | ||
| @Override | ||
| public void run() { | ||
| } | ||
| }); | ||
| } | ||
| }; | ||
| } |
| @@ -0,0 +1,44 @@ | ||
| package ru.spb.osll.GDS.events; | ||
|
|
||
| import ru.spb.osll.GDS.utils.GDSUtil; | ||
| import android.content.Context; | ||
| import android.content.Intent; | ||
|
|
||
| public class EventsManager { | ||
|
|
||
| public static final String LOG = "GDS_Events_service"; | ||
| public static final String AUTH_TOKEN = "auth_token"; | ||
| public static final String EVENTS_CHANNEL = "Events"; | ||
| public static final int INTERVAL = 7; | ||
| public static final int RADIUS = 30; | ||
| public static final int RELEVANT_PERIOD_IN_HOURS = 240; | ||
|
|
||
| private String m_authToken; | ||
|
|
||
| public EventsManager() { | ||
| m_authToken = ""; | ||
| } | ||
|
|
||
| public EventsManager(String authToken) { | ||
| m_authToken = authToken; | ||
| } | ||
|
|
||
| public void setData(String authToken) { | ||
| m_authToken = authToken; | ||
| } | ||
|
|
||
| public void startEventsService(Context c) { | ||
| Intent i = new Intent(c, EventsService.class); | ||
| i.putExtra(AUTH_TOKEN, m_authToken); | ||
| c.startService(i); | ||
| } | ||
|
|
||
| public void stopEventsService(Context c) { | ||
| c.stopService(new Intent(c, EventsService.class)); | ||
| } | ||
|
|
||
| public boolean isEventsServieRunning(Context c) { | ||
| return GDSUtil.isServiceRunning(c, EventsService.class.getName()); | ||
| } | ||
|
|
||
| } |
| @@ -0,0 +1,43 @@ | ||
| package ru.spb.osll.GDS.events; | ||
|
|
||
| import ru.spb.osll.objects.Mark; | ||
| import android.content.BroadcastReceiver; | ||
| import android.content.Context; | ||
| import android.content.Intent; | ||
| import android.os.Parcelable; | ||
|
|
||
| public abstract class EventsReceiver extends BroadcastReceiver { | ||
|
|
||
| public static final String ACTION_EVENTS = "osll.gds.events"; | ||
|
|
||
| public static final String TYPE_OPERATION = "gds.type"; | ||
| public static final int TYPE_ERROR = 0; | ||
| public static final int TYPE_EVENTS = 1; | ||
|
|
||
| public static final String ERROR = "type.error"; | ||
| public static final String EVENTS = "type.events"; | ||
| public static final String LONLAT = "type.lonlat"; | ||
|
|
||
| @Override | ||
| public void onReceive(Context context, Intent intent) { | ||
| int type = intent.getIntExtra(TYPE_OPERATION, -1); | ||
| switch (type) { | ||
| case TYPE_ERROR: | ||
| onErrorOccured(intent.getStringExtra(ERROR)); | ||
| break; | ||
| case TYPE_EVENTS: | ||
| Parcelable[] result = intent.getParcelableArrayExtra(EVENTS); | ||
| Mark[] marks = new Mark[result.length]; | ||
| for (int i = 0; i < result.length; ++i) { | ||
| marks[i] = (Mark) result[i]; | ||
| } | ||
| onEvents(marks); | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| public abstract void onErrorOccured(String error); | ||
|
|
||
| public abstract void onEvents(Mark[] mark); | ||
|
|
||
| } |
| @@ -0,0 +1,199 @@ | ||
| package ru.spb.osll.GDS.events; | ||
|
|
||
| import java.util.Calendar; | ||
| import java.util.Date; | ||
| import java.util.List; | ||
|
|
||
| import org.json.JSONObject; | ||
|
|
||
| import ru.spb.osll.GDS.LocationService; | ||
| import ru.spb.osll.GDS.exception.ExceptionHandler; | ||
| import ru.spb.osll.GDS.preferences.Settings; | ||
| import ru.spb.osll.GDS.preferences.Settings.IGDSSettings; | ||
| import ru.spb.osll.GDS.utils.GDSUtil; | ||
| import ru.spb.osll.json.IRequest.IResponse; | ||
| import ru.spb.osll.json.JsonFilterCircleRequest; | ||
| import ru.spb.osll.json.JsonFilterResponse; | ||
| import ru.spb.osll.objects.Channel; | ||
| import ru.spb.osll.objects.Mark; | ||
| import android.app.Service; | ||
| import android.content.BroadcastReceiver; | ||
| import android.content.Context; | ||
| import android.content.Intent; | ||
| import android.content.IntentFilter; | ||
| import android.location.Location; | ||
| import android.os.Bundle; | ||
| import android.os.IBinder; | ||
| import android.os.SystemClock; | ||
| import android.util.Log; | ||
|
|
||
| public class EventsService extends Service { | ||
|
|
||
| private String m_authToken = null; | ||
| private Thread m_eventsThread; | ||
| private InternalReceiver m_internalReceiver = new InternalReceiver(); | ||
| private Settings m_settings; | ||
|
|
||
| @Override | ||
| public IBinder onBind(Intent arg0) { | ||
| return null; | ||
| } | ||
|
|
||
| @Override | ||
| public void onCreate() { | ||
| Log.v(EventsManager.LOG, "EventsService create"); | ||
|
|
||
| super.onCreate(); | ||
| Thread.setDefaultUncaughtExceptionHandler(new ExceptionHandler(this)); | ||
|
|
||
| m_settings = new Settings(this); | ||
| registerReceiver(m_internalReceiver, new IntentFilter(InternalReceiver.ACTION)); | ||
| LocationService.getLocation(this); | ||
| } | ||
|
|
||
| @Override | ||
| public void onStart(Intent intent, int startId) { | ||
| Log.v(EventsManager.LOG, "EventsService start"); | ||
| super.onStart(intent, startId); | ||
|
|
||
| Bundle extras =intent.getExtras(); | ||
| if (extras != null) { | ||
| m_authToken = extras.getString(EventsManager.AUTH_TOKEN); | ||
| } | ||
| if (m_authToken == null) { | ||
| Log.v(EventsManager.LOG, "problem with extracting data"); | ||
| broadcastError("Failed to start tracking"); | ||
| stopSelf(); | ||
| return; | ||
| } | ||
|
|
||
| startEventsThread(); | ||
| } | ||
|
|
||
| @Override | ||
| public void onDestroy() { | ||
| Log.v(EventsManager.LOG, "EventsService destroy"); | ||
| super.onDestroy(); | ||
| stopEventsTread(); | ||
| unregisterReceiver(m_internalReceiver); | ||
| } | ||
|
|
||
| protected void stopEventsTread(){ | ||
| if (m_eventsThread != null){ | ||
| m_eventsThread.interrupt(); | ||
| } | ||
| } | ||
|
|
||
| protected void startEventsThread(){ | ||
| if (m_eventsThread != null){ | ||
| m_eventsThread.interrupt(); | ||
| } | ||
| m_eventsThread = new Thread(new Runnable() { | ||
| @Override | ||
| public void run() { | ||
| while (!Thread.currentThread().isInterrupted()){ | ||
| Location location = LocationService.getLocation(EventsService.this); | ||
| if (location == null) { | ||
| Log.v(EventsManager.LOG, "can't get location"); | ||
| } else { | ||
| Log.v(EventsManager.LOG, "coords: " + location.getLatitude() | ||
| + ", " + location.getLongitude()); | ||
| requestEvents(location); | ||
| } | ||
|
|
||
| SystemClock.sleep(EventsManager.INTERVAL * 1000); | ||
| } | ||
| } | ||
| }); | ||
| m_eventsThread.start(); | ||
| } | ||
|
|
||
| private void requestEvents(Location location) { | ||
| String serverUrl = m_settings.getServerUrl(); | ||
| JSONObject JSONResponse = null; | ||
| for(int i = 0; i < IGDSSettings.ATTEMPTS; i++){ | ||
| Calendar calendar = Calendar.getInstance(); | ||
| calendar.setTime(new Date()); | ||
| calendar.add(Calendar.YEAR, 1); // just in case | ||
| String timeTo = GDSUtil.getTime(calendar.getTime()); | ||
| calendar.add(Calendar.YEAR, -1); // return current date | ||
| calendar.add(Calendar.HOUR, - EventsManager.RELEVANT_PERIOD_IN_HOURS); | ||
| String timeFrom = GDSUtil.getTime(calendar.getTime()); | ||
| JSONResponse = new JsonFilterCircleRequest(m_authToken, | ||
| location.getLatitude(), location.getLongitude(), | ||
| EventsManager.RADIUS, timeFrom, timeTo, | ||
| serverUrl).doRequest(); | ||
| if (JSONResponse != null) | ||
| break; | ||
| } | ||
| if (JSONResponse != null) { | ||
| int errno = JsonFilterResponse.parseErrno(JSONResponse); | ||
| if (errno == IResponse.geo2tagError.SUCCESS.ordinal()) { | ||
| Log.v(EventsManager.LOG, "Events received successfully"); | ||
| JsonFilterResponse response = new JsonFilterResponse(); | ||
| response.parseJson(JSONResponse); | ||
| List<Channel> channels = response.getChannelsData(); | ||
| for (Channel channel : channels) { | ||
| if (channel.getName().compareTo("Events") == 0) { | ||
| broadcastEvents(channel); | ||
| } | ||
| } | ||
| } else { | ||
| handleError(errno); | ||
| return; | ||
| } | ||
| } else { | ||
| Log.v(EventsManager.LOG, "response failed"); | ||
| broadcastError("Failed to send location"); | ||
| return; | ||
| } | ||
| } | ||
|
|
||
| private void handleError(int errno) { | ||
| if (errno < 0) { | ||
| Log.v(EventsManager.LOG, "bad response received"); | ||
| } else if (errno >= IResponse.geo2tagError.values().length) { | ||
| Log.v(EventsManager.LOG, "unknown error"); | ||
| } else if (errno > 0) { | ||
| String error = IResponse.geo2tagError.values()[errno].name(); | ||
| Log.v(EventsManager.LOG, "error: " + error); | ||
| } | ||
| broadcastError("Failed to send location"); | ||
| } | ||
|
|
||
|
|
||
|
|
||
| public class InternalReceiver extends BroadcastReceiver { | ||
| public static final String ACTION = "osll.gds.events.internal"; | ||
| public static final String TYPE_SIGNAL = "osll.gds.signal"; | ||
|
|
||
| public static final int SIGNAL_UPDATE_SETTINGS = 0; | ||
|
|
||
| @Override | ||
| public void onReceive(Context context, Intent intent) { | ||
| int type = intent.getIntExtra(TYPE_SIGNAL, -1); | ||
| switch (type) { | ||
| case SIGNAL_UPDATE_SETTINGS: | ||
| //refreshSCache(); | ||
| //onSettingUpdated(); | ||
| break; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| private void broadcastError(String error) { | ||
| Intent intent = new Intent(EventsReceiver.ACTION_EVENTS); | ||
| intent.putExtra(EventsReceiver.TYPE_OPERATION, EventsReceiver.TYPE_ERROR); | ||
| intent.putExtra(EventsReceiver.ERROR, error); | ||
| sendBroadcast(intent); | ||
| } | ||
|
|
||
| private void broadcastEvents(Channel eventsChannel) { | ||
| Intent intent = new Intent(EventsReceiver.ACTION_EVENTS); | ||
| intent.putExtra(EventsReceiver.TYPE_OPERATION, EventsReceiver.TYPE_EVENTS); | ||
| Mark[] marks = eventsChannel.getMarks().toArray(new Mark[0]); | ||
| intent.putExtra(EventsReceiver.EVENTS, marks); | ||
| sendBroadcast(intent); | ||
| } | ||
|
|
||
| } |
| @@ -0,0 +1,46 @@ | ||
| package ru.spb.osll.GDS.tracking; | ||
|
|
||
| import ru.spb.osll.GDS.utils.GDSUtil; | ||
| import android.content.Context; | ||
| import android.content.Intent; | ||
|
|
||
| public class TrackingManager { | ||
|
|
||
| public static final String LOG = "GDS_Tracking_service"; | ||
| public static final String AUTH_TOKEN = "auth_token"; | ||
| public static final String CHANNEL = "channel"; | ||
|
|
||
| private String m_authToken; | ||
| private String m_channel; | ||
|
|
||
| public TrackingManager() { | ||
| m_authToken = ""; | ||
| m_channel = ""; | ||
| } | ||
|
|
||
| public TrackingManager(String authToken, String channel) { | ||
| m_authToken = authToken; | ||
| m_channel = channel; | ||
| } | ||
|
|
||
| public void setData(String authToken, String channel) { | ||
| m_authToken = authToken; | ||
| m_channel = channel; | ||
| } | ||
|
|
||
| public void startTracking(Context c) { | ||
| Intent i = new Intent(c, TrackingService.class); | ||
| i.putExtra(AUTH_TOKEN, m_authToken); | ||
| i.putExtra(CHANNEL, m_channel); | ||
| c.startService(i); | ||
| } | ||
|
|
||
| public void stopTracking(Context c) { | ||
| c.stopService(new Intent(c, TrackingService.class)); | ||
| } | ||
|
|
||
| public boolean isTracking(Context c) { | ||
| return GDSUtil.isServiceRunning(c, TrackingService.class.getName()); | ||
| } | ||
|
|
||
| } |
| @@ -0,0 +1,35 @@ | ||
| package ru.spb.osll.GDS.tracking; | ||
|
|
||
| import android.content.BroadcastReceiver; | ||
| import android.content.Context; | ||
| import android.content.Intent; | ||
|
|
||
| public abstract class TrackingReceiver extends BroadcastReceiver { | ||
|
|
||
| public static final String ACTION_TRACKING = "osll.gds.tracking"; | ||
|
|
||
| public static final String TYPE_OPERATION = "gds.type"; | ||
| public static final int TYPE_ERROR = 0; | ||
| public static final int TYPE_MARK_SENT = 1; | ||
|
|
||
| public static final String ERROR = "type.error"; | ||
| public static final String LONLAT = "type.lonlat"; | ||
|
|
||
| @Override | ||
| public void onReceive(Context context, Intent intent) { | ||
| int type = intent.getIntExtra(TYPE_OPERATION, -1); | ||
| switch (type) { | ||
| case TYPE_ERROR: | ||
| onErrorOccured(intent.getStringExtra(ERROR)); | ||
| break; | ||
| case TYPE_MARK_SENT: | ||
| onMarkSent(intent.getStringExtra(LONLAT)); | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| public abstract void onErrorOccured(String error); | ||
|
|
||
| public abstract void onMarkSent(String lonlat); | ||
|
|
||
| } |
| @@ -0,0 +1,236 @@ | ||
| package ru.spb.osll.GDS.tracking; | ||
|
|
||
| import java.util.Date; | ||
|
|
||
| import org.json.JSONObject; | ||
|
|
||
| import ru.spb.osll.GDS.exception.ExceptionHandler; | ||
| import ru.spb.osll.GDS.preferences.Settings; | ||
| import ru.spb.osll.GDS.preferences.Settings.IGDSSettings; | ||
| import ru.spb.osll.GDS.utils.GDSUtil; | ||
| import ru.spb.osll.json.JsonApplyMarkRequest; | ||
| import ru.spb.osll.json.JsonBaseResponse; | ||
| import ru.spb.osll.json.IRequest.IResponse; | ||
| import android.app.Service; | ||
| import android.content.BroadcastReceiver; | ||
| import android.content.Context; | ||
| import android.content.Intent; | ||
| import android.content.IntentFilter; | ||
| import android.location.Location; | ||
| import android.location.LocationListener; | ||
| import android.location.LocationManager; | ||
| import android.os.Bundle; | ||
| import android.os.IBinder; | ||
| import android.os.SystemClock; | ||
| import android.util.Log; | ||
|
|
||
| public class TrackingService extends Service { | ||
|
|
||
| public static final int INTERVAL = 7; | ||
|
|
||
| private String m_authToken = null; | ||
| private String m_channel = null; | ||
| private LocationManager m_locationManager; | ||
| private boolean m_isDeviceReady = false; | ||
| private Thread m_trackThread; | ||
| private InternalReceiver m_internalReceiver = new InternalReceiver(); | ||
| private Settings m_settings; | ||
|
|
||
| @Override | ||
| public IBinder onBind(Intent arg0) { | ||
| return null; | ||
| } | ||
|
|
||
| @Override | ||
| public void onCreate() { | ||
| Log.v(TrackingManager.LOG, "TrackingService create"); | ||
|
|
||
| super.onCreate(); | ||
| Thread.setDefaultUncaughtExceptionHandler(new ExceptionHandler(this)); | ||
|
|
||
| m_settings = new Settings(this); | ||
| m_locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); | ||
| m_locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, m_locationListener); | ||
| registerReceiver(m_internalReceiver, new IntentFilter(InternalReceiver.ACTION)); | ||
| getLocation(); | ||
| } | ||
|
|
||
| @Override | ||
| public void onStart(Intent intent, int startId) { | ||
| Log.v(TrackingManager.LOG, "TrackingService start"); | ||
| super.onStart(intent, startId); | ||
| m_isDeviceReady = false; // TODO check device | ||
|
|
||
| Bundle extras =intent.getExtras(); | ||
| if (extras != null) { | ||
| m_authToken = extras.getString(TrackingManager.AUTH_TOKEN); | ||
| m_channel = extras.getString(TrackingManager.CHANNEL); | ||
| } | ||
| if (m_authToken == null || m_channel == null) { | ||
| Log.v(TrackingManager.LOG, "problem with extracting data"); | ||
| broadcastError("Failed to start tracking"); | ||
| stopSelf(); | ||
| return; | ||
| } | ||
|
|
||
| //startTracking(); // TODO for testing on AVD | ||
| } | ||
|
|
||
| @Override | ||
| public void onDestroy() { | ||
| Log.v(TrackingManager.LOG, "TrackingService destroy"); | ||
| super.onDestroy(); | ||
|
|
||
| stopTracking(); | ||
| m_locationManager.removeUpdates(m_locationListener); | ||
| unregisterReceiver(m_internalReceiver); | ||
| } | ||
|
|
||
| private LocationListener m_locationListener = new LocationListener() { | ||
| public void onLocationChanged(Location location) { | ||
| if (!m_isDeviceReady && location != null){ | ||
| m_isDeviceReady = true; | ||
| onLocationDeviceStatusChanged(true); | ||
| } else if (m_isDeviceReady && location == null) { | ||
| m_isDeviceReady = false; | ||
| onLocationDeviceStatusChanged(false); | ||
| } | ||
| } | ||
| public void onStatusChanged(String provider, int status, Bundle extras) {} | ||
| public void onProviderEnabled(String provider) {} | ||
| public void onProviderDisabled(String provider) {} | ||
| }; | ||
|
|
||
| public Location getLocation() { | ||
| Location location = null; | ||
| String provider = LocationManager.NETWORK_PROVIDER; | ||
| LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); | ||
|
|
||
| if (locationManager != null) { | ||
| if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { | ||
| provider = LocationManager.GPS_PROVIDER; | ||
| } | ||
| location = locationManager.getLastKnownLocation(provider); | ||
| } | ||
| return location; | ||
| } | ||
|
|
||
| protected void onLocationDeviceStatusChanged(boolean isReady) { | ||
| Log.v(TrackingManager.LOG, "onLocationDeviceStatusChanged: " + isReady); | ||
| if (isReady) { | ||
| startTracking(); | ||
| } else { | ||
| stopTracking(); | ||
| } | ||
| } | ||
|
|
||
| protected void stopTracking(){ | ||
| if (m_trackThread != null){ | ||
| m_trackThread.interrupt(); | ||
| } | ||
| } | ||
|
|
||
| protected void startTracking(){ | ||
| if (m_trackThread != null){ | ||
| m_trackThread.interrupt(); | ||
| } | ||
| m_trackThread = new Thread(new Runnable() { | ||
| @Override | ||
| public void run() { | ||
| while (!Thread.currentThread().isInterrupted()){ | ||
| Location location = getLocation(); | ||
| Log.v(TrackingManager.LOG, "coords: " + location.getLatitude() | ||
| + ", " + location.getLongitude()); | ||
|
|
||
| sendMark(location); | ||
|
|
||
| SystemClock.sleep(INTERVAL * 1000); | ||
| } | ||
| } | ||
| }); | ||
| m_trackThread.start(); | ||
| } | ||
|
|
||
| private void sendMark(Location location) { | ||
| String serverUrl = m_settings.getServerUrl(); | ||
| JSONObject JSONResponse = null; | ||
| for(int i = 0; i < IGDSSettings.ATTEMPTS; i++){ | ||
| JSONResponse = new JsonApplyMarkRequest(m_authToken, m_channel, "gds tracker", "", | ||
| "gds tracker", location.getLatitude(), location.getLongitude(), 0, | ||
| GDSUtil.getTime(new Date()), serverUrl).doRequest(); | ||
| if (JSONResponse != null) | ||
| break; | ||
| } | ||
| if (JSONResponse != null) { | ||
| int errno = JsonBaseResponse.parseErrno(JSONResponse); | ||
| if (errno == IResponse.geo2tagError.SUCCESS.ordinal()) { | ||
| Log.v(TrackingManager.LOG, "Mark sent successfully"); | ||
| broadcastMarkSent(location); | ||
| } else { | ||
| handleError(errno); | ||
| return; | ||
| } | ||
| } else { | ||
| Log.v(TrackingManager.LOG, "response failed"); | ||
| broadcastError("Failed to send location"); | ||
| return; | ||
| } | ||
| } | ||
|
|
||
| private void handleError(int errno) { | ||
| if (errno < 0) { | ||
| Log.v(TrackingManager.LOG, "bad response received"); | ||
| } else if (errno >= IResponse.geo2tagError.values().length) { | ||
| Log.v(TrackingManager.LOG, "unknown error"); | ||
| } else if (errno > 0) { | ||
| String error = IResponse.geo2tagError.values()[errno].name(); | ||
| Log.v(TrackingManager.LOG, "error: " + error); | ||
| } | ||
| broadcastError("Failed to send location"); | ||
| } | ||
|
|
||
|
|
||
|
|
||
| public class InternalReceiver extends BroadcastReceiver { | ||
| public static final String ACTION = "osll.gds.tracking.internal"; | ||
| public static final String TYPE_SIGNAL = "osll.gds.signal"; | ||
|
|
||
| public static final int SIGNAL_UPDATE_SETTINGS = 0; | ||
| public static final int SIGNAL_SEND_HISTORY = 1; | ||
| public static final int SIGNAL_SEND_COORDINATE = 2; | ||
|
|
||
| @Override | ||
| public void onReceive(Context context, Intent intent) { | ||
| int type = intent.getIntExtra(TYPE_SIGNAL, -1); | ||
| switch (type) { | ||
| case SIGNAL_UPDATE_SETTINGS: | ||
| //refreshSCache(); | ||
| //onSettingUpdated(); | ||
| break; | ||
| case SIGNAL_SEND_HISTORY: | ||
| //refreshSCache(); | ||
| //sendHistory(); | ||
| break; | ||
| case SIGNAL_SEND_COORDINATE: | ||
| //refreshSCache(); | ||
| //sendLastCoordinate(); | ||
| break; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| private void broadcastError(String error) { | ||
| Intent intent = new Intent(TrackingReceiver.ACTION_TRACKING); | ||
| intent.putExtra(TrackingReceiver.TYPE_OPERATION, TrackingReceiver.TYPE_ERROR); | ||
| intent.putExtra(TrackingReceiver.ERROR, error); | ||
| sendBroadcast(intent); | ||
| } | ||
|
|
||
| private void broadcastMarkSent(Location location) { | ||
| Intent intent = new Intent(TrackingReceiver.ACTION_TRACKING); | ||
| intent.putExtra(TrackingReceiver.TYPE_OPERATION, TrackingReceiver.TYPE_MARK_SENT); | ||
| intent.putExtra(TrackingReceiver.LONLAT, GDSUtil.convertLocation(location)); | ||
| sendBroadcast(intent); | ||
| } | ||
|
|
||
| } |
| @@ -0,0 +1,46 @@ | ||
| package ru.spb.osll.GDS.utils; | ||
|
|
||
| import java.text.DateFormat; | ||
| import java.text.SimpleDateFormat; | ||
| import java.util.Date; | ||
| import ru.spb.osll.objects.Mark; | ||
| import android.app.ActivityManager; | ||
| import android.app.ActivityManager.RunningServiceInfo; | ||
| import android.content.Context; | ||
| import android.location.Location; | ||
|
|
||
| public class GDSUtil { | ||
| private static DateFormat dateFormat = new SimpleDateFormat("dd MM yyyy HH:MM:ss.SSS"); | ||
| public static String getTime(Date date){ | ||
| return dateFormat.format(date); | ||
| } | ||
|
|
||
| @SuppressWarnings("static-access") | ||
| public static boolean isServiceRunning(Context c, String serviceName){ | ||
| ActivityManager manager = (ActivityManager) c.getSystemService(c.ACTIVITY_SERVICE); | ||
| for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) { | ||
| if (serviceName.equals(service.service.getClassName())) { | ||
| return true; | ||
| } | ||
| } | ||
| return false; | ||
| } | ||
|
|
||
| public static String convertLocation(Mark mark){ | ||
| return convertLocation(mark.getLatitude(), mark.getLongitude(), 0.0); | ||
| } | ||
|
|
||
| public static String convertLocation(Location loc){ | ||
| double alt = loc.hasAltitude() ? loc.getAltitude() : 0.0; | ||
| return convertLocation(loc.getLatitude(), loc.getLongitude(), alt); | ||
| } | ||
|
|
||
| public static String convertLocation(double lat, double lon, double alt){ | ||
| StringBuffer strBuffer = new StringBuffer(); | ||
| strBuffer.append("lat: ").append(Location.convert(lat, Location.FORMAT_MINUTES)). | ||
| append(" lon: ").append(Location.convert(lon, Location.FORMAT_MINUTES)). | ||
| append(" alt: ").append(Location.convert(alt, Location.FORMAT_DEGREES)); | ||
| return strBuffer.toString(); | ||
| } | ||
|
|
||
| } |
| @@ -63,7 +63,7 @@ protected JSONObject getJsonObject() throws JSONException { | ||
|
|
||
| @Override | ||
| protected String getRequest() { | ||
| return "/service/filterCircle"; | ||
| } | ||
|
|
||
| } | ||
| @@ -0,0 +1,67 @@ | ||
| /* | ||
| * Copyright 2012 Ivan Bezyazychnyy ivan.bezyazychnyy@gmail.com | ||
| * | ||
| * Redistribution and use in source and binary forms, with or without | ||
| * modification, are permitted provided that the following conditions | ||
| * are met: | ||
| * | ||
| * 1. Redistributions of source code must retain the above copyright | ||
| * notice, this list of conditions and the following disclaimer. | ||
| * 2. Redistributions in binary form must reproduce the above copyright | ||
| * notice, this list of conditions and the following disclaimer in the | ||
| * documentation and/or other materials provided with the distribution. | ||
| * | ||
| * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AS IS'' AND ANY EXPRESS OR | ||
| * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
| * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
| * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| * | ||
| * 3. The name of the author may not be used to endorse or promote | ||
| * products derived from this software without specific prior written | ||
| * permission. | ||
| * | ||
| * The advertising clause requiring mention in adverts must never be included. | ||
| */ | ||
|
|
||
| package ru.spb.osll.json; | ||
|
|
||
| import java.io.IOException; | ||
| import java.net.URI; | ||
| import java.net.URISyntaxException; | ||
|
|
||
| import org.json.JSONException; | ||
| import org.json.JSONObject; | ||
|
|
||
| import android.util.Log; | ||
|
|
||
| import static ru.spb.osll.json.IRequest.ISubscribeChannel.*; | ||
|
|
||
| public class JsonSubscribeRequest extends JsonBaseRequest { | ||
| private String m_authToken; | ||
| private String m_channel; | ||
| private String m_serverUrl; | ||
|
|
||
| public JsonSubscribeRequest(String authToken, String channel, String serverUrl){ | ||
| m_authToken = authToken; | ||
| m_channel = channel; | ||
| m_serverUrl = serverUrl; | ||
| } | ||
|
|
||
|
|
||
| @Override | ||
| protected JSONObject doRequestInternal() throws JSONException, IOException, | ||
| URISyntaxException { | ||
| JSONObject jsonObject = new JSONObject(); | ||
| jsonObject.put(AUTH_TOKEN, m_authToken); | ||
| jsonObject.put(CHANNEL, m_channel); | ||
| Log.v(JSON_LOG, jsonObject.toString()); | ||
|
|
||
| return JsonBase.instance().doRequest(jsonObject, new URI(m_serverUrl + REQUEST)); | ||
| } | ||
| } |
| @@ -0,0 +1,36 @@ | ||
| /* | ||
| * Copyright 2012 Ivan Bezyazychnyy ivan.bezyazychnyy@gmail.com | ||
| * | ||
| * Redistribution and use in source and binary forms, with or without | ||
| * modification, are permitted provided that the following conditions | ||
| * are met: | ||
| * | ||
| * 1. Redistributions of source code must retain the above copyright | ||
| * notice, this list of conditions and the following disclaimer. | ||
| * 2. Redistributions in binary form must reproduce the above copyright | ||
| * notice, this list of conditions and the following disclaimer in the | ||
| * documentation and/or other materials provided with the distribution. | ||
| * | ||
| * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AS IS'' AND ANY EXPRESS OR | ||
| * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
| * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
| * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| * | ||
| * 3. The name of the author may not be used to endorse or promote | ||
| * products derived from this software without specific prior written | ||
| * permission. | ||
| * | ||
| * The advertising clause requiring mention in adverts must never be included. | ||
| */ | ||
|
|
||
| package ru.spb.osll.json; | ||
|
|
||
| public class JsonSubscribeResponse extends JsonOldResponse { | ||
|
|
||
| } |
| @@ -0,0 +1,11 @@ | ||
| [Desktop Entry] | ||
| Encoding=UTF-8 | ||
| Version=1.0 | ||
| Type=Application | ||
| Terminal=false | ||
| Name=HelloWorld | ||
| Exec=/opt/HelloWorld/bin/HelloWorld | ||
| Icon=HelloWorld64 | ||
| X-Window-Icon= | ||
| X-HildonDesk-ShowInToolbar=true | ||
| X-Osso-Type=application/x-executable |
| @@ -0,0 +1,122 @@ | ||
| # Add files and directories to ship with the application | ||
| # by adapting the examples below. | ||
| # file1.source = myfile | ||
| # dir1.source = mydir | ||
| DEPLOYMENTFOLDERS = # file1 dir1 | ||
|
|
||
| QT += network | ||
|
|
||
| symbian:TARGET.UID3 = 0xE6691141 | ||
|
|
||
| # Smart Installer package's UID | ||
| # This UID is from the protected range | ||
| # and therefore the package will fail to install if self-signed | ||
| # By default qmake uses the unprotected range value if unprotected UID is defined for the application | ||
| # and 0x2002CCCF value if protected UID is given to the application | ||
| #symbian:DEPLOYMENT.installer_header = 0x2002CCCF | ||
|
|
||
| # Allow network access on Symbian | ||
| symbian:TARGET.CAPABILITY += NetworkServices Location | ||
|
|
||
| CONFIG += mobility | ||
| MOBILITY += location | ||
|
|
||
| INCLUDEPATH += . inc | ||
|
|
||
| SOURCES += src/main.cpp \ | ||
| src/mainwindow.cpp \ | ||
| src/GDSService.cpp \ | ||
| src/LoginWidget.cpp \ | ||
| src/MainWidget.cpp \ | ||
| src/CreateAccountWidget.cpp \ | ||
| src/Settings.cpp \ | ||
| src/SettingsWidget.cpp | ||
| HEADERS += inc/defines.h \ | ||
| inc/mainwindow.h \ | ||
| inc/GDSService.h \ | ||
| inc/LoginWidget.h \ | ||
| inc/MainWidget.h \ | ||
| inc/CreateAccountWidget.h \ | ||
| inc/Settings.h \ | ||
| inc/SettingsWidget.h | ||
|
|
||
| # qsjon library | ||
| SOURCES += ../../../3rdparty/qjson-0.7.1/src/serializerrunnable.cpp \ | ||
| ../../../3rdparty/qjson-0.7.1/src/serializer.cpp \ | ||
| ../../../3rdparty/qjson-0.7.1/src/qobjecthelper.cpp \ | ||
| ../../../3rdparty/qjson-0.7.1/src/parserrunnable.cpp \ | ||
| ../../../3rdparty/qjson-0.7.1/src/parser.cpp \ | ||
| ../../../3rdparty/qjson-0.7.1/src/json_scanner.cpp \ | ||
| ../../../3rdparty/qjson-0.7.1/src/json_parser.cc | ||
| HEADERS += ../../../3rdparty/qjson-0.7.1/src/parser.h \ | ||
| ../../../3rdparty/qjson-0.7.1/src/serializerrunnable.h \ | ||
| ../../../3rdparty/qjson-0.7.1/src/serializer.h \ | ||
| ../../../3rdparty/qjson-0.7.1/src/qobjecthelper.h \ | ||
| ../../../3rdparty/qjson-0.7.1/src/qjson_export.h \ | ||
| ../../../3rdparty/qjson-0.7.1/src/qjson_debug.h \ | ||
| ../../../3rdparty/qjson-0.7.1/src/parser_p.h \ | ||
| ../../../3rdparty/qjson-0.7.1/src/json_scanner.h \ | ||
| ../../../3rdparty/qjson-0.7.1/src/parserrunnable.h \ | ||
| ../../../3rdparty/qjson-0.7.1/src/json_parser.hh \ | ||
| ../../../3rdparty/qjson-0.7.1/src/stack.hh \ | ||
| ../../../3rdparty/qjson-0.7.1/src/location.hh \ | ||
| ../../../3rdparty/qjson-0.7.1/src/position.hh | ||
|
|
||
| # geo2tag requests library | ||
| INCLUDEPATH += http_requests/inc json/inc common/inc | ||
| SOURCES += http_requests/src/DefaultQuery.cpp \ | ||
| http_requests/src/LoginQuery.cpp \ | ||
| http_requests/src/WriteTagQuery.cpp \ | ||
| json/src/JsonSerializer.cpp \ | ||
| json/src/LoginResponseJSON.cpp \ | ||
| json/src/LoginRequestJSON.cpp \ | ||
| json/src/JsonUser.cpp \ | ||
| json/src/WriteTagResponseJSON.cpp \ | ||
| json/src/WriteTagRequestJSON.cpp \ | ||
| json/src/JsonDataMark.cpp \ | ||
| json/src/JsonChannel.cpp \ | ||
| common/src/User.cpp \ | ||
| common/src/TimeSlot.cpp \ | ||
| common/src/DataMarks.cpp \ | ||
| common/src/Channel.cpp | ||
| #./../common/src/GpsInfo.cpp \ | ||
| #../../common/src/GpsModeller.cpp \ | ||
| #./../common/src/MobilityGps.cpp \ | ||
|
|
||
| HEADERS += http_requests/inc/DefaultQuery.h \ | ||
| http_requests/inc/LoginQuery.h \ | ||
| http_requests/inc/WriteTagQuery.h \ | ||
| json/inc/JsonSerializer.h \ | ||
| json/inc/LoginResponseJSON.h \ | ||
| json/inc/LoginRequestJSON.h \ | ||
| json/inc/JsonUser.h \ | ||
| #../../json/inc/JsonTimeSlot.h \ | ||
| json/inc/JsonDataMark.h \ | ||
| json/inc/JsonChannel.h \ | ||
| json/inc/WriteTagResponseJSON.h \ | ||
| json/inc/WriteTagRequestJSON.h \ | ||
| json/inc/DefaultResponseJSON.h \ | ||
| common/inc/ErrnoTypes.h \ | ||
| common/inc/User.h \ | ||
| common/inc/TimeSlot.h \ | ||
| common/inc/DataMarks.h \ | ||
| common/inc/Channel.h | ||
| #./../common/inc/ConcurrentVector.h \ | ||
| #./../common/inc/defines.h \ | ||
| #../../common/inc/DataChannel.h \ | ||
| #../../common/inc/symbian.h \ | ||
| #../../common/inc/GpsInfo.h \ | ||
| #../../common/inc/GpsModeller.h \ | ||
| #../../common/inc/MobilityGps.h \ | ||
|
|
||
|
|
||
| # Please do not modify the following two lines. Required for deployment. | ||
| include(deployment.pri) | ||
| qtcAddDeployment() | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
| @@ -0,0 +1,11 @@ | ||
| [Desktop Entry] | ||
| Encoding=UTF-8 | ||
| Version=1.0 | ||
| Type=Application | ||
| Terminal=false | ||
| Name=HelloWorld | ||
| Exec=/usr/bin/single-instance /opt/HelloWorld/bin/HelloWorld | ||
| Icon=/usr/share/icons/hicolor/80x80/apps/HelloWorld80.png | ||
| X-Window-Icon= | ||
| X-HildonDesk-ShowInToolbar=true | ||
| X-Osso-Type=application/x-executable |
| @@ -0,0 +1,63 @@ | ||
| /* | ||
| * Copyright 2011 bac1ca bac1ca89@gmail.com | ||
| * | ||
| * Redistribution and use in source and binary forms, with or without | ||
| * modification, are permitted provided that the following conditions | ||
| * are met: | ||
| * | ||
| * 1. Redistributions of source code must retain the above copyright | ||
| * notice, this list of conditions and the following disclaimer. | ||
| * 2. Redistributions in binary form must reproduce the above copyright | ||
| * notice, this list of conditions and the following disclaimer in the | ||
| * documentation and/or other materials provided with the distribution. | ||
| * | ||
| * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AS IS'' AND ANY EXPRESS OR | ||
| * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
| * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
| * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| * | ||
| * 3. The name of the author may not be used to endorse or promote | ||
| * products derived from this software without specific prior written | ||
| * permission. | ||
| * | ||
| * The advertising clause requiring mention in adverts must never be included. | ||
| */ | ||
|
|
||
| /*! --------------------------------------------------------------- | ||
| * \file AltitudeFilter.h | ||
| * \brief Header of AltitudeFilter | ||
| * \todo add comment here | ||
| * | ||
| * File description | ||
| * | ||
| * PROJ: OSLL/geo2tag | ||
| * ---------------------------------------------------------------- */ | ||
|
|
||
|
|
||
| #ifndef _AltitudeFilter_H_89C1C268_7B22_4E8A_B078_B4C7EC6FA5D6_INCLUDED_ | ||
| #define _AltitudeFilter_H_89C1C268_7B22_4E8A_B078_B4C7EC6FA5D6_INCLUDED_ | ||
|
|
||
| #include "Filter.h" | ||
|
|
||
| class AltitudeFilter : public Filter | ||
| { | ||
| double m_alt1; | ||
| double m_alt2; | ||
|
|
||
| public: | ||
| AltitudeFilter(double alt1, double alt2); | ||
|
|
||
| ~AltitudeFilter(); | ||
|
|
||
| bool filtrate(const QSharedPointer<DataMark> &mark); | ||
|
|
||
| }; // class AltitudeFilter | ||
|
|
||
|
|
||
| #endif //_AltitudeFilter_H_89C1C268_7B22_4E8A_B078_B4C7EC6FA5D6_INCLUDED_ |
| @@ -0,0 +1,99 @@ | ||
| /* | ||
| * Copyright 2010 OSLL osll@osll.spb.ru | ||
| * | ||
| * Redistribution and use in source and binary forms, with or without | ||
| * modification, are permitted provided that the following conditions | ||
| * are met: | ||
| * | ||
| * 1. Redistributions of source code must retain the above copyright | ||
| * notice, this list of conditions and the following disclaimer. | ||
| * 2. Redistributions in binary form must reproduce the above copyright | ||
| * notice, this list of conditions and the following disclaimer in the | ||
| * documentation and/or other materials provided with the distribution. | ||
| * | ||
| * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | ||
| * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
| * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
| * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| * | ||
| * 3. The name of the author may not be used to endorse or promote | ||
| * products derived from this software without specific prior written | ||
| * permission. | ||
| * | ||
| * The advertising clause requiring mention in adverts must never be included. | ||
| */ | ||
| /*! | ||
| * \file Channel.h | ||
| * \brief Header of Channel | ||
| * | ||
| * File description | ||
| * | ||
| * PROJ: OSLL/geo2tag | ||
| * ---------------------------------------------------------------- */ | ||
|
|
||
| #ifndef _Channel_H_480D4E41_537B_41D1_A67C_326A700DDC2D_INCLUDED_ | ||
| #define _Channel_H_480D4E41_537B_41D1_A67C_326A700DDC2D_INCLUDED_ | ||
|
|
||
| #include <QString> | ||
| #include <QVector> | ||
| #include <QSharedPointer> | ||
|
|
||
| //#include "ConcurrentVector.h" | ||
| #include "TimeSlot.h" | ||
|
|
||
| class Channel: public QObject | ||
| { | ||
| Q_OBJECT //!< channel name | ||
| QString m_name; //!< Description for channel | ||
| QString m_description; //!< URL for mark | ||
| QString m_url; //< Radius for visible marks | ||
| double m_activeRadius; //!< Displayed on the UI | ||
| bool m_isDisplayed; | ||
| QSharedPointer<TimeSlot> m_timeSlot; | ||
| bool m_timeSlotIsDefault; | ||
|
|
||
| public: | ||
|
|
||
| static const qulonglong DEFAULT_TIME_SLOT_VALUE_MIN; | ||
|
|
||
| Channel(const QString &name, const QString &description, const QString& url=""); | ||
|
|
||
| virtual qlonglong getId() const; | ||
|
|
||
| const QString& getDescription() const; | ||
|
|
||
| const QString& getName() const; | ||
|
|
||
| const QString& getUrl() const; | ||
|
|
||
| void setDescription(const QString& description); | ||
|
|
||
| void setUrl(const QString& url); | ||
|
|
||
| void setRadius(const double &radius); | ||
| double getRadius() const; | ||
|
|
||
| bool isDisplayed() const; | ||
| void setDisplayed(bool); | ||
|
|
||
| void setTimeSlot(QSharedPointer<TimeSlot> timeSlot); | ||
| QSharedPointer<TimeSlot> getTimeSlot() const; | ||
|
|
||
| bool timeSlotIsDefault() const; | ||
| void setDefaultTimeSlot(bool); | ||
|
|
||
| virtual ~Channel(); | ||
| // class Channel | ||
| }; | ||
|
|
||
| typedef ConcurrentVector<Channel> Channels; | ||
| //_Channel_H_480D4E41_537B_41D1_A67C_326A700DDC2D_INCLUDED_ | ||
| #endif | ||
|
|
||
| /* ===[ End of file ]=== */ |
| @@ -0,0 +1,53 @@ | ||
| /* | ||
| * Copyright 2010-2011 OSLL osll@osll.spb.ru | ||
| * | ||
| * Redistribution and use in source and binary forms, with or without | ||
| * modification, are permitted provided that the following conditions | ||
| * are met: | ||
| * | ||
| * 1. Redistributions of source code must retain the above copyright | ||
| * notice, this list of conditions and the following disclaimer. | ||
| * 2. Redistributions in binary form must reproduce the above copyright | ||
| * notice, this list of conditions and the following disclaimer in the | ||
| * documentation and/or other materials provided with the distribution. | ||
| * | ||
| * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | ||
| * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
| * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
| * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| * | ||
| * 3. The name of the author may not be used to endorse or promote | ||
| * products derived from this software without specific prior written | ||
| * permission. | ||
| * | ||
| * The advertising clause requiring mention in adverts must never be included. | ||
| */ | ||
| /*! | ||
| * PROJ: OSLL/geo2tag | ||
| * ---------------------------------------------------------------- */ | ||
|
|
||
| #ifndef CHANNELACTION_H | ||
| #define CHANNELACTION_H | ||
|
|
||
| #include "User.h" | ||
|
|
||
| class ChannelActions: public QObject | ||
| { | ||
| Q_OBJECT | ||
| int m_user; | ||
| int m_channel; | ||
| int m_action; | ||
|
|
||
| public: | ||
| ChannelActions(int user, int channel, int action); | ||
|
|
||
| virtual ~ChannelActions(); | ||
|
|
||
| }; | ||
| #endif // CHANNELACTION_H |
| @@ -0,0 +1,151 @@ | ||
| /* | ||
| * Copyright 2010-2011 OSLL osll@osll.spb.ru | ||
| * | ||
| * Redistribution and use in source and binary forms, with or without | ||
| * modification, are permitted provided that the following conditions | ||
| * are met: | ||
| * | ||
| * 1. Redistributions of source code must retain the above copyright | ||
| * notice, this list of conditions and the following disclaimer. | ||
| * 2. Redistributions in binary form must reproduce the above copyright | ||
| * notice, this list of conditions and the following disclaimer in the | ||
| * documentation and/or other materials provided with the distribution. | ||
| * | ||
| * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | ||
| * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
| * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
| * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| * | ||
| * 3. The name of the author may not be used to endorse or promote | ||
| * products derived from this software without specific prior written | ||
| * permission. | ||
| * | ||
| * The advertising clause requiring mention in adverts must never be included. | ||
| */ | ||
| /*! | ||
| * PROJ: OSLL/geo2tag | ||
| * ---------------------------------------------------------------- */ | ||
|
|
||
| #ifndef CONCURRENTVECTOR_H | ||
| #define CONCURRENTVECTOR_H | ||
|
|
||
| #include <QVector> | ||
| #include <QSharedPointer> | ||
| #include <QMutex> | ||
| #include <QMutexLocker> | ||
| #include <QMap> | ||
|
|
||
| template<typename T> | ||
| class ConcurrentVector | ||
| { | ||
| mutable QMutex m_lock; | ||
|
|
||
| QVector<QSharedPointer<T> > m_container; | ||
| QMap<qlonglong, QSharedPointer<T> > m_map; | ||
|
|
||
| public: | ||
|
|
||
| typedef typename QVector<QSharedPointer<T> >::iterator iterator; | ||
| typedef typename QVector<QSharedPointer<T> >::const_iterator const_iterator; | ||
|
|
||
| ConcurrentVector(const QVector<QSharedPointer<T> > &container=QVector<QSharedPointer<T> >()): | ||
| m_container(container) | ||
| { | ||
| } | ||
|
|
||
| ConcurrentVector(const ConcurrentVector<T>& obj):m_container(obj.m_container) | ||
| { | ||
| } | ||
|
|
||
| void push_back(const QSharedPointer<T>& obj) | ||
| { | ||
| QMutexLocker locker(&m_lock); | ||
| if(!m_map.contains(obj->getId())) | ||
| { | ||
| m_container.push_back(obj); | ||
| m_map.insert(obj->getId(), obj); | ||
| } | ||
| } | ||
|
|
||
| const QSharedPointer<T>& at(int i) const | ||
| { | ||
| QMutexLocker locker(&m_lock); | ||
| return m_container.at(i); | ||
| } | ||
|
|
||
| const QSharedPointer<T>& operator [](int i) const | ||
| { | ||
| QMutexLocker locker(&m_lock); | ||
| return m_container[i]; | ||
| } | ||
|
|
||
| QSharedPointer<T>& operator [](int i) | ||
| { | ||
| QMutexLocker locker(&m_lock); | ||
| return m_container[i]; | ||
| } | ||
|
|
||
| int size() const | ||
| { | ||
| QMutexLocker locker(&m_lock); | ||
| return m_container.size(); | ||
| } | ||
|
|
||
| bool exist(qlonglong objectId) const | ||
| { | ||
| QMutexLocker locker(&m_lock); | ||
| return m_map.contains(objectId); | ||
| } | ||
|
|
||
| const QSharedPointer<T>& item(qlonglong id) const | ||
| { | ||
| QMutexLocker locker(&m_lock); | ||
| return m_map.value(id); | ||
| } | ||
|
|
||
| QSharedPointer<T>& item(qlonglong id) | ||
| { | ||
| QMutexLocker locker(&m_lock); | ||
| return m_map[id]; | ||
| } | ||
|
|
||
| void merge(const ConcurrentVector<T>& vector) | ||
| { | ||
| for(int i=0; i<vector.size(); i++) | ||
| { | ||
| if(exist(vector.at(i)->getId())) | ||
| continue; | ||
| push_back(vector.at(i)); | ||
| } | ||
| } | ||
|
|
||
| void erase(const QSharedPointer<T> &val) | ||
| { | ||
| QMutexLocker locker(&m_lock); | ||
| int i = m_container.indexOf(val); | ||
| if(i != -1) | ||
| m_container.remove(i); | ||
| } | ||
|
|
||
| QVector<QSharedPointer<T> > vector() const | ||
| { | ||
| QMutexLocker locker(&m_lock); | ||
| return m_container; | ||
| } | ||
|
|
||
| void clear() | ||
| { | ||
| QMutexLocker locker(&m_lock); | ||
| m_container.clear(); | ||
| m_map.clear(); | ||
| } | ||
|
|
||
| }; | ||
| // CONCURRENTVECTOR_H | ||
| #endif |
| @@ -0,0 +1,44 @@ | ||
| /* | ||
| * Copyright 2010-2011 OSLL osll@osll.spb.ru | ||
| * | ||
| * Redistribution and use in source and binary forms, with or without | ||
| * modification, are permitted provided that the following conditions | ||
| * are met: | ||
| * | ||
| * 1. Redistributions of source code must retain the above copyright | ||
| * notice, this list of conditions and the following disclaimer. | ||
| * 2. Redistributions in binary form must reproduce the above copyright | ||
| * notice, this list of conditions and the following disclaimer in the | ||
| * documentation and/or other materials provided with the distribution. | ||
| * | ||
| * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | ||
| * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
| * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
| * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| * | ||
| * 3. The name of the author may not be used to endorse or promote | ||
| * products derived from this software without specific prior written | ||
| * permission. | ||
| * | ||
| * The advertising clause requiring mention in adverts must never be included. | ||
| */ | ||
| /*! | ||
| * PROJ: OSLL/geo2tag | ||
| * ---------------------------------------------------------------- */ | ||
|
|
||
| #ifndef DATACHANNEL_H | ||
| #define DATACHANNEL_H | ||
|
|
||
| #include <QMultiHash> | ||
| #include "Channel.h" | ||
| #include "DataMarks.h" | ||
|
|
||
| typedef QMultiMap<QSharedPointer<Channel>, QSharedPointer<DataMark> > DataChannels; | ||
| // DATACHANNEL_H | ||
| #endif |
| @@ -0,0 +1,123 @@ | ||
| /* | ||
| * Copyright 2010 OSLL osll@osll.spb.ru | ||
| * | ||
| * Redistribution and use in source and binary forms, with or without | ||
| * modification, are permitted provided that the following conditions | ||
| * are met: | ||
| * | ||
| * 1. Redistributions of source code must retain the above copyright | ||
| * notice, this list of conditions and the following disclaimer. | ||
| * 2. Redistributions in binary form must reproduce the above copyright | ||
| * notice, this list of conditions and the following disclaimer in the | ||
| * documentation and/or other materials provided with the distribution. | ||
| * | ||
| * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | ||
| * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
| * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
| * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| * | ||
| * 3. The name of the author may not be used to endorse or promote | ||
| * products derived from this software without specific prior written | ||
| * permission. | ||
| * | ||
| * The advertising clause requiring mention in adverts must never be included. | ||
| */ | ||
| /* */ | ||
| /*! | ||
| * \file DataMarks.h | ||
| * \brief Header of DataMarks | ||
| * \todo add comment here | ||
| * | ||
| * File description | ||
| * | ||
| * PROJ: OSLL/geo2tag | ||
| * ---------------------------------------------------------------- */ | ||
|
|
||
| #ifndef _DataMarks_H_E8A2619E_0BF6_4AE8_BB61_F09B92F73637_INCLUDED_ | ||
| #define _DataMarks_H_E8A2619E_0BF6_4AE8_BB61_F09B92F73637_INCLUDED_ | ||
|
|
||
| //#include <QString> | ||
| #include <QVector> | ||
| #include <QSharedPointer> | ||
| #include <QDateTime> | ||
| #include "User.h" | ||
| #include "ConcurrentVector.h" | ||
| //#include "Channel.h" | ||
|
|
||
| class DataMark: public QObject | ||
| { | ||
| Q_OBJECT | ||
| double m_altitude; | ||
| double m_latitude; | ||
| double m_longitude; | ||
|
|
||
| QString m_label; | ||
| QString m_description; | ||
| QString m_url; | ||
| QDateTime m_time; | ||
|
|
||
| QSharedPointer<common::User> m_user; | ||
|
|
||
| QSharedPointer<Channel> m_channel; | ||
|
|
||
| QSharedPointer<TimeSlot> m_timeSlot; | ||
|
|
||
| public: | ||
|
|
||
| DataMark(double altitude, double latitude, double longitude, QString label, | ||
| QString description, QString url, QDateTime time); // TODO add altitude to constructor | ||
|
|
||
| void setUser(QSharedPointer<common::User> user); | ||
|
|
||
| void setChannel(QSharedPointer<Channel> channel); | ||
|
|
||
| public: | ||
|
|
||
| virtual qlonglong getId() const; | ||
|
|
||
| void setDescription(const QString&); | ||
| const QString& getDescription() const; | ||
|
|
||
| double getLatitude() const; | ||
| void setLatitude(const double&); | ||
|
|
||
| double getLongitude() const; | ||
| void setLongitude(const double&); | ||
|
|
||
| double getAltitude() const; | ||
| void setAltitude(const double&); | ||
|
|
||
| const QString& getLabel() const; | ||
| void setLabel(const QString&); | ||
|
|
||
| const QString& getUrl() const; | ||
| void setUrl(const QString&); | ||
|
|
||
| const QDateTime& getTime() const; | ||
| void setTime(const QDateTime& time=QDateTime::currentDateTime().toUTC()); | ||
|
|
||
| QSharedPointer<common::User> getUser() const; | ||
|
|
||
| QSharedPointer<Channel> getChannel() const; | ||
| static double getDistance(double lat1, double lon1, double lat2, double lon2); | ||
|
|
||
| void setTimeSlot(QSharedPointer<TimeSlot> timeSlot); | ||
| QSharedPointer<TimeSlot> getTimeSlot() const; | ||
| bool timeSlotIsNull() const; | ||
|
|
||
| virtual ~DataMark(); | ||
| }; | ||
|
|
||
| bool operator<(const QSharedPointer<DataMark> &a, const QSharedPointer<DataMark> &b); | ||
|
|
||
| typedef ConcurrentVector<DataMark> DataMarks; | ||
| //_DataMarks_H_E8A2619E_0BF6_4AE8_BB61_F09B92F73637_INCLUDED_ | ||
| #endif | ||
|
|
||
| /* ===[ End of file ]=== */ |
| @@ -0,0 +1,72 @@ | ||
| /* | ||
| * Copyright 2010 OSLL osll@osll.spb.ru | ||
| * | ||
| * Redistribution and use in source and binary forms, with or without | ||
| * modification, are permitted provided that the following conditions | ||
| * are met: | ||
| * | ||
| * 1. Redistributions of source code must retain the above copyright | ||
| * notice, this list of conditions and the following disclaimer. | ||
| * 2. Redistributions in binary form must reproduce the above copyright | ||
| * notice, this list of conditions and the following disclaimer in the | ||
| * documentation and/or other materials provided with the distribution. | ||
| * | ||
| * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | ||
| * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
| * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
| * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| * | ||
| * 3. The name of the author may not be used to endorse or promote | ||
| * products derived from this software without specific prior written | ||
| * permission. | ||
| * | ||
| * The advertising clause requiring mention in adverts must never be included. | ||
| */ | ||
| /* */ | ||
| /*! | ||
| * \file DefaultException.h | ||
| * \brief Header of DefaultException | ||
| * | ||
| * PROJ: OSLL/geo2tag | ||
| * ---------------------------------------------------------------- */ | ||
|
|
||
| #ifndef _DefaultException_H_B503B3CC_1500_4544_8732_F56CD8A9F61B_INCLUDED_ | ||
| #define _DefaultException_H_B503B3CC_1500_4544_8732_F56CD8A9F61B_INCLUDED_ | ||
|
|
||
| #include <QString> | ||
|
|
||
| namespace exception | ||
| { | ||
| /*! | ||
| * Default exception. All exception will be ingerited from this one | ||
| */ | ||
| class DefaultException | ||
| { | ||
| public: | ||
| DefaultException(); | ||
|
|
||
| virtual QString getDescription() const=0; | ||
|
|
||
| virtual ~DefaultException(); | ||
|
|
||
| private: | ||
| DefaultException(const DefaultException& obj); | ||
| DefaultException& operator=(const DefaultException& obj); | ||
|
|
||
| // class DefaultException | ||
| }; | ||
|
|
||
| // namespace exception | ||
| } | ||
|
|
||
|
|
||
| //_DefaultException_H_B503B3CC_1500_4544_8732_F56CD8A9F61B_INCLUDED_ | ||
| #endif | ||
|
|
||
| /* ===[ End of file ]=== */ |
| @@ -0,0 +1,71 @@ | ||
| /* | ||
| * Copyright 2011 bac1ca bac1ca89@gmail.com | ||
| * | ||
| * Redistribution and use in source and binary forms , with or without | ||
| * modification , are permitted provided that the following conditions | ||
| * are met: | ||
| * | ||
| * 1. Redistributions of source code must retain the above copyright | ||
| * notice , this list of conditions and the following disclaimer. | ||
| * 2. Redistributions in binary form must reproduce the above copyright | ||
| * notice , this list of conditions and the following disclaimer in the | ||
| * documentation and/or other materials provided with the distribution. | ||
| * | ||
| * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AS IS'' AND ANY EXPRESS OR | ||
| * IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED WARRANTIES | ||
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
| * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT , INDIRECT , | ||
| * INCIDENTAL , SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES (INCLUDING , BUT | ||
| * NOT LIMITED TO , PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE , | ||
| * DATA , OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| * THEORY OF LIABILITY , WHETHER IN CONTRACT , STRICT LIABILITY , OR TORT | ||
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
| * THIS SOFTWARE , EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| * | ||
| * 3. The name of the author may not be used to endorse or promote | ||
| * products derived from this software without specific prior written | ||
| * permission. | ||
| * | ||
| * The advertising clause requiring mention in adverts must never be included. | ||
| */ | ||
|
|
||
| /*! --------------------------------------------------------------- | ||
| * \file ErrnoTypes.h | ||
| * \brief Header of ErrnoTypes | ||
| * \todo add comment here | ||
| * | ||
| * File description | ||
| * | ||
| * PROJ: OSLL/geo2tag | ||
| * ---------------------------------------------------------------- */ | ||
|
|
||
|
|
||
| #ifndef _ErrnoTypes_H_9465846A_3F83_4512_8C8B_EE2A40A357F9_INCLUDED_ | ||
| #define _ErrnoTypes_H_9465846A_3F83_4512_8C8B_EE2A40A357F9_INCLUDED_ | ||
|
|
||
| #include <QString> | ||
|
|
||
| enum geo2tagError | ||
| { | ||
| SUCCESS , | ||
| WRONG_TOKEN_ERROR , | ||
| USER_ALREADY_EXIST_ERROR , | ||
| USER_DOES_NOT_EXIST_ERROR , | ||
| CHANNEL_ALREADY_EXIST_ERROR , | ||
| CHANNEL_DOES_NOT_EXIST_ERROR , | ||
| SUBSCRIPTION_ALREADY_EXIST , | ||
| INTERNAL_DB_ERROR , | ||
| INCORRECT_QUERY_NAME_ERROR , | ||
| INCORRECT_JSON_ERROR , | ||
| INCORRECT_CREDENTIALS_ERROR , | ||
| CHANNEL_NOT_SUBCRIBED_ERROR , | ||
| CHANNEL_ALREADY_SUBSCRIBED_ERROR , | ||
| TAG_DOES_NOT_EXIST_ERROR , | ||
| TAG_ALREADY_EXIST_ERROR , | ||
| NULL_TIMESLOT_ERROR , | ||
| UNKNOWN_ERROR | ||
| }; | ||
|
|
||
| const QString getErrorByCode(int error); | ||
|
|
||
| #endif //_ErrnoTypes_H_9465846A_3F83_4512_8C8B_EE2A40A357F9_INCLUDED_ |
| @@ -0,0 +1,56 @@ | ||
| /* | ||
| * Copyright 2011 bac1ca bac1ca89@gmail.com | ||
| * | ||
| * Redistribution and use in source and binary forms, with or without | ||
| * modification, are permitted provided that the following conditions | ||
| * are met: | ||
| * | ||
| * 1. Redistributions of source code must retain the above copyright | ||
| * notice, this list of conditions and the following disclaimer. | ||
| * 2. Redistributions in binary form must reproduce the above copyright | ||
| * notice, this list of conditions and the following disclaimer in the | ||
| * documentation and/or other materials provided with the distribution. | ||
| * | ||
| * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AS IS'' AND ANY EXPRESS OR | ||
| * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
| * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
| * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| * | ||
| * 3. The name of the author may not be used to endorse or promote | ||
| * products derived from this software without specific prior written | ||
| * permission. | ||
| * | ||
| * The advertising clause requiring mention in adverts must never be included. | ||
| */ | ||
|
|
||
| /*! --------------------------------------------------------------- | ||
| * \file FShape.h | ||
| * \brief Header of FShape | ||
| * \todo add comment here | ||
| * | ||
| * File description | ||
| * | ||
| * PROJ: OSLL/geo2tag | ||
| * ---------------------------------------------------------------- */ | ||
|
|
||
|
|
||
| #ifndef _FShape_H_2055D9DC_F9B0_419F_A486_DF9A5459E64B_INCLUDED_ | ||
| #define _FShape_H_2055D9DC_F9B0_419F_A486_DF9A5459E64B_INCLUDED_ | ||
|
|
||
| #include <QSharedPointer> | ||
| #include "DataMarks.h" | ||
|
|
||
| class FShape | ||
| { | ||
| public: | ||
| virtual bool filtrate(const QSharedPointer<DataMark> &mark) = 0; | ||
|
|
||
| }; // class Filter | ||
|
|
||
| #endif //_FShape_H_2055D9DC_F9B0_419F_A486_DF9A5459E64B_INCLUDED_ |
| @@ -0,0 +1,62 @@ | ||
| /* | ||
| * Copyright 2011 bac1ca bac1ca89@gmail.com | ||
| * | ||
| * Redistribution and use in source and binary forms, with or without | ||
| * modification, are permitted provided that the following conditions | ||
| * are met: | ||
| * | ||
| * 1. Redistributions of source code must retain the above copyright | ||
| * notice, this list of conditions and the following disclaimer. | ||
| * 2. Redistributions in binary form must reproduce the above copyright | ||
| * notice, this list of conditions and the following disclaimer in the | ||
| * documentation and/or other materials provided with the distribution. | ||
| * | ||
| * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AS IS'' AND ANY EXPRESS OR | ||
| * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
| * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
| * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| * | ||
| * 3. The name of the author may not be used to endorse or promote | ||
| * products derived from this software without specific prior written | ||
| * permission. | ||
| * | ||
| * The advertising clause requiring mention in adverts must never be included. | ||
| */ | ||
|
|
||
| /*! --------------------------------------------------------------- | ||
| * \file FShapeCircle.h | ||
| * \brief Header of FShapeCircle | ||
| * \todo add comment here | ||
| * | ||
| * File description | ||
| * | ||
| * PROJ: OSLL/geo2tag | ||
| * ---------------------------------------------------------------- */ | ||
|
|
||
|
|
||
| #ifndef _FShapeCircle_H_685324AD_3719_4618_BE1B_F0221ABB524D_INCLUDED_ | ||
| #define _FShapeCircle_H_685324AD_3719_4618_BE1B_F0221ABB524D_INCLUDED_ | ||
|
|
||
| #include <QSharedPointer> | ||
| #include "FShape.h" | ||
|
|
||
| class FShapeCircle : public FShape | ||
| { | ||
| double m_lat; | ||
| double m_lon; | ||
| double m_radius; | ||
|
|
||
| public: | ||
| FShapeCircle(double lat, double lon, double r); | ||
| ~FShapeCircle(); | ||
| bool filtrate(const QSharedPointer<DataMark> &mark); | ||
|
|
||
| }; // class FShapeCircle | ||
|
|
||
| #endif //_FShapeCircle_H_685324AD_3719_4618_BE1B_F0221ABB524D_INCLUDED_ |
| @@ -0,0 +1,62 @@ | ||
| /* | ||
| * Copyright 2011 bac1ca bac1ca89@gmail.com | ||
| * | ||
| * Redistribution and use in source and binary forms, with or without | ||
| * modification, are permitted provided that the following conditions | ||
| * are met: | ||
| * | ||
| * 1. Redistributions of source code must retain the above copyright | ||
| * notice, this list of conditions and the following disclaimer. | ||
| * 2. Redistributions in binary form must reproduce the above copyright | ||
| * notice, this list of conditions and the following disclaimer in the | ||
| * documentation and/or other materials provided with the distribution. | ||
| * | ||
| * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AS IS'' AND ANY EXPRESS OR | ||
| * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
| * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
| * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| * | ||
| * 3. The name of the author may not be used to endorse or promote | ||
| * products derived from this software without specific prior written | ||
| * permission. | ||
| * | ||
| * The advertising clause requiring mention in adverts must never be included. | ||
| */ | ||
|
|
||
| /*! --------------------------------------------------------------- | ||
| * \file FShapePolygon.h | ||
| * \brief Header of FShapePolygon | ||
| * \todo add comment here | ||
| * | ||
| * File description | ||
| * | ||
| * PROJ: OSLL/geo2tag | ||
| * ---------------------------------------------------------------- */ | ||
|
|
||
|
|
||
| #ifndef _FShapePolygon_H_A08ADAEE_DA07_4E75_A64D_F4F86290B7D1_INCLUDED_ | ||
| #define _FShapePolygon_H_A08ADAEE_DA07_4E75_A64D_F4F86290B7D1_INCLUDED_ | ||
|
|
||
| #include "FShape.h" | ||
| #include <QPointF> | ||
|
|
||
| class FShapePolygon : public FShape | ||
| { | ||
| QList<QPointF> m_points; | ||
|
|
||
| public: | ||
| FShapePolygon(); | ||
|
|
||
| void addPoint(int idx, double lat, double lon); | ||
|
|
||
| bool filtrate(const QSharedPointer<DataMark> &mark); | ||
|
|
||
| }; // class FShapePolygon | ||
|
|
||
| #endif //_FShapePolygon_H_A08ADAEE_DA07_4E75_A64D_F4F86290B7D1_INCLUDED_ |
| @@ -0,0 +1,56 @@ | ||
| /* | ||
| * Copyright 2011 bac1ca bac1ca89@gmail.com | ||
| * | ||
| * Redistribution and use in source and binary forms, with or without | ||
| * modification, are permitted provided that the following conditions | ||
| * are met: | ||
| * | ||
| * 1. Redistributions of source code must retain the above copyright | ||
| * notice, this list of conditions and the following disclaimer. | ||
| * 2. Redistributions in binary form must reproduce the above copyright | ||
| * notice, this list of conditions and the following disclaimer in the | ||
| * documentation and/or other materials provided with the distribution. | ||
| * | ||
| * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AS IS'' AND ANY EXPRESS OR | ||
| * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
| * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
| * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| * | ||
| * 3. The name of the author may not be used to endorse or promote | ||
| * products derived from this software without specific prior written | ||
| * permission. | ||
| * | ||
| * The advertising clause requiring mention in adverts must never be included. | ||
| */ | ||
|
|
||
| /*! --------------------------------------------------------------- | ||
| * \file FShapeRectangle.h | ||
| * \brief Header of FShapeRectangle | ||
| * \todo add comment here | ||
| * | ||
| * File description | ||
| * | ||
| * PROJ: OSLL/geo2tag | ||
| * ---------------------------------------------------------------- */ | ||
|
|
||
|
|
||
| #ifndef _FShapeRectangle_H_551E8083_C487_48C6_A778_26A3143C34A8_INCLUDED_ | ||
| #define _FShapeRectangle_H_551E8083_C487_48C6_A778_26A3143C34A8_INCLUDED_ | ||
|
|
||
| #include "FShapePolygon.h" | ||
|
|
||
| class FShapeRectangle : public FShapePolygon | ||
| { | ||
| public: | ||
| FShapeRectangle(double lat1, double lon1, double lat2, double lon2); | ||
|
|
||
| }; // class FShapeRectangle | ||
|
|
||
|
|
||
| #endif //_FShapeRectangle_H_551E8083_C487_48C6_A778_26A3143C34A8_INCLUDED_ |
| @@ -0,0 +1,56 @@ | ||
| /* | ||
| * Copyright 2011 bac1ca bac1ca89@gmail.com | ||
| * | ||
| * Redistribution and use in source and binary forms, with or without | ||
| * modification, are permitted provided that the following conditions | ||
| * are met: | ||
| * | ||
| * 1. Redistributions of source code must retain the above copyright | ||
| * notice, this list of conditions and the following disclaimer. | ||
| * 2. Redistributions in binary form must reproduce the above copyright | ||
| * notice, this list of conditions and the following disclaimer in the | ||
| * documentation and/or other materials provided with the distribution. | ||
| * | ||
| * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AS IS'' AND ANY EXPRESS OR | ||
| * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
| * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
| * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| * | ||
| * 3. The name of the author may not be used to endorse or promote | ||
| * products derived from this software without specific prior written | ||
| * permission. | ||
| * | ||
| * The advertising clause requiring mention in adverts must never be included. | ||
| */ | ||
|
|
||
| /*! --------------------------------------------------------------- | ||
| * \file Filter.h | ||
| * \brief Header of Filter | ||
| * \todo add comment here | ||
| * | ||
| * File description | ||
| * | ||
| * PROJ: OSLL/geo2tag | ||
| * ---------------------------------------------------------------- */ | ||
|
|
||
|
|
||
| #ifndef _Filter_H_F1B0F887_FC25_4557_B002_AC962387F3F9_INCLUDED_ | ||
| #define _Filter_H_F1B0F887_FC25_4557_B002_AC962387F3F9_INCLUDED_ | ||
|
|
||
| #include <QSharedPointer> | ||
| #include "DataMarks.h" | ||
|
|
||
| class Filter | ||
| { | ||
| public: | ||
| virtual bool filtrate(const QSharedPointer<DataMark> &mark) = 0; | ||
|
|
||
| }; // class Filter | ||
|
|
||
| #endif //_Filter_H_F1B0F887_FC25_4557_B002_AC962387F3F9_INCLUDED_ |
| @@ -0,0 +1,65 @@ | ||
| /* | ||
| * Copyright 2011 bac1ca bac1ca89@gmail.com | ||
| * | ||
| * Redistribution and use in source and binary forms, with or without | ||
| * modification, are permitted provided that the following conditions | ||
| * are met: | ||
| * | ||
| * 1. Redistributions of source code must retain the above copyright | ||
| * notice, this list of conditions and the following disclaimer. | ||
| * 2. Redistributions in binary form must reproduce the above copyright | ||
| * notice, this list of conditions and the following disclaimer in the | ||
| * documentation and/or other materials provided with the distribution. | ||
| * | ||
| * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AS IS'' AND ANY EXPRESS OR | ||
| * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
| * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | ||
| * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
| * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
| * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
| * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | ||
| * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| * | ||
| * 3. The name of the author may not be used to endorse or promote | ||
| * products derived from this software without specific prior written | ||
| * permission. | ||
| * | ||
| * The advertising clause requiring mention in adverts must never be included. | ||
| */ | ||
|
|
||
| /*! --------------------------------------------------------------- | ||
| * \file Filtration.h | ||
| * \brief Header of Filtration | ||
| * \todo add comment here | ||
| * | ||
| * File description | ||
| * | ||
| * PROJ: OSLL/geo2tag | ||
| * ---------------------------------------------------------------- */ | ||
|
|
||
|
|
||
| #ifndef _Filtration_H_A12E4622_FC1F_4AA0_8E00_D4E6B6E36300_INCLUDED_ | ||
| #define _Filtration_H_A12E4622_FC1F_4AA0_8E00_D4E6B6E36300_INCLUDED_ | ||
|
|
||
| #include <QList> | ||
| #include <QSharedPointer> | ||
| #include "Filter.h" | ||
|
|
||
| class Filtration | ||
| { | ||
| QList<QSharedPointer<Filter> > m_filters; | ||
|
|
||
| public: | ||
| Filtration(); | ||
|
|
||
| ~Filtration(); | ||
|
|
||
| void addFilter(const QSharedPointer<Filter> & filter); | ||
|
|
||
| QList<QSharedPointer<DataMark> > filtrate(const QList<QSharedPointer<DataMark> > tags); | ||
|
|
||
| }; // class Filtration | ||
|
|
||
| #endif //_Filtration_H_A12E4622_FC1F_4AA0_8E00_D4E6B6E36300_INCLUDED_ |